content stringlengths 1 1.04M | input_ids listlengths 1 774k | ratio_char_token float64 0.38 22.9 | token_count int64 1 774k |
|---|---|---|---|
import os
from pathlib import Path
dirname, filename = os.path.split(os.path.abspath(__file__))
version = Path(f"{dirname}/version.txt").read_text()
| [
11748,
28686,
198,
6738,
3108,
8019,
1330,
10644,
198,
198,
15908,
3672,
11,
29472,
796,
28686,
13,
6978,
13,
35312,
7,
418,
13,
6978,
13,
397,
2777,
776,
7,
834,
7753,
834,
4008,
198,
9641,
796,
10644,
7,
69,
1,
90,
15908,
3672,
... | 2.796296 | 54 |
# -*- coding: utf-8 -*-
__all__ = ["TrivialSolver", "BasicSolver", "HODLRSolver"]
from .trivial import TrivialSolver
from .basic import BasicSolver
from .hodlr import HODLRSolver
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
834,
439,
834,
796,
14631,
14824,
85,
498,
50,
14375,
1600,
366,
26416,
50,
14375,
1600,
366,
39,
3727,
43,
6998,
14375,
8973,
198,
198,
6738,
764,
83,
15104,
498... | 2.549296 | 71 |
import sys
print('Your platform is: ' + sys.platform)
| [
11748,
25064,
198,
4798,
10786,
7120,
3859,
318,
25,
705,
1343,
25064,
13,
24254,
8,
198
] | 3.375 | 16 |
import logging
import re
import ssl
from datetime import datetime, timedelta, time
import os
from urllib import request, parse
from bs4 import BeautifulSoup
from utils import u_db
from utils.TextClient import TextClient
def sched_uploaded(c, d):
"""
Checks to see if the schedule has already been processed
... | [
11748,
18931,
198,
11748,
302,
198,
11748,
264,
6649,
198,
6738,
4818,
8079,
1330,
4818,
8079,
11,
28805,
12514,
11,
640,
198,
11748,
28686,
198,
6738,
2956,
297,
571,
1330,
2581,
11,
21136,
198,
198,
6738,
275,
82,
19,
1330,
23762,
5... | 2.114111 | 5,407 |
from flask import request, Response
from injector import inject
from ...dependency.provider import ServiceProvider
from ...configuration.models.api import ApiConfig
from ...data.repository import RepositoryProvider
from ...dependency import ISingleton
| [
6738,
42903,
1330,
2581,
11,
18261,
198,
6738,
8677,
273,
1330,
8677,
198,
198,
6738,
2644,
45841,
1387,
13,
15234,
1304,
1330,
4809,
29495,
198,
6738,
2644,
11250,
3924,
13,
27530,
13,
15042,
1330,
5949,
72,
16934,
198,
6738,
2644,
789... | 4.305085 | 59 |
# ------------------------------------------------------------------------------
# Metropolitan Form Analysis Toolbox-Discontiguity
# Credit: Reza Amindarbari, Andres Sevtsuk
# City Form Lab
# for more infomation see:
# Amindarbari, R., Sevtsuk, A., 2013, "Measuring Growth and Change in Metropolitan Form"
# presented a... | [
2,
16529,
26171,
198,
2,
21609,
5178,
14691,
16984,
3524,
12,
15642,
756,
328,
14834,
198,
2,
10504,
25,
797,
4496,
1703,
521,
38039,
2743,
11,
843,
411,
37918,
912,
2724,
198,
2,
2254,
5178,
3498,
198,
2,
329,
517,
1167,
296,
341,
... | 3.818713 | 171 |
#!python3
import http.server, socketserver, urllib, json, logging
# Notes
# - versionId has to be integer and can be used to check for client to submit older versions of a playlist
# - songId matches up with the catalogue
# - songId will be used to replace the albumUrl %d
# - state can be: played, nextup, queued, curre... | [
2,
0,
29412,
18,
198,
11748,
2638,
13,
15388,
11,
37037,
18497,
11,
2956,
297,
571,
11,
33918,
11,
18931,
198,
2,
11822,
198,
2,
532,
2196,
7390,
468,
284,
307,
18253,
290,
460,
307,
973,
284,
2198,
329,
5456,
284,
9199,
4697,
630... | 2.447059 | 340 |
from pymongo import MongoClient
import urllib.parse
| [
6738,
279,
4948,
25162,
1330,
42591,
11792,
198,
11748,
2956,
297,
571,
13,
29572,
628
] | 3.533333 | 15 |
'''
Download PDF files for a series of law chapter numbers
found in our training CSV file provided by partners.
Then extract the chapter texts from those PDFs.
Finally insert the chapter text into a new column 'Text' of our training CSV.
Note: each PDF contains a bit of the previous chapter and following one.
'''
impor... | [
7061,
6,
198,
10002,
12960,
3696,
329,
257,
2168,
286,
1099,
6843,
3146,
198,
9275,
287,
674,
3047,
44189,
2393,
2810,
416,
4887,
13,
198,
6423,
7925,
262,
6843,
13399,
422,
883,
12960,
82,
13,
198,
11158,
7550,
262,
6843,
2420,
656,
... | 2.367798 | 3,211 |
# -*- coding: utf-8 -*-
"""
A Collection of functions to display tasks and other data.
"""
import datetime
import itertools
import math
import string
import doto.model.task
import pytz
import wcwidth
__state_symbols = {doto.model.task.StateHolder.completed.key: "✓",
doto.model.task.StateHolder.bl... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
32,
12251,
286,
5499,
284,
3359,
8861,
290,
584,
1366,
13,
198,
37811,
198,
198,
11748,
4818,
8079,
198,
11748,
340,
861,
10141,
198,
11748,
10688,
198,
1174... | 2.192504 | 1,174 |
import sys
import re
#simbulos da linguagem
simbulos = (':', '(', ')', ',', '.', ';', '{', '}', '<', '>', '<=', '>=', '<>', '=', '+', '-', '*', '/', ':=')
#palavras reservadas da linguagem
reservedWords = ('begin', 'const', 'do', 'else', 'end', 'for', 'if', 'integer', 'procedure', 'program',
'read', '... | [
11748,
25064,
198,
11748,
302,
198,
2,
82,
14107,
377,
418,
12379,
20280,
363,
368,
198,
82,
14107,
377,
418,
796,
357,
10354,
3256,
29513,
3256,
705,
8,
3256,
46083,
3256,
705,
2637,
11,
705,
26,
3256,
705,
90,
3256,
705,
92,
3256,... | 1.856645 | 2,581 |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
#
# 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 appl... | [
2,
220,
220,
15069,
357,
66,
8,
2864,
350,
37382,
47,
37382,
46665,
13,
1439,
6923,
12224,
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,
... | 3.587912 | 364 |
#!/usr/bin/env python
# coding: utf-8
import sys
from setuptools import setup
sys.path.insert(0, 'xart')
from xart import __version__
VERSION = __version__
sys.path.pop(0)
with open('README.md') as fp:
README = fp.read()
setup(
name='xart',
version=VERSION,
description='generate art ascii texts',... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
19617,
25,
3384,
69,
12,
23,
198,
198,
11748,
25064,
198,
198,
6738,
900,
37623,
10141,
1330,
9058,
198,
198,
17597,
13,
6978,
13,
28463,
7,
15,
11,
705,
87,
433,
11537,
198,
67... | 2.233146 | 356 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
from asdf.extension import Converter
__all__ = ["WCSConverter", "CelestialFrameConverter", "CompositeFrameConverter",
"FrameConverter", "SpectralFrameConverter", "StepConverter",
"TemporalFrameConverter", "S... | [
2,
49962,
739,
257,
513,
12,
565,
682,
347,
10305,
3918,
5964,
532,
766,
38559,
24290,
13,
81,
301,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
6738,
355,
7568,
13,
2302,
3004,
1330,
35602,
353,
628,
... | 2.543478 | 138 |
# -*- coding: utf-8 -*-
"""
simulate.sequence
~~~~~~~~~~~~~~~~~
DNA sequence manipulation.
@Copyright: (c) 2017 by Lingxi Chen (chanlingxi@gmail.com).
@License: LICENSE_NAME, see LICENSE for more details.
"""
complements = {
'A':'T', 'C':'G', 'G':'C', 'T':'A', 'N':'N',
'a':'t', 'c':'g', ... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
220,
220,
220,
29308,
13,
43167,
198,
220,
220,
220,
220,
27156,
93,
628,
220,
220,
220,
7446,
8379,
17512,
13,
220,
628,
220,
220,
220,
2488,
15269,
25,
... | 2.152439 | 164 |
from common.input import input_int, input_float
| [
6738,
2219,
13,
15414,
1330,
5128,
62,
600,
11,
5128,
62,
22468,
628,
628,
628
] | 3.533333 | 15 |
import logging
import os
from pyscreenshot.imcodec import codec
from pyscreenshot.err import FailedBackendError
from pyscreenshot.util import proc
from pyscreenshot.tempdir import TemporaryDirectory
log = logging.getLogger(__name__)
| [
11748,
18931,
198,
11748,
28686,
198,
198,
6738,
279,
28349,
26892,
13,
320,
19815,
721,
1330,
40481,
198,
6738,
279,
28349,
26892,
13,
8056,
1330,
22738,
7282,
437,
12331,
198,
6738,
279,
28349,
26892,
13,
22602,
1330,
13834,
198,
6738,
... | 3.646154 | 65 |
import numpy as np
import pygame
from matplotlib import pyplot as plt
from kalman_filter_localizer import KalmanFilterLocalizer
from noisy_localizer import NoisyLocalizer
from robot import Robot
SCREEN_HEIGHT = 960
SCREEN_WIDTH = 1100
FPS = 30
TIME_PER_FRAME = 1000 // FPS
if __name__ == '__main__':
pygame.init... | [
11748,
299,
32152,
355,
45941,
198,
11748,
12972,
6057,
198,
6738,
2603,
29487,
8019,
1330,
12972,
29487,
355,
458,
83,
198,
198,
6738,
479,
282,
805,
62,
24455,
62,
12001,
7509,
1330,
12612,
805,
22417,
14565,
7509,
198,
6738,
31210,
6... | 2.151416 | 918 |
# Generated by Django 3.2.5 on 2021-07-19 13:08
from django.db import migrations, models
import django.db.models.deletion
| [
2,
2980,
515,
416,
37770,
513,
13,
17,
13,
20,
319,
33448,
12,
2998,
12,
1129,
1511,
25,
2919,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
198,
11748,
42625,
14208,
13,
9945,
13,
27530,
13,
2934,
1616,
295,
... | 2.818182 | 44 |
from twitter_api import api
from twitter_api.models import User
from twitter_api.models import Status
| [
6738,
17044,
62,
15042,
1330,
40391,
198,
6738,
17044,
62,
15042,
13,
27530,
1330,
11787,
198,
6738,
17044,
62,
15042,
13,
27530,
1330,
12678,
628,
198,
197,
628
] | 3.821429 | 28 |
import shutil
import pytest
from mason.api.get import get
from mason.api.apply import apply
from mason.definitions import from_root
from mason.test.support import testing_base as base
from os import path, mkdir
| [
11748,
4423,
346,
198,
198,
11748,
12972,
9288,
198,
198,
6738,
285,
888,
13,
15042,
13,
1136,
1330,
651,
198,
6738,
285,
888,
13,
15042,
13,
39014,
1330,
4174,
198,
6738,
285,
888,
13,
4299,
50101,
1330,
422,
62,
15763,
198,
6738,
... | 3.396825 | 63 |
from test.shared.app.facade_mock import AppFacadeMock
from test.util import TestCase
from unittest.mock import Mock, call
from OpenCast.app.service.error import OperationError
from OpenCast.domain.event.dispatcher import EventDispatcher
from OpenCast.domain.service.identity import IdentityService
from OpenCast.util.na... | [
6738,
1332,
13,
28710,
13,
1324,
13,
38942,
671,
62,
76,
735,
1330,
2034,
47522,
671,
44,
735,
198,
6738,
1332,
13,
22602,
1330,
6208,
20448,
198,
6738,
555,
715,
395,
13,
76,
735,
1330,
44123,
11,
869,
198,
198,
6738,
4946,
19248,
... | 3.53 | 100 |
import time
import pytest
from pages.basket_page import BasketPage
from pages.login_page import LoginPage
from pages.product_page import ProductPage
@pytest.mark.parametrize("link", ["1", "2", "3", "4", "5", "6",
pytest.param("7", marks=pytest.mark.xfail), "8", "9"])
@pytest.mark.nee... | [
11748,
640,
198,
11748,
12972,
9288,
198,
6738,
5468,
13,
65,
11715,
62,
7700,
1330,
347,
11715,
9876,
198,
6738,
5468,
13,
38235,
62,
7700,
1330,
23093,
9876,
198,
6738,
5468,
13,
11167,
62,
7700,
1330,
8721,
9876,
628,
198,
31,
9078... | 2.326087 | 184 |
# Copyright 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Checks that the partition table extends nearly to the end of the storage
device.
Description
-----------
This test checks if the partition table allo... | [
2,
15069,
2211,
383,
18255,
1505,
7294,
46665,
13,
1439,
2489,
10395,
13,
198,
2,
5765,
286,
428,
2723,
2438,
318,
21825,
416,
257,
347,
10305,
12,
7635,
5964,
326,
460,
307,
198,
2,
1043,
287,
262,
38559,
24290,
2393,
13,
628,
198,... | 3.481865 | 386 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import random
from PIL import Image, ImageOps, ImageEnhance, PILLOW_VERSION
import cv2
import numpy as np
import torch
import torchvision
from torchvision.transforms import functional as F
from torchvision imp... | [
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
6738,
11593,
37443,
834,
1330,
7297,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
198,
11748,
4738,
198,
6738,
350,
4146,
1330,
7412,
11,
7412,
41472,
11,
7412,
35476,
590... | 2.299771 | 1,748 |
from BluetoothService import BluetoothService
from RepeatedTimer import RepeatedTimer
import struct
| [
6738,
19263,
16177,
1330,
19263,
16177,
198,
6738,
30558,
515,
48801,
1330,
30558,
515,
48801,
198,
198,
11748,
2878,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
628,
220,
220,
220,
220,
220,
... | 2.537037 | 54 |
from rest_framework import serializers
from .models import Car | [
6738,
1334,
62,
30604,
1330,
11389,
11341,
198,
6738,
764,
27530,
1330,
1879
] | 4.769231 | 13 |
# https://www.codewars.com/kata/56a921fa8c5167d8e7000053/
'''
Instructions :
Description
Your job is to create a simple password validation function, as seen on many websites.
The rules for a valid password are as follows:
There needs to be at least 1 uppercase letter.
There needs to be at least 1 lowercase letter.... | [
2,
3740,
1378,
2503,
13,
19815,
413,
945,
13,
785,
14,
74,
1045,
14,
3980,
64,
24,
2481,
13331,
23,
66,
20,
21940,
67,
23,
68,
22,
2388,
4310,
14,
198,
198,
7061,
6,
198,
43993,
507,
1058,
198,
198,
11828,
198,
7120,
1693,
318,
... | 3.102564 | 312 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 21 18:24:48 2020
Copyright 2020 by Hadrien Montanelli.
"""
from .csv_to_array import csv_to_array
from .list_to_array import list_to_array
from .mtcarlo import mtcarlo
from .pca import pca
from .reg import reg | [
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,
7031,
5267,
2310,
1248,
25,
1731,
25,
2780,
12131,
198,
198,
15269,
12131,
416,
11161,
1535... | 2.718447 | 103 |
# Copyright 2020 The SQLFlow Authors. 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 o... | [
2,
15069,
12131,
383,
16363,
37535,
46665,
13,
1439,
2489,
10395,
13,
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... | 2.243724 | 2,191 |
# Copyright 2020 NVIDIA CORPORATION, Jonah Philion, Amlan Kar, Sanja Fidler
#
# 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 requi... | [
2,
15069,
12131,
15127,
23929,
44680,
6234,
11,
45447,
4543,
295,
11,
1703,
9620,
9375,
11,
2986,
6592,
376,
312,
1754,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
345... | 3.482394 | 284 |
import covasim as cv
import covasim.utils as cvu
import numpy as np
import sciris as sc
import pandas as pd
import os
############# Dates #######################
start_day = '2020-03-01'
end_day = '2021-10-01'
restrictions = '2020-03-01'
lifting = '2020-10-27' #250 days
############# Model Setup ######... | [
11748,
39849,
292,
320,
355,
269,
85,
198,
11748,
39849,
292,
320,
13,
26791,
355,
269,
40939,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
629,
29616,
355,
629,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
28686,
198,
198,
78... | 2.317398 | 1,276 |
import logging
from django.conf import settings
from django.contrib.auth.backends import ModelBackend
from django.core.signing import BadSignature, SignatureExpired
from django.urls import reverse
from . import signing
from .signing import UserDoesNotExist
logger = logging.getLogger(__name__)
| [
11748,
18931,
198,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
1891,
2412,
1330,
9104,
7282,
437,
198,
6738,
42625,
14208,
13,
7295,
13,
12683,
278,
1330,
7772,
11712,
1300,
11,... | 3.465116 | 86 |
from django.contrib import admin
from apps.dashboard.models import Dashboard
admin.site.register(Dashboard)
| [
6738,
42625,
14208,
13,
3642,
822,
1330,
13169,
198,
6738,
6725,
13,
42460,
3526,
13,
27530,
1330,
16189,
3526,
198,
198,
28482,
13,
15654,
13,
30238,
7,
43041,
3526,
8,
198
] | 3.516129 | 31 |
#!/usr/bin/python
def heapify(arr, n, i):
"""
Converting the tree in to a Max. Heap
"""
largest = i
left = 2*i + 1
right = 2*i + 2
for s in [right, left]:
if s < n and arr[s] > arr[largest]:
largest = s
if largest != i:
arr[i], arr[largest] = arr[largest], arr[i]
he... | [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
198,
4299,
24575,
1958,
7,
3258,
11,
299,
11,
1312,
2599,
198,
220,
220,
37227,
198,
220,
220,
35602,
889,
262,
5509,
287,
284,
257,
5436,
13,
679,
499,
198,
220,
220,
37227,
198,
220,
22... | 2.115044 | 226 |
#Question Link
#https://www.codechef.com/problems/AVGPR
t=input()
t=int(t)
for a0 in range(1,t+1):
n=input()
n=int(n)
a=list(map(int,input().split()))
b={} #dictionary to store the count
even=[] #list for even elements
odd=[] #list for odd elements
for i in range(-1001,1002):
b[i]=0
... | [
2,
24361,
7502,
198,
2,
5450,
1378,
2503,
13,
19815,
721,
258,
69,
13,
785,
14,
1676,
22143,
14,
10116,
38,
4805,
198,
83,
28,
15414,
3419,
198,
83,
28,
600,
7,
83,
8,
198,
1640,
257,
15,
287,
2837,
7,
16,
11,
83,
10,
16,
25... | 1.86067 | 567 |
import argparse
import string | [
11748,
1822,
29572,
198,
11748,
4731
] | 4.833333 | 6 |
from pytorch_transformers.tokenization_openai import OpenAIGPTTokenizer
from pytorch_transformers.modeling_openai import (
OpenAIGPTModel,
OpenAIGPTLMHeadModel,
OpenAIGPTDoubleHeadsModel
)
# Dependecies that are not specified in global hubconf.py
specific_dependencies = ['spacy', 'ftfy']
# A lot of models share th... | [
6738,
12972,
13165,
354,
62,
35636,
364,
13,
30001,
1634,
62,
9654,
1872,
1330,
4946,
32,
3528,
11571,
30642,
7509,
198,
6738,
12972,
13165,
354,
62,
35636,
364,
13,
4666,
10809,
62,
9654,
1872,
1330,
357,
198,
197,
11505,
32,
3528,
1... | 2.52436 | 3,202 |
import requests
import time
from db_connector import RevisionDB
#extractor = RevisionExtractor(payload={'titles': "Malazan Book of the Fallen"})
#content = extractor.get_all()
| [
11748,
7007,
198,
11748,
640,
198,
6738,
20613,
62,
8443,
273,
1330,
46604,
11012,
628,
198,
198,
2,
2302,
40450,
796,
46604,
11627,
40450,
7,
15577,
2220,
34758,
6,
83,
30540,
10354,
366,
15029,
1031,
272,
4897,
286,
262,
28693,
20662,... | 3.314815 | 54 |
from collections import deque
from itertools import combinations
if __name__ == "__main__":
kuhn_poker = KuhnPoker()
| [
6738,
17268,
1330,
390,
4188,
198,
6738,
340,
861,
10141,
1330,
17790,
628,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
479,
7456,
77,
62,
79,
11020,
796,
46035,
77,
47,
11020,
3419,
6... | 2.976744 | 43 |
from insights.parsers.virt_what import VirtWhat
from insights.tests import context_wrap
errors = ["virt-what: virt-what-cpuid-helper program not found in $PATH"]
VW_OUT1 = """
kvm
""".strip()
# baremetal retuns blank
VW_OUT2 = """
""".strip()
# occasionally we have more than 1 line of output
VW_OUT3 = """
xen
xen... | [
6738,
17218,
13,
79,
945,
364,
13,
48940,
62,
10919,
1330,
11285,
2061,
198,
6738,
17218,
13,
41989,
1330,
4732,
62,
37150,
198,
198,
48277,
796,
14631,
48940,
12,
10919,
25,
4118,
12,
10919,
12,
13155,
27112,
12,
2978,
525,
1430,
407... | 2.836066 | 122 |
import datetime
import socket
import ssl
from sanic.response import json, text
| [
11748,
4818,
8079,
198,
11748,
17802,
198,
11748,
264,
6649,
198,
6738,
5336,
291,
13,
26209,
1330,
33918,
11,
2420,
628
] | 3.809524 | 21 |
from .error_list import TypescriptProjectErrorList, TypescriptGoToError
from .go_to_definition import TypescriptGoToDefinitionCommand
from .go_to_type_definition import TypescriptGoToTypeDefinitionCommand
from .go_to_type import TypescriptGoToTypeCommand
from .nav_to import TypescriptNavToCommand
from .quick_info impo... | [
171,
119,
123,
6738,
764,
18224,
62,
4868,
1330,
17134,
3798,
1968,
16775,
12331,
8053,
11,
17134,
3798,
1968,
5247,
2514,
12331,
198,
6738,
764,
2188,
62,
1462,
62,
46758,
1330,
17134,
3798,
1968,
5247,
2514,
36621,
21575,
198,
6738,
7... | 2.897321 | 896 |
import numpy as np
| [
11748,
299,
32152,
355,
45941,
628
] | 3.333333 | 6 |
import pkg_resources
from typing import Callable
class PluginManager(object):
"""
Container class that holds the information about available plugins and
provides required method to fetch and clean up the plugin systems
"""
valid_provides = ['load', 'save', 'show', 'board_show']
def reset_plu... | [
11748,
279,
10025,
62,
37540,
198,
6738,
19720,
1330,
4889,
540,
628,
198,
4871,
42636,
13511,
7,
15252,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
43101,
1398,
326,
6622,
262,
1321,
546,
1695,
20652,
290,
198,
220,
220,
220... | 2.522606 | 1,504 |
import click
import mime
import gym
import re
import torchvision.transforms as T
import matplotlib.pyplot as plt
import numpy as np
import pickle as pkl
from PIL import Image
from tqdm import tqdm
from pathlib import Path
from torchvision.transforms import InterpolationMode
from robos2r.core.tf import (
pos_mat_... | [
11748,
3904,
198,
11748,
285,
524,
198,
11748,
11550,
198,
11748,
302,
198,
198,
11748,
28034,
10178,
13,
7645,
23914,
355,
309,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
299,
32152,
355,
45941,
198,
1174... | 2.592486 | 346 |
"""
team activity #12
team tuesday lunch
pandas
"""
from datetime import datetime
import matplotlib.pyplot as plt
import pandas
weather_file = "./weather_year.csv"
data = pandas.read_csv(weather_file)
data.columns = ["date", "max_temp", "mean_temp", "min_temp", "max_dew",
"mean_dew", "min_dew", "max... | [
37811,
198,
15097,
3842,
1303,
1065,
198,
15097,
256,
3322,
9965,
198,
198,
79,
392,
292,
198,
37811,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
19798,
292,
198,
... | 2.397727 | 704 |
import os
import subprocess
if __name__ == "__main__":
testMgr = BenchmarkTests()
AlexNet = Benchmark("src/alexnet.py", 79.28)
AlexNet_ImageNet = Benchmark("src/alexnet_imagenet.py", 56.30)
AlexNet2 = Benchmark("src/alexnet2.py",... | [
198,
198,
11748,
28686,
198,
11748,
850,
14681,
628,
198,
220,
220,
220,
220,
628,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
628,
628,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
... | 2.029508 | 610 |
from sqlalchemy import func
from typing import Iterable
from .models import Post, Tag
def get_tag_cloud() -> Iterable[Tag]:
"""Get tags order by its heat to generate a tag cloud"""
tags = Tag.query.join(Tag.posts).with_entities(Tag, func.count(Post.id))\
.group_by(Tag.id)\... | [
6738,
44161,
282,
26599,
1330,
25439,
198,
6738,
19720,
1330,
40806,
540,
198,
198,
6738,
764,
27530,
1330,
2947,
11,
17467,
628,
198,
4299,
651,
62,
12985,
62,
17721,
3419,
4613,
40806,
540,
58,
24835,
5974,
198,
220,
220,
220,
37227,
... | 2.183246 | 191 |
from tensorflow.keras.layers import (
Layer,
Activation,
Dropout,
BatchNormalization
)
class ActivationBatchNormDropout(Layer):
"""
Activation -> Batch Normalization -> Dropout
""" | [
6738,
11192,
273,
11125,
13,
6122,
292,
13,
75,
6962,
1330,
357,
198,
220,
220,
220,
34398,
11,
198,
220,
220,
220,
13144,
341,
11,
198,
220,
220,
220,
14258,
448,
11,
198,
220,
220,
220,
347,
963,
26447,
1634,
198,
8,
198,
198,
... | 2.566265 | 83 |
# :coding: utf-8
# :copyright: Copyright (c) 2015 ftrack
import os
import uuid
import tempfile
import pytest
import ftrack_api.cache
@pytest.fixture(params=['proxy', 'layered', 'memory', 'file', 'serialised'])
def cache(request):
'''Return cache.'''
if request.param == 'proxy':
cache = ftrack_api.c... | [
2,
1058,
66,
7656,
25,
3384,
69,
12,
23,
198,
2,
1058,
22163,
4766,
25,
15069,
357,
66,
8,
1853,
277,
11659,
198,
198,
11748,
28686,
198,
11748,
334,
27112,
198,
11748,
20218,
7753,
198,
198,
11748,
12972,
9288,
198,
198,
11748,
277... | 2.37925 | 4,559 |
# -*- coding: utf-8 -*-
"""
This module is an interface for accessing cryptocurrency market data.
"""
import os
import requests
from datetime import datetime, date
import pandas as pd
import numpy as np
from pandas.io.common import EmptyDataError
DEFAULT_COINS = [
'BCH', 'BTC', 'DASH', 'ETC', 'ETH', 'LTC', 'NEO... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
37811,
198,
1212,
8265,
318,
281,
7071,
329,
22534,
20210,
1910,
1366,
13,
198,
37811,
198,
198,
11748,
28686,
198,
11748,
7007,
198,
6738,
4818,
8079,
1330,
4818,
... | 2.76 | 125 |
#Jogo da MegaSena
from random import randint
from time import sleep
jogos = list()
numeros = list()
qtd_jogos = int(input('Quantos jogos vc deseja fazer: '))
for cont in range(0, qtd_jogos):
for num in range(0, 6):
while True:
valor = randint(1, 60)
if not valor in numeros:
... | [
2,
41,
24076,
12379,
13421,
50,
8107,
198,
198,
6738,
4738,
1330,
43720,
600,
198,
6738,
640,
1330,
3993,
198,
198,
73,
519,
418,
796,
1351,
3419,
198,
77,
6975,
418,
796,
1351,
3419,
198,
198,
80,
8671,
62,
73,
519,
418,
796,
493... | 2.014706 | 272 |
if __name__ == '__main__':
print(main())
| [
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
3601,
7,
12417,
28955,
198
] | 2.238095 | 21 |
import pandas as pd
from autoscalingsim.utils.metric.metric_category import MetricCategory
from autoscalingsim.utils.error_check import ErrorChecker
| [
11748,
19798,
292,
355,
279,
67,
198,
198,
6738,
44619,
9948,
654,
320,
13,
26791,
13,
4164,
1173,
13,
4164,
1173,
62,
22872,
1330,
3395,
1173,
27313,
198,
6738,
44619,
9948,
654,
320,
13,
26791,
13,
18224,
62,
9122,
1330,
13047,
9787... | 3.409091 | 44 |
import brownie
from eip712.messages import EIP712Message
| [
11748,
7586,
494,
198,
6738,
304,
541,
49517,
13,
37348,
1095,
1330,
412,
4061,
49517,
12837,
628,
198
] | 3.277778 | 18 |
import os
from montagne import cfg
from montagne.common.log import getLogger
LOG = getLogger()
CONF = cfg.CONF
CONF.register_opts([
cfg.StrOpt('auth_uri',
default='http://localhost:5000/v2.0',
help='Complete public Identity API endpoint'),
cfg.StrOpt('identity_uri',
... | [
11748,
28686,
198,
6738,
40689,
21080,
1330,
30218,
70,
198,
6738,
40689,
21080,
13,
11321,
13,
6404,
1330,
651,
11187,
1362,
198,
198,
25294,
796,
651,
11187,
1362,
3419,
198,
198,
10943,
37,
796,
30218,
70,
13,
10943,
37,
198,
10943,
... | 2.188764 | 445 |
"""
File: Model Interface and its implementations
Copyright (C) 2020 Microsoft Corporation
SPDX-License-Identifier: MIT
"""
from abc import ABC, abstractmethod
import os
from unicorn import *
from unicorn.x86_const import *
from config import CONF
from custom_types import List, Tuple, CTrace
from helpers import assem... | [
37811,
198,
8979,
25,
9104,
26491,
290,
663,
25504,
198,
198,
15269,
357,
34,
8,
12131,
5413,
10501,
198,
4303,
36227,
12,
34156,
12,
33234,
7483,
25,
17168,
198,
37811,
198,
6738,
450,
66,
1330,
9738,
11,
12531,
24396,
198,
11748,
28... | 2.234803 | 2,517 |
from boto3.s3.transfer import TransferConfig
from functools import partial
from multiprocessing.pool import ThreadPool
from boto3.s3.transfer import TransferConfig
from multiprocessing import Process
import xml.etree.ElementTree as ET
import product_meta as pm
import boto3
import threading
import errno
import time
impo... | [
6738,
275,
2069,
18,
13,
82,
18,
13,
39437,
1330,
20558,
16934,
198,
6738,
1257,
310,
10141,
1330,
13027,
198,
6738,
18540,
305,
919,
278,
13,
7742,
1330,
14122,
27201,
198,
6738,
275,
2069,
18,
13,
82,
18,
13,
39437,
1330,
20558,
1... | 2.98692 | 841 |
import pickle
import numpy
import random
lines = open('word_ids.py', 'r').readline()
word_to_id = eval(lines)
components = None
with open('components_dump.txt', 'br') as c:
components = pickle.load(c)
windows_sum = sum(components[0]) # windows
not_windows_sum = sum(components[1]) # not windows
# recall = probab... | [
11748,
2298,
293,
198,
11748,
299,
32152,
198,
11748,
4738,
198,
198,
6615,
796,
1280,
10786,
4775,
62,
2340,
13,
9078,
3256,
705,
81,
27691,
961,
1370,
3419,
198,
4775,
62,
1462,
62,
312,
796,
5418,
7,
6615,
8,
198,
198,
5589,
3906... | 2.985112 | 403 |
'''
Extract interesting spectra from the full HI cube.
'''
import os
from spectral_cube import SpectralCube
import astropy.units as u
import matplotlib.pyplot as p
import seaborn as sn
sn.set_context('poster')
sn.set_style("ticks")
# path = "/srv/astro/erickoch/M33/"
path = "/media/eric/MyRAID/M33/14B-088/HI/full_im... | [
198,
7061,
6,
198,
11627,
974,
3499,
5444,
430,
422,
262,
1336,
36210,
23441,
13,
198,
7061,
6,
198,
198,
11748,
28686,
198,
6738,
37410,
62,
40296,
1330,
13058,
1373,
29071,
198,
11748,
6468,
28338,
13,
41667,
355,
334,
198,
11748,
2... | 1.891845 | 1,729 |
# Compatibility imports
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
#from .base_multi_gpus import MultiGPUBaseModel as BaseModel
from .base import BaseModel
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import tensorflow as tf... | [
2,
220,
46021,
17944,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
6738,
11593,
37443,
834,
1330,
7297,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
198,
2,
6738,
764,
8692,
62,
41684,
62,
31197,
385,
1330,
15... | 3.376682 | 223 |
# -*- coding: utf-8 -*-
from flask import Flask
from flask import request
from flask import make_response
from newsapi.articles import Articles
from google.appengine.api import app_identity
from random import shuffle
import json
import logging as l
import random
import numpy as np
import os
import cloudstorage as gcs... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
6738,
42903,
1330,
46947,
198,
6738,
42903,
1330,
2581,
198,
6738,
42903,
1330,
787,
62,
26209,
198,
6738,
1705,
15042,
13,
26845,
1330,
22698,
198,
6738,
23645,
13,
... | 2.417569 | 2,402 |
import ormar
| [
11748,
393,
3876,
628
] | 3.5 | 4 |
import csv
date = '2021-5-25'
# paths
mullvad_path = "data/stage3/csvs/{}/{}-mullvad.csv".format(date, date)
control_path = "data/stage3/csvs/{}/{}-control.csv".format(date, date)
aggragated_path = "analysis/stage3/aggregated/{}-aggregated.csv".format(date)
mullvad_analysis = "analysis/stage3/individual/mullvad-analy... | [
11748,
269,
21370,
198,
198,
4475,
796,
705,
1238,
2481,
12,
20,
12,
1495,
6,
198,
198,
2,
13532,
198,
76,
724,
85,
324,
62,
6978,
796,
366,
7890,
14,
14247,
18,
14,
6359,
14259,
14,
90,
92,
14,
90,
92,
12,
76,
724,
85,
324,
... | 2.571429 | 238 |
# -*- coding: utf-8 -*-
import sqlite3
import json
connection = sqlite3.connect('emitters.db')
cursor = connection.cursor()
cursor.execute("CREATE TABLE IF NOT EXISTS emitters "
"(id INTEGER PRIMARY KEY, name TEXT NOT NULL, risk TEXT)")
fh = open('emitters.json','r', encoding="utf-8")
emitters_list ... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
11748,
44161,
578,
18,
198,
11748,
33918,
198,
198,
38659,
796,
44161,
578,
18,
13,
8443,
10786,
368,
45512,
13,
9945,
11537,
198,
198,
66,
21471,
796,
4637,
13,
... | 2.488889 | 270 |
from mep3_msgs.action import VacuumPumpCommand
import rclpy
from rclpy.action import ActionServer, CancelResponse, GoalResponse
from rclpy.callback_groups import ReentrantCallbackGroup
from rclpy.executors import MultiThreadedExecutor
import rclpy.node
"""
# Move RIGHT arm to position:
ros2 action send_goal /big/dynami... | [
6738,
502,
79,
18,
62,
907,
14542,
13,
2673,
1330,
25709,
13814,
47,
931,
21575,
198,
11748,
374,
565,
9078,
198,
6738,
374,
565,
9078,
13,
2673,
1330,
7561,
10697,
11,
27910,
31077,
11,
25376,
31077,
198,
6738,
374,
565,
9078,
13,
... | 2.695364 | 755 |
# Copyright 2013-2022 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.package import *
class RBit(RPackage):
"""Classes and Methods for Fast Memory-Efficient Boolean Selection... | [
2,
15069,
2211,
12,
1238,
1828,
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,
... | 2.672222 | 360 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sys import argv
import bottle
from bottle import route, get, view, static_file
from titlecase import titlecase
bottle.debug(False)
@route("/resources/<filepath:path>")
@get('/')
@view('index')
@get('/<word>')
bottle.run(host='0.0.0.0', port=argv[1])
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
6738,
25064,
1330,
1822,
85,
198,
11748,
9294,
198,
6738,
9294,
1330,
6339,
11,
651,
11,
1570,
11,
9037,
62,
775... | 2.491935 | 124 |
import torch
from torchvision import models
class TorchModelFullyConv(torch.nn.Module):
"""Customize TorchVision models to replace fully connected layer by convolutional layer."""
| [
11748,
28034,
198,
6738,
28034,
10178,
1330,
4981,
628,
198,
4871,
34868,
17633,
37,
2132,
3103,
85,
7,
13165,
354,
13,
20471,
13,
26796,
2599,
198,
220,
220,
220,
37227,
15022,
1096,
34868,
44206,
4981,
284,
6330,
3938,
5884,
7679,
416... | 3.875 | 48 |
from unittest import TestCase
from guet.commands.add._args import ArgumentCheck
| [
6738,
555,
715,
395,
1330,
6208,
20448,
198,
198,
6738,
915,
316,
13,
9503,
1746,
13,
2860,
13557,
22046,
1330,
45751,
9787,
628
] | 3.565217 | 23 |
import os
import torch
from torchvision import models
from resnet_model import *
# extract vgg features
if __name__ == '__main__':
save_fold = '../weights'
if not os.path.exists(save_fold):
os.mkdir(save_fold)
resnet = models.resnet50(pretrained=True)
torch.save(resnet.state_dict(), os.path.join... | [
11748,
28686,
198,
11748,
28034,
198,
6738,
28034,
10178,
1330,
4981,
198,
6738,
581,
3262,
62,
19849,
1330,
1635,
198,
2,
7925,
410,
1130,
3033,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
3613,
... | 2.592593 | 135 |
from typing import Any, Callable, Optional
from rx3 import operators as ops
from rx3.core import Observable, pipe
from rx3.core.typing import Comparer
from rx3.internal.basic import default_comparer
| [
6738,
19720,
1330,
4377,
11,
4889,
540,
11,
32233,
198,
198,
6738,
374,
87,
18,
1330,
12879,
355,
39628,
198,
6738,
374,
87,
18,
13,
7295,
1330,
19243,
540,
11,
12656,
198,
6738,
374,
87,
18,
13,
7295,
13,
774,
13886,
1330,
3082,
... | 3.40678 | 59 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
import numpy as np
import matplotlib.pyplot as plt
mu = np.array([0., 0.])
cov = np.array([[1., 0.],
[1., 1.]])
num_points = 10000
x = np.random.multivariate_normal(mu, cov, num_points)
plt.plot(x[:,0], x[:,1], ".")
plt.xlim(-5... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
11748,
10688,
220,
198,
11748,
299,
32152,
355,
4594... | 1.945055 | 182 |
#coding:utf-8
import math
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
np.set_printoptions(linewidth=200,suppress=True)
mpl.rcParams['font.sans-serif'] = [u'SimHei'] # FangSong/黑体 FangSong/KaiTi
mpl.rcParams['axes.unicode_minus'] = False
# 6.2 验证中心极限定理
t = 1000
a = np.zeros(10000)
fo... | [
2,
66,
7656,
25,
40477,
12,
23,
198,
198,
11748,
10688,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
29487,
8019,
355,
285,
489,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
198,
37659,
13,
2617,
62,
4... | 2 | 254 |
# -*- coding: utf-8 -*-
import os
os.environ['MLCOMP_TESTING'] = '1'
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
11748,
28686,
198,
198,
418,
13,
268,
2268,
17816,
44,
5639,
2662,
47,
62,
51,
6465,
2751,
20520,
796,
705,
16,
6,
198
] | 1.891892 | 37 |
import math
import re
import numpy as np
import pandas as pd
import sys
if __name__ == '__main__':
build_and_save_map_plot()
| [
11748,
10688,
198,
11748,
302,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
25064,
628,
628,
628,
628,
628,
628,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
22... | 2.648148 | 54 |
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
import uuid
post_save.connect(create_profile, sender=User) | [
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,
13,
12683,
874,
1330,
1281,
62,
21928,
198,
11748,
334,
27112,
628,
198,
... | 3.232143 | 56 |
import argparse
from tqdm import tqdm
import torch
from torch.optim import SGD
from scalablebdl.converter import to_bayesian, to_deterministic
from scalablebdl.bnn_utils import freeze, unfreeze, disable_dropout
from scalablebdl.mean_field import PsiSGD
from dataset.cifar import load_dataset
from models.wrn import wrn
... | [
11748,
1822,
29572,
198,
6738,
256,
80,
36020,
1330,
256,
80,
36020,
198,
11748,
28034,
198,
6738,
28034,
13,
40085,
1330,
26147,
35,
198,
6738,
43865,
17457,
75,
13,
1102,
332,
353,
1330,
284,
62,
24406,
35610,
11,
284,
62,
67,
2357,... | 2.187651 | 826 |
from bson.objectid import ObjectId
from bson.errors import InvalidId
import json
from json import JSONEncoder
| [
6738,
275,
1559,
13,
15252,
312,
1330,
9515,
7390,
198,
6738,
275,
1559,
13,
48277,
1330,
17665,
7390,
198,
198,
11748,
33918,
198,
6738,
33918,
1330,
19449,
27195,
12342,
628,
628,
198
] | 3.59375 | 32 |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from typing import Any, Callable, Dict, Iterable, Mapping, Sequence
import hydra
from torchvision.transforms import Compose # @manua... | [
2,
15069,
357,
66,
8,
30277,
19193,
82,
11,
3457,
13,
290,
29116,
13,
198,
2,
198,
2,
770,
2723,
2438,
318,
11971,
739,
262,
347,
10305,
12,
7635,
5964,
1043,
287,
262,
198,
2,
38559,
24290,
2393,
287,
262,
6808,
8619,
286,
428,
... | 3.184659 | 352 |
# -*- coding: utf-8 -*-#
'''
# Name: randomForest
# Description:
# Author: super
# Date: 2020/3/16
'''
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
2,
198,
7061,
6,
198,
2,
6530,
25,
220,
220,
220,
220,
220,
220,
220,
220,
4738,
34605,
198,
2,
12489,
25,
220,
220,
198,
2,
6434,
25,
220,
220,
220,
220,
220,
220,
2... | 1.84058 | 69 |
"""
@Author: huuuuusy
@GitHub: https://github.com/huuuuusy
系统: Ubuntu 18.04
IDE: VS Code 1.36
工具: python == 3.7.3
"""
"""
思路:
双指针直接交换元素
结果:
执行用时 : 208 ms, 在所有 Python3 提交中击败了66.03%的用户
内存消耗 : 17.4 MB, 在所有 Python3 提交中击败了93.54%的用户
"""
if __name__ == "__main__":
nums = ["h","e","l","l","o"]
... | [
37811,
220,
198,
31,
13838,
25,
289,
12303,
12303,
385,
88,
198,
31,
38,
270,
16066,
25,
3740,
1378,
12567,
13,
785,
14,
71,
12303,
12303,
385,
88,
198,
163,
111,
119,
163,
119,
253,
171,
120,
248,
14949,
1248,
13,
3023,
198,
1411... | 1.348432 | 287 |
from django.core import checks
from django.db import models
from django.db.models.aggregates import Sum
from django.utils import timezone
# from django.utils.translation import gettext_lazy as _
from shop.conf import app_settings
from shop.shopmodels.product import Availability, BaseReserveProductMixin
from shop.except... | [
6738,
42625,
14208,
13,
7295,
1330,
8794,
198,
6738,
42625,
14208,
13,
9945,
1330,
4981,
198,
6738,
42625,
14208,
13,
9945,
13,
27530,
13,
9460,
2301,
689,
1330,
5060,
198,
6738,
42625,
14208,
13,
26791,
1330,
640,
11340,
198,
2,
422,
... | 2.899619 | 1,574 |
import torch
import torch.nn as nn
from src.Video.models.sequenceLearning.environment import DEVICE
from src.Video.models.sequenceLearning.nn.modules import Embed, LSTMEncoder, SelfAttention
from torchvision.models import densenet121
class FeatureExtractor(nn.Module):
"""
Feature extraction initialization part o... | [
11748,
28034,
198,
11748,
28034,
13,
20471,
355,
299,
77,
198,
198,
6738,
12351,
13,
10798,
13,
27530,
13,
43167,
41730,
13,
38986,
1330,
5550,
27389,
198,
6738,
12351,
13,
10798,
13,
27530,
13,
43167,
41730,
13,
20471,
13,
18170,
1330,... | 2.880559 | 1,574 |
default_app_config = 'src.services.apps.ServicesConfig' | [
12286,
62,
1324,
62,
11250,
796,
705,
10677,
13,
30416,
13,
18211,
13,
31007,
16934,
6
] | 3.4375 | 16 |
from mock import patch
patch.object() | [
6738,
15290,
1330,
8529,
198,
198,
17147,
13,
15252,
3419
] | 3.8 | 10 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2017 Contributor
#
# 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
#
# ... | [
2,
532,
9,
12,
269,
9078,
12,
521,
298,
12,
5715,
25,
604,
26,
33793,
12,
8658,
82,
12,
14171,
25,
18038,
532,
9,
12,
198,
2,
409,
25,
900,
4292,
8658,
2705,
8658,
11338,
28,
19,
6482,
10394,
28,
19,
25,
198,
2,
198,
2,
1506... | 3.427778 | 360 |
# -*- coding: utf-8 -*-
from .build import META_ARCH_REGISTRY, build_model # isort:skip
from .panoptic_fpn import PanopticFPN
# import all the meta_arch, so they will be registered
from .rcnn import GeneralizedRCNN, ProposalNetwork
from .retinanet import RetinaNet
from .semantic_seg import SEM_SEG_HEADS_REGISTRY, S... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
6738,
764,
11249,
1330,
337,
20892,
62,
31315,
62,
31553,
1797,
40405,
11,
1382,
62,
19849,
220,
1303,
318,
419,
25,
48267,
198,
198,
6738,
764,
6839,
8738,
291,
... | 2.773723 | 137 |
# This script is responsible for getting the Tweets from the users/ subscribers
# The bot currently supports four commands:
#
# 1. "Subscribe <HSL_route_id>" (example: Subscribe HSL:1023)
# 2. "Unsubscribe <HSL_route_id>" (example: Unsubscribe HSL:1023)
# 3. "Unsubscribe all" (unsubscribes from all routes)
# 4. "Get su... | [
2,
770,
4226,
318,
4497,
329,
1972,
262,
24205,
1039,
422,
262,
2985,
14,
18327,
198,
2,
383,
10214,
3058,
6971,
1440,
9729,
25,
198,
2,
198,
2,
352,
13,
366,
27125,
1279,
7998,
43,
62,
38629,
62,
312,
24618,
357,
20688,
25,
19808... | 3.212801 | 1,203 |
"""
Index search.
"""
from microcosm_elasticsearch.errors import translate_elasticsearch_errors
class SearchIndex:
"""
Encapsulates search against an index.
An index may have many (polymorphic) document types registered with it. The search index
handles this complexity in two ways:
- It creat... | [
37811,
198,
15732,
2989,
13,
198,
198,
37811,
198,
6738,
4580,
6966,
76,
62,
417,
3477,
12947,
13,
48277,
1330,
15772,
62,
417,
3477,
12947,
62,
48277,
628,
198,
4871,
11140,
15732,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
... | 2.372066 | 1,747 |
# -*- coding: utf-8 -*-
"""
***********************************************
Pablo Fernandez
Jenna Stanley
Copyright 2016, www.pablofernandez.com
***********************************************
"""
print("************************************");
print("Pablo Fernandez");
print("Jenna Stanley");
print("Program 03A Euler... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
17174,
46068,
8162,
198,
47,
18817,
39692,
220,
198,
41,
13713,
14167,
198,
15269,
1584,
11,
7324,
13,
79,
23117,
1659,
18092,
13,
785,
198,
17174,
46068,
81... | 2.570922 | 846 |
# Generated by Django 2.1.14 on 2020-09-11 16:27
from django.db import migrations, models
| [
2,
2980,
515,
416,
37770,
362,
13,
16,
13,
1415,
319,
12131,
12,
2931,
12,
1157,
1467,
25,
1983,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.875 | 32 |
import os
from typing import Optional
from inoft_vocal_framework.utils.general import load_json
| [
11748,
28686,
198,
6738,
19720,
1330,
32233,
198,
198,
6738,
287,
11205,
62,
85,
4374,
62,
30604,
13,
26791,
13,
24622,
1330,
3440,
62,
17752,
628
] | 3.769231 | 26 |
from py_expression_eval import Parser
import random
import math
"""
Estimates the integral of function over the interval (a, b) using an specified number of rectangles and Simpson's Method
Args:
function: A py_expression expression
a: A float number that represents the left bound of integ... | [
6738,
12972,
62,
38011,
62,
18206,
1330,
23042,
263,
201,
198,
11748,
4738,
201,
198,
11748,
10688,
201,
198,
201,
198,
37811,
201,
198,
47052,
262,
19287,
286,
2163,
625,
262,
16654,
357,
64,
11,
275,
8,
1262,
281,
7368,
1271,
286,
... | 3.226106 | 2,804 |
import pytest
import copy
from pyAssignment.Assignment.Question import Question
from pyAssignment.Assignment.Answers import MultipleChoice
# from .Utils import Approx
| [
11748,
12972,
9288,
198,
11748,
4866,
198,
6738,
12972,
8021,
16747,
13,
8021,
16747,
13,
24361,
1330,
18233,
198,
6738,
12972,
8021,
16747,
13,
8021,
16747,
13,
2025,
37848,
220,
1330,
20401,
46770,
198,
2,
422,
764,
18274,
4487,
1330,
... | 3.886364 | 44 |
import os
import copy
import pytest
import pandas as pd
import numpy as np
from nnaps.mesa import extract_mesa, fileio
| [
11748,
28686,
198,
11748,
4866,
198,
11748,
12972,
9288,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
299,
32152,
355,
45941,
198,
198,
6738,
299,
77,
1686,
13,
6880,
64,
1330,
7925,
62,
6880,
64,
11,
2393,
952,
628,
628
] | 3 | 41 |
import os
import typing as t
import logging
import re
import pandas as pd
from Bio import SeqIO
logger = logging.getLogger(__name__)
from dataclasses import dataclass
@dataclass
if __name__ == "__main__":
input_path = "/groups/itay_mayrose/halabikeren/vir_to_host/associations/viral_species_seq_data/no_outl... | [
11748,
28686,
198,
11748,
19720,
355,
256,
198,
11748,
18931,
198,
198,
11748,
302,
198,
198,
11748,
19798,
292,
355,
279,
67,
198,
6738,
16024,
1330,
1001,
80,
9399,
198,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
36... | 2.593968 | 431 |
# Copyright 2021 Curtin University
#
# 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 in writi... | [
2,
15069,
33448,
19569,
259,
2059,
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,
743... | 3.83105 | 219 |
# -*- coding: utf-8 -*-
import sys
import logging
import optparse
import multiprocessing
import salt_confd.version
from salt.ext import six
import salt.version
import salt.utils.args
import salt.utils.parsers
import salt.config as config
def salt_information():
'''
Return version of Salt and salt-sproxy.
... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
11748,
25064,
198,
11748,
18931,
198,
11748,
2172,
29572,
198,
11748,
18540,
305,
919,
278,
198,
198,
11748,
8268,
62,
10414,
67,
13,
9641,
198,
198,
6738,
8268,
13... | 2.5 | 674 |