content stringlengths 1 1.04M | input_ids listlengths 1 774k | ratio_char_token float64 0.38 22.9 | token_count int64 1 774k |
|---|---|---|---|
import json
def initialize_json():
""" Create the item list file if it doesn't exist. """
try:
with open("items/item_list.json", "r") as itemjson:
items = json.load(itemjson)
except:
# Create the item list
jsondata = {"items": []}
# Save the item list to the it... | [
11748,
33918,
628,
198,
4299,
41216,
62,
17752,
33529,
198,
220,
220,
220,
37227,
13610,
262,
2378,
1351,
2393,
611,
340,
1595,
470,
2152,
13,
37227,
628,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7... | 2.4048 | 625 |
# facerec.py
import cv2, sys, numpy, os,pyttsx,time
size = 4
fn_haar = 'haarcascade_frontalface_default.xml'
fn_dir = 'att_faces'
# Part 1: Create fisherRecognizer
print('Training...')
# Create a list of images and a list of corresponding names
(images, lables, names, id) = ([], [], {}, 0)
for (subdirs, dirs, files) ... | [
2,
1986,
8344,
13,
9078,
198,
11748,
269,
85,
17,
11,
25064,
11,
299,
32152,
11,
28686,
11,
9078,
83,
912,
87,
11,
2435,
198,
7857,
796,
604,
198,
22184,
62,
42948,
796,
705,
3099,
5605,
28966,
62,
8534,
1604,
558,
62,
12286,
13,
... | 2.426316 | 380 |
"""
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.
An example is the root-to-leaf path 1->2->3 which represents the number 123.
Find the total sum of all root-to-leaf numbers.
Note: A leaf is a node with no children.
Example:
Input: [1,2,3]
1
/ \
2 ... | [
37811,
198,
15056,
257,
13934,
5509,
7268,
19561,
422,
657,
12,
24,
691,
11,
1123,
6808,
12,
1462,
12,
33201,
3108,
714,
2380,
257,
1271,
13,
198,
198,
2025,
1672,
318,
262,
6808,
12,
1462,
12,
33201,
3108,
352,
3784,
17,
3784,
18,
... | 2.793333 | 300 |
# -*- coding: utf-8 -*-
"""
======================================================
JSON format (:mod:`sknano.io._json_format`)
======================================================
.. currentmodule:: sknano.io._json_format
"""
from __future__ import absolute_import, division, print_function
from __future__ import un... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
10052,
4770,
50155,
198,
40386,
5794,
357,
25,
4666,
25,
63,
8135,
77,
5733,
13,
952,
13557,
17752,
62,
18982,
63,
8,
198,
10052,
4770,
50155,
198,
198,
49... | 2.689711 | 622 |
from random import choice, randint
from typing import List, Optional
from rpgtk.exceptions import DiceException
SIDE_HEAD = 'head'
SIDE_TAIL = 'tail'
class Dice:
'''
The Dice object have some sides.
Args:
sides (int): The number of the sides of a dice instance.
Attributes:
last_rol... | [
6738,
4738,
1330,
3572,
11,
43720,
600,
198,
6738,
19720,
1330,
7343,
11,
32233,
198,
198,
6738,
374,
6024,
30488,
13,
1069,
11755,
1330,
34381,
16922,
198,
198,
50,
14114,
62,
37682,
796,
705,
2256,
6,
198,
50,
14114,
62,
5603,
4146,... | 2.541916 | 334 |
from os import getenv
from flask import Flask, request, make_response
import requests
import pymongo
from bson import ObjectId
from icalendar import Calendar, Event
# Replace the uri string with your MongoDB deployment's connection string.
conn_str = getenv("MONGODB_CONN", "mongodb://root:devpassword@localhost:27017/")... | [
6738,
28686,
1330,
651,
24330,
198,
6738,
42903,
1330,
46947,
11,
2581,
11,
787,
62,
26209,
198,
11748,
7007,
198,
11748,
279,
4948,
25162,
198,
6738,
275,
1559,
1330,
9515,
7390,
198,
6738,
220,
605,
9239,
1330,
26506,
11,
8558,
198,
... | 3.145749 | 247 |
# Event: LCCS Python Fundamental Skills Workshop
# Date: Dec 2018
# Author: Joe English, PDST
# eMail: computerscience@pdst.ie
# Purpose: Solution to Breakout Activity 6.1 - suggested activities (Modifications)
# ATM System
# Menu driven program handle balance enquiries, lodgements, and withdrawals
# Q3 - Add PI... | [
2,
8558,
25,
406,
4093,
50,
11361,
49983,
20389,
26701,
201,
198,
2,
7536,
25,
4280,
2864,
201,
198,
2,
6434,
25,
5689,
3594,
11,
14340,
2257,
201,
198,
2,
304,
25804,
25,
9061,
4234,
31,
30094,
301,
13,
494,
201,
198,
2,
32039,
... | 2.735726 | 613 |
'''
* Copyright 2018 IBM Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... | [
7061,
6,
198,
1635,
15069,
2864,
19764,
10501,
198,
1635,
198,
1635,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
1635,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,... | 3.016355 | 428 |
"""Quick sanity check on models."""
# Copyright (C) 2020 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | [
37811,
21063,
34182,
2198,
319,
4981,
526,
15931,
198,
198,
2,
15069,
357,
34,
8,
12131,
8180,
10501,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
345,
743,
407,
779,
... | 2.382746 | 823 |
#!/usr/bin/env python3.4
# -*- coding: utf8 -*-
import fdb
from oxy.db import Db
if __name__ == '__main__':
pass
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
13,
19,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
23,
532,
9,
12,
198,
198,
11748,
277,
9945,
198,
198,
6738,
10661,
13,
9945,
1330,
360,
65,
628,
198,
198,
361,
11593,
3672,
834,
... | 2.140351 | 57 |
# -*- coding:utf-8 -*-
# Copyright (c) 2016 Yingcai FENG
#
# 2016/7/4 fengyc: Create plugins.py.
| [
2,
532,
9,
12,
19617,
25,
40477,
12,
23,
532,
9,
12,
198,
2,
15069,
357,
66,
8,
1584,
38833,
66,
1872,
376,
26808,
198,
2,
198,
2,
1584,
14,
22,
14,
19,
277,
268,
1360,
66,
25,
13610,
20652,
13,
9078,
13,
628,
198
] | 2.2 | 45 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2020-03-28 08:21
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import mezzanine.core.fields
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2980,
515,
416,
37770,
352,
13,
1157,
13,
1959,
319,
12131,
12,
3070,
12,
2078,
8487,
25,
2481,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198... | 2.772152 | 79 |
from math import ceil
| [
6738,
10688,
1330,
2906,
346,
198
] | 3.666667 | 6 |
#
# PySNMP MIB module HUAWEI-MODULE-INFO-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-MODULE-INFO-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:46:58 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | [
2,
198,
2,
9485,
15571,
7378,
337,
9865,
8265,
367,
34970,
8845,
40,
12,
33365,
24212,
12,
10778,
12,
8895,
33,
357,
4023,
1378,
16184,
76,
489,
8937,
13,
785,
14,
79,
893,
11632,
8,
198,
2,
7054,
45,
13,
16,
2723,
2393,
1378,
1... | 2.906672 | 2,593 |
from elgamal.elgamal import Elgamal
pb, pv = Elgamal.newkeys(256)
| [
6738,
1288,
28483,
282,
13,
417,
28483,
282,
1330,
2574,
28483,
282,
628,
198,
40842,
11,
279,
85,
796,
2574,
28483,
282,
13,
3605,
13083,
7,
11645,
8,
198
] | 2.344828 | 29 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from setuptools import setup, find_packages
setup(name="vlab-api-gateway",
author="Nicholas Willhite,",
author_email='willnx84@gmail.com',
version='2020.12.29',
packages=find_packages(),
description="Routes requests to vLab services",
i... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
41002,
12,
23,
532,
9,
12,
198,
6738,
900,
37623,
10141,
1330,
9058,
11,
1064,
62,
43789,
628,
198,
40406,
7,
3672,
2625,
19279,
397,
12,
15042,
12,
10494... | 2.353293 | 167 |
import os
def read_file(config_file_path: str, file_to_read_in: str) -> str:
"""
Reads the contents of a file, relative to the configuration file being processed.
Can not access files in parent directories. Variables in the included file are not processed.
The parameter ``config_file_path`` is autom... | [
11748,
28686,
628,
198,
4299,
1100,
62,
7753,
7,
11250,
62,
7753,
62,
6978,
25,
965,
11,
2393,
62,
1462,
62,
961,
62,
259,
25,
965,
8,
4613,
965,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
4149,
82,
262,
10154,
286,
257,... | 2.583878 | 459 |
import numpy as np
import math
from collections import deque
class Block(object):
"""Block object."""
def stacked_on(self, other):
"""Checks whether current block is placed on other block."""
x_dist = np.linalg.norm(self.pos[0] - other.pos[0])
y_dist = np.linalg.norm(self.pos[1] - oth... | [
11748,
299,
32152,
355,
45941,
198,
11748,
10688,
198,
6738,
17268,
1330,
390,
4188,
628,
198,
4871,
9726,
7,
15252,
2599,
198,
220,
220,
220,
37227,
12235,
2134,
526,
15931,
628,
220,
220,
220,
825,
24167,
62,
261,
7,
944,
11,
584,
... | 2.249753 | 1,013 |
# Simulator script for the simulation
# Author - Ameya Deshmukh
import simpy
import statistics
import random
customer_wait_times = []
| [
2,
13942,
4226,
329,
262,
18640,
198,
2,
6434,
532,
38561,
3972,
2935,
23940,
2724,
71,
198,
198,
11748,
985,
9078,
198,
11748,
7869,
198,
11748,
4738,
198,
198,
23144,
263,
62,
17077,
62,
22355,
796,
17635,
628,
628,
628,
628
] | 3.487805 | 41 |
#! /usr/bin/python
# Created by G. Barkhuff
# June 2015
# Method to parse jackhmmer hmm3-text result, after
# Manually deleting file to only contain final iteration results.
| [
2,
0,
1220,
14629,
14,
8800,
14,
29412,
198,
198,
2,
15622,
416,
402,
13,
20511,
71,
1648,
198,
2,
2795,
1853,
198,
2,
11789,
284,
21136,
14509,
23940,
647,
289,
3020,
18,
12,
5239,
1255,
11,
706,
198,
2,
1869,
935,
34817,
2393,
... | 3.384615 | 52 |
#
# Name:
# fixClimateFiles.py
# GFS1-NHD:A10636.0000-SCRIPT;2
#
# Status:
# DELIVERED
#
# History:
# Revision 2 (DELIVERED)
# Created: 20-AUG-2009 13:12:14 OBERFIEL
# Added purpose section to documentation block.
#
# Revision 1 (REVIEW)
# ... | [
2,
198,
2,
220,
220,
220,
6530,
25,
198,
2,
220,
220,
220,
220,
220,
220,
4259,
37649,
25876,
13,
9078,
198,
2,
220,
220,
220,
220,
220,
220,
402,
10652,
16,
12,
45,
10227,
25,
32,
15801,
2623,
13,
2388,
12,
6173,
46023,
26,
1... | 2.256604 | 1,060 |
import torch.nn as nn
import torch.nn.init as init
from ssd_project.utils.global_variables import *
device = DEVICE
#https://github.com/sgrvinod/a-PyTorch-Tutorial-to-Object-Detection/blob/master/utils.py
class AverageMeter(object):
"""
Keeps track of most recent, average, sum, and count of a metric.
"""... | [
11748,
28034,
13,
20471,
355,
299,
77,
198,
11748,
28034,
13,
20471,
13,
15003,
355,
2315,
198,
6738,
264,
21282,
62,
16302,
13,
26791,
13,
20541,
62,
25641,
2977,
1330,
1635,
198,
198,
25202,
796,
5550,
27389,
628,
198,
2,
5450,
1378... | 2.424223 | 1,577 |
from app.calculator import calc # 获取蓝图
from flask import request,session,render_template,flash,redirect,url_for
@calc.route('/calc_info', methods=['GET', 'POST']) # 设置路由
if __name__ == '__main__':
print("result:{}".format(eval('1 + (5 - 2) * 3')))
| [
6738,
598,
13,
9948,
3129,
1352,
1330,
42302,
1303,
5525,
236,
115,
20998,
244,
164,
241,
251,
32368,
122,
198,
6738,
42903,
1330,
2581,
11,
29891,
11,
13287,
62,
28243,
11,
34167,
11,
445,
1060,
11,
6371,
62,
1640,
628,
198,
198,
3... | 2.280702 | 114 |
#!/usr/bin/env python3
import json
import subprocess
import sys
if __name__ == "__main__":
main()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
11748,
33918,
198,
11748,
850,
14681,
198,
11748,
25064,
628,
628,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1388,
3419,
198
] | 2.634146 | 41 |
from django.contrib.auth.models import User, Group
from geem.models import Package
from rest_framework import viewsets, permissions
from rest_framework.authentication import SessionAuthentication
from oauth2_provider.contrib.rest_framework import TokenHasReadWriteScope, TokenHasScope, OAuth2Authentication
from api.seri... | [
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
27530,
1330,
11787,
11,
4912,
198,
6738,
4903,
368,
13,
27530,
1330,
15717,
198,
6738,
1334,
62,
30604,
1330,
5009,
1039,
11,
21627,
198,
6738,
1334,
62,
30604,
13,
41299,
3299,
1330,
... | 3.513605 | 294 |
"""
Queue follows FIFO and has two ends 1. head/front - from where elements are removed 2. tail/rear - from where the elements are entered
Process or removing the element is called dequeue and process of entering the element is called enqueue
Queue can be implemented in three ways using: 1. List 2. deque class from 'co... | [
37811,
198,
34991,
5679,
376,
5064,
46,
290,
468,
734,
5645,
352,
13,
1182,
14,
8534,
532,
422,
810,
4847,
389,
4615,
362,
13,
7894,
14,
260,
283,
532,
422,
810,
262,
4847,
389,
5982,
198,
18709,
393,
10829,
262,
5002,
318,
1444,
... | 3.047619 | 252 |
from detectors.detectsecrets import DetectSecrets
from detectors.gitsecrets import GitSecrets
# TODO: Turn this into a registry to match the notifiers pattern?
AvailableDetectors = {
'detect-secrets': DetectSecrets,
'git-secrets': GitSecrets
}
| [
6738,
40471,
13,
15255,
478,
2363,
8004,
1330,
35874,
6558,
8004,
198,
6738,
40471,
13,
18300,
2363,
8004,
1330,
15151,
6558,
8004,
198,
198,
2,
16926,
46,
25,
6756,
428,
656,
257,
20478,
284,
2872,
262,
407,
13350,
3912,
30,
198,
104... | 3.285714 | 77 |
#!/usr/bin/env python
# Convert old pos0.npy using logM_gas to a new value of Sigma_c
import argparse
import yaml
import numpy as np
from gas_mass_conversions import logM_to_logsigma
parser = argparse.ArgumentParser(description="Convert the value of logM_gas to Sigma_c in walker position (pos0.npy) files.")
parser.ad... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
2,
38240,
1468,
1426,
15,
13,
77,
9078,
1262,
2604,
44,
62,
22649,
284,
257,
649,
1988,
286,
31669,
62,
66,
198,
11748,
1822,
29572,
198,
11748,
331,
43695,
198,
11748,
299,
321... | 2.705387 | 594 |
import numpy as np
from Board import *
from tkinter import END
class Game():
"""
管理整个游戏
"""
boardWidth = 8 # 棋盘宽度
boardHeight = 8 # 棋盘高度
n_in_row = 5 # N子棋
flag_human_click = False #
move_human = -1 #
def Show(self, board, KEY=False):
... | [
11748,
299,
32152,
355,
45941,
198,
6738,
5926,
1330,
1635,
198,
6738,
256,
74,
3849,
1330,
23578,
198,
198,
4871,
3776,
33529,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
13328,
106,
94,
49426,
228,
46763,
112,
10310,
103,
162,
11... | 1.502535 | 2,959 |
import pandas as pd
import numpy as np
from smlcs.helper.preprocessing import Preprocessing
from joblib import load
| [
11748,
19798,
292,
355,
279,
67,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
895,
75,
6359,
13,
2978,
525,
13,
3866,
36948,
1330,
3771,
36948,
198,
6738,
1693,
8019,
1330,
3440,
628
] | 3.545455 | 33 |
from tkinter import *
from tkinter.ttk import *
from time import strftime
root=Tk()
root.title("Clock")
label=Label(root,font=("ds-digital",80),background="black",foreground="cyan")
label.pack(anchor="center")
time()
mainloop()
| [
6738,
256,
74,
3849,
1330,
1635,
201,
198,
6738,
256,
74,
3849,
13,
926,
74,
1330,
1635,
201,
198,
6738,
640,
1330,
965,
31387,
201,
198,
15763,
28,
51,
74,
3419,
201,
198,
15763,
13,
7839,
7203,
44758,
4943,
201,
198,
18242,
28,
... | 2.655556 | 90 |
#
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pysnmp/license.html
#
# This file instantiates some of the MIB managed objects for SNMP engine use
#
import time
if 'mibBuilder' not in globals():
import sys
sys.stderr.write... | [
2,
198,
2,
770,
2393,
318,
636,
286,
279,
893,
77,
3149,
3788,
13,
198,
2,
198,
2,
15069,
357,
66,
8,
5075,
12,
23344,
11,
49804,
64,
412,
889,
1659,
1279,
13629,
1659,
31,
14816,
13,
785,
29,
198,
2,
13789,
25,
2638,
1378,
16... | 2.347902 | 572 |
#!/usr/bin/env python3
import tarfile
import shutil
import os
shutil.copyfile('original.tar','1000.tar')
for i in range(1000,0,-1):
tar = tarfile.open("./%d.tar"%(i))
if i == 1:
tar.extract('flag.png')
else:
tar.extract('%d.tar'%(i-1))
tar.close()
os.remove("./%d.tar"%(i)) | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
11748,
13422,
7753,
198,
11748,
4423,
346,
198,
11748,
28686,
198,
1477,
22602,
13,
30073,
7753,
10786,
14986,
13,
18870,
41707,
12825,
13,
18870,
11537,
198,
1640,
1312,
287,
2837,
... | 2.136364 | 132 |
##
# Copyright (c) 2007-2015 Cyrus Daboo. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | [
2235,
198,
2,
220,
220,
220,
15069,
357,
66,
8,
4343,
12,
4626,
34305,
360,
397,
2238,
13,
1439,
2489,
10395,
13,
198,
2,
198,
2,
220,
220,
220,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
... | 3.399267 | 273 |
from django import forms
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from .models import CustomUser
| [
6738,
42625,
14208,
1330,
5107,
201,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
23914,
1330,
11787,
12443,
341,
8479,
11,
11787,
19400,
8479,
201,
198,
6738,
764,
27530,
1330,
8562,
12982,
201,
198
] | 3.611111 | 36 |
# -*- coding: utf-8 -*-
""" Main """
from Scripts.main import Main
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
201,
198,
201,
198,
37811,
8774,
37227,
201,
198,
6738,
12327,
82,
13,
12417,
1330,
8774,
201,
198,
201,
198
] | 2.242424 | 33 |
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('loc/<int:location_id>/', views.location, name='location'),
path('cam/<int:camera_id>/', views.camera, name='camera'),
]
| [
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
198,
198,
6738,
764,
1330,
5009,
198,
198,
6371,
33279,
82,
796,
685,
198,
220,
220,
220,
3108,
10786,
3256,
5009,
13,
9630,
11,
1438,
11639,
9630,
33809,
198,
220,
220,
220,
3108,
10786,
... | 2.719101 | 89 |
# AUTOGENERATED! DO NOT EDIT! File to edit: notebooks/02_causal_model.ipynb (unless otherwise specified).
__all__ = ['CausalGraph', 'show_graph', 'view_graph', 'get_ancestors', 'cut_edges', 'get_causes', 'get_instruments',
'get_effect_modifiers', 'CausalModel', 'identify_effect', 'construct_backdoor',
... | [
2,
47044,
7730,
1677,
1137,
11617,
0,
8410,
5626,
48483,
0,
9220,
284,
4370,
25,
43935,
14,
2999,
62,
6888,
6775,
62,
19849,
13,
541,
2047,
65,
357,
25252,
4306,
7368,
737,
198,
198,
834,
439,
834,
796,
37250,
24334,
6775,
37065,
32... | 2.581068 | 1,067 |
# pylint: disable=missing-function-docstring, missing-module-docstring/
#==============================================================================
from pyccel.decorators import allow_negative_index
@allow_negative_index('a')
| [
2,
279,
2645,
600,
25,
15560,
28,
45688,
12,
8818,
12,
15390,
8841,
11,
4814,
12,
21412,
12,
15390,
8841,
14,
198,
2,
23926,
25609,
855,
198,
6738,
12972,
66,
5276,
13,
12501,
273,
2024,
1330,
1249,
62,
31591,
62,
9630,
198,
198,
... | 4.358491 | 53 |
# @Time : 9/19/17 5:16 PM
# @Author : Tiancheng Zhao
from __future__ import print_function
import os
import json
import logging
from datetime import datetime
import torch
# from nltk.tokenize.moses import MosesDetokenizer
from nltk.tokenize.treebank import TreebankWordDetokenizer
import nltk
import sys
from colle... | [
2,
2488,
7575,
220,
220,
220,
1058,
860,
14,
1129,
14,
1558,
642,
25,
1433,
3122,
198,
2,
2488,
13838,
220,
1058,
20834,
2395,
782,
29436,
198,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
198,
11748,
28686,
198,
11748,
... | 2.100858 | 932 |
from modi.module.module import Module
| [
6738,
953,
72,
13,
21412,
13,
21412,
1330,
19937,
628
] | 3.9 | 10 |
import uuid
import pika
import json
import jsons
PERSIST = pika.BasicProperties(delivery_mode=2)
class Connection(object):
"""
Manage a connection to the RabbitMQ server.
"""
# def channel(self):
# return self.connection.channel()
#
# def close(self, code=200, text="Normal shutdown"):... | [
11748,
334,
27112,
198,
11748,
279,
9232,
198,
11748,
33918,
198,
11748,
44804,
684,
198,
198,
47,
4877,
8808,
796,
279,
9232,
13,
26416,
2964,
18200,
7,
12381,
6315,
62,
14171,
28,
17,
8,
198,
198,
4871,
26923,
7,
15252,
2599,
198,
... | 2.750685 | 1,095 |
import math
import torch
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import pdb
from .layernorm import LayerNormalization
from torch.autograd import Variable
class GraphConvolution(Module):
"""
Si... | [
11748,
10688,
198,
198,
11748,
28034,
198,
198,
6738,
28034,
13,
20471,
13,
17143,
2357,
1330,
25139,
2357,
198,
6738,
28034,
13,
20471,
13,
18170,
13,
21412,
1330,
19937,
198,
11748,
28034,
13,
20471,
355,
299,
77,
198,
11748,
28034,
1... | 2.677215 | 474 |
MAX_RETRY = 3
DEVMODE = False
# secrets
API_KEY_SMSKA_NET = None
| [
22921,
62,
2200,
40405,
796,
513,
198,
7206,
15996,
16820,
796,
10352,
198,
198,
2,
13141,
198,
17614,
62,
20373,
62,
50,
5653,
25123,
62,
12884,
796,
6045,
198
] | 2.275862 | 29 |
import numpy as np
import sympy as sp
if __name__ == "__main__":
traj_opt() | [
11748,
299,
32152,
355,
45941,
198,
11748,
10558,
88,
355,
599,
628,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1291,
73,
... | 2.108696 | 46 |
import argparse
import enum
import json
import shutil
import sys
from dataclasses import dataclass
from distutils import dir_util
from pathlib import Path
from autodidaqt.utils import autodidaqt_LIB_ROOT
@dataclass
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Create autodidaqt proj... | [
11748,
1822,
29572,
198,
11748,
33829,
198,
11748,
33918,
198,
11748,
4423,
346,
198,
11748,
25064,
198,
6738,
4818,
330,
28958,
1330,
4818,
330,
31172,
198,
6738,
1233,
26791,
1330,
26672,
62,
22602,
198,
6738,
3108,
8019,
1330,
10644,
1... | 2.619718 | 426 |
#!/home/clyde/Documents/My-Gallery/virtual/bin/python
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| [
2,
48443,
11195,
14,
66,
306,
2934,
14,
38354,
14,
3666,
12,
29352,
14,
32844,
14,
8800,
14,
29412,
198,
6738,
42625,
14208,
13,
7295,
1330,
4542,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220... | 2.962963 | 54 |
from .print_level_order import print_level_order
| [
6738,
764,
4798,
62,
5715,
62,
2875,
1330,
3601,
62,
5715,
62,
2875,
628,
628
] | 3.466667 | 15 |
from typing import Tuple
from selectorlib import Extractor
from pprint import pformat
import json
import requests
import pandas as pd
def summarize(score: int, cutoff: int, correct: dict, incorrect: dict, skipped: dict) -> str:
"""formats information
Args:
score (int): score on test
cutoff (int): cutoff of test... | [
6738,
19720,
1330,
309,
29291,
198,
6738,
31870,
8019,
1330,
29677,
273,
198,
6738,
279,
4798,
1330,
279,
18982,
198,
11748,
33918,
198,
11748,
7007,
198,
11748,
19798,
292,
355,
279,
67,
198,
198,
4299,
35743,
7,
26675,
25,
493,
11,
... | 2.716433 | 998 |
from django.utils.functional import cached_property
from django.utils.html import escape
from wagtail.core.models import Page
from wagtail.core.rich_text import features as feature_registry
from wagtail.core.rich_text.rewriters import (
EmbedRewriter,
LinkRewriter,
MultiRuleRewriter,
)
from wagtail.core.wh... | [
6738,
42625,
14208,
13,
26791,
13,
45124,
1330,
39986,
62,
26745,
198,
6738,
42625,
14208,
13,
26791,
13,
6494,
1330,
6654,
198,
198,
6738,
266,
363,
13199,
13,
7295,
13,
27530,
1330,
7873,
198,
6738,
266,
363,
13199,
13,
7295,
13,
75... | 3.131852 | 675 |
#!/usr/bin/env python
#
# test_cli.py - Unit test cases for generic COT CLI.
#
# September 2013, Glenn F. Matthews
# Copyright (c) 2013-2017, 2019 the COT project developers.
# See the COPYRIGHT.txt file at the top-level directory of this distribution
# and at https://github.com/glennmatthews/cot/blob/master/COPYRIGHT.... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
198,
2,
1332,
62,
44506,
13,
9078,
532,
11801,
1332,
2663,
329,
14276,
327,
2394,
43749,
13,
198,
2,
198,
2,
2693,
2211,
11,
17551,
376,
13,
22233,
198,
2,
15069,
357,
66,
8,
... | 2.118339 | 19,478 |
import os
import argparse
import json
import hashlib
import boto3
from . import fragdb
from .fragment_doc import fragment_srt, fragment_syosetu
from ..util.count_chars import count_meaty_chars
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--minlen', type=int, default=0)
... | [
11748,
28686,
198,
11748,
1822,
29572,
198,
11748,
33918,
198,
11748,
12234,
8019,
198,
198,
11748,
275,
2069,
18,
198,
198,
6738,
764,
1330,
7956,
9945,
198,
6738,
764,
8310,
363,
434,
62,
15390,
1330,
24225,
62,
82,
17034,
11,
24225,
... | 1.926282 | 1,248 |
from pathlib import Path
from shutil import copyfile
Path("my_package").mkdir(exist_ok=True)
copyfile("../miniver/miniver/_static_version.py", "my_package/_static_version.py")
copyfile("../miniver/miniver/_version.py", "my_package/_version.py")
README_filename = "../miniver/README.md"
write_snippet_from_readme(
... | [
6738,
3108,
8019,
1330,
10644,
198,
6738,
4423,
346,
1330,
4866,
7753,
198,
198,
15235,
7203,
1820,
62,
26495,
11074,
28015,
15908,
7,
38476,
62,
482,
28,
17821,
8,
198,
30073,
7753,
7203,
40720,
1084,
1428,
14,
1084,
1428,
47835,
12708... | 2.805 | 200 |
import pickle
import argparse
import numpy as np
parser = argparse.ArgumentParser()
parser.add_argument('-rescored', help="File with pickled rescored dictionary", required=True)
parser.add_argument('-references', help="File with reference. Used to weight average by length", required=True)
parser.add_argument('-lattic... | [
11748,
2298,
293,
198,
11748,
1822,
29572,
198,
11748,
299,
32152,
355,
45941,
198,
198,
48610,
796,
1822,
29572,
13,
28100,
1713,
46677,
3419,
198,
198,
48610,
13,
2860,
62,
49140,
10786,
12,
411,
66,
1850,
3256,
1037,
2625,
8979,
351,... | 2.631048 | 496 |
# -*- coding: utf-8 -*-
# pylint: disable=unused-import
"""HTTP vendor crawlers for constant enumerations."""
from pcapkit.vendor.http.error_code import ErrorCode as HTTP_ErrorCode
from pcapkit.vendor.http.frame import Frame as HTTP_Frame
from pcapkit.vendor.http.setting import Setting as HTTP_Setting
__all__ = ['HTT... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
279,
2645,
600,
25,
15560,
28,
403,
1484,
12,
11748,
198,
37811,
40717,
18371,
27784,
8116,
329,
6937,
27056,
602,
526,
15931,
198,
198,
6738,
279,
11128,
15813,
13,
... | 3.058824 | 119 |
from fastapi import FastAPI, Depends, Response, status, HTTPException, APIRouter
from sqlalchemy import Boolean, desc, true
from sqlalchemy.orm import Session
from typing import List
from ..database import get_db
from .. import models, schemas, utils
router = APIRouter()
# get all persons
@router.get("/persons", sta... | [
6738,
3049,
15042,
1330,
12549,
17614,
11,
2129,
2412,
11,
18261,
11,
3722,
11,
14626,
16922,
11,
3486,
4663,
39605,
198,
6738,
44161,
282,
26599,
1330,
41146,
11,
1715,
11,
2081,
198,
6738,
44161,
282,
26599,
13,
579,
1330,
23575,
198,... | 2.983165 | 297 |
#Write an if-elif-else chain that determines a person's stage of life.
#Set a value for the variable age, then:
# If the person is less than 2, print a message that the person
# is a baby.
#
# If the person is at least 2 years old, but less than 4, print
# a message that the person is a toddler.
#
# ... | [
2,
16594,
281,
611,
12,
417,
361,
12,
17772,
6333,
326,
15947,
257,
1048,
338,
3800,
286,
1204,
13,
220,
198,
2,
7248,
257,
1988,
329,
262,
7885,
2479,
11,
788,
25,
198,
2,
220,
220,
1002,
262,
1048,
318,
1342,
621,
362,
11,
360... | 2.851441 | 451 |
from Sorteador import emails, nomes, main
from emailer import infos
quant = int(input('Quantas pessoas irão participar do amigo secreto? '))
for i in range(1, quant + 1):
nome = input(f'Informe o nome do {i}º participante: ')
email = input(f'Informe o email do {i}º participante: ')
print('\n')
... | [
6738,
33947,
1329,
273,
1330,
7237,
11,
299,
2586,
11,
1388,
201,
198,
6738,
3053,
263,
1330,
1167,
418,
201,
198,
201,
198,
40972,
796,
493,
7,
15414,
10786,
24915,
292,
279,
408,
78,
292,
4173,
28749,
2916,
283,
466,
716,
14031,
3... | 2.265306 | 343 |
import mock
from .context import aiociscospark
| [
11748,
15290,
198,
198,
6738,
764,
22866,
1330,
257,
72,
420,
2304,
2117,
668,
628,
198
] | 3.125 | 16 |
from ...Plastic.SuperElastic.SuperElasticHardening import SuperElasticHardening
from ...Plastic.SuperElastic.SuperElasticHardeningModifications import SuperElasticHardeningModifications
class SuperElasticity:
"""The SuperElasticity object specifies a superelastic material model.
Notes
-----
This obje... | [
6738,
2644,
3646,
3477,
13,
12442,
9527,
3477,
13,
12442,
9527,
3477,
17309,
3101,
1330,
3115,
9527,
3477,
17309,
3101,
198,
6738,
2644,
3646,
3477,
13,
12442,
9527,
3477,
13,
12442,
9527,
3477,
17309,
3101,
5841,
6637,
1330,
3115,
9527,
... | 2.572197 | 1,115 |
from django.apps import AppConfig
| [
6738,
42625,
14208,
13,
18211,
1330,
2034,
16934,
201,
198,
201,
198
] | 3.083333 | 12 |
# Imports
import os
import jinja2
import webapp2
import logging
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
from flask import Flask, request
app = Flask(__name__)
@app.route('/') | [
2,
1846,
3742,
198,
11748,
28686,
198,
11748,
474,
259,
6592,
17,
198,
11748,
3992,
1324,
17,
198,
11748,
18931,
198,
41,
1268,
37048,
62,
1677,
53,
4663,
1340,
10979,
796,
474,
259,
6592,
17,
13,
31441,
7,
198,
220,
220,
220,
40213... | 2.581197 | 117 |
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('create', views.create, name='create'),
path('edit/<str:pk>', views.BookmarkUpdate.as_view(), name='edit'),
path('delete/<str:pk>', views.delete, name='delete')
] | [
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
201,
198,
6738,
764,
1330,
5009,
201,
198,
201,
198,
6371,
33279,
82,
796,
685,
201,
198,
220,
220,
220,
3108,
10786,
3256,
5009,
13,
9630,
11,
1438,
11639,
9630,
33809,
201,
198,
220,
2... | 2.60177 | 113 |
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
from tests import pyunit_utils
import h2o
def h2o_H2OFrame_summary():
"""
Python API test: h2o.frame.H2OFrame.summary()
"""
frame = h2o.import_file(path=pyunit_utils.locate("smalldata/iris/iris.csv"))
frame.summary()
i... | [
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
11748,
25064,
198,
17597,
13,
6978,
13,
28463,
7,
16,
553,
40720,
40720,
40720,
4943,
198,
6738,
5254,
1330,
12972,
20850,
62,
26791,
198,
11748,
289,
17,
78,
198,
198,
4299,
289,
17... | 2.40884 | 181 |
import pickle
import wikiscraper
import time
import requests
from pymongo import MongoClient
import datetime
client = MongoClient('localhost', 27017)
db = client['itemdb']
items = pickle.load(open('items.p', 'rb'))
#remove duplicate items
items = set(items)
count = len(items)
ticker = 0.0
ts = time.time()
for it... | [
11748,
2298,
293,
198,
11748,
47145,
2304,
38545,
198,
11748,
640,
198,
11748,
7007,
198,
6738,
279,
4948,
25162,
1330,
42591,
11792,
198,
11748,
4818,
8079,
628,
198,
16366,
796,
42591,
11792,
10786,
36750,
3256,
2681,
29326,
8,
198,
994... | 2.623729 | 295 |
""" Advent of code 2017 day 15/2 """
import unittest
from code import solution, Judge
class MyTest(unittest.TestCase):
"""Unit tests for actual day"""
def test_match(self):
""" The basic test cases """
self.assertEqual(solution("""Generator A starts with 65
Generator B starts with 8921"""), 3... | [
37811,
33732,
286,
2438,
2177,
197,
820,
1315,
14,
17,
37227,
198,
198,
11748,
555,
715,
395,
198,
6738,
2438,
1330,
4610,
11,
8974,
198,
198,
4871,
2011,
14402,
7,
403,
715,
395,
13,
14402,
20448,
2599,
198,
220,
220,
220,
37227,
2... | 2.409704 | 371 |
from flask import request
from . import video
from ..router import Response_headers
from ..decorator import is_login
from ..model import UserOrder, VideoInfo, CourseInfo
from .. import db
@video.route('/video', methods=['GET'])
@is_login | [
6738,
42903,
1330,
2581,
198,
6738,
764,
1330,
2008,
198,
6738,
11485,
472,
353,
1330,
18261,
62,
50145,
198,
6738,
11485,
12501,
273,
1352,
1330,
318,
62,
38235,
198,
6738,
11485,
19849,
1330,
11787,
18743,
11,
7623,
12360,
11,
20537,
... | 3.552239 | 67 |
from pathlib import Path
import gast as ast
from transonic.analyses import beniget
from transonic.analyses.util import (
get_annotations,
print_ast,
print_dump,
print_unparsed,
filter_code_typevars
)
path_examples = Path("examples")
files = sorted(path_examples.glob("*.py"))
with open(files[1... | [
6738,
3108,
8019,
1330,
10644,
198,
198,
11748,
21956,
355,
6468,
198,
6738,
1007,
9229,
13,
272,
43710,
1330,
1888,
328,
316,
628,
198,
6738,
1007,
9229,
13,
272,
43710,
13,
22602,
1330,
357,
198,
220,
220,
220,
651,
62,
34574,
602,
... | 2.634146 | 246 |
"""Unit tests for the graphspace quotient space."""
import geomstats.backend as gs
from geomstats.geometry.graphspace import GraphSpace, GraphSpaceMetric
from tests.conftest import Parametrizer, TestCase
from tests.data_generation import TestData
| [
37811,
26453,
5254,
329,
262,
4823,
13200,
23611,
1153,
2272,
526,
15931,
198,
198,
11748,
4903,
296,
34242,
13,
1891,
437,
355,
308,
82,
198,
6738,
4903,
296,
34242,
13,
469,
15748,
13,
34960,
13200,
1330,
29681,
14106,
11,
29681,
1410... | 3.571429 | 70 |
from uttl.buildout.command_recipe import CommandRecipe
from zc.buildout import UserError | [
6738,
3384,
28781,
13,
11249,
448,
13,
21812,
62,
29102,
431,
1330,
9455,
37523,
198,
6738,
1976,
66,
13,
11249,
448,
1330,
11787,
12331
] | 3.666667 | 24 |
import technical_keywords as t
| [
11748,
6276,
62,
2539,
10879,
355,
256,
628,
198
] | 3.666667 | 9 |
import board
import busio
import time
import math
import struct
import digitalio
# board specific definitions
uart = busio.UART(board.A2, board.A3, baudrate=115200) # TX2 RX2 blackpill
#uart = busio.UART(board.C2, board.C3, baudrate=115200) # TX2 RX2 Metro M0 express
led = digitalio.DigitalInOut(board.LED)
led.direct... | [
11748,
3096,
198,
11748,
1323,
952,
198,
11748,
640,
198,
11748,
10688,
198,
11748,
2878,
198,
11748,
4875,
952,
198,
198,
2,
3096,
2176,
17336,
198,
19986,
796,
1323,
952,
13,
52,
7227,
7,
3526,
13,
32,
17,
11,
3096,
13,
32,
18,
... | 2.310409 | 538 |
from ..serializers import ClienteSerializer
from ..models import Cliente | [
6738,
11485,
46911,
11341,
1330,
20985,
68,
32634,
7509,
198,
6738,
11485,
27530,
1330,
20985,
68
] | 4.5 | 16 |
"""
__move_one_output_indirect_match_diff_rules_MDL.py_____________________________________________________
Automatically generated AToM3 Model File (Do not modify directly)
Author: levi
Modified: Mon Jul 29 15:51:56 2013
_________________________________________________________________________________________________... | [
37811,
198,
834,
21084,
62,
505,
62,
22915,
62,
521,
1060,
62,
15699,
62,
26069,
62,
38785,
62,
12740,
43,
13,
9078,
10221,
4841,
29343,
198,
198,
38062,
4142,
7560,
317,
2514,
44,
18,
9104,
9220,
357,
5211,
407,
13096,
3264,
8,
198... | 3.236902 | 439 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 21 14:19:48 2021
@author: nams
"""
import numpy as np
import scipy.constants
# from functools import cache
from functools import lru_cache
import tes_optical_stack.nk_code as nk_code
nk = nk_code.load_from_materials_mat()
z0 = np.sqrt(scipy.const... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
41972,
319,
30030,
4280,
2310,
1478,
25,
1129,
25,
2780,
33448,
198,
198,
31,
9800,
25,
299,
4105,
19... | 2.333333 | 168 |
from datetime import datetime
from bs4 import BeautifulSoup as bs
from loguru import logger
import numpy as np
import pandas as pd
import requests
from requests.adapters import HTTPAdapter
from tqdm import tqdm
from urllib3.util import Retry
from user_agent import generate_user_agent
# A public league for current we... | [
6738,
4818,
8079,
1330,
4818,
8079,
198,
198,
6738,
275,
82,
19,
1330,
23762,
50,
10486,
355,
275,
82,
198,
6738,
2604,
14717,
1330,
49706,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
7007,
19... | 2.205422 | 1,660 |
# Databricks notebook source
v_result = dbutils.notebook.run("1.ingest_circuits_file", 0, {"p_data_source": "Ergast API", "p_file_date": "2021-04-18"})
# COMMAND ----------
v_result
# COMMAND ----------
v_result = dbutils.notebook.run("2.ingest_races_file", 0, {"p_data_source": "Ergast API", "p_file_date": "2021-04... | [
2,
16092,
397,
23706,
20922,
2723,
198,
85,
62,
20274,
796,
288,
4360,
4487,
13,
11295,
2070,
13,
5143,
7203,
16,
13,
278,
395,
62,
21170,
15379,
62,
7753,
1600,
657,
11,
19779,
79,
62,
7890,
62,
10459,
1298,
366,
9139,
70,
459,
7... | 2.398682 | 607 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
| [
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,
15720,
602,
11,
4981,
628
] | 2.891892 | 37 |
#!/usr/bin/python
# Version: 0.1
# Last changed: 06/08/17
import sys
import signal
import time
import random
import socket
from pythonosc import osc_message_builder
from pythonosc import udp_client
from a3dLogger import a3dLogger
if __name__ == '__main__':
# init stuff
osc = OSCHandler( "192.168.1.255... | [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
198,
2,
10628,
25,
220,
220,
220,
220,
220,
657,
13,
16,
198,
2,
4586,
3421,
25,
9130,
14,
2919,
14,
1558,
198,
198,
11748,
25064,
198,
11748,
6737,
198,
11748,
640,
198,
11748,
4738,
198... | 2.507246 | 207 |
#!/usr/bin/env python3
"""
This module contains a quadratic equation solver,
but uses an optional parameter so multiple root functions
do not need to be defined.
"""
import numpy as np
a = 2.1
b = 5.4
c = 1.2
# The following shows how to define optional parameters.
# The last input has a default value of True.
# If... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
37811,
198,
1212,
8265,
4909,
257,
15094,
81,
1512,
16022,
1540,
332,
11,
198,
4360,
3544,
281,
11902,
11507,
523,
3294,
6808,
5499,
198,
4598,
407,
761,
284,
307,
5447,
13,
... | 2.743227 | 849 |
from . import _utils
from ._base import CRUDRouterBase, NOT_FOUND
from .base_async import CRUDRouterAsync
__all__ = [
"CRUDRouterAsync",
]
| [
6738,
764,
1330,
4808,
26791,
198,
6738,
47540,
8692,
1330,
8740,
52,
7707,
39605,
14881,
11,
5626,
62,
37,
15919,
198,
6738,
764,
8692,
62,
292,
13361,
1330,
8740,
52,
7707,
39605,
42367,
198,
198,
834,
439,
834,
796,
685,
198,
220,
... | 2.666667 | 54 |
""" Utils """ | [
37811,
7273,
4487,
37227
] | 3.25 | 4 |
from tir import Webapp
import unittest
from datetime import datetime
DateSystem = datetime.today().strftime("%d/%m/%Y")
if __name__ == '__main__':
unittest.main() | [
6738,
48965,
1330,
5313,
1324,
198,
11748,
555,
715,
395,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
10430,
11964,
796,
4818,
8079,
13,
40838,
22446,
2536,
31387,
7203,
4,
67,
14,
4,
76,
14,
4,
56,
4943,
198,
198,
361,
11593,
367... | 2.783333 | 60 |
# coding=utf-8
from typing import List
from src.data_structure.data_structure import TreeNode
class Solution:
"""
二叉树的最大深度
"""
def max_depth_recursive(self, root: TreeNode) -> int:
"""
Time: O(n), Space: (n)
:param root:
:return:
"""
if not root:
... | [
2,
19617,
28,
40477,
12,
23,
198,
6738,
19720,
1330,
7343,
198,
198,
6738,
12351,
13,
7890,
62,
301,
5620,
13,
7890,
62,
301,
5620,
1330,
12200,
19667,
628,
198,
4871,
28186,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
... | 1.81378 | 537 |
from ast_hierarchy import PropertyNode, DeclarationNode
# TODO Built-in methods for types. Boxing/Unboxing for Object type | [
6738,
6468,
62,
71,
959,
9282,
1330,
14161,
19667,
11,
24720,
19667,
628,
198,
2,
16926,
46,
28477,
12,
259,
5050,
329,
3858,
13,
35921,
14,
3118,
45471,
329,
9515,
2099
] | 4 | 31 |
###########################################################################
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/l... | [
29113,
29113,
7804,
21017,
198,
2,
198,
2,
220,
15069,
12131,
3012,
11419,
198,
2,
198,
2,
220,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
220,
345,
743,
407,
779,
428,
2393,
2845,
... | 2.338589 | 1,332 |
from . import core
import argparse
import cv2
from numpy import ndarray
from typing import Iterator
if __name__ == "__main__":
main(*parse_args())
| [
6738,
764,
1330,
4755,
198,
11748,
1822,
29572,
198,
11748,
269,
85,
17,
198,
6738,
299,
32152,
1330,
299,
67,
18747,
198,
6738,
19720,
1330,
40806,
1352,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
22... | 3.04 | 50 |
import numpy as np
from ..boundingregion import BoundingBox
from ..dimension import Dimension
from ..element import Element
from ..ndmapping import NdMapping, item_check
from ..sheetcoords import Slice
from .. import util
from .grid import GridInterface
from .interface import Interface
class ImageInterface(GridInte... | [
11748,
299,
32152,
355,
45941,
198,
198,
6738,
11485,
7784,
278,
36996,
1330,
347,
9969,
14253,
198,
6738,
11485,
46156,
1330,
34024,
198,
6738,
11485,
30854,
1330,
11703,
198,
6738,
11485,
358,
76,
5912,
1330,
220,
399,
67,
44,
5912,
1... | 2.185294 | 2,040 |
# -*- coding=utf-8 -*-
import threading
import pygame
| [
2,
532,
9,
12,
19617,
28,
40477,
12,
23,
532,
9,
12,
198,
11748,
4704,
278,
198,
11748,
12972,
6057,
198
] | 2.571429 | 21 |
#!/usr/bin/python
"""tests for the text printing function
:author: `Patrick Kanzler <patrick.kanzler@fablab.fau.de>`_
:organization: `python-escpos <https://github.com/python-escpos>`_
:copyright: Copyright (c) 2016 `python-escpos <https://github.com/python-escpos>`_
:license: GNU GPL v3
"""
from __future__ import ab... | [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
37811,
41989,
329,
262,
2420,
13570,
2163,
198,
198,
25,
9800,
25,
4600,
32718,
14248,
89,
1754,
1279,
29615,
13,
27541,
89,
1754,
31,
69,
23117,
397,
13,
69,
559,
13,
2934,
29,
63,
62,
1... | 2.794258 | 418 |
from rl import *
from utils import *
import random
from recsim.agents import full_slate_q_agent
from irl_agent import InverseRLAgent
import tensorflow.compat.v1 as tf
import time
from numpy import load
def clicked_quality_reward(responses):
"""Calculates the total clicked watchtime from a list of responses.
... | [
6738,
374,
75,
1330,
1635,
198,
6738,
3384,
4487,
1330,
1635,
198,
11748,
4738,
198,
6738,
664,
14323,
13,
49638,
1330,
220,
1336,
62,
6649,
378,
62,
80,
62,
25781,
198,
6738,
220,
1901,
62,
25781,
1330,
554,
4399,
7836,
36772,
198,
... | 2.288681 | 963 |
import shapely.geometry as geom
import matplotlib.pyplot as plt
from copy import copy
from numpy import inf, dot
import math
import munkres
import scipy.spatial as spatial
import numpy as np
#Deprecated, better to use hungarian algorithm
#Deprecated : better to use Interpolator and hungarian algorithm
| [
11748,
5485,
306,
13,
469,
15748,
355,
4903,
296,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
6738,
4866,
1330,
4866,
198,
6738,
299,
32152,
1330,
1167,
11,
16605,
198,
11748,
10688,
198,
11748,
285,
2954,
411,
... | 3.546512 | 86 |
# -*- coding: utf-8 -*-
# Copyright 2017-2019 ControlScan, Inc.
#
# This file is part of Cyphon Engine.
#
# Cyphon Engine 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, version 3 of the License.
#
# Cyphon En... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
15069,
2177,
12,
23344,
6779,
33351,
11,
3457,
13,
198,
2,
198,
2,
770,
2393,
318,
636,
286,
5934,
746,
261,
7117,
13,
198,
2,
198,
2,
5934,
746,
261,
7117,
318... | 3.29207 | 517 |
#!/usr/bin/env python
import argparse
import fastalite
import logging
# As the name implies, given a set of fasta / fastq files (min 2), combine them into one fasta file.
# Check at least to be sure no overlapping IDs. Optionally check sequences themselves.
# Optionally handle paired reads (being sure to include eac... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
11748,
1822,
29572,
198,
11748,
3049,
282,
578,
198,
11748,
18931,
198,
198,
2,
1081,
262,
1438,
15565,
11,
1813,
257,
900,
286,
3049,
64,
1220,
3049,
80,
3696,
357,
1084,
362,
828,
... | 3.538462 | 104 |
import numpy as np
from .base import Explainer
from .parsers import util
class Random(Explainer):
"""
Explainer that returns random influence values.
Local-Influence Semantics
- Pos. and neg. values are arbitrary.
Note
- Supports GBDTs and RFs.
"""
def __init__(self, random_... | [
11748,
299,
32152,
355,
45941,
198,
198,
6738,
764,
8692,
1330,
5905,
10613,
198,
6738,
764,
79,
945,
364,
1330,
7736,
628,
198,
4871,
14534,
7,
18438,
10613,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
5905,
10613,
326,
5860... | 2.187853 | 708 |
# Generated by Django 2.1.7 on 2019-04-05 11:16
import ckeditor.fields
from django.db import migrations, models
import django.db.models.deletion
import djmoney.models.fields
| [
2,
2980,
515,
416,
37770,
362,
13,
16,
13,
22,
319,
13130,
12,
3023,
12,
2713,
1367,
25,
1433,
198,
198,
11748,
269,
9091,
2072,
13,
25747,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
198,
11748,
42625,
14208,
13,... | 2.983051 | 59 |
#!/usr/bin/python3
# -*- coding: latin-1 -*-
import sys, os, sys, subprocess, re
def listdirectory(path):
'''list all files'''
fichier=[]
#cf : http://docs.python.org/2/library/os.html
for root, dirs, files in os.walk(path):
for i in files:
fichier.append(os.path.join(root, i)) ... | [
2,
48443,
14629,
14,
8800,
14,
29412,
18,
198,
2,
532,
9,
12,
19617,
25,
3042,
259,
12,
16,
532,
9,
12,
198,
11748,
25064,
11,
28686,
11,
25064,
11,
850,
14681,
11,
302,
198,
198,
4299,
1351,
34945,
7,
6978,
2599,
220,
198,
220,... | 2.122744 | 277 |
from setuptools import find_packages, setup
setup(
name="mybib",
version="1.0",
long_description=__doc__,
packages=find_packages(),
include_package_data=True,
zip_safe=False,
install_requires=["Flask"],
)
| [
6738,
900,
37623,
10141,
1330,
1064,
62,
43789,
11,
9058,
198,
198,
40406,
7,
198,
220,
220,
220,
1438,
2625,
1820,
65,
571,
1600,
198,
220,
220,
220,
2196,
2625,
16,
13,
15,
1600,
198,
220,
220,
220,
890,
62,
11213,
28,
834,
1539... | 2.516129 | 93 |
import os
import imp
# Use the file from the parent directory.
mod = imp.load_source("_parent", os.path.join(os.path.dirname(os.path.dirname(__file__)),
os.path.basename(__file__)))
main = mod.main
| [
11748,
28686,
198,
11748,
848,
198,
2,
5765,
262,
2393,
422,
262,
2560,
8619,
13,
198,
4666,
796,
848,
13,
2220,
62,
10459,
7203,
62,
8000,
1600,
28686,
13,
6978,
13,
22179,
7,
418,
13,
6978,
13,
15908,
3672,
7,
418,
13,
6978,
13,... | 2.121739 | 115 |
import re,sys
# **************************************************************************************************************
#
# Class representing a single note
#
# **************************************************************************************************************
# ****************************... | [
11748,
302,
11,
17597,
198,
198,
2,
41906,
17174,
17174,
46068,
1174,
198,
2,
198,
2,
197,
197,
197,
197,
197,
197,
197,
197,
197,
197,
9487,
10200,
257,
2060,
3465,
198,
2,
198,
2,
41906,
17174,
17174,
46068,
1174,
198,
198,
2,
4... | 5.627803 | 223 |