content stringlengths 1 1.04M | input_ids listlengths 1 774k | ratio_char_token float64 0.38 22.9 | token_count int64 1 774k |
|---|---|---|---|
import pytest
from pathlib import Path
root = Path(__file__).parent.resolve()
@pytest.fixture(scope="session")
def csv_path() -> str:
"""
Returns a path to a CSV file. The file has a column called 'fips' representing unique county IDs. It joins
with a column called 'GEOID' in the topojson file at topo_p... | [
11748,
12972,
9288,
198,
6738,
3108,
8019,
1330,
10644,
628,
198,
15763,
796,
10644,
7,
834,
7753,
834,
737,
8000,
13,
411,
6442,
3419,
628,
198,
31,
9078,
9288,
13,
69,
9602,
7,
29982,
2625,
29891,
4943,
198,
4299,
269,
21370,
62,
... | 2.896194 | 289 |
"""
3. MNE Interface Cycle Feature Distributions
============================================
Compute bycycle feature distributions using MNE objects.
"""
####################################################################################################
# Import Packages and Load Data
# ----------------------------... | [
37811,
198,
18,
13,
337,
12161,
26491,
26993,
27018,
46567,
507,
198,
10052,
25609,
198,
198,
7293,
1133,
416,
13696,
3895,
24570,
1262,
337,
12161,
5563,
13,
198,
37811,
198,
198,
29113,
29113,
29113,
4242,
198,
2,
17267,
6400,
1095,
2... | 3.156271 | 1,459 |
import string
#Translate in python has 2 pieces, a translation table and the translate call.
#The translation table is a list of 256 characters. Changing the order of the #characters is used for mapping
norm = string.maketrans('', '') #builds list of all characters
print len(norm) #256 characters
print string.maketr... | [
11748,
4731,
198,
198,
2,
8291,
17660,
287,
21015,
468,
362,
5207,
11,
257,
11059,
3084,
290,
262,
15772,
869,
13,
198,
2,
464,
11059,
3084,
318,
257,
1351,
286,
17759,
3435,
13,
33680,
262,
1502,
286,
262,
1303,
10641,
19858,
318,
... | 3.119048 | 756 |
from django.urls import path
from manti_by.apps.gallery import views
urlpatterns = [path("", views.index, name="gallery_list")]
| [
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
198,
198,
6738,
285,
17096,
62,
1525,
13,
18211,
13,
24460,
1330,
5009,
628,
198,
6371,
33279,
82,
796,
685,
6978,
7203,
1600,
5009,
13,
9630,
11,
1438,
2625,
24460,
62,
4868,
4943,
60,
... | 3.046512 | 43 |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import copy
from dataclasses import dataclass
from typing import Any, Dict, List, Optional
from omegaconf import DictConfig, OmegaConf
from hydra.core.object_type import ObjectType
from hydra.core.singleton import Singleton
from hydra.plugins.conf... | [
2,
15069,
357,
66,
8,
3203,
11,
3457,
13,
290,
663,
29116,
13,
1439,
6923,
33876,
198,
11748,
4866,
198,
6738,
4818,
330,
28958,
1330,
4818,
330,
31172,
198,
6738,
19720,
1330,
4377,
11,
360,
713,
11,
7343,
11,
32233,
198,
198,
6738... | 3.717172 | 99 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | [
2,
198,
2,
49962,
284,
262,
24843,
10442,
5693,
357,
1921,
37,
8,
739,
530,
198,
2,
393,
517,
18920,
5964,
11704,
13,
220,
4091,
262,
28536,
2393,
198,
2,
9387,
351,
428,
670,
329,
3224,
1321,
198,
2,
5115,
6634,
9238,
13,
220,
... | 3.723112 | 437 |
#
# Tests the Component class bindings
#
import unittest
from test_resources import file_contents
if __name__ == '__main__':
unittest.main()
| [
2,
198,
2,
30307,
262,
35100,
1398,
34111,
198,
2,
198,
11748,
555,
715,
395,
198,
198,
6738,
1332,
62,
37540,
1330,
2393,
62,
3642,
658,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
... | 2.98 | 50 |
import pandas as pd
from ..utils._docs import fill_doc
from .average import add_average_column
@fill_doc
def ratio(df_alpha, df_delta):
"""Compute the ratio of alpha/delta band power.
Parameters
----------
%(df_psd)s
Contains alpha-band PSD.
%(df_psd)s
Contains delta-band PSD.
... | [
11748,
19798,
292,
355,
279,
67,
198,
198,
6738,
11485,
26791,
13557,
31628,
1330,
6070,
62,
15390,
198,
6738,
764,
23913,
1330,
751,
62,
23913,
62,
28665,
628,
198,
31,
20797,
62,
15390,
198,
4299,
8064,
7,
7568,
62,
26591,
11,
47764... | 2.291022 | 969 |
import numpy as np
import pytest
import numgrad as ng
@pytest.mark.parametrize('function, expect', [
(lambda: np.asarray(ng.Variable([0, 1])), np.array([0., 1.])),
(lambda: 0. in ng.Variable(0.), TypeError),
(lambda: 0. in ng.Variable([0.]), True),
(lambda: 1. in ng.Variable([[0., 1.], [2., 3.]... | [
11748,
299,
32152,
355,
45941,
198,
11748,
12972,
9288,
198,
198,
11748,
997,
9744,
355,
23370,
628,
628,
628,
628,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
10786,
8818,
11,
1607,
3256,
685,
198,
220,
220,
220,
357,
... | 2.289318 | 674 |
# From https://stackoverflow.com/questions/30988033/
# sending-live-video-frame-over-network-in-python-opencv
from numpysocket import NumpySocket
import cv2
npSocket = NumpySocket()
npSocket.startClient(9999)
# Read until video is completed
while True:
# Capture frame-by-frame
frame = npSocket.recieveNu... | [
2,
3574,
3740,
1378,
25558,
2502,
11125,
13,
785,
14,
6138,
507,
14,
1270,
4089,
1795,
2091,
14,
198,
2,
220,
220,
220,
220,
220,
7216,
12,
12583,
12,
15588,
12,
14535,
12,
2502,
12,
27349,
12,
259,
12,
29412,
12,
9654,
33967,
198... | 2.587302 | 189 |
import datetime, os, sys
import subprocess
#### #### #### #### ####
#### Functions ####
#### #### #### #### ####
#### #### #### #### ####
#### Main ####
#### #### #### #### ####
try:
## Variables initialization
targetDirectory = GetTargetDirectory()
alternativeDate = GetAlternativeDate()
... | [
11748,
4818,
8079,
11,
28686,
11,
25064,
198,
11748,
850,
14681,
628,
198,
4242,
1303,
21017,
1303,
21017,
1303,
21017,
1303,
21017,
220,
198,
4242,
40480,
1303,
21017,
220,
198,
4242,
1303,
21017,
1303,
21017,
1303,
21017,
1303,
21017,
2... | 2.819277 | 249 |
from os import environ
import pytest
from opentsdb import TSDBClient, TSDBConnectProtocols, Counter
@pytest.fixture
@pytest.fixture
@pytest.fixture
@pytest.fixture
@pytest.fixture
@pytest.fixture
| [
6738,
28686,
1330,
551,
2268,
198,
198,
11748,
12972,
9288,
198,
198,
6738,
1034,
658,
9945,
1330,
309,
10305,
33,
11792,
11,
309,
10305,
2749,
261,
1606,
19703,
4668,
82,
11,
15034,
628,
198,
31,
9078,
9288,
13,
69,
9602,
628,
198,
... | 2.573171 | 82 |
from django.apps import AppConfig
| [
6738,
42625,
14208,
13,
18211,
1330,
2034,
16934,
628
] | 3.888889 | 9 |
#!/usr/bin/env python2.7
import numpy as np
import os
import random
import sys
from scipy.ndimage import imread
dataset = sys.argv[1]
outputdir = sys.argv[2] if len(sys.argv) == 3 else 'data'
minibatches = 10
minibatch_size = 500
split_channels = lambda x: np.array((x[:,:,0], x[:,:,1], x[:,:,2]))
images = os.listd... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
17,
13,
22,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
28686,
198,
11748,
4738,
198,
11748,
25064,
198,
198,
6738,
629,
541,
88,
13,
358,
9060,
1330,
545,
961,
198,
198,
19608,
... | 2.249377 | 802 |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from requests import Session as BaseSession
from log_request_id import DEFAULT_NO_REQUEST_ID, OUTGOING_REQUEST_ID_HEADER_SETTING, REQUEST_ID_HEADER_SETTING, local
| [
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
6738,
42625,
14208,
13,
7295,
13,
1069,
11755,
1330,
12205,
525,
306,
16934,
1522,
198,
6738,
7007,
1330,
23575,
355,
7308,
36044,
198,
198,
6738,
2604,
62,
25927,
62,
312,
1330,
5550,
388... | 3.298701 | 77 |
# future imports
from __future__ import unicode_literals
# stdlib imports
import logging
import time
import threading
# third-party imports
import pykka
from mopidy.core import CoreListener
logger = logging.getLogger(__name__)
class WebhookPlayback(pykka.ThreadingActor, CoreListener):
"""Control the tracklist... | [
2,
2003,
17944,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
198,
2,
14367,
8019,
17944,
198,
11748,
18931,
198,
11748,
640,
198,
11748,
4704,
278,
198,
198,
2,
2368,
12,
10608,
17944,
198,
11748,
12972,
74,
4... | 2.189144 | 2,395 |
from lxml import html
import requests
import sqlite3
c = sqlite3.connect('bling.db')
oldscore={}
for row in c.execute('SELECT * FROM users'):
print(row)
| [
6738,
300,
19875,
1330,
27711,
198,
11748,
7007,
198,
11748,
44161,
578,
18,
198,
66,
796,
44161,
578,
18,
13,
8443,
10786,
11108,
13,
9945,
11537,
198,
198,
727,
26675,
34758,
92,
198,
198,
1640,
5752,
287,
269,
13,
41049,
10786,
465... | 2.925926 | 54 |
from vgn.exceptions import VgnGetError
from vgn.data_classes import *
import vgn.converter as conv
import datetime
import asyncio
import aiohttp
if __name__ == '__main__':
asyncio.run(main())
| [
6738,
410,
4593,
13,
1069,
11755,
1330,
569,
4593,
3855,
12331,
198,
6738,
410,
4593,
13,
7890,
62,
37724,
1330,
1635,
198,
11748,
410,
4593,
13,
1102,
332,
353,
355,
3063,
198,
11748,
4818,
8079,
198,
11748,
30351,
952,
198,
11748,
2... | 2.898551 | 69 |
"""Package for all services."""
from .validator_service import Config, ValidatorService
| [
37811,
27813,
329,
477,
2594,
526,
15931,
198,
6738,
764,
12102,
1352,
62,
15271,
1330,
17056,
11,
48951,
1352,
16177,
198
] | 4.190476 | 21 |
#!/usr/bin/env python3
# encoding: utf-8
import os
import random
from typing import NoReturn
import numpy as np
import torch as th
from rls.utils.display import colorize
from rls.utils.logging_utils import get_logger
logger = get_logger(__name__)
def check_or_create(dicpath: str, name: str = '') -> NoReturn:
... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
21004,
25,
3384,
69,
12,
23,
198,
198,
11748,
28686,
198,
11748,
4738,
198,
6738,
19720,
1330,
1400,
13615,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
28034,
355,
294,... | 2.495845 | 361 |
import torch.nn as nn
from mmdet.core import bbox2result
from .. import builder
from ..registry import DETECTORS
from .seq_base import SeqBaseDetector
@DETECTORS.register_module
| [
11748,
28034,
13,
20471,
355,
299,
77,
198,
198,
6738,
8085,
15255,
13,
7295,
1330,
275,
3524,
17,
20274,
198,
6738,
11485,
1330,
27098,
198,
6738,
11485,
2301,
4592,
1330,
38267,
9782,
20673,
198,
6738,
764,
41068,
62,
8692,
1330,
1001... | 3.196429 | 56 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import operator
labels = {}
f = open('log.txt', 'r')
for line in f.readlines():
s = line.strip().split('| ')
name = s[0].split(' ')[0].strip()
if len(s) != 2:
safe_add(name, 'other')
continue
lbls = s[1].strip().split(';')
for lab... | [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
11748,
10088,
198,
198,
23912,
1424,
796,
23884,
628,
220,
220,
220,
220,
198,
198,
69,
796,
1280,
10786,
6404,
13,
141... | 2.167247 | 287 |
# Copyright 2021, 2022 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | [
2,
220,
15069,
33448,
11,
33160,
19764,
10501,
198,
2,
198,
2,
220,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
220,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
... | 3.624365 | 197 |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 7 12:21:17 2017
@author: Rochlitz.R
"""
import matplotlib.pyplot as plt
import numpy as np
import pygimli as pg
from custEM.meshgen.invmesh_tools import PrismWorld
from custEM.meshgen import meshgen_utils as mu
from custEM.inv.inv_utils import MultiFWD
xt, zt = np.load... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
41972,
319,
30030,
5267,
220,
767,
1105,
25,
2481,
25,
1558,
2177,
198,
198,
31,
9800,
25,
371,
5374,
75,
4224,
13,
49,
198,
37811,
198,
198,
11748,
2603,
... | 2.006229 | 2,087 |
"""
Test Prolog script.
"""
from unittest import mock
import pytest
from lm_agent.workload_managers.slurm.slurmctld_prolog import prolog as main
@pytest.mark.asyncio
@mock.patch("lm_agent.workload_managers.slurm.slurmctld_prolog.sys")
@mock.patch("lm_agent.workload_managers.slurm.slurmctld_prolog.get_job_context")
... | [
37811,
198,
14402,
1041,
6404,
4226,
13,
198,
37811,
198,
6738,
555,
715,
395,
1330,
15290,
198,
198,
11748,
12972,
9288,
198,
198,
6738,
300,
76,
62,
25781,
13,
1818,
2220,
62,
805,
10321,
13,
6649,
333,
76,
13,
6649,
333,
76,
310,... | 2.236868 | 1,009 |
"""Context processors and other useful functions"""
from re import template
from flask import Blueprint, current_app as app
from datetime import datetime
from blogapp import fc
contexts_bp = Blueprint("contexts_bp", __name__)
@contexts_bp.app_context_processor
def datetime_processor():
"""Inject current date/t... | [
37811,
21947,
20399,
290,
584,
4465,
5499,
37811,
198,
6738,
302,
1330,
11055,
198,
6738,
42903,
1330,
39932,
11,
1459,
62,
1324,
355,
598,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
198,
6738,
4130,
1324,
1330,
277,
66,
628,
198,
... | 2.898667 | 375 |
from setuptools import setup
from pathlib import Path
subpackage_path = (Path(__file__).parent / "deps" / "subpackage").resolve()
setup(
name="mainpackage",
version="0.1",
packages="mainpackage",
install_requires=[
f"subpackage @ git+file://{subpackage_path}#subpackage-0.1",
],
)
| [
6738,
900,
37623,
10141,
1330,
9058,
198,
6738,
3108,
8019,
1330,
10644,
198,
198,
7266,
26495,
62,
6978,
796,
357,
15235,
7,
834,
7753,
834,
737,
8000,
1220,
366,
10378,
82,
1,
1220,
366,
7266,
26495,
11074,
411,
6442,
3419,
198,
198... | 2.613445 | 119 |
#
# Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
#
"""
This file contains implementation of managing physical router configuration
"""
# Import kazoo.client before monkey patching
from cfgm_common.zkclient import ZookeeperClient
from gevent import monkey
monkey.patch_all()
from cfgm_common.vnc_kombu... | [
2,
198,
2,
15069,
357,
66,
8,
1946,
7653,
9346,
27862,
11,
3457,
13,
1439,
2489,
10395,
13,
198,
2,
198,
198,
37811,
198,
1212,
2393,
4909,
7822,
286,
11149,
3518,
20264,
8398,
198,
37811,
198,
198,
2,
17267,
479,
1031,
2238,
13,
... | 2.160902 | 4,568 |
# Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation
# the rights to ... | [
2,
15069,
357,
66,
8,
5413,
10501,
198,
2,
1439,
2489,
10395,
13,
198,
2,
198,
2,
17168,
13789,
198,
2,
198,
2,
2448,
3411,
318,
29376,
7520,
11,
1479,
286,
3877,
11,
284,
597,
1048,
16727,
257,
4866,
286,
428,
3788,
290,
3917,
... | 3.986842 | 304 |
# Copyright 2021 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | [
2,
15069,
33448,
6186,
13,
785,
11,
3457,
13,
393,
663,
29116,
13,
1439,
6923,
33876,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
11074,
198,
2,
921,
743,
407,
779,
428,
2393,
... | 2.78481 | 948 |
"""A full binary tree example"""
from dbcbet.dbcbet import pre, post, inv, bet, finitize, finitize_method
from dbcbet.helpers import state, argument_types
@inv(full_tree_invariant)
if __name__ == "__main__":
bet(FullBinaryTree).run()
| [
37811,
32,
1336,
13934,
5509,
1672,
37811,
198,
198,
6738,
288,
15630,
11181,
13,
9945,
66,
11181,
1330,
662,
11,
1281,
11,
800,
11,
731,
11,
957,
270,
1096,
11,
957,
270,
1096,
62,
24396,
198,
6738,
288,
15630,
11181,
13,
16794,
36... | 2.645161 | 93 |
import argparse
import random
import numpy as np
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Create train and test splits.")
parser.add_argument("-i", "--image_list", help="List of images to split.")
parser.add_argument(
"-p", "--percent", help="Percent of data used... | [
11748,
1822,
29572,
198,
11748,
4738,
198,
198,
11748,
299,
32152,
355,
45941,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
30751,
796,
1822,
29572,
13,
28100,
1713,
46677,
7,
11213,
2625,
... | 2.757396 | 169 |
import heapq
arr = [3, 0, 1, 0]
k = 1
li = kFrequent(arr, k)
print(li) | [
11748,
24575,
80,
628,
198,
3258,
796,
685,
18,
11,
657,
11,
352,
11,
657,
60,
198,
74,
796,
352,
198,
4528,
796,
479,
37,
46018,
7,
3258,
11,
479,
8,
198,
4798,
7,
4528,
8
] | 2 | 36 |
from math.utils import *
def main():
"""
main() -> None
"""
myVariable = complex()
print(myVariable)
sumatoria(3)
print(calVolumenParalelepipedo(2, 3, 10))
print(sumatoria(3))
print(sumatoriaLambda(3))
return None
sumatoriaLambda = lambda x: (x * (x + 1)) / 2
# print(result... | [
6738,
10688,
13,
26791,
1330,
1635,
198,
198,
4299,
1388,
33529,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1388,
3419,
4613,
6045,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
616,
43015,
796,
3716,
3419,
198,
220,
220,
220,
... | 2.335714 | 420 |
from numba import *
a = 10
b = 11
c = 12
func = jitter()
assert func() == (20, 22)
| [
6738,
997,
7012,
1330,
1635,
198,
198,
64,
796,
838,
198,
65,
796,
1367,
198,
66,
796,
1105,
198,
198,
20786,
796,
474,
1967,
3419,
198,
30493,
25439,
3419,
6624,
357,
1238,
11,
2534,
8,
198
] | 2.361111 | 36 |
"""
A generic tab that displays a serie of items in a scrollable, searchable,
sortable list. It should be inherited, to actually provide methods that
insert items in the list, and that lets the user interact with them.
"""
import curses
import collections
import logging
from typing import Dict, Callable
from poezio ... | [
37811,
198,
32,
14276,
7400,
326,
11298,
257,
1055,
494,
286,
3709,
287,
257,
10743,
540,
11,
2989,
540,
11,
198,
30619,
540,
1351,
13,
220,
632,
815,
307,
19552,
11,
284,
1682,
2148,
5050,
326,
198,
28463,
3709,
287,
262,
1351,
11,... | 3.70229 | 131 |
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name='board_home'),
path('new/', views.new, name='board_new'),
path('detail/<int:board_id>', views.detail, name='board_detail'),
path('delete/<int:board_id>', views.delete, name='board_delete'),
path('edit/<int:bo... | [
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
198,
6738,
764,
1330,
5009,
198,
198,
6371,
33279,
82,
796,
685,
198,
220,
220,
220,
3108,
10786,
3256,
5009,
13,
11195,
11,
1438,
11639,
3526,
62,
11195,
33809,
198,
220,
220,
220,
3108,
... | 2.669118 | 136 |
#!/usr/bin/env python
# encoding: utf-8
"""
Advent of Code 2020 - Day 9 - Challenge 2
https://adventofcode.com/2020/day/9
Solution: 35602097
"""
__author__ = "Filippo Corradino"
__email__ = "filippo.corradino@gmail.com"
from day09_1 import find_invalid
if __name__ == "__main__":
main()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
21004,
25,
3384,
69,
12,
23,
198,
37811,
198,
2782,
1151,
286,
6127,
12131,
532,
3596,
860,
532,
13879,
362,
198,
5450,
1378,
324,
1151,
1659,
8189,
13,
785,
14,
42334,
14,
820,
... | 2.504202 | 119 |
# PreviesSearchPage.py
from selenium import webdriver
from selenium.webdriver.common.by import By
from bs4 import BeautifulSoup
import BusinessPaths
import time
import PrettifyPage
import CreateDict
import json
import sys
if __name__ == '__main__':
PreviewSearchPage()
| [
2,
43280,
444,
18243,
9876,
13,
9078,
198,
198,
6738,
384,
11925,
1505,
1330,
3992,
26230,
198,
6738,
384,
11925,
1505,
13,
12384,
26230,
13,
11321,
13,
1525,
1330,
2750,
198,
6738,
275,
82,
19,
1330,
23762,
50,
10486,
198,
11748,
732... | 3.22093 | 86 |
from typing import List, Union
from pydantic import BaseModel, validator
from app.event_models import EventModel
JOIN_ROOM = "JOIN_ROOM"
REJOIN_ROOM = "REJOIN_ROOM"
ROOM_JOINED = "ROOM_JOINED"
NEW_ROOM_JOINED = "NEW_ROOM_JOINED"
KICK_PLAYER = "KICK_PLAYER"
PLAYER_KICKED = "PLAYER_KICKED"
PLAYER_DISCONNECTED = "PLAYE... | [
6738,
19720,
1330,
7343,
11,
4479,
198,
198,
6738,
279,
5173,
5109,
1330,
7308,
17633,
11,
4938,
1352,
198,
198,
6738,
598,
13,
15596,
62,
27530,
1330,
8558,
17633,
198,
198,
45006,
1268,
62,
13252,
2662,
796,
366,
45006,
1268,
62,
13... | 2.283505 | 194 |
import torch
import torchvision
import torchvision.transforms as transforms
import matplotlib.pyplot as plt
import numpy as np
classes = ('beaver','dolphin','otter','seal','whale','aquarium fish','flatfish','ray','shark','trout','orchids','poppies','roses','sunflowers','tulips','bottles','bowls','cans','cups','plates'... | [
11748,
28034,
198,
11748,
28034,
10178,
198,
11748,
28034,
10178,
13,
7645,
23914,
355,
31408,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
299,
32152,
355,
45941,
198,
198,
37724,
796,
19203,
1350,
8770,
4170... | 3.175287 | 348 |
# Generated by Django 2.1.7 on 2019-04-26 09:16
from django.db import migrations, models
| [
2,
2980,
515,
416,
37770,
362,
13,
16,
13,
22,
319,
13130,
12,
3023,
12,
2075,
7769,
25,
1433,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.84375 | 32 |
from keras_efficientnets.efficientnet import *
from keras_efficientnets.config import BlockArgs
__version__ = '0.1.6.1'
| [
6738,
41927,
292,
62,
16814,
45938,
13,
16814,
3262,
1330,
1635,
198,
6738,
41927,
292,
62,
16814,
45938,
13,
11250,
1330,
9726,
42035,
198,
198,
834,
9641,
834,
796,
705,
15,
13,
16,
13,
21,
13,
16,
6,
198
] | 3.102564 | 39 |
from pikapi.spiders.spider_by_browser import *
from pikapi.spiders.spider_by_cookie import *
from pikapi.spiders.spider_by_req import *
all_providers = [
SpiderXiladaili,
SpiderYqie,
SpiderZdaye,
SpiderSuperfastip,
SpiderXsdaili,
SpiderCrossincode,
SpiderTxt,
SpiderKxdaili,
SpiderJ... | [
6738,
279,
1134,
15042,
13,
2777,
4157,
13,
2777,
1304,
62,
1525,
62,
40259,
1330,
1635,
198,
6738,
279,
1134,
15042,
13,
2777,
4157,
13,
2777,
1304,
62,
1525,
62,
44453,
1330,
1635,
198,
6738,
279,
1134,
15042,
13,
2777,
4157,
13,
... | 2.188119 | 303 |
import argparse
import os
from scipy.io import loadmat
import numpy as np
import cv2
import matplotlib
matplotlib.use('agg') # use matplotlib without GUI support
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser()
parser.add_argument('--data_dir', type=str, default='/home/xuchong/Projects/occ_edge_or... | [
11748,
1822,
29572,
198,
11748,
28686,
198,
6738,
629,
541,
88,
13,
952,
1330,
3440,
6759,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
269,
85,
17,
198,
198,
11748,
2603,
29487,
8019,
198,
6759,
29487,
8019,
13,
1904,
10786,
9460,
... | 2.347774 | 831 |
import os
import os.path as osp
import re
import numpy as np
from numpy import array, int32
from scipy.io import loadmat
from .base import BaseDataset
| [
11748,
28686,
198,
11748,
28686,
13,
6978,
355,
267,
2777,
198,
11748,
302,
198,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
299,
32152,
1330,
7177,
11,
493,
2624,
198,
6738,
629,
541,
88,
13,
952,
1330,
3440,
6759,
198,
198,
6738,... | 3.08 | 50 |
"""
A list of functions that return gameObject classes of primitive shapes.
"""
from math import cos, sin, pi
from .object2d import Object2D
# ----------------------------------------------------------------------------------------
def draw_square(x:float, y:float, height:float = 1, width:float = 1, fill... | [
37811,
201,
198,
197,
32,
1351,
286,
5499,
326,
1441,
983,
10267,
6097,
286,
20049,
15268,
13,
201,
198,
201,
198,
37811,
201,
198,
201,
198,
6738,
10688,
1330,
8615,
11,
7813,
11,
31028,
201,
198,
201,
198,
6738,
764,
15252,
17,
67... | 2.664434 | 1,642 |
# Copyright (c) 2021, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
#... | [
2,
15069,
357,
66,
8,
33448,
11,
18650,
290,
14,
273,
663,
29116,
13,
201,
198,
2,
201,
198,
2,
770,
1430,
318,
1479,
3788,
26,
345,
460,
17678,
4163,
340,
290,
14,
273,
13096,
201,
198,
2,
340,
739,
262,
2846,
286,
262,
22961,
... | 2.169614 | 10,801 |
"""
This file is a part of My-PyChess application.
In this file, we define some basic gui-related functions
For a better understanding of the variables used here, checkout docs.txt
"""
import pygame
from tools.loader import CHESS, BACK, putNum, putLargeNum
from tools import sound
# Apply 'convert_alpha()' o... | [
37811,
201,
198,
1212,
2393,
318,
257,
636,
286,
2011,
12,
20519,
7376,
824,
3586,
13,
201,
198,
818,
428,
2393,
11,
356,
8160,
617,
4096,
11774,
12,
5363,
5499,
201,
198,
201,
198,
1890,
257,
1365,
4547,
286,
262,
9633,
973,
994,
... | 3.642857 | 238 |
from django.urls import path
from .views import (
TeamListView, TeamDetailView, CreateTeamView, InviteTeamMemberView,
JoinTeamView, ChangeTeamMemberRoleView, DeleteTeamMemberRoleView,
JoinTeamUserView, DeleteTeamView
)
urlpatterns = [
path('', TeamListView.as_view(), name='team-list'),
path('creat... | [
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
198,
198,
6738,
764,
33571,
1330,
357,
198,
220,
220,
220,
4816,
8053,
7680,
11,
4816,
11242,
603,
7680,
11,
13610,
15592,
7680,
11,
10001,
578,
15592,
27608,
7680,
11,
198,
220,
220,
220,... | 2.477941 | 408 |
import time
import board
import pwmio
from adafruit_motor import servo
| [
11748,
640,
198,
11748,
3096,
198,
11748,
279,
26377,
952,
198,
6738,
512,
1878,
4872,
62,
76,
20965,
1330,
1113,
78,
628,
198
] | 3.173913 | 23 |
# -*- coding: utf-8 -*-
import time
from django.db.models import Q
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.http import HttpResponseNotFound
from django.contrib.auth.hashers import make_password
from django.contrib.auth.hashers import check_password
from django.views.... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
11748,
640,
198,
6738,
42625,
14208,
13,
9945,
13,
27530,
1330,
1195,
198,
6738,
42625,
14208,
13,
19509,
23779,
1330,
8543,
198,
6738,
42625,
14208,
13,
4023,
1330,
367,
... | 3.203608 | 388 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 20 15:40:51 2020
@author: zettergm
known issues:
1) Need to control number of decimal places in output printing to improve readability
"""
import numpy as np
from elimtools import Gauss_elim,backsub
nrow=10
ncol=10
A=np.random.randn(nrow,ncol)... | [
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,
26223,
2447,
1160,
1315,
25,
1821,
25,
4349,
12131,
198,
198,
31,
9800,
25,
1976,
40088,
... | 2.392 | 375 |
################################################################################
# #### Hiking_project_trailsraper.py ##### #
# #### written by: Etienne Deneault ##### #
##########################################################################... | [
29113,
29113,
14468,
201,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
21017,
367,
14132,
62,
16302,
62,
9535,
4487,
38545,
13,
9078,
46424,
220,
220,
220,
220,
220,
220,
220,
... | 2.190189 | 2,324 |
# Copyright 2017,2021 IBM Corp.
#
# 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 agr... | [
2,
15069,
2177,
11,
1238,
2481,
19764,
11421,
13,
198,
2,
198,
2,
220,
220,
220,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
345,
743,
198,
2,
220,
220,
220,
407,
779,
428,
2393,
2845,
287,... | 3.011792 | 424 |
from typing import Callable
from async_couch import CouchClient
db_name = 'test_db_01'
invalid_db_name = 'invalid_%^^&_name'
non_existing_db = 'non_existing_database'
doc_id = None
| [
6738,
19720,
1330,
4889,
540,
198,
198,
6738,
30351,
62,
66,
7673,
1330,
48225,
11792,
628,
198,
9945,
62,
3672,
796,
705,
9288,
62,
9945,
62,
486,
6,
198,
259,
12102,
62,
9945,
62,
3672,
796,
705,
259,
12102,
62,
4,
18237,
5,
62,... | 2.71831 | 71 |
#!/usr/bin/python
'''Creates a folder containing text files of Cocoa keywords.'''
import os, commands, re
from sys import argv
def find(searchpath, ext):
'''Mimics the "find searchpath -name *.ext" unix command.'''
results = []
for path, dirs, files in os.walk(searchpath):
for filename in files:
... | [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
7061,
6,
16719,
274,
257,
9483,
7268,
2420,
3696,
286,
18490,
12162,
26286,
2637,
7061,
198,
11748,
28686,
11,
9729,
11,
302,
198,
6738,
25064,
1330,
1822,
85,
198,
198,
4299,
1064,
7,
12947,... | 2.285156 | 1,536 |
import iteration_utilities
import more_itertools
import toolz
import cytoolz
import pydash
| [
11748,
24415,
62,
315,
2410,
198,
11748,
517,
62,
270,
861,
10141,
198,
11748,
2891,
89,
198,
11748,
3075,
25981,
89,
198,
11748,
279,
5173,
1077,
198
] | 3.37037 | 27 |
import threading
import sys
from traceback import print_tb,print_exc
from random import randint
from time import ctime as now
class JobThread(threading.Thread):
"""
Thread that executes a job every N milliseconds
"""
def shutdown(self):
"""
Stop this thread
"""
self._fi... | [
11748,
4704,
278,
198,
11748,
25064,
198,
6738,
12854,
1891,
1330,
3601,
62,
83,
65,
11,
4798,
62,
41194,
198,
6738,
4738,
1330,
43720,
600,
198,
6738,
640,
1330,
269,
2435,
355,
783,
198,
198,
4871,
15768,
16818,
7,
16663,
278,
13,
... | 1.825893 | 896 |
import mpi #needed to use mpi
##################################################################
##################################################################
#setting the domain size for the problem to be solved
domain_size = 2
##################################################################
#################... | [
11748,
285,
14415,
1303,
27938,
284,
779,
285,
14415,
198,
198,
29113,
29113,
2235,
198,
29113,
29113,
2235,
198,
2,
33990,
262,
7386,
2546,
329,
262,
1917,
284,
307,
16019,
198,
27830,
62,
7857,
796,
362,
198,
198,
29113,
29113,
2235,
... | 3.114548 | 1,196 |
import re
import time
import random
import IPython
from google.colab import output
n = 0
# アイコンの指定
BOT_ICON = 'https://3.bp.blogspot.com/-qbORCFE5qhk/UmTBJwEYKjI/AAAAAAAAZYY/nbjieynFcLQ/s800/job_uranaishi.png'
YOUR_ICON = 'https://3.bp.blogspot.com/-nHZhTWISMxk/Vw5KxMQxRhI/AAAAAAAA5tQ/HR_btIW3k1ISG3GGNG1HFpsgk38wSu... | [
11748,
302,
198,
11748,
640,
198,
11748,
4738,
198,
11748,
6101,
7535,
198,
6738,
23645,
13,
4033,
397,
1330,
5072,
628,
198,
77,
796,
657,
220,
198,
198,
2,
220,
11839,
11482,
24679,
6527,
27032,
234,
229,
22522,
248,
198,
33,
2394,
... | 2 | 204 |
#!/usr/bin/env python
"""
_Repack_t_
Repack job splitting test
"""
import unittest
import threading
import logging
import time
from WMCore.WMBS.File import File
from WMCore.WMBS.Fileset import Fileset
from WMCore.WMBS.Subscription import Subscription
from WMCore.WMBS.Workflow import Workflow
from WMCore.DataStructs... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
37811,
198,
62,
6207,
441,
62,
83,
62,
198,
198,
6207,
441,
1693,
26021,
1332,
198,
198,
37811,
198,
198,
11748,
555,
715,
395,
198,
11748,
4704,
278,
198,
11748,
18931,
198,
11748,
... | 1.837599 | 11,644 |
#############################################################################
#
# Copyright (c) 2020 Teunis van Beelen
# All rights reserved.
#
# Email: teuniz@protonmail.com
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are m... | [
29113,
29113,
7804,
4242,
2,
198,
2,
198,
2,
15069,
357,
66,
8,
12131,
1665,
403,
271,
5719,
1355,
417,
268,
198,
2,
1439,
2489,
10395,
13,
198,
2,
198,
2,
9570,
25,
573,
403,
528,
31,
1676,
1122,
4529,
13,
785,
198,
2,
198,
2... | 2.926959 | 10,323 |
n = int(input())
nums = []
nums2 = []
for i in range(n):
nums.append(int(input()))
print("nums.append", nums)
nums2 = sorted(nums)
print("sorted(nums)", nums2)
print(nums2[n - 2])
print(nums2[n - 1])
| [
77,
796,
493,
7,
15414,
28955,
198,
77,
5700,
796,
17635,
198,
77,
5700,
17,
796,
17635,
198,
1640,
1312,
287,
2837,
7,
77,
2599,
198,
220,
220,
220,
997,
82,
13,
33295,
7,
600,
7,
15414,
3419,
4008,
198,
220,
220,
220,
3601,
72... | 2.10101 | 99 |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 5 17:01:13 2018
@author: Pavel
"""
"""
This function will take the whole of SUN database and flaten it into a single
folder while resizing and cropping all images into given square shape.
If the file is smaller than that, it will be ignored.
"""
import os
from PIL imp... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
41972,
319,
2892,
3158,
220,
642,
1596,
25,
486,
25,
1485,
2864,
198,
198,
31,
9800,
25,
49612,
198,
37811,
198,
198,
37811,
198,
1212,
2163,
481,
1011,
26... | 2.459476 | 1,678 |
from pathlib import Path
import numpy as np
import torch
from torch.utils.data import Dataset
from Hyperparameters import sep, unet_width
from Util import get_spectrogram
class UNetDataset(Dataset):
"""
Dataset for accessing data opints of the autoencoder output.
"""
def __init__(self, root_dir, gt_... | [
6738,
3108,
8019,
1330,
10644,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
28034,
198,
6738,
28034,
13,
26791,
13,
7890,
1330,
16092,
292,
316,
198,
198,
6738,
15079,
17143,
7307,
1330,
41767,
11,
555,
316,
62,
10394,
198,
6738... | 2.427984 | 729 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This file is part of CbM (https://github.com/ec-jrc/cbm).
# Author : Gilbert Voican, Konstantinos Anastasakis
# Credits : GTCAP Team
# Copyright : 2021 European Commission, Joint Research Centre
# License : 3-Clause BSD
from ipywidgets import (HTML, HBox, VBox,... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
2,
770,
2393,
318,
636,
286,
327,
65,
44,
357,
5450,
1378,
12567,
13,
785,
14,
721,
12,
73,
6015,
14,
66... | 2.771654 | 127 |
{
"targets": [{
"target_name": "catch.cc",
"type": "none",
"direct_dependent_settings": {
"include_dirs": [
"../single_include"
],
},
"sources": [
"../include/catch_with_main.hpp"
],
}]
}
| [
90,
198,
220,
366,
83,
853,
1039,
1298,
685,
90,
198,
220,
220,
220,
366,
16793,
62,
3672,
1298,
366,
40198,
13,
535,
1600,
198,
220,
220,
220,
366,
4906,
1298,
366,
23108,
1600,
198,
220,
220,
220,
366,
12942,
62,
21186,
62,
3369... | 1.936 | 125 |
import numpy
import pandas as pd
from keras.models import Sequential
from keras.layers import Dense
from keras.wrappers.scikit_learn import KerasClassifier
from sklearn.model_selection import cross_val_score
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import StratifiedKFold
from sklearn.... | [
11748,
299,
32152,
198,
11748,
19798,
292,
355,
279,
67,
198,
6738,
41927,
292,
13,
27530,
1330,
24604,
1843,
198,
6738,
41927,
292,
13,
75,
6962,
1330,
360,
1072,
198,
6738,
41927,
292,
13,
29988,
11799,
13,
36216,
15813,
62,
35720,
... | 2.646545 | 10,420 |
from .stylegan_encoder_network import *
from .encoder import *
from .encoding_dataset import *
from .tensorboard import * | [
6738,
764,
7635,
1030,
62,
12685,
12342,
62,
27349,
1330,
1635,
198,
6738,
764,
12685,
12342,
1330,
1635,
198,
6738,
764,
12685,
7656,
62,
19608,
292,
316,
1330,
1635,
198,
6738,
764,
83,
22854,
3526,
1330,
1635
] | 3.27027 | 37 |
# -*- coding: utf-8 -*-
"""
s1acker.s1acker
~~~~~~~~~~~~~~
This module provides functions that deal with s1 search interface.
:copyright: (c) 2017 by quinoa42.
:license: MIT, see LICENSE for more details.
"""
import logging
import os.path as op
import re
import time
from itertools import chain
fr... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
220,
220,
220,
264,
16,
10735,
13,
82,
16,
10735,
198,
220,
220,
220,
220,
15116,
8728,
4907,
628,
220,
220,
220,
770,
8265,
3769,
5499,
326,
1730,
351,
... | 1.98672 | 3,991 |
#!/usr/bin/env python
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
#... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
29113,
29113,
7804,
4242,
198,
2,
198,
2,
15069,
357,
34,
8,
1584,
383,
33734,
5834,
12052,
13,
198,
2,
14039,
25,
3740,
1378,
2503,
13,
39568,
13,
952,
14,
677,
26426,
14,
19... | 3.337868 | 882 |
# -*- coding: utf-8 -*-
# flake8: noqa: E501
from __future__ import unicode_literals
from datetime import datetime
from kinopoisk.movie import Movie
from .base import BaseTest
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
781,
539,
23,
25,
645,
20402,
25,
412,
33548,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
19... | 2.887097 | 62 |
import os
import sys
from argparse import ArgumentParser
from azureml.core import Dataset, Datastore, Workspace
from azureml.data.dataset_factory import DataType
from azureml.datadrift import DataDriftDetector
target_dataset_timestamp_column = "datetime"
input_schema_dir = os.path.join("input", "schema")
data_dir = "... | [
11748,
28686,
198,
11748,
25064,
198,
6738,
1822,
29572,
1330,
45751,
46677,
198,
198,
6738,
35560,
495,
4029,
13,
7295,
1330,
16092,
292,
316,
11,
16092,
459,
382,
11,
10933,
10223,
198,
6738,
35560,
495,
4029,
13,
7890,
13,
19608,
292... | 2.823944 | 142 |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import numpy as np
import os
from plot_constants import *
plt.rcParams.update(params)
plt.rc('font', family='serif')
if __name__ == "__main__":
fig, axs = plt.subplots(1, 4)
fig.set_size_inches(28, 6)
... | [
11748,
2603,
29487,
8019,
198,
6759,
29487,
8019,
13,
1904,
10786,
46384,
11537,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
2603,
29487,
8019,
13,
83,
15799,
355,
4378,
263,
198,
11748,
299,
32152,
355,
45... | 2.035994 | 4,084 |
from typing import List, Type, Union
from pydantic import BaseModel
from tortoise import Model, fields
from fast_tmp.utils.password import make_password, verify_password
| [
6738,
19720,
1330,
7343,
11,
5994,
11,
4479,
198,
198,
6738,
279,
5173,
5109,
1330,
7308,
17633,
198,
6738,
7619,
25678,
1330,
9104,
11,
7032,
198,
198,
6738,
3049,
62,
22065,
13,
26791,
13,
28712,
1330,
787,
62,
28712,
11,
11767,
62,... | 3.826087 | 46 |
import numpy as np
import matplotlib as mpl
# import matplotlib.cm as cm
import matplotlib.pyplot as plt
import matplotlib.patheffects as pe
from brightness_temperature import *
from plot_searchlight import get_intensity, font_size, iunits
#plt.rc('text.latex', preamble=r'\usepackage{cmbright}')
#plt.rc('text', usete... | [
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
29487,
8019,
355,
285,
489,
198,
2,
1330,
2603,
29487,
8019,
13,
11215,
355,
12067,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
2603,
29487,
8019,
13,
8071,
... | 2.032543 | 14,166 |
import numpy as np
import matplotlib.pylab as plt
from Gradient_2D import numerical_gradient
init_x = np.array([-4.0, 5.0])
lr = 0.1
step_num = 30
x, x_history = gradient_descent(function, init_x, lr=lr, step_num=step_num)
plt.plot( [-6, 6], [0,0], '--b')
plt.plot( [0,0], [-6, 6], '--b')
plt.plot(x_history[:,0], ... | [
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
29487,
8019,
13,
79,
2645,
397,
355,
458,
83,
198,
6738,
17701,
1153,
62,
17,
35,
1330,
29052,
62,
49607,
628,
628,
198,
15003,
62,
87,
796,
45941,
13,
18747,
26933,
12,
19,
13,
15,
... | 1.995327 | 214 |
import cv2
import numpy as np
cap=cv2.VideoCapture(0)
max_radius=0
max_center=(0,0)
lower=np.array([7,137,132])
upper=np.array([25,255,255])
while True:
ret, frame = cap.read()
if frame is None:
break
hsv=cv2.cvtColor(frame,cv2.COLOR_BGR2HSV)
out=cv2.inRange(hsv,lower,upper)
erosion=cv... | [
11748,
269,
85,
17,
198,
11748,
299,
32152,
355,
45941,
198,
198,
11128,
28,
33967,
17,
13,
10798,
49630,
7,
15,
8,
198,
198,
9806,
62,
42172,
28,
15,
198,
9806,
62,
16159,
16193,
15,
11,
15,
8,
198,
198,
21037,
28,
37659,
13,
1... | 1.90205 | 439 |
# Copyright 2017 Mycroft AI Inc.
#
# 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 writin... | [
2,
15069,
2177,
2011,
36714,
9552,
3457,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
198,
2... | 2.670719 | 1,892 |
from typing import Any, Tuple
from Crypto.Cipher import PKCS1_OAEP
from Crypto.PublicKey import RSA
def keyGen(key_size: int) -> Tuple[Any, Any]:
"""Genrates key for RSA algorithm.
Parameters
----------
key_size : int
Size of key
"""
key_pair = RSA.generate(key_size)
private_key... | [
6738,
19720,
1330,
4377,
11,
309,
29291,
198,
198,
6738,
36579,
13,
34,
10803,
1330,
29673,
7902,
16,
62,
23621,
8905,
198,
6738,
36579,
13,
15202,
9218,
1330,
42319,
628,
198,
4299,
1994,
13746,
7,
2539,
62,
7857,
25,
493,
8,
4613,
... | 2.523381 | 556 |
import sys
import requests
import getopt
import json
import calendar
import math
from datetime import datetime, timezone, timedelta
from veracode_api_signing.plugin_requests import RequestsAuthPluginVeracodeHMAC
api_base = "https://api.veracode.com/was/configservice/v1/"
headers = {
"User-Agent": "Dynamic Analysi... | [
11748,
25064,
198,
11748,
7007,
198,
11748,
651,
8738,
198,
11748,
33918,
198,
11748,
11845,
198,
11748,
10688,
198,
198,
6738,
4818,
8079,
1330,
4818,
8079,
11,
640,
11340,
11,
28805,
12514,
198,
6738,
3326,
330,
1098,
62,
15042,
62,
1... | 2.065421 | 2,247 |
from django.contrib import admin
from django.urls import path, include
from .views import *
urlpatterns = [
path('staff/all', StaffListView.as_view()),
path('staff/<int:pk>', StaffRetrieveView.as_view()),
path('staff/update/<int:pk>', StaffUpdateView.as_view()),
path('staff/new', StaffCreateV... | [
6738,
42625,
14208,
13,
3642,
822,
1330,
13169,
201,
198,
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
11,
2291,
201,
198,
6738,
764,
33571,
1330,
1635,
201,
198,
201,
198,
201,
198,
6371,
33279,
82,
796,
685,
201,
198,
220,
220,
2... | 2.363803 | 547 |
import torch.nn as nn
from torchvision import models
import torch.nn.functional as F
import torch
"""
# https://zhuanlan.zhihu.com/p/93806755
class res50(torch.nn.Module):
def __init__(self, num_classes):
super(res50, self).__init__()
resnet = resnet50(pretrained=True)
self.bac... | [
11748,
28034,
13,
20471,
355,
299,
77,
201,
198,
6738,
28034,
10178,
1330,
4981,
201,
198,
11748,
28034,
13,
20471,
13,
45124,
355,
376,
201,
198,
11748,
28034,
201,
198,
201,
198,
201,
198,
37811,
201,
198,
2,
3740,
1378,
23548,
7258... | 1.790447 | 649 |
v = [17, 92, 18, 33, 58, 7, 33, 42, 79, 37]
print(find_max(v))
| [
201,
198,
85,
796,
685,
1558,
11,
10190,
11,
1248,
11,
4747,
11,
7618,
11,
767,
11,
4747,
11,
5433,
11,
9225,
11,
5214,
60,
201,
198,
4798,
7,
19796,
62,
9806,
7,
85,
4008,
201,
198
] | 1.810811 | 37 |
from flask_app.database.db import *
from flask_app.database.models.User import *
| [
6738,
42903,
62,
1324,
13,
48806,
13,
9945,
1330,
1635,
198,
198,
6738,
42903,
62,
1324,
13,
48806,
13,
27530,
13,
12982,
1330,
1635,
198
] | 3.28 | 25 |
from __future__ import absolute_import, division, print_function
import numpy as np
import tensorflow as tf
from tensorflow.python import keras
from tensorflow_probability.python import distributions as tfd
from tensorflow_probability.python import layers as tfl
from tensorflow_probability.python.internal import \
... | [
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
11,
7297,
11,
3601,
62,
8818,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
6738,
11192,
273,
11125,
13,
29412,
1330,
41927,
292,
198,
6738,
1119... | 2.510845 | 7,607 |
# -*- coding: utf-8 -*-
##
# \file pe_absorbing_layer.py
# \title Definition of an absorbing layer for the parabolic equation.
# \author Pierre Chobeau
# \version 0.1
# \license BSD 3-Clause License
# \inst UMRAE (Ifsttar Nantes), LAUM (Le Mans Université)
# \date 2017, 20 Nov.
##
import numpy as np
... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2235,
198,
2,
3467,
7753,
220,
220,
220,
220,
613,
62,
46303,
4623,
62,
29289,
13,
9078,
198,
2,
3467,
7839,
220,
220,
220,
30396,
286,
281,
34418,
7679,
329,
262,
1... | 2.156469 | 2,288 |
#
# Copyright (C) 2005, Giovanni Bajo
#
# Based on previous work under copyright (c) 2002 McMillan Enterprises, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the L... | [
2,
198,
2,
15069,
357,
34,
8,
5075,
11,
50191,
347,
34944,
198,
2,
198,
2,
13403,
319,
2180,
670,
739,
6634,
357,
66,
8,
6244,
15359,
359,
272,
41253,
11,
3457,
13,
198,
2,
198,
2,
770,
1430,
318,
1479,
3788,
26,
345,
460,
176... | 2.380062 | 4,223 |
import os
import numpy as np
import dolfin as df
import matplotlib.pyplot as plt
from finmag import Simulation
from finmag.energies import Demag, Exchange
MODULE_DIR = os.path.dirname(os.path.abspath(__file__))
IMAGE = os.path.join(MODULE_DIR, 'precession.png')
ts = np.linspace(0, 3e-10)
subfigures = ("without prece... | [
11748,
28686,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
288,
4024,
259,
355,
47764,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
6738,
957,
19726,
1330,
41798,
198,
6738,
957,
19726,
13,
877,
70,
444,
1330,
... | 2.366366 | 333 |
#!/usr/bin/env python3
import sys
import matplotlib.pyplot as plt
import numpy as np
from typex.encryptor import Encryptor
plt.rcdefaults()
input_text = sys.stdin.read()
letter_appearances = {}
for char in Encryptor.ALPHABET:
letter_appearances[char] = 0
for char in input_text:
if char.upper() in Encryptor.A... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
11748,
25064,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
2099,
87,
13,
12685,
6012,
273,
1330,
14711,
6012,
273,
1... | 2.623794 | 311 |
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import pecan
from pecan import rest
from inventory.api.controllers.v1 import base
from inventory.api.controllers.v1 import cpu
from inventory.api.controllers.v1 import ethernet_port
from inventory.api.controllers.v1 import host... | [
2,
198,
2,
15069,
357,
66,
8,
2864,
3086,
5866,
11998,
11,
3457,
13,
198,
2,
198,
2,
30628,
55,
12,
34156,
12,
33234,
7483,
25,
24843,
12,
17,
13,
15,
198,
2,
628,
198,
11748,
613,
5171,
198,
6738,
613,
5171,
1330,
1334,
198,
... | 3.051248 | 761 |
import pytest
from thumbor_extras.detectors.dnn_face_detector import Detector
@pytest.mark.parametrize('image_context_arg', [
'face_image_context', 'gray_face_image_context', 'cmyk_face_image_context'
])
| [
11748,
12972,
9288,
198,
6738,
15683,
273,
62,
2302,
8847,
13,
15255,
478,
669,
13,
67,
20471,
62,
2550,
62,
15255,
9250,
1330,
4614,
9250,
198,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
10786,
9060,
62,
22866,
62,
8... | 2.64557 | 79 |
import time
hall1 = Sensor(1)
hall1.enable()
# set start times to show display is working
t1 = 999
while True:
td1 = hall1.getDiff()
if td1 != None:
t1 = td1
printToDisplay(t1)
| [
11748,
640,
198,
198,
18323,
16,
796,
35367,
7,
16,
8,
198,
18323,
16,
13,
21633,
3419,
198,
198,
2,
900,
923,
1661,
284,
905,
3359,
318,
1762,
198,
83,
16,
796,
36006,
198,
198,
4514,
6407,
25,
198,
197,
8671,
16,
796,
6899,
16... | 2.410256 | 78 |
"""
By David Oswald, d.f.oswald@cs.bham.ac.uk
26 August 2015
Some of this code is based on information or code from
- Sam Kerr: http://samuelkerr.com/?p=431
- Eli Bendersky: http://eli.thegreenplace.net/2009/03/07/computing-modular-square-roots-in-python/
- http://cr.yp.to/highspeed/naclcrypto-20090310.pdf,... | [
37811,
198,
2750,
3271,
34374,
11,
288,
13,
69,
13,
418,
21667,
31,
6359,
13,
65,
2763,
13,
330,
13,
2724,
198,
2608,
2932,
1853,
198,
220,
198,
2773,
286,
428,
2438,
318,
1912,
319,
1321,
393,
2438,
422,
198,
220,
198,
532,
3409,... | 3.621053 | 475 |
#!/usr/bin/env python3
import math
import time
if __name__ == "__main__":
start = time.time()
main()
end = time.time()
print("Duration: {0:0.6f}s".format(end - start))
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
11748,
10688,
198,
11748,
640,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
923,
796,
640,
13,
2435,
3419,
198,
220,
220,
220,... | 2.3625 | 80 |
#!/bin/python
# coding=utf-8
from optparse import OptionParser
import urllib
import re
osmap = {
'mac' : 'Mac',
'osx' : 'Mac',
'win' : 'Windows',
'win64' : 'Windows64',
'win32' : 'Windows32',
}
# -------------- main --------------
if __name__ == '__main__':
usage = "usage: %prog [optio... | [
2,
48443,
8800,
14,
29412,
198,
2,
19617,
28,
40477,
12,
23,
628,
198,
6738,
2172,
29572,
1330,
16018,
46677,
198,
11748,
2956,
297,
571,
198,
11748,
302,
198,
198,
418,
8899,
796,
1391,
198,
220,
220,
220,
705,
20285,
6,
220,
220,
... | 2.195219 | 502 |
dicts={
0xe88f9c:
[0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x07,0x00,0x02,0x01,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0C,0x30,0x00,0x00,
0x00,0x00,0x1C,0x18,0x18,0xFF,0x18,0x18,0x10,0x00,0xFF,0x02,0x01,0x81,0xC0,0xC0,0x41,0x01,0xFF,0x07,0x0D,0x19,0x31,0x61,0xC1,0x01,0x01,0x01,0x01,0x0... | [
11600,
82,
34758,
198,
15,
27705,
3459,
69,
24,
66,
25,
198,
197,
58,
15,
87,
405,
11,
15,
87,
405,
11,
15,
87,
405,
11,
15,
87,
405,
11,
15,
87,
405,
11,
15,
87,
18,
37,
11,
15,
87,
405,
11,
15,
87,
405,
11,
15,
87,
4... | 1.202212 | 8,501 |
import tensorflow as tf
import numpy as np
# computes VGG loss or content loss
| [
11748,
11192,
273,
11125,
355,
48700,
198,
11748,
299,
32152,
355,
45941,
628,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
552,
1769,
569,
11190,
2994,
393,
2695,
2994,
628,
220,
220,
220,
220
] | 2.512821 | 39 |
from ..utils import Object
class GetSuitableDiscussionChats(Object):
"""
Returns a list of basic group and supergroup chats, which can be used as a discussion group for a channel. Basic group chats need to be first upgraded to supergroups before they can be set as a discussion group
Attributes:
... | [
198,
198,
6738,
11485,
26791,
1330,
9515,
628,
198,
4871,
3497,
5606,
4674,
34255,
1925,
1381,
7,
10267,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
16409,
257,
1351,
286,
4096,
1448,
290,
2208,
8094,
40815,
11,
543,
460,
307... | 3.028249 | 177 |