content stringlengths 1 1.04M | input_ids listlengths 1 774k | ratio_char_token float64 0.38 22.9 | token_count int64 1 774k |
|---|---|---|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 14 15:52:16 2019
@author: max
"""
import os
import re
import argparse
import shutil
#%%
if __name__ == '__main__':
args=parseArguments()
path=args.dir
copy_file(path)
print(args)
... | [
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,
2892,
2365,
1478,
1315,
25,
4309,
25,
1433,
13130,
198,
198,
31,
9800,
25,
3509,
198,
378... | 1.614173 | 254 |
import datetime
from datetime import datetime as dt
import threading
from threading import Lock
import os
# pretty simple data class to describe actions to be taken as rule consequences
| [
11748,
4818,
8079,
198,
6738,
4818,
8079,
1330,
4818,
8079,
355,
288,
83,
198,
11748,
4704,
278,
198,
6738,
4704,
278,
1330,
13656,
198,
11748,
28686,
198,
198,
2,
2495,
2829,
1366,
1398,
284,
6901,
4028,
284,
307,
2077,
355,
3896,
69... | 4.372093 | 43 |
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2020, Battelle Memorial Institute.
#
# 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... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
22935,
90,
198,
2,
43907,
25,
900,
277,
12685,
28,
40477,
12,
23,
10117,
28,
29412,
1509,
28,
19,
40379,
28,
19,
39747,
28,
19,
2123,
25,
198,
2,
198,
2,
15069,
12131,
... | 3.06237 | 1,924 |
class Snake:
"""A dangerous and/or harmless serpent."""
pass
class Cobra(Snake):
"""Definitely dangerous, yup."""
def bite(self, other):
"""Deliver a dose of venom."""
if other.immune == False:
other.poisoned == True
other.poison_timer = 10 * self.venom
class BoaConstrictor(... | [
4871,
16705,
25,
198,
220,
220,
220,
37227,
32,
4923,
290,
14,
273,
23585,
33727,
526,
15931,
198,
220,
220,
220,
1208,
628,
198,
4871,
44305,
7,
49795,
2599,
198,
220,
220,
220,
37227,
7469,
12998,
4923,
11,
331,
929,
526,
15931,
6... | 2.453901 | 282 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = "Fireclaw the Fox"
__license__ = """
Simplified BSD (BSD 2-Clause) License.
See License.txt or http://opensource.org/licenses/BSD-2-Clause for more info
"""
from direct.distributed.DistributedSmoothNodeAI import DistributedSmoothNodeAI
| [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
834,
9800,
834,
796,
366,
13543,
43143,
262,
5426,
1,
198,
834,
43085,
834,
796,
37227,
198,
8890,
489,
1431,
347,
10305,
35... | 2.872549 | 102 |
from typing import Any, Dict
from ....models.models import Poll
from ....shared.exceptions import ActionException
from ....shared.patterns import FullQualifiedId
from ...generics.update import UpdateAction
from ...util.default_schema import DefaultSchema
from ...util.register import register_action
from .base import b... | [
6738,
19720,
1330,
4377,
11,
360,
713,
198,
198,
6738,
19424,
27530,
13,
27530,
1330,
12868,
198,
6738,
19424,
28710,
13,
1069,
11755,
1330,
7561,
16922,
198,
6738,
19424,
28710,
13,
33279,
82,
1330,
6462,
46181,
1431,
7390,
198,
6738,
... | 2.306554 | 473 |
from DataBases.DataBaseClass import Database
from datetime import datetime
class UserInfoDatabase(Database):
"""Stores information on users including currency, user ids, and items"""
| [
6738,
6060,
33,
1386,
13,
6601,
14881,
9487,
1330,
24047,
201,
198,
6738,
4818,
8079,
1330,
4818,
8079,
201,
198,
201,
198,
4871,
11787,
12360,
38105,
7,
38105,
2599,
201,
198,
220,
220,
220,
37227,
1273,
2850,
1321,
319,
2985,
1390,
... | 3.711538 | 52 |
from ascii_drawing import Canvas, Square, figure_from_string, GeneralColorConversor, ScaleConversor
from .chess_rules import KING, QUEEN, ROOK, BISHOP, KNIGHT, PAWN
PIECE_NAMES = {KING: 'king', QUEEN: 'queen', ROOK: 'rook', BISHOP: 'bishop',
KNIGHT: 'knight', PAWN: 'pawn'}
from os import path
from pkg_reso... | [
6738,
355,
979,
72,
62,
19334,
278,
1330,
1680,
11017,
11,
9276,
11,
3785,
62,
6738,
62,
8841,
11,
3611,
10258,
3103,
690,
273,
11,
21589,
3103,
690,
273,
628,
628,
198,
198,
6738,
764,
2395,
824,
62,
38785,
1330,
32957,
11,
1195,
... | 2.476636 | 214 |
from math import gcd, ceil
main() | [
6738,
10688,
1330,
308,
10210,
11,
2906,
346,
201,
198,
201,
198,
12417,
3419
] | 2.571429 | 14 |
import sys
from definition import Variable, Statement, Assignment, Print, SourceCode
from lexer import Lexer
from parser import parse
if __name__ == '__main__':
main()
| [
11748,
25064,
198,
198,
6738,
6770,
1330,
35748,
11,
21983,
11,
50144,
11,
12578,
11,
8090,
10669,
198,
6738,
31191,
263,
1330,
17210,
263,
198,
6738,
30751,
1330,
21136,
628,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,... | 3.612245 | 49 |
# Generated by Django 3.2.5 on 2021-08-07 03:52
from django.db import migrations
| [
2,
2980,
515,
416,
37770,
513,
13,
17,
13,
20,
319,
33448,
12,
2919,
12,
2998,
7643,
25,
4309,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
628
] | 2.766667 | 30 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import random
if __name__ == "__main__": # this means that if somebody ran this Python file, execute only the code below
main()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
11748,
4738,
628,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
220,
1303,
428,
1724,
3... | 2.875 | 64 |
import sys
import os
from collections import defaultdict
import numpy as np
class DataCenter(object):
"""docstring for DataCenter"""
| [
11748,
25064,
198,
11748,
28686,
198,
198,
6738,
17268,
1330,
4277,
11600,
198,
11748,
299,
32152,
355,
45941,
198,
198,
4871,
6060,
23656,
7,
15252,
2599,
198,
197,
37811,
15390,
8841,
329,
6060,
23656,
37811,
628,
628
] | 3.756757 | 37 |
#!/usr/bin/python3
#
# Version updater
# Copyright (C) 2016 Christopher Gurnee. All rights reserved.
#
# Please refer to readme.md for information about this source code.
# Please refer to license.txt for details about distribution and modification.
#
# Updates various version constants based on HASHCHECK_VERS... | [
2,
48443,
14629,
14,
8800,
14,
29412,
18,
201,
198,
2,
201,
198,
2,
10628,
2325,
729,
201,
198,
2,
15069,
357,
34,
8,
1584,
12803,
402,
700,
1453,
13,
220,
1439,
2489,
10395,
13,
201,
198,
2,
201,
198,
2,
4222,
3522,
284,
1100,
... | 2.220288 | 2,642 |
__all__ = ('YoutubeKeeper', 'YLFormat')
import youtube_dl
import os
from sys import stderr
from pathlib import Path
from .structured import YLFormat
from typing import List, Tuple, Sequence, Iterable
from tkinter.messagebox import askokcancel
from tkinter import Tk
if 'withdraw tk':
try:
Tk().withdraw(... | [
834,
439,
834,
796,
19203,
56,
9762,
42,
41278,
3256,
705,
45448,
26227,
11537,
198,
198,
11748,
35116,
62,
25404,
198,
198,
11748,
28686,
198,
6738,
25064,
1330,
336,
1082,
81,
198,
6738,
3108,
8019,
1330,
10644,
198,
198,
6738,
764,
... | 2.732283 | 127 |
# Copyright 2017, Wenjia Bai. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
2,
15069,
2177,
11,
31164,
73,
544,
40750,
13,
1439,
6923,
33876,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
705,
34156,
24036,
198,
2,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
35... | 2.107631 | 2,267 |
# The Fibonacci numbers are the sequence below, where the first two numbers are 1, and each
# number thereafter is the sum of the two preceding numbers. Write a program that asks the
# user how many Fibonacci numbers to print and then prints that many.
# 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 ...
# How... | [
2,
383,
41566,
261,
44456,
3146,
389,
262,
8379,
2174,
11,
810,
262,
717,
734,
3146,
389,
352,
11,
290,
1123,
198,
2,
1271,
19547,
318,
262,
2160,
286,
262,
734,
18148,
3146,
13,
19430,
257,
1430,
326,
7893,
262,
198,
2,
2836,
703... | 2.713262 | 279 |
"""Module containing the :class:`Pulse` class and functions for initializing
pulse shapes."""
import logging
import re
from collections.abc import MutableMapping
import matplotlib.pyplot as plt
import numpy as np
import scipy.fftpack
from matplotlib.gridspec import GridSpec
from numpy.fft import fft, fftfreq
from scip... | [
37811,
26796,
7268,
262,
1058,
4871,
25,
63,
47,
9615,
63,
1398,
290,
5499,
329,
4238,
2890,
198,
79,
9615,
15268,
526,
15931,
198,
11748,
18931,
198,
11748,
302,
198,
6738,
17268,
13,
39305,
1330,
13859,
540,
44,
5912,
198,
198,
1174... | 2.044784 | 27,845 |
# Copyright 2021 Zilliz. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | [
2,
15069,
33448,
1168,
359,
528,
13,
1439,
2489,
10395,
13,
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,
428,
2393,
2845,
287,
11846,
351,
262,
13... | 3.850649 | 154 |
from .juliaset import julia
from .juliaset import JuliaSet
__version__ = "0.3.0" | [
6738,
764,
73,
377,
4448,
316,
1330,
474,
43640,
198,
6738,
764,
73,
377,
4448,
316,
1330,
22300,
7248,
198,
198,
834,
9641,
834,
796,
366,
15,
13,
18,
13,
15,
1
] | 2.53125 | 32 |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | [
2,
19617,
25,
3384,
69,
12,
23,
198,
2,
15069,
357,
66,
8,
1584,
11,
33448,
11,
18650,
290,
14,
273,
663,
29116,
13,
220,
1439,
2489,
10395,
13,
198,
2,
770,
3788,
318,
10668,
12,
36612,
284,
345,
739,
262,
14499,
2448,
33532,
1... | 2.487109 | 9,774 |
from context import Card
import unittest
from functools import reduce
runner = unittest.TextTestRunner()
suite = DealtHandsUnitTestSuite()
runner.run(suite)
| [
6738,
4732,
1330,
5172,
201,
198,
11748,
555,
715,
395,
201,
198,
6738,
1257,
310,
10141,
1330,
4646,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
16737,
796,
555,
715,
395,
13,
8206,
14402,
49493,
3419,
201,
198,
238... | 2.661538 | 65 |
"Functional tests showing how models can be used to create/edit datasets."
import os
import dtoolcore.utils
from . import tmp_dir_fixture # NOQA
import pytest
| [
1,
22203,
282,
5254,
4478,
703,
4981,
460,
307,
973,
284,
2251,
14,
19312,
40522,
526,
198,
198,
11748,
28686,
198,
198,
11748,
288,
25981,
7295,
13,
26791,
198,
198,
6738,
764,
1330,
45218,
62,
15908,
62,
69,
9602,
220,
1303,
8005,
... | 3.3 | 50 |
import sys
import os
import boto3
from botocore.exceptions import ClientError
import click
import json
import datetime
import time
import re
from util import *
line_widget_x = 0
line_widget_y = 0
| [
11748,
25064,
220,
198,
11748,
28686,
198,
11748,
275,
2069,
18,
198,
6738,
10214,
420,
382,
13,
1069,
11755,
1330,
20985,
12331,
198,
11748,
3904,
198,
11748,
33918,
198,
11748,
4818,
8079,
198,
11748,
640,
198,
11748,
302,
198,
6738,
... | 3.262295 | 61 |
from io import BytesIO
import requests
from PIL import Image
header = {'Authorization': 'Basic aHVnZTpmaWxl', }
response = requests.get('http://www.pythonchallenge.com/pc/return/cave.jpg', headers=header)
img = Image.open(BytesIO(response.content))
width, height = img.size
img_new = Image.new('RGB', (width // 2, hei... | [
6738,
33245,
1330,
2750,
4879,
9399,
198,
198,
11748,
7007,
198,
6738,
350,
4146,
1330,
7412,
198,
198,
25677,
796,
1391,
6,
13838,
1634,
10354,
705,
26416,
257,
39,
53,
77,
57,
51,
79,
2611,
54,
87,
75,
3256,
1782,
198,
26209,
796,... | 2.572 | 250 |
# -*- coding:utf-8 -*-
# 导入的库
import inspect
import json
import time
from typing import Any
import requests
from SelfExpection.CustomExpection import CustomExpection
from SelfExpection.OfficialException import OfficialException
from logrecord.WriteLog import WriteLog
class AdministrativeDistrictEnquir... | [
2,
532,
9,
12,
19617,
25,
40477,
12,
23,
532,
9,
12,
201,
198,
2,
10263,
107,
120,
17739,
98,
21410,
41753,
241,
201,
198,
11748,
10104,
201,
198,
11748,
33918,
201,
198,
11748,
640,
201,
198,
6738,
19720,
1330,
4377,
201,
198,
20... | 1.377035 | 22,364 |
# -*- coding: utf-8 -*-
"""sysdescrparser.cisco_ios."""
import re
from cisco import Cisco
# pylint: disable=no-member
class CiscoIOS(Cisco):
"""Class CiscoIOS.
SNMP sysDescr for CiscoIOS.
"""
def __init__(self, raw):
"""Constructor."""
super(CiscoIOS, self).__init__(raw)
... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
37811,
17597,
20147,
81,
48610,
13,
66,
4861,
62,
4267,
526,
15931,
628,
198,
11748,
302,
198,
6738,
269,
4861,
1330,
28289,
628,
198,
2,
279,
2645,
600,
25,
1556... | 2.012939 | 541 |
#!/usr/bin/env python
# coding: utf-8
# # Discrete Probability Distribution Plot
# In[1]:
import os
try:
import jax
except:
get_ipython().run_line_magic('pip', 'install jax jaxlib')
import jax
import jax.numpy as jnp
try:
import matplotlib.pyplot as plt
except:
get_ipython().run_line_magic('pi... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
19617,
25,
3384,
69,
12,
23,
198,
198,
2,
1303,
8444,
8374,
30873,
1799,
27484,
28114,
198,
198,
2,
554,
58,
16,
5974,
628,
198,
11748,
28686,
198,
198,
28311,
25,
198,
220,
220... | 2.59408 | 473 |
#!/usr/bin/env python3
"""
usage: pwd_.py [-h] [-P] [--brief] [--home]
show the os.environ["PWD"], by default just its "os.path.abspath"
optional arguments:
-h, --help show this help message and exit
-P, --physical show the "realpath"s, not "abspath"s, of sym links
--brief show the briefest abspa... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
37811,
198,
26060,
25,
279,
16993,
44807,
9078,
25915,
71,
60,
25915,
47,
60,
685,
438,
65,
3796,
60,
685,
438,
11195,
60,
198,
198,
12860,
262,
28686,
13,
268,
2268,
14692,... | 2.610909 | 825 |
#!/usr/bin/env python3
import click
app_name = "myappname"
config_file_name = "myconf.ini"
app_dir_name = click.get_app_dir(app_name)
click.echo(app_dir_name)
# ./app_dirs.py
# /home/melv/.config/myappname
# XDG_CONFIG_HOME=/home/melv/ ./app_dirs.py
# /home/melv/myappname
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
11748,
3904,
198,
198,
1324,
62,
3672,
796,
366,
1820,
1324,
3672,
1,
198,
11250,
62,
7753,
62,
3672,
796,
366,
1820,
10414,
13,
5362,
1,
198,
1324,
62,
15908,
62,
3672,
796,
3... | 2.214286 | 126 |
from pylab import *
import pylab
import agpy.test_doc
print "beta.__module__:",beta.__module__
for k,v in pylab.__dict__.iteritems():
if hasattr(v,'__module__'):
if v.__module__ is None:
locals()[k].__module__ = 'pylab'
| [
6738,
279,
2645,
397,
1330,
1635,
198,
11748,
279,
2645,
397,
198,
11748,
556,
9078,
13,
9288,
62,
15390,
198,
198,
4798,
366,
31361,
13,
834,
21412,
834,
25,
1600,
31361,
13,
834,
21412,
834,
198,
198,
1640,
479,
11,
85,
287,
279,
... | 2.184211 | 114 |
import xml.etree.ElementTree as ET
import os
from os import listdir, getcwd
from os.path import join
import argparse
# classes = [
# "aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat",
# "chair", "cow", "diningtable", "dog", "horse", "motorbike", "person",
# "pottedplant", "sheep", "sof... | [
11748,
35555,
13,
316,
631,
13,
20180,
27660,
355,
12152,
198,
11748,
28686,
198,
6738,
28686,
1330,
1351,
15908,
11,
651,
66,
16993,
198,
6738,
28686,
13,
6978,
1330,
4654,
198,
11748,
1822,
29572,
628,
198,
2,
6097,
796,
685,
198,
2... | 2.327957 | 372 |
# -*- coding=utf-8 -*-
import cv2
from PIL import Image
import math
image_path = './face1.png'
human_img = Image.open(image_path)
human_img = human_img.convert('RGBA')
# 圣诞帽相关参数
hat_img = Image.open("./hat.png")
hat_brim_length = 175.0
hat_height_buffer = 25.0
hat_img = hat_img.convert('RGBA')
# load image:
image =... | [
2,
532,
9,
12,
19617,
28,
40477,
12,
23,
532,
9,
12,
198,
11748,
269,
85,
17,
198,
6738,
350,
4146,
1330,
7412,
198,
11748,
10688,
628,
198,
198,
9060,
62,
6978,
796,
705,
19571,
2550,
16,
13,
11134,
6,
198,
10734,
62,
9600,
796... | 2.534634 | 1,025 |
#!/usr/bin/env python3
from ..type import is_list, is_dict
from .struct import Struct
from .helper import _common_keys
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
6738,
11485,
4906,
1330,
318,
62,
4868,
11,
318,
62,
11600,
198,
6738,
764,
7249,
1330,
32112,
198,
6738,
764,
2978,
525,
1330,
4808,
11321,
62,
13083,
628
] | 3.102564 | 39 |
import firebase_admin
import csv
import time
from firebase_admin import credentials
from firebase_admin import firestore
cred = credentials.Certificate('beacon-dddae-firebase-adminsdk-2qj4p-4ab2ce47dd.json')
firebase_admin.initialize_app(cred)
flag=0
# print(u'{} => {}'.format(doc.id, doc.to_dict()))
while(flag==0... | [
11748,
2046,
8692,
62,
28482,
198,
11748,
269,
21370,
198,
11748,
640,
198,
6738,
2046,
8692,
62,
28482,
1330,
18031,
198,
6738,
2046,
8692,
62,
28482,
1330,
2046,
8095,
198,
66,
445,
796,
18031,
13,
37608,
22460,
10786,
1350,
7807,
12,... | 1.823986 | 1,159 |
# GV Vbias
# Alexis Jouan 13/10/2019
# Reading AC current and AC voltage with two lockins
import numpy as np
import time
from qcodes.dataset.measurements import Measurement
from qcodes.dataset.plotting import plot_by_id
from datetime import datetime
import qcodes_measurements as qcm
from qcodes_measurements.tools.mea... | [
2,
402,
53,
569,
65,
4448,
198,
2,
31078,
45538,
272,
1511,
14,
940,
14,
23344,
198,
2,
11725,
7125,
1459,
290,
7125,
15004,
351,
734,
5793,
1040,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
640,
198,
6738,
10662,
40148,
13... | 3.147826 | 115 |
from .pillowgraph import PillowGraph
from graph.models import Graph
from app_backend import proxy_convert_functions as pc_funcs
from queue import Queue
| [
6738,
764,
27215,
322,
34960,
1330,
19770,
322,
37065,
198,
6738,
4823,
13,
27530,
1330,
29681,
198,
6738,
598,
62,
1891,
437,
1330,
15741,
62,
1102,
1851,
62,
12543,
2733,
355,
40653,
62,
12543,
6359,
198,
6738,
16834,
1330,
4670,
518,... | 3.581395 | 43 |
for i in range (1,6):
for j in range(1,6):
print("(",i,",",j,")",end='')
print()
a=[[1,2,3,4,5],[6,7,8,9,10],[11,12,13,14,15],[16,17,18,19,20],[21,22,23,24,25]]
print(a)
n=1
for i in range (1,6):
for j in range(1,6):
print()
| [
1640,
1312,
287,
2837,
357,
16,
11,
21,
2599,
201,
198,
220,
220,
220,
329,
474,
287,
2837,
7,
16,
11,
21,
2599,
201,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
7,
1600,
72,
553,
553,
11,
73,
553,
42501,
437,
28,
7061... | 1.610465 | 172 |
# Import dependencies
import time
import json
import tweepy
import urllib2
import feedparser
from fake_useragent import UserAgent
from datetime import datetime, timedelta
from credentials import *
print("Loading Configuration Files...")
with open('config.json') as json_data_file:
data = json.load(json_data_file)... | [
2,
17267,
220,
20086,
198,
11748,
640,
198,
11748,
33918,
198,
11748,
4184,
538,
88,
198,
11748,
2956,
297,
571,
17,
198,
11748,
3745,
48610,
198,
6738,
8390,
62,
7220,
25781,
1330,
11787,
36772,
198,
6738,
4818,
8079,
1330,
4818,
8079,... | 2.748993 | 745 |
import fastscapelib_fortran as fs
import xsimlab as xs
from .channel import ChannelErosion
from .context import FastscapelibContext
from .grid import UniformRectilinearGrid2D
from .main import SurfaceToErode
@xs.process
class Sea:
"""Sea level."""
# TODO: add diagnostics like shoreline extraction or
# ... | [
11748,
3049,
1416,
499,
417,
571,
62,
3319,
2596,
355,
43458,
198,
11748,
2124,
14323,
23912,
355,
2124,
82,
628,
198,
6738,
764,
17620,
1330,
11102,
36,
4951,
295,
198,
6738,
764,
22866,
1330,
12549,
1416,
499,
417,
571,
21947,
198,
... | 2.774945 | 902 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Ggnn.py: Update function following the Gated Graph Neural Network (GGNN) framework.
* Bibliography: Li et al. (2016), Gated Graph Neural Networks (GG-NN)
Usage:
"""
from __future__ import print_function
import torch.nn as nn
# Own modules
__author__ = "Pa... | [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
37811,
198,
220,
220,
220,
402,
4593,
77,
13,
9078,
25,
10133,
2163,
1708,
262,
402,
515,
29681,
47986,
7311,
357,
1119... | 2.830601 | 183 |
# -*- coding: iso-8859-1 -*-
# Maintainer: joaander
import hoomd
hoomd.context.initialize()
import unittest
import os
if __name__ == '__main__':
unittest.main(argv = ['test.py', '-v'])
| [
2,
532,
9,
12,
19617,
25,
47279,
12,
3459,
3270,
12,
16,
532,
9,
12,
198,
2,
337,
2913,
10613,
25,
2525,
64,
4066,
198,
198,
11748,
289,
4207,
67,
198,
71,
4207,
67,
13,
22866,
13,
36733,
1096,
3419,
198,
11748,
555,
715,
395,
... | 2.27381 | 84 |
"""Supervisr Mod mod/provider/onlinenet Header"""
__ui_name__ = 'Supervisr mod/mod/provider/onlinenet'
__author__ = 'Supervisr Team'
__email__ = 'supervisr@beryju.org'
__version__ = '0.3.14-alpha'
default_app_config = 'supervisr.provider.debug.apps.SupervisrModProviderDebugConfig'
| [
37811,
12442,
4703,
81,
3401,
953,
14,
15234,
1304,
14,
261,
2815,
268,
316,
48900,
37811,
198,
834,
9019,
62,
3672,
834,
796,
705,
12442,
4703,
81,
953,
14,
4666,
14,
15234,
1304,
14,
261,
2815,
268,
316,
6,
198,
834,
9800,
834,
... | 2.635514 | 107 |
import falcon
import yaml
from composition_root import FalconContainer
from infrastructure.framework.falcon.controllers import InfoController
app = falcon.API()
app.set_error_serializer(error_serializer)
app.add_route('/', FalconContainer.info_controller_factory())
app.add_route('/items', FalconContainer.items_contr... | [
11748,
24215,
1102,
198,
11748,
331,
43695,
198,
6738,
11742,
62,
15763,
1330,
17621,
29869,
198,
6738,
6884,
13,
30604,
13,
42932,
1102,
13,
3642,
36667,
1330,
14151,
22130,
628,
198,
198,
1324,
796,
24215,
1102,
13,
17614,
3419,
198,
... | 3.612903 | 93 |
"""An NLP project on Automated Essay Scoring.
Project EssaySense
==================
EssaySense is an NLP project on Automated Essay Scoring, based on neural network
technologies.
Several neural network models are included to modelling the scoring task, imple-
mented using TensorFlow (see https://tensorflow.org). Pre-... | [
37811,
2025,
399,
19930,
1628,
319,
17406,
515,
11985,
323,
1446,
3255,
13,
198,
198,
16775,
11985,
323,
41166,
198,
4770,
855,
198,
29508,
323,
41166,
318,
281,
399,
19930,
1628,
319,
17406,
515,
11985,
323,
1446,
3255,
11,
1912,
319,
... | 3.228571 | 665 |
import asyncio
import itertools
import time
from .chatgetter import ChatGetter
from ... import helpers, utils, errors
from ...events.common import EventCommon
# Sometimes the edits arrive very fast (within the same second).
# In that case we add a small delta so that the age is older, for
# comparision purposes. This... | [
11748,
30351,
952,
198,
11748,
340,
861,
10141,
198,
11748,
640,
198,
198,
6738,
764,
17006,
1136,
353,
1330,
24101,
3855,
353,
198,
6738,
2644,
1330,
49385,
11,
3384,
4487,
11,
8563,
198,
6738,
2644,
31534,
13,
11321,
1330,
8558,
17227... | 2.444942 | 3,796 |
import numpy as np
from pathlib import Path
from deepdiff import DeepDiff
from priwo import read_dat, write_dat
from tempfile import NamedTemporaryFile
fnames = [
"test_fake_presto_radio.dat",
"test_fake_presto_radio_breaks.dat",
"test_fake_presto_xray.dat",
]
fdata = np.asarray(
[
0.0,
... | [
11748,
299,
32152,
355,
45941,
198,
198,
6738,
3108,
8019,
1330,
10644,
198,
6738,
2769,
26069,
1330,
10766,
28813,
198,
6738,
1293,
21638,
1330,
1100,
62,
19608,
11,
3551,
62,
19608,
198,
6738,
20218,
7753,
1330,
34441,
12966,
5551,
8979... | 1.824281 | 626 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
11,
7297,
11,
3601,
62,
8818,
11,
28000,
1098,
62,
17201,
874,
628
] | 3.085714 | 35 |
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
SCALE_DIAG_MIN_MAX = (-20, 2)
EPS = 1e-6
def apply_squashing_func(sample, logp):
"""
Squash the ouput of the gaussian distribution and account for that in the log probability.
:param sample: (tf.Tensor) Action sampled from Ga... | [
11748,
299,
32152,
355,
45941,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
11748,
11192,
273,
11125,
62,
1676,
65,
1799,
355,
256,
46428,
198,
198,
6173,
21358,
62,
35,
3539,
38,
62,
23678,
62,
22921,
796,
13841,
1238,
11,
362,
8,... | 2.805785 | 242 |
import math
import unicodedata
from decouple import config
from django.conf import settings
from django.core.paginator import EmptyPage, Paginator
from django.http import HttpResponseForbidden
from django.views.decorators.cache import cache_page
from jwt import InvalidSignatureError, DecodeError
from login.jwtlogin im... | [
11748,
10688,
198,
11748,
28000,
9043,
1045,
198,
198,
6738,
875,
43846,
1330,
4566,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
6738,
42625,
14208,
13,
7295,
13,
79,
363,
20900,
1330,
33523,
9876,
11,
31525,
20900,
198,
6738,
... | 3.578947 | 95 |
#!/usr/bin/env python3
import unittest
from pyqtcmd import History, Command, ConsistencyError
if __name__ == '__main__':
unittest.main()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
11748,
555,
715,
395,
198,
198,
6738,
12972,
80,
23047,
9132,
1330,
7443,
11,
9455,
11,
3515,
396,
1387,
12331,
628,
628,
628,
628,
628,
198,
361,
11593,
3672,
834,
6624,
70... | 2.637931 | 58 |
idade = 29
print('Minha idade é: ' + str(idade))
print('Minha idade é: {}'.format(idade))
print(f'Minha idade é: {idade}')
nome = 'Élysson MR cdoiksabncdsaicbsdaoin dsaucubsdaocpiknbsdaoiyvcsdaopikbncsdaiyvbcds'
print(f'Meu nome é {nome:.15} e eu tenho {idade:03} anos')
dinheiro = 2.598
print(f'Eu tenho {dinheir... | [
312,
671,
796,
2808,
198,
198,
4798,
10786,
9452,
3099,
4686,
671,
38251,
25,
705,
1343,
965,
7,
312,
671,
4008,
198,
198,
4798,
10786,
9452,
3099,
4686,
671,
38251,
25,
23884,
4458,
18982,
7,
312,
671,
4008,
198,
198,
4798,
7,
69,
... | 1.980916 | 262 |
from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, cast
import attr
from ..types import UNSET
from ..util.serialization import is_not_none
T = TypeVar("T", bound="Edge")
@attr.s(auto_attribs=True)
class Edge:
"""A degree-two logical connection in the quantum processor's architecture.
T... | [
6738,
19720,
1330,
4377,
11,
4889,
540,
11,
360,
713,
11,
7343,
11,
32233,
11,
5994,
11,
5994,
19852,
11,
3350,
198,
198,
11748,
708,
81,
198,
198,
6738,
11485,
19199,
1330,
4725,
28480,
198,
6738,
11485,
22602,
13,
46911,
1634,
1330,... | 3.048232 | 311 |
class Solution:
"""
https://leetcode.com/problems/missing-number/
Given an array containing n distinct numbers taken from
0, 1, 2, ..., n, find the one that is missing from the array.
Example 1
Input: [3,0,1]
Output: 2
Example 2
Input: [9,6,4,2,3,5,7,0,1]
Output: 8... | [
4871,
28186,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3740,
1378,
293,
316,
8189,
13,
785,
14,
1676,
22143,
14,
45688,
12,
17618,
14,
628,
220,
220,
220,
11259,
281,
7177,
7268,
299,
7310,
3146,
2077,
422,
198,
220,
220,
... | 2.199475 | 381 |
import re
from Parser import Parser
import csv
| [
11748,
302,
198,
6738,
23042,
263,
1330,
23042,
263,
198,
11748,
269,
21370,
628
] | 3.428571 | 14 |
from .raspi_ip import IP
| [
6738,
764,
81,
5126,
72,
62,
541,
1330,
6101,
198
] | 2.5 | 10 |
from typing import Optional
import torch
from rising.ops import torch_one_hot
__all__ = ["one_hot_batch"]
def one_hot_batch(target: torch.Tensor,
num_classes: Optional[int] = None,
dtype: Optional[torch.dtype] = None) -> torch.Tensor:
"""
Compute one hot for input tensor ... | [
6738,
19720,
1330,
32233,
198,
198,
11748,
28034,
198,
6738,
7396,
13,
2840,
1330,
28034,
62,
505,
62,
8940,
198,
198,
834,
439,
834,
796,
14631,
505,
62,
8940,
62,
43501,
8973,
628,
198,
4299,
530,
62,
8940,
62,
43501,
7,
16793,
25... | 2.335605 | 587 |
"""
*Simple Aural Interval*
An interval that is less than equal to an octave.
Simple / compound intervals partition by ordering.
"""
from abc import ABCMeta
from ._interval import AuralInterval
__all__ = ["SimpleInterval"]
| [
37811,
628,
220,
220,
220,
1635,
26437,
317,
1523,
4225,
2100,
9,
628,
220,
1052,
16654,
326,
318,
1342,
621,
4961,
284,
281,
19318,
1015,
13,
628,
220,
17427,
1220,
13061,
20016,
18398,
416,
16216,
13,
198,
198,
37811,
198,
198,
6738... | 3.414286 | 70 |
# -*- coding: utf-8 -*-
from model.contact import Contact
import pytest
import random
import string
testdata = [Contact(first_name=random_string("first name", 10), middle_name=random_string("Middle name", 10), last_name=random_string("Last name", 10), nickname=random_string("Nickname", 10), title=random_string("Titl... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
2746,
13,
32057,
1330,
14039,
198,
11748,
12972,
9288,
198,
11748,
4738,
198,
11748,
4731,
628,
198,
198,
9288,
7890,
796,
685,
17829,
7,
11085,
62,
3672,
28,
2512... | 2.511682 | 428 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
"""
Скрипт показывает пример ограничение ввода только тем текстом, что был указан.
"""
from PyQt5.QtWidgets import *
if __name__ == '__main__':
app = QApplication([])
w = Widget()
w.show()
app.exec()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
834,
9800,
834,
796,
705,
541,
21879,
1077,
6,
628,
198,
37811,
198,
140,
94,
31583,
21169,
18849,
140,
123,... | 1.568421 | 190 |
import openmc
import openmc_dagmc_wrapper as odw
import openmc_plasma_source as ops
import neutronics_material_maker as nmm
import math
import numpy as np
my_h5m_filename = "dagmc_not_merged.h5m"
# materials
material_tag_to_material_dict = {
"lead": "Lead",
"flibe": nmm.Material.from_library(name=... | [
11748,
1280,
23209,
201,
198,
11748,
1280,
23209,
62,
67,
363,
23209,
62,
48553,
355,
16298,
86,
201,
198,
11748,
1280,
23209,
62,
489,
11797,
62,
10459,
355,
39628,
201,
198,
11748,
22190,
20844,
62,
33665,
62,
10297,
355,
299,
3020,
... | 2.315615 | 903 |
# get all recipes
# get individual recipe as Json | [
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
651,
477,
14296,
628,
220,
220,
220,
1303,
651,
1981,
8364,
355,
449,
1559
] | 2.212121 | 33 |
from django.core.management.base import BaseCommand
from django.utils import timezone
from axes.models import AccessLog
| [
6738,
42625,
14208,
13,
7295,
13,
27604,
13,
8692,
1330,
7308,
21575,
198,
6738,
42625,
14208,
13,
26791,
1330,
640,
11340,
198,
198,
6738,
34197,
13,
27530,
1330,
8798,
11187,
628
] | 3.935484 | 31 |
import conf.config
import dataset.pennfudan_dataset
import model.yolov3
"""
(1)demo weights:
67.91% = person AP || score_threhold=0.5 : F1=0.80 ; Recall=99.09% ; Precision=66.87%
mAP = 67.91%
---------------------------------------
tensor(2.9181) tensor(2.8104)
tensor(0.1682) tensor(0.1877)
tensor(20.8298) tensor(... | [
11748,
1013,
13,
11250,
198,
11748,
27039,
13,
79,
1697,
69,
463,
272,
62,
19608,
292,
316,
198,
11748,
2746,
13,
88,
349,
709,
18,
198,
198,
37811,
198,
171,
120,
230,
16,
171,
120,
231,
9536,
78,
19590,
25,
220,
198,
198,
3134,
... | 1.912935 | 804 |
# -*- coding: utf-8 -*-
"""All nodes for import that are NOT specific to a ephy package."""
import os
from nipype.interfaces.base import BaseInterface,\
BaseInterfaceInputSpec, traits, TraitedSpec, isdefined
from nipype.interfaces.base import File
# ----------------- ImportMat ----------------------------- #
cl... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
3237,
13760,
329,
1330,
326,
389,
5626,
2176,
284,
257,
304,
6883,
5301,
526,
15931,
198,
11748,
28686,
198,
198,
6738,
299,
541,
2981,
13,
3849,
32186,
13,
8692,... | 2.429318 | 3,063 |
from copy import deepcopy
from functools import partial, update_wrapper
import torch
import numpy as np
import torch.optim as optim
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from experiments.models.topics_torch_models import NormModel, NormModelTrident
from... | [
6738,
4866,
1330,
2769,
30073,
198,
6738,
1257,
310,
10141,
1330,
13027,
11,
4296,
62,
48553,
198,
11748,
28034,
198,
11748,
299,
32152,
355,
45941,
198,
198,
11748,
28034,
13,
40085,
355,
6436,
198,
198,
6738,
1341,
35720,
13,
3866,
36... | 2.241298 | 1,695 |
"""
Enable logging (from Lambda functions) in JSON format which makes post-processing much easier.
Since we assume this will be used by Lambda functions, we also add the request id in log lines.
"""
import json
import logging
import logging.config
import sys
import traceback
from contextlib import ContextDecorator
fr... | [
37811,
198,
36695,
18931,
357,
6738,
21114,
6814,
5499,
8,
287,
19449,
5794,
543,
1838,
1281,
12,
36948,
881,
4577,
13,
198,
198,
6385,
356,
7048,
428,
481,
307,
973,
416,
21114,
6814,
5499,
11,
356,
635,
751,
262,
2581,
4686,
287,
... | 2.522541 | 2,928 |
sol = []
for _ in xrange(0, int(raw_input())):
s = raw_input()
#w = [i for i in s]
#print w
#t = [s[len(s) - 1 - count] for count in xrange(len(s))]
#print t
T = []
st = 0
for i in xrange(0, len(s)):
v = (ord(s[i]) + ord(s[len(s) - 1 - i])) - 96
if v ... | [
201,
198,
201,
198,
201,
198,
34453,
796,
17635,
201,
198,
1640,
4808,
287,
2124,
9521,
7,
15,
11,
493,
7,
1831,
62,
15414,
28955,
2599,
201,
198,
220,
220,
220,
264,
796,
8246,
62,
15414,
3419,
201,
198,
220,
220,
220,
1303,
86,
... | 1.538296 | 1,397 |
import re
import voluptuous as vol
from esphomeyaml.automation import ACTION_REGISTRY, LambdaAction
import esphomeyaml.config_validation as cv
from esphomeyaml.const import CONF_ARGS, CONF_BAUD_RATE, CONF_FORMAT, CONF_ID, CONF_LEVEL, \
CONF_LOGS, CONF_TAG, CONF_TX_BUFFER_SIZE
from esphomeyaml.core import ESPHomeY... | [
11748,
302,
198,
198,
11748,
2322,
37623,
5623,
355,
2322,
198,
198,
6738,
1658,
746,
462,
88,
43695,
13,
2306,
296,
341,
1330,
40282,
62,
31553,
1797,
40405,
11,
21114,
6814,
12502,
198,
11748,
1658,
746,
462,
88,
43695,
13,
11250,
6... | 2.245951 | 988 |
import json
import inspect
import qualipy
from celery import Celery
from celery import group
app = Celery()
# celery config file here:
app.config_from_object('sampleconfig')
@app.task
def process_image(image, filters, ROI=None, return_predictions=False,
combine_results=False, sort_filters=True):
... | [
11748,
33918,
198,
11748,
10104,
198,
198,
11748,
4140,
541,
88,
198,
198,
6738,
18725,
1924,
1330,
15248,
1924,
198,
6738,
18725,
1924,
1330,
1448,
198,
198,
1324,
796,
15248,
1924,
3419,
198,
2,
18725,
1924,
4566,
2393,
994,
25,
198,
... | 2.555446 | 1,010 |
import numpy as np
import cv2
import glob
################ ÉCHÉQUIER #############################
chessboardSize = (8,6)
frameSize = (720,540)
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)
objp = np.zeros((chessboardSize[0] * chessboardSize[1], 3), np.float32)
objp[:,:2] = np.mg... | [
11748,
299,
32152,
355,
45941,
198,
11748,
269,
85,
17,
198,
11748,
15095,
628,
198,
198,
14468,
43052,
3398,
38351,
43702,
1137,
1303,
14468,
7804,
4242,
198,
198,
2395,
824,
3526,
10699,
796,
357,
23,
11,
21,
8,
198,
14535,
10699,
7... | 2.41485 | 1,468 |
# -----------------------------------------------------------------------------
# Copyright (c) 2019 Nicolas P. Rougier
# Distributed under the terms of the BSD License.
# -----------------------------------------------------------------------------
import sys
import som, mnist, plot
import numpy as np
import matplotli... | [
2,
16529,
32501,
198,
2,
15069,
357,
66,
8,
13130,
29737,
350,
13,
13876,
70,
959,
198,
2,
4307,
6169,
739,
262,
2846,
286,
262,
347,
10305,
13789,
13,
198,
2,
16529,
32501,
198,
11748,
25064,
198,
11748,
3870,
11,
285,
77,
396,
1... | 2.142979 | 1,168 |
"""
Unit tests for module `regular.nfa`
"""
import unittest
from regular.nfa import NFA
class TestNFA(unittest.TestCase):
"""
Test cases for class `NFA`
"""
def test_overlapping_states(self):
"""
The operations for union and concatenation cannot be performed if the NFAs have
... | [
37811,
198,
26453,
5254,
329,
8265,
4600,
16338,
13,
77,
13331,
63,
198,
37811,
198,
198,
11748,
555,
715,
395,
198,
198,
6738,
3218,
13,
77,
13331,
1330,
399,
7708,
628,
198,
4871,
6208,
45,
7708,
7,
403,
715,
395,
13,
14402,
20448... | 2.011327 | 618 |
from getratings.models.ratings import Ratings
| [
6738,
651,
10366,
654,
13,
27530,
13,
10366,
654,
1330,
36826,
201,
198,
201,
198
] | 3.266667 | 15 |
from tarterus.graphpaper import right, left, back #turn_positive
# from tarterus.graphpaper import is_positive, turn_across
from tarterus.graphpaper import advance # , empty, middle_value
from tarterus.passage import passage_width_table
from tarterus.room import find_loc
# TODO: stairs & trapped doors
# TODO: "blocki... | [
6738,
256,
2571,
385,
13,
34960,
20189,
1330,
826,
11,
1364,
11,
736,
1303,
15344,
62,
24561,
198,
2,
422,
256,
2571,
385,
13,
34960,
20189,
1330,
318,
62,
24561,
11,
1210,
62,
330,
1214,
198,
6738,
256,
2571,
385,
13,
34960,
20189,... | 2.492991 | 856 |
import rapids_scanpy_funcs
import anndata
import cupy
import scanpy as sc
min_genes_per_cell = 200
max_genes_per_cell = 6000
adata = sc.read('/data/anndata/krasnow_hlca_10x_UMIs.sparse.h5ad')
a = adata.T
genes = a.var_names
# print(type(genes))
# print(genes)
#a = anndata.read_h5ad('/data/anndata/krasnow_hlca_10x_U... | [
11748,
4095,
2340,
62,
35836,
9078,
62,
12543,
6359,
198,
11748,
281,
358,
1045,
198,
11748,
6508,
88,
198,
11748,
9367,
9078,
355,
629,
198,
198,
1084,
62,
5235,
274,
62,
525,
62,
3846,
796,
939,
198,
9806,
62,
5235,
274,
62,
525,
... | 1.984127 | 378 |
from django.db import models
from django.contrib.auth.models import User
from django.conf import settings
User = settings.AUTH_USER_MODEL
from datetime import datetime, timedelta
from directoalartista.apps.genericuser.models import GenericUser
from django.contrib.auth import get_user_model
#User = get_user_model()... | [
6738,
42625,
14208,
13,
9945,
1330,
4981,
198,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
27530,
1330,
11787,
198,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
12982,
796,
6460,
13,
32,
24318,
62,
29904,
62,
33365,
... | 3.285714 | 98 |
import random
import time
x = 2
A = random_int_list(1, 100000, 1000)
B = A
start = time.clock()
HORNER(B, x)
end = time.clock()
print("Horner: %f s" % (end - start))
B = A
start = time.clock()
NAIVE(B, x)
end = time.clock()
print("Navie: %f s" % (end - start))
| [
11748,
4738,
198,
11748,
640,
628,
628,
198,
87,
796,
362,
198,
32,
796,
4738,
62,
600,
62,
4868,
7,
16,
11,
1802,
830,
11,
8576,
8,
198,
198,
33,
796,
317,
198,
9688,
796,
640,
13,
15750,
3419,
198,
39,
1581,
21479,
7,
33,
11... | 2.321739 | 115 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Blueprint
from flask.ext.restful import Api
Weather = Blueprint('Weather', __name__)
weather_api = Api(Weather)
from .views import *
# weather_api.add_resource(viewRelti, '/v1/weather/realtime')
# weather_api.add_resource(viewForecast, '/v1/wather/foreca... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
42903,
1330,
39932,
198,
6738,
42903,
13,
2302,
13,
2118,
913,
1330,
5949,
72,
198,
198,
41865,
796,
39932,
10786... | 2.458621 | 580 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Helper functions for tests."""
from flask import url_for
def sign_up(app, clien... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
198,
2,
770,
2393,
318,
636,
286,
554,
574,
952,
13,
198,
2,
15069,
357,
34,
8,
1853,
12,
7908,
327,
28778,
13,
198,
2,
198,
2,
554,
574,
952,
318,
1479,
3788... | 2.702576 | 427 |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Plugins API package
"""
from hydra.plugins.completion_plugin import CompletionPlugin
from hydra.plugins.launcher import Launcher
from hydra.plugins.plugin import Plugin
from hydra.plugins.search_path_plugin import SearchPathPlugin
from hydra.plu... | [
2,
15069,
357,
66,
8,
3203,
11,
3457,
13,
290,
663,
29116,
13,
1439,
6923,
33876,
198,
37811,
198,
23257,
1040,
7824,
5301,
198,
37811,
198,
6738,
25039,
13,
37390,
13,
785,
24547,
62,
33803,
1330,
955,
24547,
37233,
198,
6738,
25039,... | 3.329114 | 158 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/9/11 20:20
# @Author : Lin Luo
# @Site :
# @File : dev
# @Software: PyCharm
from . import BaseConfig
from redis import Redis
class Config(BaseConfig):
"""开发环境配置参数"""
SQLALCHEMY_ECHO = True
DEBUG = True
EMV = 'dev'
# DB
DB... | [
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,
7575,
220,
220,
220,
1058,
13130,
14,
24,
14,
1157,
1160,
25,
1238,
198,
2,
2488,
13838,
220,
1058,
5164,
... | 1.815172 | 725 |
from django.test import TestCase
from .models import Image, Category, Location
# Create your tests here.
#Set up method | [
6738,
42625,
14208,
13,
9288,
1330,
6208,
20448,
198,
6738,
764,
27530,
1330,
7412,
11,
21743,
11,
13397,
198,
198,
2,
13610,
534,
5254,
994,
13,
198,
220,
220,
220,
1303,
7248,
510,
2446
] | 3.647059 | 34 |
#!/usr/bin/env python
import re
import click
from sdrf_pipelines.openms.unimod import UnimodDatabase
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@click.group(context_settings=CONTEXT_SETTINGS)
@click.command('generate')
@click.option("--enzyme", "-e", help="")
@click.option("--fix_mod", "-f", help=""... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
11748,
302,
198,
11748,
3904,
198,
6738,
264,
7109,
69,
62,
79,
541,
20655,
13,
9654,
907,
13,
403,
320,
375,
1330,
791,
320,
375,
38105,
198,
198,
10943,
32541,
62,
28480,
51,
... | 2.546816 | 267 |
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyPythonMemcached(PythonPackage):
"""This software is a 100% Python interface to the memca... | [
2,
15069,
2211,
12,
23344,
13914,
45036,
3549,
2351,
4765,
11,
11419,
290,
584,
198,
2,
1338,
441,
4935,
34152,
13,
4091,
262,
1353,
12,
5715,
27975,
38162,
9947,
2393,
329,
3307,
13,
198,
2,
198,
2,
30628,
55,
12,
34156,
12,
33234,... | 2.778481 | 316 |
from .wto import wto
from .weis_wave_volume import weis
from .weighted_std import wstd
from .vwmacd import vwmacd
from .vv_ma_angles import vv_ma_angle
from .voss import vpf
from .volatility import volatility
from .vix_fix import vixfix
from .vidyatv import vidyatv
from .vhf import vhf
from .var_macd import varmacd ... | [
6738,
764,
86,
1462,
1330,
266,
1462,
198,
6738,
764,
732,
271,
62,
19204,
62,
29048,
1330,
356,
271,
198,
6738,
764,
6551,
276,
62,
19282,
1330,
266,
19282,
220,
198,
6738,
764,
85,
86,
20285,
67,
1330,
410,
86,
20285,
67,
220,
1... | 2.887173 | 842 |
"""
Basic fitter utilities
Authors: Matthew Kerr, Toby Burnett
$Header: /nfs/slac/g/glast/ground/cvs/pointlike/python/uw/utilities/fitter.py,v 1.10 2013/07/28 15:27:44 burnett Exp $
"""
import types
import numpy as np
from scipy import optimize #for fmin,fmin_powell,fmin_bfgs
from numpy import linalg #for inv
import... | [
37811,
198,
26416,
277,
1967,
20081,
198,
198,
30515,
669,
25,
9308,
32879,
11,
37578,
46039,
198,
3,
39681,
25,
1220,
77,
9501,
14,
6649,
330,
14,
70,
14,
4743,
459,
14,
2833,
14,
66,
14259,
14,
4122,
2339,
14,
29412,
14,
84,
86,... | 2.059345 | 8,459 |
import FWCore.ParameterSet.Config as cms
import math
L1TTriggerTowerConfig_etaphi = cms.PSet(readMappingFile=cms.bool(False),
minEta=cms.double(1.479),
maxEta=cms.double(3.0),
minPhi=cms.double(-1*ma... | [
11748,
48849,
14055,
13,
36301,
7248,
13,
16934,
355,
269,
907,
198,
11748,
10688,
198,
198,
43,
16,
51,
48344,
51,
789,
16934,
62,
316,
499,
5303,
796,
269,
907,
13,
3705,
316,
7,
961,
44,
5912,
8979,
28,
46406,
13,
30388,
7,
251... | 1.691932 | 818 |
# eosfit.py fits E(V) data to a Birch-Murnaghan equation of state.
# Current version: 3.1
#
# Copyright (C) 2012 Kurt Lejaeghere <Kurt.Lejaeghere@UGent.be>, Center for
# Molecular Modeling (CMM), Ghent University, Ghent, Belgium
#
# eosfit.py is free software; you can redistribute it and/or modify it under
# the terms... | [
2,
304,
418,
11147,
13,
9078,
11414,
412,
7,
53,
8,
1366,
284,
257,
47631,
12,
44,
700,
45109,
16022,
286,
1181,
13,
220,
198,
2,
9236,
2196,
25,
513,
13,
16,
198,
2,
198,
2,
15069,
357,
34,
8,
2321,
20642,
1004,
6592,
1533,
1... | 3.310924 | 357 |
import sys
sys.path.append("..")
from models import (Paper, Paragraph)
from time import sleep
from pymongo import MongoClient
from pymatgen.matproj.rest import (MPRester)
from articledownloader.articledownloader import (ArticleDownloader)
from os import (environ, path, remove, listdir, strerror)
from autologging impor... | [
11748,
25064,
198,
17597,
13,
6978,
13,
33295,
7203,
492,
4943,
198,
198,
6738,
4981,
1330,
357,
42950,
11,
2547,
6111,
8,
198,
6738,
640,
1330,
3993,
198,
6738,
279,
4948,
25162,
1330,
42591,
11792,
198,
6738,
279,
4948,
265,
5235,
1... | 3.151351 | 185 |
"""
Day 11 challenge
"""
import attr
import math
from functools import reduce
@attr.s
DIRECTIONS = {
"nw": Offset(horizontal=-.5, vertical=.5),
"n": Offset(vertical=1),
"ne": Offset(horizontal=.5, vertical=.5),
"se": Offset(horizontal=.5, vertical=-.5),
"s": Offset(vertical=-1),
"sw": Offset... | [
37811,
198,
12393,
1367,
4427,
198,
37811,
198,
11748,
708,
81,
198,
11748,
10688,
198,
6738,
1257,
310,
10141,
1330,
4646,
628,
198,
31,
35226,
13,
82,
628,
198,
17931,
23988,
11053,
796,
1391,
198,
220,
220,
220,
366,
47516,
1298,
3... | 1.34946 | 16,660 |
import time
import os
import json
import shutil
import numpy as np
import cv2 as cv
import torch
import torch.nn as nn
import torch.nn.functional as F
from Utils.import_choice import import_module
from Utils.visualization import VisualImage, make_output_img
def sec_to_hm(t):
"""Convert time in seconds to time in... | [
11748,
640,
198,
11748,
28686,
198,
11748,
33918,
198,
11748,
4423,
346,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
269,
85,
17,
355,
269,
85,
198,
198,
11748,
28034,
198,
11748,
28034,
13,
20471,
355,
299,
77,
198,
11748,
28034,
... | 2.341549 | 284 |
from flask_app.config.mysqlconnection import connectToMySQL
from flask import flash
| [
6738,
42903,
62,
1324,
13,
11250,
13,
28744,
13976,
38659,
1330,
2018,
2514,
3666,
17861,
198,
6738,
42903,
1330,
7644,
628
] | 4.047619 | 21 |
import configparser
import os
import random
import unittest
from _datetime import datetime
from TM1py import TM1Service, Element, ElementAttribute, Hierarchy, Dimension, Cube, NativeView, AnonymousSubset, \
Subset, Process, Chore, ChoreStartTime, ChoreFrequency, ChoreTask
from TM1py.Objects.Application import Cub... | [
11748,
4566,
48610,
198,
11748,
28686,
198,
11748,
4738,
198,
11748,
555,
715,
395,
198,
198,
6738,
4808,
19608,
8079,
1330,
4818,
8079,
198,
198,
6738,
21232,
16,
9078,
1330,
21232,
16,
16177,
11,
11703,
11,
11703,
33682,
11,
36496,
92... | 2.992 | 375 |
# Copyright (C) 2021 TREVI Software
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# flake8: noqa
from . import fsm_person
| [
2,
15069,
357,
34,
8,
33448,
43236,
12861,
10442,
198,
2,
13789,
13077,
6489,
12,
18,
13,
15,
393,
1568,
357,
4023,
1378,
2503,
13,
41791,
13,
2398,
14,
677,
4541,
14,
363,
489,
737,
198,
198,
2,
781,
539,
23,
25,
645,
20402,
19... | 2.660377 | 53 |
# Generated by Django 3.0 on 2019-12-17 02:20
from django.db import migrations
| [
2,
2980,
515,
416,
37770,
513,
13,
15,
319,
13130,
12,
1065,
12,
1558,
7816,
25,
1238,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
628
] | 2.892857 | 28 |
# vi: set ft=python sts=4 ts=4 sw=4 et:
import os
import csv
def collect_relations(file_name='ownthink_v2.csv'):
"""Get all unique relations."""
rel_dict = {}
# output relation file
csvf_relation = open("relation_dict.csv", "w", newline='', encoding='utf-8')
w_relation = csv.writer(csvf_relation... | [
2,
25357,
25,
900,
10117,
28,
29412,
39747,
28,
19,
40379,
28,
19,
1509,
28,
19,
2123,
25,
198,
198,
11748,
28686,
198,
11748,
269,
21370,
628,
198,
4299,
2824,
62,
39468,
7,
7753,
62,
3672,
11639,
593,
14925,
62,
85,
17,
13,
4066... | 1.940395 | 3,087 |
from django.test import TestCase
from .models import Category, Image, Location
# Set up method
# Testing instance
# Set up method
# Testing instance
# Set up method
# Testing instance
| [
6738,
42625,
14208,
13,
9288,
1330,
6208,
20448,
198,
6738,
764,
27530,
1330,
21743,
11,
7412,
11,
13397,
198,
220,
220,
1303,
5345,
510,
2446,
198,
220,
220,
220,
220,
220,
220,
198,
220,
220,
1303,
23983,
220,
4554,
198,
220,
220,
... | 2.44 | 100 |
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
import array
import math
import board
import digitalio
try:
from audiocore import RawSample
except ImportError:
from audioio import RawSample
try:
from audioio import AudioOut
except ImportErro... | [
2,
30628,
55,
12,
8979,
15269,
8206,
25,
2177,
7576,
273,
15442,
329,
1215,
1878,
4872,
20171,
198,
2,
198,
2,
30628,
55,
12,
34156,
12,
33234,
7483,
25,
17168,
198,
198,
11748,
640,
198,
11748,
7177,
198,
11748,
10688,
198,
11748,
... | 3.07 | 500 |
# -*- coding: utf-8 -*-
"""
Functions for plotting simulated vs observed cumulative distribution functions.
"""
from __future__ import absolute_import
import os
from typing import Dict
from typing import Iterable
from typing import List
from typing import Optional
import altair as alt
import attr
import checkrs.base ... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
24629,
2733,
329,
29353,
28590,
3691,
6515,
23818,
6082,
5499,
13,
198,
37811,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
198,
11748,
28686,
198... | 2.52456 | 3,868 |