content
stringlengths
1
1.05M
input_ids
listlengths
1
883k
ratio_char_token
float64
1
22.9
token_count
int64
1
883k
#!/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)
[ 2, 48443, 14629, 14, 8800, 14, 29412, 198, 6738, 4818, 324, 519, 1330, 41216, 11, 40391, 198, 198, 25811, 796, 1391, 198, 220, 220, 705, 15042, 62, 2539, 10354, 705, 1558, 20167, 13331, 2231, 1765, 66, 19, 64, 23, 22883, 67, 18, 186...
2.084112
749
import numpy as np import math import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D if __name__ == '__main__': main()
[ 11748, 299, 32152, 355, 45941, 198, 11748, 10688, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 6738, 285, 489, 62, 25981, 74, 896, 13, 76, 29487, 18, 67, 1330, 12176, 274, 18, 35, 198, 198, 361, 11593, 3672, 83...
2.535714
56
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)
[ 11748, 28686, 13, 6978, 198, 198, 6738, 275, 82, 19, 1330, 23762, 50, 10486, 198, 11748, 7007, 198, 198, 2, 13397, 286, 2393, 284, 3650, 3452, 1900, 2443, 1271, 198, 43, 11262, 62, 44706, 62, 4537, 8264, 62, 25664, 796, 12813, 22065, ...
2.917603
267
# 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()
[ 2, 277, 5943, 271, 14, 66, 445, 14817, 13, 9078, 198, 198, 11748, 4818, 8079, 198, 11748, 7007, 198, 11748, 4704, 278, 198, 6738, 3128, 22602, 13, 22877, 1330, 256, 89, 12001, 198, 6738, 17268, 1330, 3706, 83, 29291, 628, 198, 220, ...
2.963768
276
# 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
[ 2, 15069, 2864, 21798, 28876, 528, 283, 11203, 1279, 5450, 1378, 270, 12, 42068, 13, 10951, 14, 15097, 14, 88, 417, 528, 283, 11203, 29, 198, 2, 13789, 17168, 357, 5450, 1378, 44813, 1668, 13, 2398, 14, 677, 4541, 14, 36393, 737, 19...
2.748299
147
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
[ 6738, 764, 8692, 62, 33692, 1330, 1635, 198, 198, 38604, 7036, 1961, 62, 2969, 3705, 15853, 685, 198, 220, 220, 220, 705, 17319, 62, 305, 1706, 13, 18211, 13, 49046, 49, 6197, 16934, 3256, 198, 220, 220, 220, 705, 5589, 44292, 3256, ...
2.328
250
"""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
[ 37811, 10707, 273, 1352, 5387, 20081, 37811, 198, 11748, 279, 2645, 684, 198, 6738, 279, 2645, 684, 13, 3642, 36667, 1330, 25290, 38, 2149, 756, 10646, 628, 198, 4299, 651, 62, 79, 2645, 684, 7, 12501, 273, 1352, 62, 22046, 2599, 198,...
2.742081
221
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
[ 6738, 331, 16436, 13, 11250, 1330, 327, 40616, 19667, 355, 31171, 628, 198, 4299, 651, 62, 37581, 62, 12286, 82, 33529, 198, 197, 37811, 3855, 257, 331, 16436, 327, 40616, 19667, 2134, 351, 4277, 3815, 329, 616, 62, 16302, 526, 15931, ...
2.111702
564
""" 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
[ 37811, 383, 2251, 62, 1324, 2163, 27521, 262, 6282, 286, 257, 649, 46947, 2134, 11, 290, 198, 220, 220, 220, 5860, 340, 706, 340, 338, 9639, 510, 351, 8398, 6460, 198, 220, 220, 220, 1262, 598, 13, 11250, 198, 37811, 198, 6738, 4290...
2.992537
402
from unittest import TestCase from versions.constraints import Constraints, merge, ExclusiveConstraints from versions.constraint import Constraint
[ 6738, 555, 715, 395, 1330, 6208, 20448, 198, 198, 6738, 6300, 13, 1102, 2536, 6003, 1330, 1482, 2536, 6003, 11, 20121, 11, 35651, 3103, 2536, 6003, 198, 6738, 6300, 13, 1102, 2536, 2913, 1330, 1482, 2536, 2913, 628, 198 ]
3.846154
39
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()
[ 11748, 25064, 198, 11748, 850, 14681, 198, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 28883, 796, 25064, 13, 853, 85, 58, 16, 60, 198, 220, 2...
2.300885
226
from dataclasses import dataclass from numbers import Real from typing import Optional
[ 6738, 4818, 330, 28958, 1330, 4818, 330, 31172, 198, 6738, 3146, 1330, 6416, 198, 6738, 19720, 1330, 32233, 628, 628, 628 ]
4.380952
21
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')
[ 6738, 20486, 21915, 1330, 1635, 201, 198, 201, 198, 6738, 4738, 1330, 1635, 201, 198, 201, 198, 6738, 10688, 1330, 1635, 201, 198, 201, 198, 201, 198, 201, 198, 201, 198, 201, 198, 2, 12417, 201, 198, 201, 198, 7061, 6, 201, 198, ...
2.101395
2,150
################################################################################################################################################################ # @project Open Space Toolkit Mathematics # @file bindings/python/test/test_objects.py # @author Lucas Brmond <lucas@loftorbital.com> # @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 ################################################################################################################################################################
[ 29113, 29113, 29113, 29113, 29113, 198, 198, 2, 2488, 16302, 220, 220, 220, 220, 220, 220, 220, 4946, 4687, 16984, 15813, 220, 39448, 198, 2, 2488, 7753, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 34111, 14, 29412, 14, 9288, ...
4.2746
437
#!/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()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 2, 19617, 25, 3384, 69, 12, 23, 198, 198, 7061, 6, 31904, 284, 7716, 44805, 13, 80, 6015, 705, 7061, 198, 198, 6738, 15095, 1330, 15095, 198, 11748, 25064, 198, 11748, 302, 198, ...
2.034413
494
# -*- 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/
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 11748, 269, 12397, 198, 198, 687, 796, 269, 12397, 13, 15878, 31425, 3419, 220, 1303, 7663, 31425, 198, 3672, 796, 1296, 13, 1136, 8367, 10786, 3672, 3256, 705, 6894, 11...
2.393229
384
# 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" ]
[ 2, 3740, 1378, 518, 12463, 13, 2398, 14, 49315, 14, 12286, 14, 16624, 14, 37540, 14, 8924, 11674, 4, 1238, 22882, 4, 19004, 62, 21, 13, 12315, 198, 2, 399, 13, 17, 13, 17, 7275, 2935, 6519, 273, 198, 198, 5458, 62, 19199, 796, 1...
1.967356
919
import pytest from filestack.helpers import verify_webhook_signature
[ 11748, 12972, 9288, 198, 6738, 1226, 395, 441, 13, 16794, 364, 1330, 11767, 62, 12384, 25480, 62, 12683, 1300, 628, 198 ]
3.380952
21
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
[ 11748, 374, 67, 2704, 571, 198, 6738, 374, 67, 2704, 571, 13, 4354, 1330, 37902, 4663, 891, 198, 6738, 20081, 13, 315, 879, 62, 12543, 2733, 1330, 21231, 198, 6738, 20081, 1330, 38491, 628, 198, 2, 825, 3294, 62, 31691, 7, 17440, 16...
2.468401
269
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
[ 6738, 42903, 1330, 8543, 62, 28243, 11, 2581, 11, 18941, 11, 19016, 62, 1640, 11, 15614, 198, 6738, 42903, 62, 38235, 1330, 17594, 62, 35827, 11, 1459, 62, 7220, 198, 6738, 764, 5107, 1330, 33517, 8479, 11, 18957, 8479, 11, 21743, 847...
3.811475
122
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
[ 11748, 15095, 198, 11748, 28686, 198, 198, 11748, 19798, 292, 355, 279, 67, 198, 6738, 11192, 273, 11125, 13, 29412, 13, 6122, 292, 13, 3866, 36948, 13, 9060, 1330, 7412, 6601, 8645, 1352, 198, 6738, 19720, 1330, 360, 713, 11, 7343, 1...
3.522124
113
# find fibonacci number
[ 198, 2, 1064, 12900, 261, 44456, 1271, 198 ]
3.125
8
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
[ 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 198, 198, 11748, 33918, 198, 6738, 5254, 1330, 6208, 20448, 11, 351, 62, 33692, 198, 6738, 9686, 13, 31391, 1330, 37430, 62, 198, 6738, 11875, 77, 499, 1330, 20985, 198, 6738, ...
3.606061
66
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2018-07-04 09:43:51 # @Author : Zhi Liu (zhiliu.mind@gmail.com) # @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()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 2488, 10430, 220, 220, 220, 1058, 2864, 12, 2998, 12, 3023, 7769, 25, 3559, 25, 4349, 198, 2, 2488, 13838, 220, ...
2.122605
261
#!/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!
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 37811, 36046, 262, 10579, 37811, 198, 198, 11748, 1822, 29572, 198, 198, 2, 20368, 1783, 438, 198, 198, 2, 20368, 1783, 438, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417,...
3.049505
101
from tests.utils import W3CTestCase
[ 6738, 5254, 13, 26791, 1330, 370, 18, 4177, 395, 20448, 628 ]
3.363636
11
name = "pympu6050"
[ 3672, 796, 366, 9078, 3149, 84, 1899, 1120, 1 ]
2
9
# 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")
[ 2, 15069, 357, 66, 8, 1946, 12, 5539, 11, 1312, 420, 496, 198, 2, 1439, 2489, 10395, 13, 198, 2, 198, 2, 2297, 396, 3890, 290, 779, 287, 2723, 290, 13934, 5107, 11, 351, 393, 1231, 198, 2, 17613, 11, 389, 10431, 4955, 326, 262, ...
2.777662
958
from django.db import models # Create your models here.
[ 6738, 42625, 14208, 13, 9945, 1330, 4981, 198, 198, 2, 13610, 534, 4981, 994, 13, 198 ]
3.5625
16
""" """ import os import unittest from lxml import etree from svety import PACKDIR from svety import reader from svety import retriever __author__ = ["Clment Besnier <clemsciences@aol.com>", ]
[ 37811, 198, 198, 37811, 198, 11748, 28686, 198, 11748, 555, 715, 395, 198, 198, 6738, 300, 19875, 1330, 2123, 631, 198, 198, 6738, 264, 303, 774, 1330, 47035, 34720, 198, 6738, 264, 303, 774, 1330, 9173, 198, 6738, 264, 303, 774, 1330...
2.842857
70
from textwrap import dedent from openeo.internal.processes.generator import PythonRenderer from openeo.internal.processes.parse import Process
[ 6738, 2420, 37150, 1330, 4648, 298, 198, 198, 6738, 1280, 68, 78, 13, 32538, 13, 14681, 274, 13, 8612, 1352, 1330, 11361, 49, 437, 11882, 198, 6738, 1280, 68, 78, 13, 32538, 13, 14681, 274, 13, 29572, 1330, 10854, 628, 628, 628, 628...
3.511628
43
# 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() ## -----------------------------------------------------------------------------
[ 2, 383, 17168, 13789, 357, 36393, 8, 198, 198, 2, 15069, 357, 66, 8, 1853, 10642, 89, 31753, 7455, 198, 198, 2, 2448, 3411, 318, 29376, 7520, 11, 1479, 286, 3877, 11, 284, 597, 1048, 16727, 257, 4866, 198, 2, 286, 428, 3788, 290, ...
4.860636
409
""" 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
[ 37811, 198, 15069, 2864, 5803, 9757, 282, 7012, 357, 7554, 82, 21183, 2059, 8, 198, 24843, 362, 13, 15, 220, 357, 4023, 1378, 2503, 13, 43073, 13, 2398, 14, 677, 4541, 14, 43, 2149, 24290, 12, 17, 13, 15, 8, 198, 37811, 198, 6738,...
2.72028
286
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
[ 11748, 3049, 15042, 355, 4808, 7217, 15042, 198, 11748, 11779, 355, 4808, 9967, 7983, 198, 198, 1324, 62, 20147, 796, 1391, 198, 220, 220, 220, 705, 7839, 10354, 6, 26437, 21015, 11779, 7824, 3256, 198, 220, 220, 220, 705, 9641, 10354, ...
2.552083
96
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='sdodl001@odu.edu', 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', ] )
[ 6738, 15095, 1330, 15095, 198, 11748, 28686, 198, 198, 6738, 900, 37623, 10141, 1330, 9058, 11, 1064, 62, 43789, 628, 198, 198, 40406, 7, 3672, 11639, 15245, 35720, 3256, 198, 220, 220, 220, 220, 220, 2196, 11639, 15, 13, 15, 13, 15, ...
1.950588
850
# 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
[ 2, 10664, 284, 1330, 3108, 284, 1332, 14, 69, 25506, 290, 1332, 14, 46521, 14, 198, 2, 1475, 1058, 10784, 350, 56, 4221, 1340, 34219, 11639, 3, 34219, 14079, 15763, 14, 9288, 14, 69, 25506, 14, 14079, 15763, 14, 9288, 14, 46521, 14,...
3.092857
140
#!/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))
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 2, 5123, 657, 13, 17, 13, 18, 198, 198, 11748, 25064, 198, 361, 25064, 13, 9641, 62, 10951, 58, 15, 60, 14512, 357, 18, 2599, 198, 220, 220, 220, 25064, 13, 19282, 448, ...
2.749186
1,535
#/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])
[ 2, 14, 14629, 14, 8800, 14, 24330, 21015, 198, 6738, 11485, 21412, 17, 1330, 616, 62, 4798, 198, 198, 2, 1675, 1057, 2446, 3436, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 1330, 25064, 198, 220...
2.151261
119
from multiscale import MultiScale from patchgan import PatchDiscriminator
[ 198, 6738, 1963, 2304, 1000, 1330, 15237, 29990, 198, 6738, 8529, 1030, 1330, 17106, 15642, 3036, 20900, 198 ]
4.166667
18
from os import symlink, path, access, X_OK import pytest from leapp.libraries.actor import workaround from leapp.libraries.common.utils import makedirs
[ 6738, 28686, 1330, 827, 4029, 676, 11, 3108, 11, 1895, 11, 1395, 62, 11380, 198, 198, 11748, 12972, 9288, 198, 198, 6738, 443, 1324, 13, 75, 11127, 13, 11218, 1330, 46513, 198, 6738, 443, 1324, 13, 75, 11127, 13, 11321, 13, 26791, 1...
3.25
48
""" https://codility.com/programmers/task/equi_leader/ """ from collections import Counter, defaultdict
[ 37811, 198, 5450, 1378, 19815, 879, 13, 785, 14, 23065, 11056, 14, 35943, 14, 4853, 72, 62, 27940, 14, 198, 37811, 628, 198, 6738, 17268, 1330, 15034, 11, 4277, 11600, 628 ]
3.451613
31
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')
[ 6738, 450, 66, 1330, 9738, 11, 12531, 24396, 198, 6738, 19720, 1330, 4377, 11, 7343, 11, 5994, 19852, 198, 198, 6738, 18912, 62, 6603, 13, 67, 8957, 62, 9948, 3129, 1352, 13, 16794, 364, 13, 4868, 62, 17080, 2455, 273, 13, 69, 7861,...
3.098765
81
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")
[ 11748, 2956, 297, 571, 198, 11748, 7007, 198, 11748, 18540, 305, 919, 278, 13, 7742, 198, 6738, 18540, 305, 919, 278, 1330, 19850, 198, 11748, 334, 27112, 198, 11748, 28686, 198, 198, 17566, 62, 15908, 796, 28686, 13, 6978, 13, 22179, ...
1.93797
532
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)
[ 11748, 474, 715, 273, 355, 474, 83, 198, 6738, 474, 715, 273, 1330, 299, 77, 11, 4981, 198, 361, 474, 83, 13, 10134, 62, 66, 15339, 25, 198, 220, 220, 220, 474, 83, 13, 33152, 13, 1904, 62, 66, 15339, 796, 352, 1303, 474, 83, ...
2.192771
249
# -*- 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)
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 11748, 12972, 9288, 198, 6738, 42625, 14208, 13, 9945, 13, 27530, 1330, 43301, 7248, 198, 6738, 1334, 62, 30604, 13, 1069, 11755, 1330, 1892, 21077, 198, 198, 6738, ...
3.492188
256
<caret>search_variable = 1
[ 27, 6651, 83, 29, 12947, 62, 45286, 796, 352 ]
2.888889
9
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
[ 6738, 32465, 1330, 4280, 4402, 198, 11748, 12972, 9288, 198, 198, 6738, 40391, 13, 41989, 13, 22584, 1749, 13, 24886, 1330, 13397, 22810, 628, 198, 2, 6196, 7613, 34609, 2810, 416, 12972, 9288, 12, 28241, 14208, 198, 2, 3740, 1378, 9078...
3.484848
66
import datetime from flask import Flask, render_template ''' algoritmo simples para definir se o dia par ou impar ''' app = Flask(__name__)
[ 11748, 4818, 8079, 198, 6738, 42903, 1330, 46947, 11, 8543, 62, 28243, 198, 7061, 6, 198, 220, 220, 220, 435, 7053, 270, 5908, 985, 2374, 31215, 2730, 343, 384, 267, 288, 544, 220, 1582, 267, 84, 848, 283, 198, 7061, 6, 198, 1324, ...
2.843137
51
# -*- 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__)
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 198, 1635, 15622, 416, 9485, 1925, 1670, 13, 198, 1635, 4935, 25, 18388, 198, 1635, 6434, 1438, 25, 314, 430, 421, 18642, 327, 17531, 7058, 7066, 8873, 198, 1635,...
3.129771
131
from pytest import raises from psycopg2_pgevents import debug from psycopg2_pgevents.debug import log, set_debug
[ 6738, 12972, 9288, 1330, 12073, 198, 198, 6738, 17331, 22163, 70, 17, 62, 79, 469, 85, 658, 1330, 14257, 198, 6738, 17331, 22163, 70, 17, 62, 79, 469, 85, 658, 13, 24442, 1330, 2604, 11, 900, 62, 24442, 628 ]
2.948718
39
import glob import os import sqlalchemy as db from sqlalchemy.sql import text
[ 11748, 15095, 198, 11748, 28686, 198, 11748, 44161, 282, 26599, 355, 20613, 198, 6738, 44161, 282, 26599, 13, 25410, 1330, 2420, 628 ]
3.590909
22
###################################################################### # 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
[ 29113, 29113, 4242, 2235, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7788, 31800, 1847, 220, 220, 220, 220, 220, 220, ...
3.177419
124
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()
[ 11748, 1233, 18747, 198, 11748, 299, 32152, 198, 11748, 555, 715, 395, 198, 6738, 285, 14415, 19, 9078, 1330, 4904, 40, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 361, 11593, 3672,...
2.362903
124
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'
[ 11748, 33918, 198, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 18439, 1330, 8323, 5344, 11, 17594, 11, 2604, 448, 198, 6738, 42625, 14208, 13, 4023, 1330, 367, 29281, 31077, 198, 6738, 42625, 14208, 13, 26791, 1330, 640, 11340, 198, 673...
3.135802
81
# 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
[ 2, 11259, 257, 4731, 11, 3297, 340, 287, 24030, 1502, 1912, 319, 262, 8373, 286, 3435, 13, 198, 198, 2, 17934, 352, 25, 198, 198, 2, 23412, 25, 198, 2, 366, 21048, 1, 198, 2, 25235, 25, 198, 2, 366, 68, 861, 1, 198, 2, 50125, ...
2.909091
253
#!/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()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 11748, 256, 74, 3849, 355, 256, 74, 198, 6738, 256, 74, 3849, 1330, 256, 30488, 628, 628, 198, 198, 12417, 62, ...
2.411765
68
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
[ 198, 11748, 334, 27112, 198, 198, 6738, 19720, 1330, 7343, 198, 198, 6738, 27468, 12947, 1330, 48567, 12947, 198, 6738, 27468, 12947, 13, 1069, 11755, 1330, 1892, 21077, 12331, 198, 198, 6738, 3049, 15042, 1330, 3486, 4663, 39605, 11, 182...
3.453846
130
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 """
[ 6738, 42625, 14208, 13, 9288, 1330, 6208, 20448, 198, 198, 6738, 2219, 13, 7890, 62, 315, 2410, 1330, 6060, 18274, 4487, 198, 6738, 1861, 62, 27530, 13, 10378, 62, 34960, 1330, 37947, 1387, 37065, 198, 6738, 1861, 62, 27530, 13, 73, 2...
3.514563
103
# 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)
[ 2, 3310, 2234, 15941, 11, 13196, 318, 326, 262, 1366, 318, 287, 262, 826, 8619, 198, 2, 1366, 460, 307, 2077, 422, 3740, 1378, 2503, 13, 74, 9460, 293, 13, 785, 14, 66, 14, 4803, 12, 1050, 1063, 12, 32225, 2903, 12, 2301, 2234, ...
2.261649
279
# -*- 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
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 37811, 34184, 1187, 329, 2615, 262, 10685, 3127, 39349, 338, 38226, 2891, 3524, 526, 15931, 198, 198, 6738, 19720, 1330, 7343, 11, 309, 29291, 198, 198, 6738, 12972, ...
2.81122
1,123
""" V1 Client """ from threatstack.base import BaseClient from threatstack.v1 import resources
[ 37811, 198, 53, 16, 20985, 198, 37811, 198, 198, 6738, 2372, 25558, 13, 8692, 1330, 7308, 11792, 198, 198, 6738, 2372, 25558, 13, 85, 16, 1330, 4133, 628, 198 ]
3.413793
29
"""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
[ 37811, 17633, 46787, 329, 11099, 278, 8053, 37811, 198, 6738, 4818, 8079, 1330, 4818, 8079, 198, 198, 6738, 42625, 14208, 13, 3642, 822, 1330, 13169, 198, 6738, 42625, 14208, 13, 10414, 13, 6371, 82, 13, 12286, 82, 1330, 19016, 198, 673...
3.42069
290
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)
[ 11748, 28686, 198, 11748, 25064, 198, 6738, 17268, 1330, 390, 4188, 11, 4277, 11600, 198, 6738, 19720, 1330, 360, 713, 11, 4479, 198, 198, 17597, 13, 6978, 13, 33295, 7203, 40720, 40720, 4943, 198, 198, 11748, 28034, 198, 11748, 28034, ...
3.415584
77
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__)
[ 11748, 18931, 198, 11748, 302, 198, 6738, 4818, 8079, 1330, 4818, 8079, 198, 198, 11748, 15881, 88, 198, 6738, 15881, 88, 13, 4023, 1330, 18261, 198, 198, 2, 645, 1040, 14978, 9485, 3118, 411, 5634, 19927, 198, 11748, 15881, 88, 9288, ...
3.597701
87
#!/usr/bin/python # parseskipfish.py # # By Adrien de Beaupre adriendb@gmail.com | adrien@intru-shun.ca # 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
[ 2, 48443, 14629, 14, 8800, 14, 29412, 201, 198, 2, 13544, 274, 74, 541, 11084, 13, 9078, 201, 198, 2, 201, 198, 2, 2750, 1215, 15355, 390, 32831, 3866, 512, 1289, 65, 31, 14816, 13, 785, 930, 512, 15355, 31, 600, 622, 12, 1477, ...
2.881387
548
""" 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__)
[ 37811, 9058, 308, 3820, 37227, 198, 198, 2, 15069, 357, 34, 8, 12131, 416, 11787, 469, 15592, 31, 38, 10060, 11, 1279, 3740, 1378, 12567, 13, 785, 14, 12982, 469, 15592, 1875, 13, 198, 2, 198, 2, 770, 2393, 318, 636, 286, 1279, 37...
3.007092
282
"""pytest for user.models.verifycode """
[ 37811, 9078, 9288, 329, 2836, 13, 27530, 13, 332, 1958, 8189, 198, 37811, 198 ]
2.928571
14
""" 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]
[ 37811, 198, 10669, 24406, 1429, 2491, 3384, 4487, 13, 198, 198, 31, 8094, 18162, 9729, 25, 1057, 11, 869, 198, 31, 8094, 350, 631, 87, 721, 5499, 25, 442, 15763, 11, 269, 16993, 198, 198, 31, 7785, 41752, 25, 198, 220, 18291, 6945, ...
2.37054
2,831
""" 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)
[ 37811, 198, 35477, 2536, 689, 6654, 16311, 287, 13042, 198, 37811, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 2, 13949, 18272, 6654, 8379, 13, 198, 22915, 16, 796, 366, 5962, 636, 3467, 77, 5498, 636, 1, 198, 4798, 7, 22915, ...
3.49359
156
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, 'scielo@scielo.org'), ('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()
[ 11748, 28686, 198, 11748, 302, 198, 198, 6738, 27944, 13, 11250, 1330, 17056, 333, 1352, 198, 6738, 27944, 13, 31534, 1330, 968, 18453, 198, 198, 6738, 267, 64, 541, 76, 71, 1330, 357, 198, 220, 220, 220, 220, 220, 220, 220, 16099, ...
2.031111
1,575
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)
[ 11748, 5474, 7890, 198, 11748, 6193, 48610, 198, 11748, 9003, 7890, 198, 198, 11748, 19798, 292, 355, 279, 67, 198, 6738, 4818, 8079, 1330, 4818, 8079, 198, 6738, 3108, 8019, 1330, 10644, 198, 198, 2704, 2337, 796, 5474, 7890, 13, 961, ...
2.354745
685
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_())
[ 6738, 9485, 48, 83, 20, 1330, 33734, 14055, 11, 33734, 8205, 72, 11, 33734, 54, 312, 11407, 198, 6738, 20613, 1330, 360, 65, 628, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 1330, 25064, 198, 22...
2.177419
124
from gym_android_wechat_jump.env.wechat_jump_env import WechatJumpEnv
[ 6738, 11550, 62, 19411, 62, 732, 17006, 62, 43327, 13, 24330, 13, 732, 17006, 62, 43327, 62, 24330, 1330, 775, 17006, 36046, 4834, 85, 198 ]
2.8
25
import requests from bot.constants import BASE_ENDPOINT import cli.app # bot.add_param("-h", "--help", help="HELP me") if __name__ == '__main__': bot.run()
[ 11748, 7007, 198, 6738, 10214, 13, 9979, 1187, 1330, 49688, 62, 1677, 6322, 46, 12394, 198, 11748, 537, 72, 13, 1324, 628, 198, 2, 10214, 13, 2860, 62, 17143, 7203, 12, 71, 1600, 366, 438, 16794, 1600, 1037, 2625, 39, 3698, 47, 502,...
2.523077
65
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
[ 11748, 28686, 198, 11748, 848, 198, 6738, 3108, 8019, 1330, 10644, 198, 11748, 4566, 48610, 198, 11748, 7007, 198, 11748, 308, 6024, 22105, 198, 11250, 796, 4566, 48610, 13, 16934, 46677, 3419, 198, 198, 38604, 7036, 1961, 796, 848, 13, ...
2.40678
767
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 4981, 11, 15720, 602, 628 ]
2.891892
37
# 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
[ 2, 19617, 28, 40477, 12, 23, 198, 2, 17202, 39410, 25, 428, 2393, 373, 7560, 416, 262, 21624, 12994, 24118, 687, 10290, 357, 27110, 5235, 8, 16984, 13, 17202, 198, 2, 17202, 2141, 407, 4370, 416, 1021, 4556, 345, 821, 1728, 345, 760...
3.797297
74
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))
[ 11748, 28686, 198, 11748, 25064, 198, 11748, 33918, 198, 11748, 279, 10025, 22602, 198, 11748, 18931, 198, 11748, 334, 27112, 198, 11748, 640, 198, 11748, 18540, 305, 919, 278, 198, 6738, 3108, 8019, 1330, 10644, 198, 6738, 4704, 278, 133...
2.287823
813
#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 )
[ 2, 361, 657, 198, 2, 720, 7390, 25, 36738, 10951, 13, 9078, 11, 85, 352, 13, 2091, 5075, 14, 3070, 14, 1314, 1596, 25, 1120, 25, 2231, 595, 11072, 5518, 720, 198, 2, 720, 11187, 25, 36738, 10951, 13, 9078, 11, 85, 720, 198, 2, ...
2.579006
1,810
"""H1st CLI.""" import click from .pred_maint import h1st_pmfp_cli
[ 37811, 39, 16, 301, 43749, 526, 15931, 628, 198, 11748, 3904, 198, 198, 6738, 764, 28764, 62, 76, 2913, 1330, 289, 16, 301, 62, 4426, 46428, 62, 44506, 628 ]
2.448276
29
""" 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()
[ 37811, 198, 8979, 25, 17963, 62, 2487, 82, 62, 16345, 13, 9078, 198, 5376, 25, 26918, 198, 1783, 32501, 198, 1212, 1430, 7228, 477, 262, 17963, 14088, 9943, 32855, 198, 5562, 2160, 510, 284, 257, 6937, 36247, 13, 14882, 481, 1064, 198...
3.71028
107
#!/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. """
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 21004, 25, 3384, 69, 12, 23, 198, 37811, 198, 12102, 62, 8000, 39815, 13, 9078, 198, 198, 41972, 416, 1375, 782, 42990, 319, 1946, 12, 2998, 12, 1731, 13, 198, 37811, 198, 198, ...
2.986301
146
"""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.")), ] )
[ 37811, 15156, 907, 973, 287, 262, 10214, 526, 15931, 198, 6738, 17268, 1330, 14230, 1068, 35, 713, 198, 6738, 4818, 330, 28958, 1330, 4818, 330, 31172, 198, 6738, 19720, 1330, 7343, 198, 198, 6738, 42625, 14208, 13, 26791, 13, 41519, 13...
2.525378
1,123
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 #################### """
[ 11748, 299, 32152, 355, 45941, 198, 11748, 10088, 198, 6738, 340, 861, 10141, 1330, 6772, 198, 6738, 28034, 1330, 299, 77, 198, 11748, 28034, 13, 20471, 13, 45124, 355, 376, 198, 11748, 28034, 198, 6738, 28034, 13, 20471, 13, 18170, 13,...
3.297619
84
# -*- coding: utf-8 -*- import uuid import pytest from dbtrigger.cli import DatabaseCli, QueryCli, ServerCli from dbtrigger.config import settings from dbtrigger.models import Database
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 11748, 334, 27112, 198, 198, 11748, 12972, 9288, 198, 198, 6738, 20613, 46284, 13, 44506, 1330, 24047, 2601, 72, 11, 43301, 2601, 72, 11, 9652, 2601, 72, 198, 6738,...
3.044776
67
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']
[ 11748, 1976, 76, 80, 11, 640, 11, 33918, 198, 22866, 796, 1976, 76, 80, 13, 21947, 3419, 198, 198, 12984, 796, 4732, 13, 44971, 7, 89, 76, 80, 13, 2200, 48, 8, 198, 198, 2, 2312, 389, 4738, 13894, 8251, 329, 4856, 46300, 6284, 1...
2.266551
574
from abc import ABC, abstractmethod from typing import List
[ 6738, 450, 66, 1330, 9738, 11, 12531, 24396, 198, 6738, 19720, 1330, 7343, 628 ]
4.357143
14
"""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()
[ 37811, 25981, 278, 11812, 37811, 198, 2, 16529, 1783, 10541, 198, 2, 15069, 357, 66, 8, 5413, 10501, 13, 1439, 2489, 10395, 13, 198, 2, 49962, 739, 262, 17168, 13789, 13, 4091, 13789, 13, 14116, 287, 262, 1628, 6808, 329, 5964, 1321, ...
3.072758
591
import os os.system("cp -r ../../../topic_scripts/* ./")
[ 11748, 28686, 198, 198, 418, 13, 10057, 7203, 13155, 532, 81, 11485, 14, 40720, 40720, 26652, 62, 46521, 15211, 24457, 4943 ]
2.714286
21
# -*- 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
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 198, 9452, 4402, 8383, 7822, 13, 198, 37811, 198, 2, 10898, 198, 6738, 11593, 37443, 834, 1330, 4112, 62, 11748, 11, 7297, 11, 3601, 62, 8818, 11, 3467, 198, 22...
3.207792
77
# 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)
[ 2, 31215, 1330, 283, 284, 4598, 422, 6937, 274, 1330, 1635, 198, 6738, 6937, 274, 1330, 15789, 62, 10943, 2257, 8643, 36, 198, 6738, 6937, 274, 1330, 6550, 368, 1512, 292, 355, 24787, 198, 198, 4798, 7, 8895, 62, 10943, 2257, 8643, ...
2.439252
107
# 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
[ 2, 19337, 65, 31249, 13, 9078, 532, 18537, 940, 7822, 329, 779, 351, 19337, 38072, 198, 2, 198, 2, 15069, 2211, 3203, 11, 3457, 13, 198, 2, 198, 2, 770, 3788, 743, 307, 973, 290, 9387, 1864, 284, 262, 2846, 286, 262, 198, 2, 229...
2.222724
2,438
#!/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'
[ 2, 48443, 14629, 14, 8800, 14, 29412, 198, 198, 2, 44224, 5254, 329, 262, 1388, 9206, 4706, 2443, 198, 198, 2, 16888, 10822, 16802, 198, 2, 2129, 2412, 319, 262, 22563, 8398, 2810, 416, 262, 923, 7959, 13, 1477, 4226, 13, 198, 2, ...
2.73869
1,680
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])
[ 77, 11, 256, 796, 3975, 7, 600, 11, 5128, 22446, 35312, 28955, 198, 69, 796, 17635, 198, 43420, 796, 25915, 16, 11, 532, 16, 11, 532, 16, 11, 532, 16, 60, 198, 1640, 1312, 287, 2837, 7, 15, 11, 299, 2599, 198, 197, 69, 13, 332...
2.006289
159
from typing import Optional from reacticket.extensions.abc import MixinMeta from reacticket.extensions.mixin import settings
[ 6738, 19720, 1330, 32233, 198, 198, 6738, 6324, 9715, 13, 2302, 5736, 13, 39305, 1330, 15561, 259, 48526, 198, 6738, 6324, 9715, 13, 2302, 5736, 13, 19816, 259, 1330, 6460, 628 ]
4.096774
31
from breakzip import command_line import pytest import os
[ 6738, 2270, 13344, 1330, 3141, 62, 1370, 198, 11748, 12972, 9288, 198, 11748, 28686, 628, 628, 628 ]
3.705882
17
from .command import Command from datetime import datetime import calendar from tourney.util import this_season_filter from tourney.stats import Stats
[ 6738, 764, 21812, 1330, 9455, 198, 198, 6738, 4818, 8079, 1330, 4818, 8079, 198, 11748, 11845, 198, 6738, 4205, 1681, 13, 22602, 1330, 428, 62, 6230, 62, 24455, 198, 198, 6738, 4205, 1681, 13, 34242, 1330, 20595, 198 ]
4.026316
38
""" 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'), ]
[ 37811, 198, 32, 4593, 15132, 5231, 42829, 6677, 37902, 6561, 198, 37811, 198, 6738, 42625, 14208, 13, 10414, 13, 6371, 82, 1330, 19016, 198, 6738, 764, 33571, 1330, 2449, 77, 42829, 6677, 7680, 11, 44515, 7680, 198, 198, 6371, 33279, 82...
2.255639
133
"""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 )
[ 37811, 6207, 13264, 4560, 37811, 198, 11748, 28686, 198, 198, 6738, 2169, 1330, 4566, 11, 7736, 628, 198, 198, 2, 25, 7343, 286, 35847, 13532, 329, 2169, 38072, 198, 5460, 929, 62, 6978, 796, 685, 198, 220, 220, 220, 1432, 78, 7, 13...
2.558333
840
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)'''
[ 11748, 33918, 198, 11748, 25064, 198, 2, 34345, 11639, 14, 11195, 14, 36902, 14, 8457, 12, 330, 70, 12, 1069, 12629, 12, 9866, 14, 25095, 735, 448, 62, 9288, 62, 43420, 14, 17126, 54, 6081, 13, 17752, 6, 198, 198, 66, 429, 28, 15,...
1.902304
1,085