content stringlengths 1 1.04M | input_ids listlengths 1 774k | ratio_char_token float64 0.38 22.9 | token_count int64 1 774k |
|---|---|---|---|
# Copyright 2018 The Cirq Developers
#
# 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
2,
15069,
2864,
383,
21239,
80,
34152,
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,
13789,
13,
198,
2,
921,... | 2.766667 | 810 |
"""
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... | [
37811,
198,
15269,
357,
66,
8,
33160,
43208,
21852,
1766,
1539,
43,
8671,
13,
198,
198,
9654,
35389,
1046,
318,
11971,
739,
17996,
272,
6599,
43,
410,
17,
13,
198,
1639,
460,
779,
428,
3788,
1864,
284,
262,
2846,
290,
3403,
286,
262... | 2.142308 | 520 |
from itertools import combinations
import numpy as np
import matplotlib.pyplot as plt
from utils import *
import configparser
import torch
class CurveEnvironment:
"""
Curve ํ๊ฒฝ, ๊ฐํ ํ์ต ๋ชจ๋ธ์ด ์์ฑํ action์ ๊ธฐ๋ฐ์ผ๋ก ์ปค๋ธ์ ์์๋ฅผ ๋ฐ๊พธ๊ณ , ๋ฐ๋ ์ปค๋ธ๋ฅผ ๊ธฐ๋ฐ์ผ๋ก reward๋ฅผ ์ธก์
"""
def __init__(self, order=3, dim=2, data_size=10, ini... | [
6738,
340,
861,
10141,
1330,
17790,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
6738,
3384,
4487,
1330,
1635,
198,
11748,
4566,
48610,
198,
11748,
28034,
628,
198,
4871,
46... | 1.466155 | 3,516 |
from email import utils
import re
import time
import urllib
def strftime(datetime, formatstr):
"""
Uses Python's strftime with some tweaks
"""
return datetime.strftime(formatstr).lstrip("0").replace(" 0", " ")
# def slugify(s):
# """
# Use Django's slugify method
# """
# return ... | [
6738,
3053,
1330,
3384,
4487,
198,
11748,
302,
198,
11748,
640,
198,
11748,
2956,
297,
571,
628,
628,
198,
4299,
965,
31387,
7,
19608,
8079,
11,
5794,
2536,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
36965,
11361,
338,
965,
... | 2.621212 | 132 |
"""OpenMediaVault Controller."""
import asyncio
import time
from datetime import timedelta
from homeassistant.const import (
CONF_HOST,
CONF_NAME,
CONF_PASSWORD,
CONF_SSL,
CONF_USERNAME,
CONF_VERIFY_SSL,
)
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import asy... | [
37811,
11505,
13152,
53,
1721,
22741,
526,
15931,
198,
198,
11748,
30351,
952,
198,
11748,
640,
198,
6738,
4818,
8079,
1330,
28805,
12514,
198,
198,
6738,
1363,
562,
10167,
13,
9979,
1330,
357,
198,
220,
220,
220,
7102,
37,
62,
39,
10... | 2.088696 | 5,423 |
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
| [
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
6738,
285,
489,
62,
25981,
74,
896,
13,
76,
29487,
18,
67,
1330,
12176,
274,
18,
35,
198,
6738,
2603,
29487,
8019,
1330,
12067,
628,
6... | 2.790698 | 43 |
from math import log
import operator
# ่ฎก็ฎ้ฆๅ็ต
# axis ่กจ็คบ็ฌฌๅ ๅ็็บฌๅบฆindex ๏ผvalue่กจ็คบ่ฟไธช็บฌๅบฆ็ๅผไฝไธบๅ็
# ๅคๆฐ่กจๅณ
# ๅๅปบๆ ็ๅฝๆฐไปฃ็
| [
6738,
10688,
1330,
2604,
198,
11748,
10088,
198,
198,
2,
5525,
106,
94,
163,
106,
245,
165,
99,
247,
37863,
250,
163,
228,
113,
628,
198,
2,
16488,
5525,
94,
101,
163,
97,
118,
163,
105,
105,
49035,
254,
26344,
245,
21410,
163,
11... | 1.008772 | 114 |
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 16 20:00:44 2021
@author: qizhe
"""
if __name__ == '__main__':
solu = Solution()
input_List = [[5,1,9,11],[2,4,8,10],[13,3,6,7],[15,14,12,16]]
input_List = [[0,1,2,3],[4,5,6,7],[8,9,10,11],[12,13,14,15]]
# input_List = 1
result = solu.solveNQueen... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
41972,
319,
7031,
2556,
1467,
1160,
25,
405,
25,
2598,
33448,
198,
198,
31,
9800,
25,
10662,
528,
258,
198,
37811,
198,
361,
11593,
3672,
834,
6624,
705,
8... | 1.969849 | 199 |
import h5py
import numpy as np
'''
if 't1.'
i = 0
seq_name = 't1'
elif 't2.' in imagefile:
i = 1
seq_name = 't2'
elif 't1ce.' in imagefile:
i = 2
seq_name = 't1ce'
elif 'flair.' in imagefile:
i = 3
seq_name = 'flair'
'''
import platform
# to make the code portable even on cedar,you ne... | [
11748,
289,
20,
9078,
198,
11748,
299,
32152,
355,
45941,
198,
198,
7061,
6,
198,
361,
705,
83,
16,
2637,
220,
198,
220,
220,
220,
1312,
796,
657,
198,
220,
220,
220,
33756,
62,
3672,
796,
705,
83,
16,
6,
198,
417,
361,
705,
83,... | 2.12877 | 862 |
import numpy as np
import pyspawn
pyspawn.import_methods.into_hessian(pyspawn.potential.terachem_cas)
hess = pyspawn.hessian()
ndims = 18
istate = 0
pos = np.asarray([ 0.000000000, 0.000000000, 0.101944554,
0.000000000, 0.000000000, 2.598055446,
0.000... | [
11748,
299,
32152,
355,
45941,
198,
11748,
279,
893,
79,
3832,
220,
220,
220,
220,
220,
220,
220,
220,
198,
198,
79,
893,
79,
3832,
13,
11748,
62,
24396,
82,
13,
20424,
62,
33979,
666,
7,
79,
893,
79,
3832,
13,
13059,
1843,
13,
... | 1.733668 | 597 |
import sys
import os
from setuptools import setup
from setuptools.command.test import test as TestCommand
import conch
if __name__ == '__main__':
setup(name='conch-sounds',
version=conch.__version__,
description='Analyze acoustic similarity in Python',
classifiers=[
... | [
11748,
25064,
198,
11748,
28686,
198,
6738,
900,
37623,
10141,
1330,
9058,
198,
6738,
900,
37623,
10141,
13,
21812,
13,
9288,
1330,
1332,
355,
6208,
21575,
198,
198,
11748,
369,
354,
628,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,... | 1.885685 | 971 |
import aioreactive as rx
from aioreactive import AsyncAnonymousObserver
from aioreactive.subject import AsyncSubject
from ..utils import dropargs, asyncinit
@asyncinit | [
11748,
257,
72,
382,
5275,
355,
374,
87,
198,
6738,
257,
72,
382,
5275,
1330,
1081,
13361,
20660,
31310,
18497,
198,
6738,
257,
72,
382,
5275,
13,
32796,
1330,
1081,
13361,
19776,
198,
198,
6738,
11485,
26791,
1330,
4268,
22046,
11,
3... | 3.44898 | 49 |
#!/usr/bin/python
# Layer 7 Router
#
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
import json, re, os, subprocess
PORT_NUMBER = 8080
# Writes config for a given service
globaladdons = {
'example': [
'ec2-52-16-13-243.eu-west-1.compute.amazonaws.com',
],
}
for name, machines in globaladdons.it... | [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
2,
34398,
767,
48538,
198,
2,
198,
6738,
7308,
6535,
28820,
18497,
1330,
7308,
40717,
18453,
25060,
11,
6535,
28820,
18497,
198,
11748,
33918,
11,
302,
11,
28686,
11,
850,
14681,
628,
198,
15... | 2.882979 | 282 |
from pypred import ast, compact
| [
6738,
279,
4464,
445,
1330,
6468,
11,
16001,
628
] | 3.666667 | 9 |
#!/usr/bin/env python
""" Build CLI help pages to RST for dynamic inclusion of help messages
This solves the problem of not being able to install YATSM on readthedocs
because of its complicated dependencies without the need to mock out
basically every import. Just run this script before pushing any new changes
to the ... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
37811,
10934,
43749,
1037,
5468,
284,
371,
2257,
329,
8925,
14900,
286,
1037,
6218,
198,
198,
1212,
39107,
262,
1917,
286,
407,
852,
1498,
284,
2721,
575,
1404,
12310,
319,
1100,
83,
7... | 2.489183 | 832 |
try:
foobar
except: #"catch all", highly discourage due to not being able to identify what went wrong
print("PROBLEM")
print("after the try") | [
28311,
25,
198,
220,
220,
220,
11511,
30973,
198,
16341,
25,
220,
1303,
1,
40198,
477,
1600,
4047,
27518,
2233,
284,
407,
852,
1498,
284,
5911,
644,
1816,
2642,
220,
198,
220,
220,
220,
3601,
7203,
4805,
9864,
2538,
44,
4943,
198,
4... | 3.145833 | 48 |
import re
import string
# obtained and modified from
# https://github.com/tensorflow/tensorflow/blob/590d6eef7e91a6a7392c8ffffb7b58f2e0c8bc6b/tensorflow/python/ops/special_math_ops.py#L311
def einsum_parse_and_resolve_equation(equation, input_shapes):
"""Helper for einsum() that splits/resolves inputs & outputs.... | [
11748,
302,
198,
11748,
4731,
198,
198,
2,
6492,
290,
9518,
422,
198,
2,
3740,
1378,
12567,
13,
785,
14,
83,
22854,
11125,
14,
83,
22854,
11125,
14,
2436,
672,
14,
36993,
67,
21,
68,
891,
22,
68,
6420,
64,
21,
64,
22,
32321,
66,... | 2.284457 | 1,705 |
๏ปฟ#!/usr/bin/env python
# -*- coding: utf-8 -*-
import rhinoscriptsyntax as rs
import Rhino
import os
color_palette = {"cut":(153,204,255),"plunge":(254,184,0),"point":(153,204,255)}
LAYER_NAME = "vector_from_gcode"
if __name__=="__main__":
main() | [
171,
119,
123,
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
11748,
9529,
11996,
6519,
1837,
41641,
355,
44608,
198,
11748,
47759,
198,
11748,
28686,
198,
8043,
... | 2.20339 | 118 |
#A dictionary in a Dictionary
users = {
'aeinstein':{
'first':'albert',
'last':'einstein',
'location':'princeton',
},
'mcurie':{
'first':'mary',
'last':'curie',
'location':'paris',
},
}
for username,user_info in users.items():
print(f'Username: {username}')
full_name=f"{user_info['firs... | [
2,
32,
22155,
287,
257,
28261,
201,
198,
18417,
796,
1391,
201,
198,
197,
6,
3609,
11962,
10354,
90,
201,
198,
197,
197,
6,
11085,
10354,
6,
282,
4835,
3256,
201,
198,
197,
197,
6,
12957,
10354,
6,
68,
11962,
3256,
201,
198,
197,
... | 2.288557 | 201 |
import os
import sys
try:
import tkinter
import time
import yaml
from tkinter import messagebox
from utils.serial_comm import SerialIface
from datetime import datetime
from utils.test_utils import util_logger
from matplotlib import pyplot as plt
from robot.libraries.BuiltIn import B... | [
11748,
28686,
198,
11748,
25064,
198,
198,
28311,
25,
198,
220,
220,
220,
1330,
256,
74,
3849,
198,
220,
220,
220,
1330,
640,
198,
220,
220,
220,
1330,
331,
43695,
198,
220,
220,
220,
422,
256,
74,
3849,
1330,
3275,
3524,
198,
220,
... | 2.105476 | 16,307 |
import collections
import copy
from typing import Iterable
import dgl
import torch
import torchtext
| [
11748,
17268,
198,
11748,
4866,
198,
6738,
19720,
1330,
40806,
540,
198,
198,
11748,
288,
4743,
198,
11748,
28034,
198,
11748,
28034,
5239,
628,
628
] | 4.16 | 25 |
# chesstab-4-1-1_castling-option-correction.py
# Copyright 2020 Roger Marsh
# Licence: See LICENCE (BSD licence)
"""Read games from a ChessTab database and report games with FENs where the
castling options are not consistent with the piece placement, and attempt
correction on request.
The database must be compatible ... | [
2,
269,
956,
39029,
12,
19,
12,
16,
12,
16,
62,
2701,
1359,
12,
18076,
12,
10215,
8243,
13,
9078,
198,
2,
15069,
12131,
13637,
9786,
198,
2,
10483,
594,
25,
4091,
38559,
18310,
357,
21800,
17098,
8,
198,
198,
37811,
5569,
1830,
42... | 1.859855 | 15,855 |
'''
made by YeahKun in 2017-7-22 11:50:42
็ๅญ่ฐๆธธๆ2.0
ๅขๅ ไบๆ็คบ๏ผๆฉๅฑไบๅ่ฏ็็ง็ฑปๅๆฐ้
'''
import random
HANGMANPICS = [
'''
=====
+---+
| |
|
|
|
|
=====''',
'''
=====
+---+
| |
O |
|
|
|
=====''',
'''
=====
+---+
| |
O |
| |
|
|
... | [
7061,
6,
201,
198,
220,
220,
220,
925,
416,
9425,
42,
403,
287,
2177,
12,
22,
12,
1828,
1367,
25,
1120,
25,
3682,
201,
198,
220,
220,
220,
13328,
234,
250,
27764,
245,
164,
108,
250,
162,
116,
116,
22755,
237,
17,
13,
15,
201,
... | 1.597095 | 1,859 |
import sys
import math
import re
from collections import OrderedDict
import random
import numpy
import matplotlib.pyplot as plt
features = OrderedDict({})
trainingData = []
testFeatures = OrderedDict({})
testData = []
class_attribute = []
# returns
# feature index of the best feature
# information gain by that... | [
11748,
25064,
198,
11748,
10688,
198,
11748,
302,
198,
6738,
17268,
1330,
14230,
1068,
35,
713,
198,
11748,
4738,
198,
11748,
299,
32152,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
40890,
796,
14230,
1068,
35,
71... | 2.995708 | 466 |
if __name__ == '__main__':
P = coordinate()
print(P)
P = coordinate(x=2)
print(P)
P = coordinate(y=3)
print(P)
P = coordinate(x=5, y=7)
print(P)
| [
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
197,
47,
796,
20435,
3419,
198,
197,
4798,
7,
47,
8,
198,
197,
47,
796,
20435,
7,
87,
28,
17,
8,
198,
197,
4798,
7,
47,
8,
198,
197,
47,
796,
20435,
7,
... | 2.025974 | 77 |
#ClickKaleidoscope.py
import random
import turtle
t = turtle.Pen()
t.speed(0)
t.hideturtle()
turtle.bgcolor("black")
colors = ["red", "yellow", "blue", "green", "orange", "purple",
"white", "gray"]
turtle.onscreenclick(draw_kaleido)
| [
2,
8164,
42,
1000,
312,
40326,
13,
9078,
198,
198,
11748,
4738,
198,
11748,
28699,
198,
83,
796,
28699,
13,
25553,
3419,
198,
83,
13,
12287,
7,
15,
8,
198,
83,
13,
49675,
316,
17964,
3419,
198,
83,
17964,
13,
35904,
8043,
7203,
13... | 2.474747 | 99 |
#!/usr/bin/env python
import unittest
from tests.base import PyangBindTestCase
if __name__ == "__main__":
unittest.main()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
11748,
555,
715,
395,
198,
198,
6738,
5254,
13,
8692,
1330,
9485,
648,
36180,
14402,
20448,
628,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
... | 2.62 | 50 |
# -*- coding: utf-8 -*-
from copy import deepcopy
from typing import List, Optional
__author__ = 'lundberg'
# Models for filtering out unneeded or unwanted data from eduID database objects
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
4866,
1330,
2769,
30073,
198,
6738,
19720,
1330,
7343,
11,
32233,
198,
198,
834,
9800,
834,
796,
705,
37525,
3900,
6,
628,
198,
2,
32329,
329,
25431,
503,
555,
2... | 3.322581 | 62 |
''' Serialization interface for custom DataFrame objects. Allows to save/load
for memory streams or files. Because one cannot serialize DataFrames with
custom attributes, this uses an intermediate object for that process. Plan
it implement pickling saved methods later (requires more work). These are meant to
... | [
7061,
6,
23283,
1634,
7071,
329,
2183,
6060,
19778,
5563,
13,
220,
40402,
284,
3613,
14,
2220,
220,
198,
329,
4088,
15190,
393,
3696,
13,
220,
4362,
530,
2314,
11389,
1096,
6060,
35439,
351,
198,
2183,
12608,
11,
428,
3544,
281,
19898... | 2.814912 | 1,529 |
import pymongo
from sshtunnel import SSHTunnelForwarder | [
11748,
279,
4948,
25162,
198,
6738,
26678,
28286,
4954,
1330,
6723,
6535,
403,
4954,
39746,
263
] | 3.4375 | 16 |
"""Meta-learners for Omniglot experiment.
Based on original implementation:
https://github.com/amzn/metalearn-leap
"""
import random
from abc import abstractmethod
from torch import nn
from torch import optim
import maml
import warpgrad
from leap import Leap
from leap.utils import clone_state_dict
from utils import R... | [
37811,
48526,
12,
35720,
364,
329,
31816,
328,
26487,
6306,
13,
198,
15001,
319,
2656,
7822,
25,
198,
5450,
1378,
12567,
13,
785,
14,
321,
47347,
14,
28469,
451,
77,
12,
293,
499,
198,
37811,
198,
11748,
4738,
198,
6738,
450,
66,
13... | 2.262348 | 4,940 |
# Coinbase Pro library:
# https://github.com/danpaquin/coinbasepro-python
#curl "https://api.pro.coinbase.com/products/BTC-USD/candles?start=2021-01-01T12:00:00&end=2021-01-12T12:00:00&granularity=3600"
import cbpro
import numpy as np
import pandas as pd
import logging
from datetime import datetime, timedelta
imp... | [
2,
45802,
1041,
5888,
25,
198,
2,
3740,
1378,
12567,
13,
785,
14,
25604,
8957,
21915,
14,
3630,
12093,
538,
305,
12,
29412,
628,
198,
2,
66,
6371,
366,
5450,
1378,
15042,
13,
1676,
13,
3630,
8692,
13,
785,
14,
29498,
14,
35964,
12... | 2.729927 | 137 |
from django.db import models
from django.contrib.auth.models import User
from django.db.models import Count
from django.core.urlresolvers import reverse
from django.utils.timezone import now
'''
def votes(self):
num_submissions = Submission.objects.filter(uploaded_by=self).count()
return num_submi... | [
6738,
42625,
14208,
13,
9945,
1330,
4981,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
27530,
1330,
11787,
198,
6738,
42625,
14208,
13,
9945,
13,
27530,
1330,
2764,
198,
6738,
42625,
14208,
13,
7295,
13,
6371,
411,
349,
690,
... | 2.890995 | 211 |
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from bs4 import BeautifulSoup
import urllib.request,re,os
import config | [
6738,
384,
11925,
1505,
1330,
3992,
26230,
198,
6738,
384,
11925,
1505,
13,
12384,
26230,
13,
11284,
13,
9019,
1330,
5313,
32103,
21321,
198,
6738,
275,
82,
19,
1330,
23762,
50,
10486,
198,
11748,
2956,
297,
571,
13,
25927,
11,
260,
1... | 3.434783 | 46 |
from typing import Optional, List, Set
from fastapi import FastAPI
from pydantic import BaseModel, HttpUrl
app = FastAPI()
@app.put('/items/{item_id}') | [
6738,
19720,
1330,
32233,
11,
7343,
11,
5345,
198,
198,
6738,
3049,
15042,
1330,
12549,
17614,
198,
6738,
279,
5173,
5109,
1330,
7308,
17633,
11,
367,
29281,
28165,
628,
198,
1324,
796,
12549,
17614,
3419,
198,
198,
31,
1324,
13,
1996,
... | 3.039216 | 51 |
import cv2
import os
import time
import numpy as np
from keras import backend as K
from keras.models import load_model
from yad2k.models.keras_yolo import yolo_eval, yolo_head
| [
11748,
269,
85,
17,
198,
11748,
28686,
198,
11748,
640,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
41927,
292,
1330,
30203,
355,
509,
198,
6738,
41927,
292,
13,
27530,
1330,
3440,
62,
19849,
198,
198,
6738,
331,
324,
17,
74,
13,
... | 2.920635 | 63 |
"""Describe logbook events."""
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.core import callback
from .const import DOMAIN, DOOR_STATION, DOOR_STATION_EVENT_ENTITY_IDS
@callback
def async_describe_events(hass, async_describe_event):
"""Describe logbook events."""
@callback
def asyn... | [
37811,
24564,
4892,
2604,
2070,
2995,
526,
15931,
198,
198,
6738,
1363,
562,
10167,
13,
9979,
1330,
5161,
5446,
62,
3525,
9050,
62,
2389,
198,
6738,
1363,
562,
10167,
13,
7295,
1330,
23838,
198,
198,
6738,
764,
9979,
1330,
24121,
29833,... | 2.245203 | 469 |
"""
WSGI config for gigfinder project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
"""
import os,sys
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | [
37811,
198,
19416,
18878,
4566,
329,
12526,
22805,
1628,
13,
198,
198,
1026,
32142,
262,
25290,
18878,
869,
540,
355,
257,
8265,
12,
5715,
7885,
3706,
7559,
31438,
15506,
13,
198,
198,
1890,
517,
1321,
319,
428,
2393,
11,
766,
198,
54... | 2.800847 | 236 |
"""Layer definitions.
This could also be done in the setup file itself.
"""
import os
from zope.app.testing.functional import ZCMLLayer
# We define a ZCML test layer. ZCML layers are special as they define
# some setup code for creation of empty ZODBs and more. If you only
# want some ZCML registrations to be done, y... | [
37811,
49925,
17336,
13,
198,
198,
1212,
714,
635,
307,
1760,
287,
262,
9058,
2393,
2346,
13,
198,
37811,
198,
11748,
28686,
198,
6738,
1976,
3008,
13,
1324,
13,
33407,
13,
45124,
1330,
1168,
24187,
3069,
2794,
198,
198,
2,
775,
8160,... | 2.980559 | 823 |
from tqdm import tqdm
import time
import platform
# ops is a list of AsyncOp object
| [
6738,
256,
80,
36020,
1330,
256,
80,
36020,
198,
11748,
640,
198,
11748,
3859,
198,
198,
2,
39628,
318,
257,
1351,
286,
1081,
13361,
18257,
2134,
628
] | 3.185185 | 27 |
import matplotlib.pyplot as plt
from numba import njit
import numpy as np
import pandas as pd
from scipy.special import gamma, gammainc
import takahe
from tqdm import tqdm
def MadauDickinson(Z, z):
"""Computes the Madau & Dickinson SFRD at metallicity Z and redshift z.
Implements the SFRD given by eqn(15) of ... | [
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
6738,
997,
7012,
1330,
299,
45051,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
19798,
292,
355,
279,
67,
198,
6738,
629,
541,
88,
13,
20887,
1330,
34236,
11,
308,
6475,... | 2.065158 | 1,105 |
"""Intercept log messages from the used libraries and pass them to `loguru`.
See https://github.com/Delgan/loguru
"""
import logging
from loguru import logger
# class PropagateHandler(logging.Handler):
# """Send events from loguru to standard logging"""
# def emit(self, record):
# logging.getLogger(... | [
37811,
9492,
984,
2604,
6218,
422,
262,
973,
12782,
290,
1208,
606,
284,
4600,
6404,
14717,
44646,
198,
198,
6214,
3740,
1378,
12567,
13,
785,
14,
13856,
1030,
14,
6404,
14717,
198,
198,
37811,
198,
11748,
18931,
198,
198,
6738,
2604,
... | 2.590317 | 537 |
from .board import Board, demo_board
from .ticket import Ticket, load_tickets, demo_ticket
| [
6738,
764,
3526,
1330,
5926,
11,
13605,
62,
3526,
198,
6738,
764,
43350,
1330,
24014,
11,
3440,
62,
83,
15970,
11,
13605,
62,
43350,
198
] | 3.64 | 25 |
# Example 1
# This example show how to encoding matrix in graph7 format
import graph7 as g7
import random
order = 10
# Matrix contains only 0 and 1, so for encoding a matrix on one element
# needed only 1 bit
rand_mat = [[random.randint(0, 1) for _ in range(order)] for _ in range(order)]
directed = g7.encode(rand_ma... | [
2,
17934,
352,
198,
2,
770,
1672,
905,
703,
284,
21004,
17593,
287,
4823,
22,
5794,
198,
198,
11748,
4823,
22,
355,
308,
22,
198,
11748,
4738,
198,
198,
2875,
796,
838,
198,
198,
2,
24936,
4909,
691,
657,
290,
352,
11,
523,
329,
... | 2.599156 | 237 |
# -*- coding: utf-8 -*-
# vim: set ts=4 et
from datetime import datetime, timedelta
import re
from sqlalchemy import or_, and_, func
from pybot.plugin import *
from . import models
from .models import *
RETRY_INTERVAL = 3600
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
43907,
25,
900,
40379,
28,
19,
2123,
198,
198,
6738,
4818,
8079,
1330,
4818,
8079,
11,
28805,
12514,
198,
11748,
302,
198,
6738,
44161,
282,
26599,
1330,
393,
62,
1... | 2.875 | 80 |
# Token types
# EOF (end-of-file) token -> indicates that no more input is left for lexical analysis.
# Lexical Analysis: Breaking input strings into tokens -> scanner, tokenizer, lexical analyzer, lexer
# Lexeme -> a sequence of characters that form a token. This is for multidigit for example. Here we implement the i... | [
2,
29130,
3858,
198,
198,
2,
412,
19238,
357,
437,
12,
1659,
12,
7753,
8,
11241,
4613,
9217,
326,
645,
517,
5128,
318,
1364,
329,
31191,
605,
3781,
13,
198,
2,
17210,
605,
14691,
25,
24942,
5128,
13042,
656,
16326,
4613,
27474,
11,
... | 3.546256 | 454 |
#!/usr/bin/env python3
import argparse
import datetime
import re
VERSION_HEADER_RE = re.compile(r'(?P<version>\d+\.\d+\.\d+) ?- ?(?P<date>\d{4}-\d{2}-\d{2})')
CHANGE_TYPE_RE = re.compile(r'^### ?(?P<change_type>.*)')
SKIP_LINE_RE = re.compile(r'^-{2,}|^$')
LIST_LINE_RE = re.compile(r'^[-*] ?(?P<line_item>.*)')
CONTIN... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
11748,
1822,
29572,
198,
11748,
4818,
8079,
198,
11748,
302,
198,
198,
43717,
62,
37682,
1137,
62,
2200,
796,
302,
13,
5589,
576,
7,
81,
6,
7,
30,
47,
27,
9641,
29,
59,
... | 2.037736 | 265 |
from django.shortcuts import render
from .models import UserProfile, Friend, RoomInstance
from django.contrib.auth.models import User, Group
from django.contrib.sessions.models import Session
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect, HttpResponse
from regist... | [
6738,
42625,
14208,
13,
19509,
23779,
1330,
8543,
198,
6738,
764,
27530,
1330,
11787,
37046,
11,
9182,
11,
10096,
33384,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
27530,
1330,
11787,
11,
4912,
198,
6738,
42625,
14208,
13,
3... | 2.980392 | 408 |
import falcon
import json
from helper.log import logger
from helper.utils import Constants
| [
11748,
24215,
1102,
198,
11748,
33918,
198,
6738,
31904,
13,
6404,
1330,
49706,
198,
6738,
31904,
13,
26791,
1330,
4757,
1187,
628
] | 4.181818 | 22 |
# encoding: utf-8
# pylint: disable=C0103
"""Utility functions to deal with audio."""
import librosa
__all__ = ['load']
# simply use librosa.load (this may change in the future)
load = librosa.load
| [
2,
21004,
25,
3384,
69,
12,
23,
198,
2,
279,
2645,
600,
25,
15560,
28,
34,
486,
3070,
198,
37811,
18274,
879,
5499,
284,
1730,
351,
6597,
526,
15931,
198,
198,
11748,
9195,
4951,
64,
198,
198,
834,
439,
834,
796,
37250,
2220,
2052... | 2.830986 | 71 |
import uvicorn
from fastapi import FastAPI
from email_sender.service.email_sender import EmailSender
from flights_tracker.routes import router
from flights_tracker.services.weekend_flights_service import WeekendFlightsService
app = FlightsTracker()
app.include_router(router)
if __name__ == "__main__":
uvicorn.... | [
11748,
334,
25531,
1211,
198,
6738,
3049,
15042,
1330,
12549,
17614,
198,
198,
6738,
3053,
62,
82,
2194,
13,
15271,
13,
12888,
62,
82,
2194,
1330,
9570,
50,
2194,
198,
6738,
13956,
62,
2213,
10735,
13,
81,
448,
274,
1330,
20264,
198,
... | 2.944882 | 127 |
import os
import celery
import requests
from app.logic.pipeline import process, load_model, predict
CELERY_BROKER = os.environ.get('CELERY_BROKER')
CELERY_BACKEND = os.environ.get('CELERY_BACKEND')
app = celery.Celery('tasks', broker=CELERY_BROKER, backend=CELERY_BACKEND)
@app.task(base=Model)
Model = app.regis... | [
11748,
28686,
198,
198,
11748,
18725,
1924,
198,
11748,
7007,
198,
6738,
598,
13,
6404,
291,
13,
79,
541,
4470,
1330,
1429,
11,
3440,
62,
19849,
11,
4331,
198,
198,
34,
3698,
19664,
62,
11473,
11380,
1137,
796,
28686,
13,
268,
2268,
... | 2.541353 | 133 |
import tensorflow as tf
tf.enable_eager_execution();
| [
11748,
11192,
273,
11125,
355,
48700,
198,
27110,
13,
21633,
62,
68,
3536,
62,
18558,
1009,
9783,
628,
198
] | 2.894737 | 19 |
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponse
| [
198,
6738,
42625,
14208,
13,
19509,
23779,
1330,
8543,
11,
18941,
11,
651,
62,
15252,
62,
273,
62,
26429,
198,
6738,
42625,
14208,
13,
4023,
1330,
367,
29281,
31077,
198
] | 3.433333 | 30 |
import db
import mfrc522
import network
import speaker
import squeezebox
import squeezebox
import time
import ujson
from machine import Pin, PWM
if __name__ == '__main__':
main()
| [
11748,
20613,
198,
11748,
285,
69,
6015,
49542,
198,
11748,
3127,
198,
11748,
10834,
198,
11748,
13170,
38130,
1140,
198,
11748,
13170,
38130,
1140,
198,
11748,
640,
198,
11748,
334,
17752,
198,
6738,
4572,
1330,
13727,
11,
350,
22117,
62... | 3.166667 | 60 |
PARTIAL_MOCK_CONFIG = {
"api":{
"plugins":{
"lots.core": None,
"transferring":{
"plugins":{
"lots.transferring":None
}
},
}
}
}
| [
30709,
12576,
62,
44,
11290,
62,
10943,
16254,
796,
1391,
198,
220,
220,
220,
366,
15042,
1298,
90,
198,
220,
220,
220,
220,
220,
366,
37390,
1298,
90,
198,
220,
220,
220,
220,
220,
220,
220,
366,
75,
1747,
13,
7295,
1298,
6045,
1... | 1.619048 | 126 |
#coding:utf-8
'''
filename:floatrange.py
generate a sequence of parmeters with floating-point numbers.
'''
import itertools
f = frange(1.2,9)
print(list(f))
f = frange(1.2)
print(list(f))
f = frange(1.2,9,-1)
print(list(f))
f = frange(1.2,None,-1)
print(list(f))
f = frange(1.2,None,0)
print(list(f))... | [
2,
66,
7656,
25,
40477,
12,
23,
198,
198,
7061,
6,
198,
220,
220,
220,
29472,
25,
22468,
9521,
13,
9078,
198,
220,
220,
220,
7716,
257,
8379,
286,
1582,
4164,
364,
351,
12462,
12,
4122,
3146,
13,
198,
7061,
6,
628,
198,
11748,
3... | 2.10828 | 157 |
import argparse
import os
import re
import sys
SOURCE_FMT = """// AUTOGENERATED
// Generated by spirv_num_to_cpp.py, from '{file_name}'
#include <stddef.h>
#include <stdint.h>
namespace {namespace} {{
const volatile uint32_t {var_name}[] = {{
{raw_lines}
}};
const volatile size_t {var_name}_count = {total_data_co... | [
11748,
1822,
29572,
198,
11748,
28686,
198,
11748,
302,
198,
11748,
25064,
628,
198,
47690,
62,
37,
13752,
796,
37227,
1003,
47044,
7730,
1677,
1137,
11617,
198,
1003,
2980,
515,
416,
9158,
85,
62,
22510,
62,
1462,
62,
20322,
13,
9078,
... | 2.392739 | 303 |
import json
from json import JSONDecodeError
import subprocess as sp
from traceback import print_exc
from ..dbi import WeewxDB
from flask import Flask, request
def create_app(database):
"""
:param database: Name of database to save into
"""
app = Flask(__name__)
weewx_db = WeewxDB(database)
... | [
11748,
33918,
198,
6738,
33918,
1330,
19449,
10707,
1098,
12331,
198,
11748,
850,
14681,
355,
599,
198,
6738,
12854,
1891,
1330,
3601,
62,
41194,
198,
198,
6738,
11485,
67,
8482,
1330,
775,
413,
87,
11012,
198,
6738,
42903,
1330,
46947,
... | 2.77707 | 157 |
"""
Modified from https://github.com/facebookresearch/DomainBed
@author: Baixu Chen
@contact: cbx_99_hasta@outlook.com
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.autograd as autograd
class InvariancePenaltyLoss(nn.Module):
r"""Invariance Penalty Loss from `Invariant Risk M... | [
37811,
198,
5841,
1431,
422,
3740,
1378,
12567,
13,
785,
14,
19024,
34033,
14,
43961,
45896,
198,
31,
9800,
25,
8999,
844,
84,
12555,
198,
31,
32057,
25,
269,
65,
87,
62,
2079,
62,
71,
40197,
31,
448,
5460,
13,
785,
198,
37811,
19... | 2.755906 | 381 |
#!/usr/bin/env python
import parallel
import unittest
import thread
import testing_lib
import time
import uuid
import config
from multiprocessing import RawValue
if __name__ == '__main__':
unittest.main()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
11748,
10730,
198,
11748,
555,
715,
395,
198,
11748,
4704,
198,
11748,
4856,
62,
8019,
198,
11748,
640,
198,
11748,
334,
27112,
198,
11748,
4566,
198,
6738,
18540,
305,
919,
278,
... | 3.149254 | 67 |
# Fix the program
print("Are you ready?")
number = int(input("Please type in a number: "))
while number != 0:
print(number)
number = number -1
print("Now!") | [
2,
13268,
262,
1430,
198,
4798,
7203,
8491,
345,
3492,
1701,
8,
198,
17618,
796,
493,
7,
15414,
7203,
5492,
2099,
287,
257,
1271,
25,
366,
4008,
198,
4514,
1271,
14512,
657,
25,
198,
220,
220,
220,
3601,
7,
17618,
8,
198,
220,
220... | 2.928571 | 56 |
import datetime
import os
import fitz # fitzๅฐฑๆฏpip install PyMuPDF -i https://mirrors.aliyun.com/pypi/simple (PyMuPDF-1.18.17)
if __name__ == "__main__":
path = r'D:\่ๅ็งๆ-็ ๅ\2021 ่ๅ็งๆAIๅนณๅฐ\OCR\ไธๅธๅ
ฌๅธ่ดขๆฅ.pdf'
# path = r'D:\่ๅ็งๆ-็ ๅ\2021 ่ๅ็งๆAIๅนณๅฐ\OCR\็ญๅๅ
ฌๅธ2016ๅนดๅฎก่ฎกๆฅๅ.pdf'
pdf_to_img(path)
# list_img = ['็ญๅๅ
ฌ... | [
11748,
4818,
8079,
198,
11748,
28686,
198,
198,
11748,
4197,
89,
220,
1303,
4197,
89,
22887,
109,
42468,
79,
541,
2721,
9485,
33239,
20456,
532,
72,
3740,
1378,
10793,
5965,
13,
7344,
88,
403,
13,
785,
14,
79,
4464,
72,
14,
36439,
3... | 1.117378 | 656 |
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.b (the "License");
# you may not use this file except in compliance with the License.
#
import asyncio
from asyncio import wait
from userbot import BOTLOG_CHATID, BOTLOG, CMD_HELP
from userbot.events impor... | [
2,
15069,
357,
34,
8,
13130,
383,
12281,
5303,
417,
6794,
5834,
11419,
13,
198,
2,
198,
2,
49962,
739,
262,
12281,
5303,
417,
6794,
5094,
13789,
11,
10628,
352,
13,
65,
357,
1169,
366,
34156,
15341,
198,
2,
345,
743,
407,
779,
428... | 2.418564 | 571 |
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... | [
37811,
198,
15269,
12131,
383,
2944,
2611,
46665,
13,
198,
198,
1212,
2723,
2438,
318,
11971,
739,
262,
347,
10305,
12,
7635,
5964,
1043,
287,
262,
198,
43,
2149,
24290,
2393,
287,
262,
6808,
8619,
286,
428,
2723,
5509,
13,
198,
198,
... | 3.816568 | 507 |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... | [
2,
15069,
12131,
43208,
21852,
1766,
1539,
12052,
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,
13789,
13,
198... | 2.663144 | 757 |
import sys
from pathlib import Path
sys.path.append(str(Path(__file__).resolve().parent))
from cwesecurity.cwe import Cwe | [
11748,
25064,
198,
6738,
3108,
8019,
1330,
10644,
198,
17597,
13,
6978,
13,
33295,
7,
2536,
7,
15235,
7,
834,
7753,
834,
737,
411,
6442,
22446,
8000,
4008,
198,
6738,
269,
86,
274,
721,
1684,
13,
66,
732,
1330,
327,
732
] | 2.95122 | 41 |
import logging
import multiprocessing
import os
from dataclasses import dataclass
from itertools import repeat, takewhile
from pathlib import Path
from typing import Any, List, Mapping, Optional, Union
import numpy as np
import pandas as pd
from .bed_reader import read_f32, read_f64, read_i8
# https://stackoverflow... | [
11748,
18931,
198,
11748,
18540,
305,
919,
278,
198,
11748,
28686,
198,
6738,
4818,
330,
28958,
1330,
4818,
330,
31172,
198,
6738,
340,
861,
10141,
1330,
9585,
11,
1011,
4514,
198,
6738,
3108,
8019,
1330,
10644,
198,
6738,
19720,
1330,
... | 2.031957 | 15,302 |
# Author: Matthew Bowden bowdenm@spu.edu
import flask as fsk
app = fsk.Flask(__name__)
@app.route('/')
| [
2,
6434,
25,
9308,
9740,
6559,
9563,
6559,
76,
31,
2777,
84,
13,
15532,
198,
198,
11748,
42903,
355,
277,
8135,
198,
198,
1324,
796,
277,
8135,
13,
7414,
2093,
7,
834,
3672,
834,
8,
628,
198,
31,
1324,
13,
38629,
10786,
14,
11537,... | 2.377778 | 45 |
if __name__ == '__main__':
from time import perf_counter_ns
basic_tests = (
([1, 1, 1], 1),
([1, 2, 3, 4, 5, 6], 3)
)
additional_tests = (
([1, 2], 0),
([2, 3, 5, 7], 0),
([1] * 100 + [2] + [4], 4),
([10, 20, 23, 27, 45, 69, 118, 138, 161, 166, 167, 170,... | [
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
422,
640,
1330,
23035,
62,
24588,
62,
5907,
198,
220,
220,
220,
4096,
62,
41989,
796,
357,
198,
220,
220,
220,
220,
220,
220,
220,
29565,
16,
... | 2.077604 | 10,966 |
import numpy as np
import copy
import pygmo
from gips.gistmodel.mode0 import mode0
from gips.gistmodel.mode1 import mode1
from gips.gistmodel.mode3 import mode3
from gips.gistmodel.mode4 import mode4
from gips.gistmodel.mode5 import mode5
from gips.gistmodel.mode6 import mode6
from gips.gistmodel.mode7 import mode7
f... | [
11748,
299,
32152,
355,
45941,
198,
198,
11748,
4866,
198,
11748,
12972,
70,
5908,
198,
198,
6738,
308,
2419,
13,
70,
396,
19849,
13,
14171,
15,
1330,
4235,
15,
198,
6738,
308,
2419,
13,
70,
396,
19849,
13,
14171,
16,
1330,
4235,
16... | 2.924419 | 172 |
from mlflow.exceptions import MlflowException
from mlflow.models.evaluation.artifacts import (
ImageEvaluationArtifact,
JsonEvaluationArtifact,
NumpyEvaluationArtifact,
CsvEvaluationArtifact,
ParquetEvaluationArtifact,
TextEvaluationArtifact,
PickleEvaluationArtifact,
)
import matplotlib.py... | [
6738,
285,
1652,
9319,
13,
1069,
11755,
1330,
337,
1652,
9319,
16922,
198,
6738,
285,
1652,
9319,
13,
27530,
13,
18206,
2288,
13,
50179,
1330,
357,
198,
220,
220,
220,
7412,
36,
2100,
2288,
8001,
29660,
11,
198,
220,
220,
220,
449,
... | 2.182796 | 1,023 |
# pylint: disable=invalid-name
"""Hyvรคksymistestausluokka
"""
#Pylint disablettu toistaiseksi
from stub_io import StubIO # pylint: disable=import-error
class ReadingtipLibrary: # pylint: disable=invalid-name
"""Luokka joka vastaa vaatimusten testaamisesta
"""
def __init__(self):
"""Luokan konstru... | [
2,
279,
2645,
600,
25,
15560,
28,
259,
12102,
12,
3672,
198,
37811,
21217,
85,
11033,
591,
4948,
396,
395,
8717,
2290,
482,
4914,
198,
37811,
198,
198,
2,
47,
2645,
600,
15560,
926,
84,
284,
12523,
786,
591,
72,
198,
6738,
17071,
... | 1.994398 | 714 |
import frozendict
from loguru import logger
from omni_converter import AutoDataFactory
from omni_converter.solver.astar import AstarSolver
from omni_cv_rules.coconut.omni_converter import AutoList
from omni_cv_rules.rulebook import CV_RULEBOOK
target_conversions=[
("[image_path]","numpy_rgb"),
("pix2pix_batch... | [
11748,
8400,
89,
437,
713,
198,
6738,
2604,
14717,
1330,
49706,
198,
198,
6738,
39030,
8461,
62,
1102,
332,
353,
1330,
11160,
6601,
22810,
198,
6738,
39030,
8461,
62,
1102,
332,
353,
13,
82,
14375,
13,
459,
283,
1330,
317,
7364,
50,
... | 2.177966 | 472 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
train triplet net and get feature vectors
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import six
import time
import argparse
# from tqdm import tqdm
import matplotlib
matplotlib.use('Agg')
import ma... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
37811,
198,
27432,
15055,
83,
2010,
290,
651,
3895,
30104,
198,
37811,
198,
198,
6738,
11593,
37443,
834,
1330,
41... | 2.49835 | 909 |
#!/usr/bin/env python3
# coding=utf-8
import sys
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import pyqtSlot,QTimer
from PyQt5 import uic,QtGui
import random
import math
if __name__=='__main__':
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
19617,
28,
40477,
12,
23,
198,
198,
11748,
25064,
198,
11748,
25064,
198,
6738,
9485,
48,
83,
20,
13,
48,
83,
54,
312,
11407,
1330,
1635,
198,
6738,
9485,
48,
83,
20,
13,
... | 2.345588 | 136 |
# Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
from __future__ import absolute_import
from cef_parser import *
# test the module
if __name__ == "__main__":
import sys
# ver... | [
2,
15069,
357,
66,
8,
1853,
383,
18255,
1505,
13302,
47238,
25161,
46665,
13,
1439,
2489,
198,
2,
10395,
13,
5765,
286,
428,
2723,
2438,
318,
21825,
416,
257,
347,
10305,
12,
7635,
5964,
326,
198,
2,
460,
307,
1043,
287,
262,
38559,... | 3.031746 | 252 |
from os import path
from django.conf import settings
from rest_framework import exceptions, authentication
import jwt
from .models import CustomUser
| [
198,
6738,
28686,
1330,
3108,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
6738,
1334,
62,
30604,
1330,
13269,
11,
18239,
198,
11748,
474,
46569,
198,
6738,
764,
27530,
1330,
8562,
12982,
198,
220,
220,
220,
220,
220,
220,
220,
... | 3.34 | 50 |
import time,machine
BUTTONPIN = 0
buttonpin = machine.Pin(BUTTONPIN, machine.Pin.IN, machine.Pin.PULL_UP)
buttonlast = 0
print("wait_until_pressed: Waits until the button is pressed.")
while buttonpin.value()==1:
print("push the button")
time.sleep_ms(100)
print("button is pressed")
| [
11748,
640,
11,
30243,
198,
47526,
11357,
44032,
796,
657,
198,
16539,
11635,
796,
4572,
13,
28348,
7,
47526,
11357,
44032,
11,
4572,
13,
28348,
13,
1268,
11,
4572,
13,
28348,
13,
5105,
3069,
62,
8577,
8,
198,
16539,
12957,
796,
657,
... | 2.910891 | 101 |
'''Word2Vec Baseline
python3 baseline_embeddings.py path_to_embedding'''
import logging
import logging.config
import configparser as cp
#import args
import sys
import pickle
import numpy as np
import vectorizer
import load
import sample
#configurations
config = cp.ConfigParser(strict=False)
config.read('defaults.c... | [
7061,
6,
26449,
17,
53,
721,
6455,
4470,
198,
29412,
18,
14805,
62,
20521,
67,
654,
13,
9078,
3108,
62,
1462,
62,
20521,
12083,
7061,
6,
198,
198,
11748,
18931,
198,
11748,
18931,
13,
11250,
198,
198,
11748,
4566,
48610,
355,
31396,
... | 2.431624 | 1,170 |
import argparse
import random
import time
import torch
import numpy as np
from network import GNet
from trainer import Trainer
from utils.data_loader import FileLoader
if __name__ == "__main__":
main()
| [
11748,
1822,
29572,
198,
11748,
4738,
198,
11748,
640,
198,
11748,
28034,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
3127,
1330,
402,
7934,
198,
6738,
21997,
1330,
31924,
198,
6738,
3384,
4487,
13,
7890,
62,
29356,
1330,
9220,
17401,
... | 3.47541 | 61 |
from src.pysource import get_callable, print_source
| [
6738,
12351,
13,
79,
893,
1668,
1330,
651,
62,
13345,
540,
11,
3601,
62,
10459,
198
] | 3.25 | 16 |
"""
The boolean module lets you create complicated boolean expressions by composing
objects. The compositions can be evaluated against multiple values.
"""
import logging
import operator
import re
from functools import partial, wraps
from itertools import count
log = logging.getLogger(__name__)
__all__ = [
"pred... | [
37811,
198,
464,
25131,
8265,
8781,
345,
2251,
8253,
25131,
14700,
416,
49760,
198,
48205,
13,
383,
33543,
460,
307,
16726,
1028,
3294,
3815,
13,
198,
37811,
198,
11748,
18931,
198,
11748,
10088,
198,
11748,
302,
198,
198,
6738,
1257,
3... | 2.641822 | 483 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/8/4 14:15
# @Author : Marrion
#
import functools,inspect
@check
print(add(3,4)) | [
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,
2177,
14,
23,
14,
19,
1478,
25,
1314,
198,
2,
2488,
13838,
220,
1058,
1526,
81,... | 2.086957 | 69 |
# -*- coding:utf-8 -*-
'''
Model for classify.
'''
from config import CMS_CFG
from torcms.model.core_tab import TabPost, TabPost2Tag, TabTag
class MClassify():
'''
Model for classify.
'''
@staticmethod
@staticmethod
@staticmethod
@staticmethod
| [
2,
532,
9,
12,
19617,
25,
40477,
12,
23,
532,
9,
12,
198,
7061,
6,
198,
17633,
329,
36509,
13,
198,
7061,
6,
198,
198,
6738,
4566,
1330,
40773,
62,
22495,
38,
198,
6738,
7332,
46406,
13,
19849,
13,
7295,
62,
8658,
1330,
16904,
6... | 2.559633 | 109 |
# -*- coding: utf-8 -*-
"""Format adapter for the terminaltables module."""
import terminaltables
import itertools
from cli_helpers.utils import filter_dict_by_key
from .preprocessors import (convert_to_string, override_missing_value,
style_output)
supported_formats = ('ascii', 'double', ... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
26227,
21302,
329,
262,
5651,
2501,
2977,
8265,
526,
15931,
198,
198,
11748,
5651,
2501,
2977,
198,
11748,
340,
861,
10141,
198,
198,
6738,
537,
72,
62,
16794,
36... | 2.570071 | 421 |
#!/usr/bin/env python3
import sys
import requests
from google.cloud import translate
REGIST_URL = r"https://www.berlin.de/daten/liste-der-kfz-kennzeichen/kfz-kennz-d.csv"
NUMBERS = (
"null",
"eins",
"zwei",
"drei",
"vier",
"fรผnf",
"sechs",
"sieben",
"acht",
"neun"
)
csvData ... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
11748,
25064,
198,
198,
11748,
7007,
198,
6738,
23645,
13,
17721,
1330,
15772,
198,
198,
31553,
8808,
62,
21886,
796,
374,
1,
5450,
1378,
2503,
13,
527,
2815,
13,
2934,
14,
... | 2.353945 | 469 |
# -*- coding: utf-8 -*-
"""Heartbeat service.
This is the internal thread responsible for sending heartbeat events
at regular intervals (may not be an actual thread).
"""
from __future__ import absolute_import, unicode_literals
from celery.signals import heartbeat_sent
from celery.utils.sysinfo import load_average
f... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
28541,
12945,
2139,
13,
198,
198,
1212,
318,
262,
5387,
4704,
4497,
329,
7216,
36051,
2995,
198,
265,
3218,
20016,
357,
11261,
407,
307,
281,
4036,
4704,
737,
198... | 3.02381 | 252 |
from toolbox.geohash.lib import ray as _uut
from nose import tools as _tools
from toolbox.geohash.lib import point as _point
| [
6738,
2891,
3524,
13,
469,
1219,
1077,
13,
8019,
1330,
26842,
355,
4808,
84,
315,
198,
198,
6738,
9686,
1330,
4899,
355,
4808,
31391,
198,
198,
6738,
2891,
3524,
13,
469,
1219,
1077,
13,
8019,
1330,
966,
355,
4808,
4122,
628,
198
] | 3.071429 | 42 |
import numpy as np
import os
import imageio
mnist = np.load('mnist.npy')
num_imgs = mnist.shape[0]
for i in range(num_imgs):
img = mnist[i,:,:]
name = 'img_%s.jpg'%(i)
file_path = os.path.join('mnist_images', name)
imageio.imwrite(file_path, (img*255).astype(np.uint8)) | [
11748,
299,
32152,
355,
45941,
198,
11748,
28686,
198,
11748,
2939,
952,
198,
198,
10295,
396,
796,
45941,
13,
2220,
10786,
10295,
396,
13,
77,
9078,
11537,
198,
22510,
62,
9600,
82,
796,
285,
77,
396,
13,
43358,
58,
15,
60,
198,
16... | 2.166667 | 132 |
# Copyright (C) 2020 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""REST facade for roles."""
from lib import users
from lib.constants import roles, objects, object_states
from lib.decorator import memoize
from lib.entities import entities_factory
from lib.entities.entity ... | [
2,
15069,
357,
34,
8,
12131,
3012,
3457,
13,
198,
2,
49962,
739,
2638,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
1279,
3826,
38559,
24290,
2393,
29,
198,
37811,
49,
6465,
43562,
329,
9176... | 2.959581 | 668 |
import pytest
from fastapi_iam import auth
pytestmark = pytest.mark.asyncio
| [
11748,
12972,
9288,
198,
6738,
3049,
15042,
62,
1789,
1330,
6284,
198,
198,
9078,
9288,
4102,
796,
12972,
9288,
13,
4102,
13,
292,
13361,
952,
628
] | 3 | 26 |
# Copyright 2020 Jiang Shenghu
# SPDX-License-Identifier: Apache-2.0
from tvm import topi
from ..poly import TensorTable, Statement, ScheduleTree
from .conv import PlainConv2d, Conv2d
| [
2,
15069,
12131,
32294,
22323,
456,
84,
198,
2,
30628,
55,
12,
34156,
12,
33234,
7483,
25,
24843,
12,
17,
13,
15,
198,
6738,
256,
14761,
1330,
1353,
72,
198,
198,
6738,
11485,
35428,
1330,
309,
22854,
10962,
11,
21983,
11,
19281,
27... | 3.166667 | 60 |
"""Main file for DETR."""
from typing import Any
from absl import flags
from clu import metric_writers
import jax
import jax.numpy as jnp
import ml_collections
from scenic import app
from scenic.projects.baselines.detr import model as detr_model
from scenic.projects.baselines.detr import trainer
from scenic.train_lib... | [
37811,
13383,
2393,
329,
38267,
49,
526,
15931,
198,
198,
6738,
19720,
1330,
4377,
198,
198,
6738,
2352,
75,
1330,
9701,
198,
6738,
537,
84,
1330,
18663,
62,
34422,
198,
11748,
474,
897,
198,
11748,
474,
897,
13,
77,
32152,
355,
474,
... | 2.655963 | 436 |
from rest_framework.response import Response
from rest_framework import status
from rest_framework.views import APIView
from main.serializers import BookReplicaSerializer, BookSerializer, LibrarianSerializer, LibraryHallSerializer, ReaderSerializer
from main.models import Book, BookReplica, CustomUser, Librarian, Libr... | [
6738,
1334,
62,
30604,
13,
26209,
1330,
18261,
198,
6738,
1334,
62,
30604,
1330,
3722,
220,
198,
6738,
1334,
62,
30604,
13,
33571,
1330,
3486,
3824,
769,
198,
6738,
1388,
13,
46911,
11341,
1330,
4897,
39232,
3970,
32634,
7509,
11,
4897,... | 4.017857 | 112 |
"""Loads a trained model checkpoint and makes predictions on a dataset."""
from chemprop_solvation.parsing import parse_predict_args
from chemprop_solvation.train import make_predictions
if __name__ == '__main__':
args = parse_predict_args()
make_predictions(args)
| [
37811,
8912,
82,
257,
8776,
2746,
26954,
290,
1838,
16277,
319,
257,
27039,
526,
15931,
198,
198,
6738,
4607,
22930,
62,
34453,
10473,
13,
79,
945,
278,
1330,
21136,
62,
79,
17407,
62,
22046,
198,
6738,
4607,
22930,
62,
34453,
10473,
... | 3.235294 | 85 |
class NoSolutionPossible(Exception):
"""A simple class used to explicitly let a user know that a solution is not
possible given the current inputs.
"""
pass
| [
198,
4871,
1400,
46344,
47,
4733,
7,
16922,
2599,
198,
220,
220,
220,
37227,
32,
2829,
1398,
973,
284,
11777,
1309,
257,
2836,
760,
326,
257,
4610,
318,
407,
198,
220,
220,
220,
1744,
1813,
262,
1459,
17311,
13,
198,
220,
220,
220,
... | 3.5 | 50 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
__... | [
2,
19617,
28,
40477,
12,
23,
198,
2,
17202,
39410,
25,
428,
2393,
373,
7560,
416,
262,
21624,
12994,
26144,
35986,
13,
17202,
198,
2,
17202,
2141,
407,
4370,
416,
1021,
4556,
345,
821,
1728,
345,
760,
644,
345,
389,
1804,
0,
17202,
... | 3.504673 | 107 |
import math
from rpython.rlib.rfloat import isnan, isinf, copysign
# code to deal with special values (infinities, NaNs, ...)
#
# The special types can be:
ST_NINF = 0 # negative infinity
ST_NEG = 1 # negative finite number (nonzero)
ST_NZERO = 2 # -0.
ST_PZERO = 3 # +0.
ST_P... | [
11748,
10688,
198,
6738,
374,
29412,
13,
81,
8019,
13,
81,
22468,
1330,
2125,
272,
11,
318,
10745,
11,
2243,
893,
570,
198,
198,
2,
2438,
284,
1730,
351,
2041,
3815,
357,
10745,
259,
871,
11,
11013,
47503,
11,
2644,
8,
198,
2,
198... | 1.500791 | 4,425 |
# -*- coding: utf-8 -*-
'''
torstack.library.compat.py
compat definition.
:copyright: (c) 2018 by longniao <longniao@gmail.com>
:license: MIT, see LICENSE for more details.
'''
import sys
# __all__ = (
# 'text_type', 'string_types', 'izip', 'iteritems', 'itervalues',
# 'with_metaclass',
# )
PY3 = sys.versi... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
7061,
6,
198,
13165,
25558,
13,
32016,
13,
5589,
265,
13,
9078,
198,
5589,
265,
6770,
13,
198,
198,
25,
22163,
4766,
25,
357,
66,
8,
2864,
416,
890,
77,
13481,
... | 2.338068 | 352 |