content stringlengths 1 1.04M | input_ids listlengths 1 774k | ratio_char_token float64 0.38 22.9 | token_count int64 1 774k |
|---|---|---|---|
# coding=utf-8
# Copyright 2018-2020 EVA
#
# 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,
19617,
28,
40477,
12,
23,
198,
2,
15069,
2864,
12,
42334,
8696,
32,
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,
... | 3.238462 | 260 |
import numpy as np
import torch
from utils.training_utils import build_between_sentence_data
def build_relation_list(option = 'scidtb'):
"""
iterate over data to yield a list of all relations
"""
if option == 'scidtb':
return ['ROOT',
'elab-aspect',
'elab-addition',
'enablement',
'same-unit... | [
11748,
299,
32152,
355,
45941,
198,
11748,
28034,
198,
6738,
3384,
4487,
13,
34409,
62,
26791,
1330,
1382,
62,
23395,
62,
34086,
594,
62,
7890,
198,
198,
4299,
1382,
62,
49501,
62,
4868,
7,
18076,
796,
705,
1416,
312,
83,
65,
6,
259... | 2.423772 | 3,929 |
"""
935
medium
knight dialer
"""
sol = Solution()
print(sol.knightDialer(2))
| [
37811,
198,
24,
2327,
198,
24132,
198,
74,
3847,
5980,
263,
198,
37811,
628,
198,
34453,
796,
28186,
3419,
198,
4798,
7,
34453,
13,
74,
3847,
24400,
263,
7,
17,
4008,
628,
628,
628,
198
] | 2.428571 | 35 |
from aiohttp import web
import asyncio
import logging
host = '127.0.0.1'
port = 9000
loop = asyncio.get_event_loop()
loop.run_until_complete(init(loop))
loop.run_forever()
| [
6738,
257,
952,
4023,
1330,
3992,
198,
11748,
30351,
952,
198,
11748,
18931,
628,
198,
4774,
796,
705,
16799,
13,
15,
13,
15,
13,
16,
6,
198,
634,
796,
50138,
628,
628,
198,
26268,
796,
30351,
952,
13,
1136,
62,
15596,
62,
26268,
... | 2.69697 | 66 |
__author__ = 'mehdibenchoufi'
| [
834,
9800,
834,
796,
705,
1326,
31298,
571,
24421,
280,
12463,
6,
198
] | 2.307692 | 13 |
"""Trains DGP models.
You can use this to create checkpoints which you can analyze with sample_gradients.py
Adapted from
https://github.com/hughsalimbeni/DGPs_with_IWVI/blob/master/experiments/run_conditional_density_estimation.py
"""
import csv
import os
import random
import warnings
from typing import Dict
import... | [
37811,
2898,
1299,
360,
16960,
4981,
13,
198,
198,
1639,
460,
779,
428,
284,
2251,
36628,
543,
345,
460,
16602,
351,
6291,
62,
9744,
2334,
13,
9078,
198,
198,
48003,
276,
422,
198,
5450,
1378,
12567,
13,
785,
14,
71,
6724,
21680,
32... | 3.048851 | 348 |
#!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
import logging
import numpy as np
import plyfile
import skimage.measure
import time
import torch
import deep_sdf.utils
def convert_sdf_samples_to_npy(
pytorch_2d_sdf_tensor,
pixel_grid_origin,
N,
npy_filename_out,
off... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
15069,
5472,
12,
25579,
3203,
13,
1439,
6923,
33876,
13,
198,
198,
11748,
18931,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
35960,
7753,
198,
11748,
1341,
9060,
13,
1326,
5... | 2.637349 | 830 |
import os
import torch
from transformers import BertModel, BertTokenizer
from bert_ner.aux import get_data_from_tuples, get_all_sentences, batchify, test, bioes_classes
from bert_ner.model import NERModel
_path = os.path.dirname(__file__)
_test_filename = os.path.join(_path, '../data/test.conll')
_save_filename = os... | [
11748,
28686,
198,
198,
11748,
28034,
198,
6738,
6121,
364,
1330,
22108,
17633,
11,
22108,
30642,
7509,
198,
198,
6738,
275,
861,
62,
1008,
13,
14644,
1330,
651,
62,
7890,
62,
6738,
62,
28047,
2374,
11,
651,
62,
439,
62,
34086,
3007,
... | 2.756345 | 394 |
import pytest
from ansiblemetrics.playbook.num_uri import NumUri
script_0_1 = '---\n-host: localhost'
script_0_2 = '- oasis_roles.rhsm\n- oasis_roles.molecule_openstack_ci\n- oasis_roles.molecule_docker_ci'
script_1 = '- name: Check that you can connect (GET) to a page and it returns a status 200\n\turi:\n\t\turl: ' \... | [
11748,
12972,
9288,
198,
6738,
9093,
856,
4164,
10466,
13,
1759,
2070,
13,
22510,
62,
9900,
1330,
31835,
52,
380,
198,
198,
12048,
62,
15,
62,
16,
796,
705,
6329,
59,
77,
12,
4774,
25,
1957,
4774,
6,
198,
12048,
62,
15,
62,
17,
... | 2.251142 | 219 |
from nimba.core.exceptions import ImproperlyRoute
| [
6738,
299,
320,
7012,
13,
7295,
13,
1069,
11755,
1330,
12205,
525,
306,
43401,
628
] | 3.4 | 15 |
#!/usr/bin/env python3
# Copyright (c) 2021 Silas Cutler, silas.cutler@gmail.com (https://silascutler.com/)
# See the file 'COPYING' for copying permission.
import os
import re
import sys
import guestfs
if __name__ == "__main__":
if len(sys.argv) < 2:
print("inspect_vm: missing disk image to inspect", ... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
15069,
357,
66,
8,
33448,
4243,
292,
37194,
11,
3313,
292,
13,
8968,
1754,
31,
14816,
13,
785,
357,
5450,
1378,
18217,
3372,
315,
1754,
13,
785,
34729,
198,
2,
4091,
262,
23... | 2.386935 | 199 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/3/21 13:56
# @Author : GUO Ziyao
import os
from easyw.bootstrap import app
port = int(os.environ.get('EASYW_PORT', 9715))
app.run(host='0.0.0.0', port=port, debug=True)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2488,
7575,
220,
220,
220,
1058,
2864,
14,
18,
14,
2481,
1511,
25,
3980,
198,
2,
2488,
13838,
220,
1058,
19348,
... | 2.194444 | 108 |
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import url
from . import views
urlpatterns=[
url('home',views.welcome,name = 'welcome'),
# url(r'^search/', views.search_results, name='search_results')
url(r'^$',views.signup, name='sign'),
url(r'^profile... | [
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
6738,
42625,
14208,
13,
10414,
13,
6371,
82,
13,
12708,
1330,
9037,
198,
6738,
42625,
14208,
13,
10414,
13,
6371,
82,
1330,
19016,
198,
6738,
764,
1330,
5009,
198,
198,
6371,
33279,
82,
... | 2.784946 | 186 |
"""Addition circuits"""
from computer.gates import AND, OR, XOR
from computer.configuration import PRECISION
# TODO Refactor to stateless classes?
def half_adder(a: str, b: str):
"""Add two bits together and return the sum and carry bit.
Max output is 2 i.e. sum=0, carry=1.
```
a b sum carry
... | [
37811,
4550,
653,
24907,
37811,
628,
198,
6738,
3644,
13,
70,
689,
1330,
5357,
11,
6375,
11,
1395,
1581,
198,
6738,
3644,
13,
11250,
3924,
1330,
22814,
34,
42446,
628,
198,
2,
16926,
46,
6524,
11218,
284,
1181,
1203,
6097,
30,
628,
... | 2.188791 | 678 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import math
import numpy as np
| [
2,
15069,
357,
66,
8,
5413,
10501,
13,
198,
2,
49962,
739,
262,
17168,
5964,
13,
198,
198,
11748,
10688,
198,
198,
11748,
299,
32152,
355,
45941,
628,
628,
198
] | 3.666667 | 30 |
from http.server import BaseHTTPRequestHandler, HTTPServer
import bpy
import json
import sys
argv = sys.argv
argv = argv[argv.index("--") + 1:]
outputFolder=argv[0]
blendFolder=argv[1]
with HTTPServer(('', 8000), handler) as server:
server.serve_forever()
| [
6738,
2638,
13,
15388,
1330,
7308,
40717,
18453,
25060,
11,
38288,
18497,
198,
11748,
275,
9078,
198,
11748,
33918,
198,
11748,
25064,
198,
198,
853,
85,
796,
25064,
13,
853,
85,
198,
853,
85,
796,
1822,
85,
58,
853,
85,
13,
9630,
7... | 2.739583 | 96 |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making GameAISDK available.
This source code file is licensed under the GNU General Public License Version 3.
For full details, please refer to the file "LICENSE.txt" which is provided as part of this source code package.
Copyright... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
24893,
1087,
318,
10607,
284,
1104,
262,
1280,
2723,
2055,
416,
1642,
3776,
32,
1797,
48510,
1695,
13,
198,
198,
1212,
2723,
2438,
2393,
318,
11971,
739,
262... | 2.441313 | 3,442 |
import argparse
from pydub import AudioSegment
parser = argparse.ArgumentParser()
parser.add_argument("-f", "--flag", dest="flag", help="Flag to Use")
args = parser.parse_args()
flag = args.flag
if args.flag is None:
print("Please specify a flag with -f")
exit(1)
else:
flag = args.flag
flag = flag.upp... | [
11748,
1822,
29572,
198,
6738,
279,
5173,
549,
1330,
13491,
41030,
434,
198,
198,
48610,
796,
1822,
29572,
13,
28100,
1713,
46677,
3419,
198,
48610,
13,
2860,
62,
49140,
7203,
12,
69,
1600,
366,
438,
32109,
1600,
2244,
2625,
32109,
1600... | 2.849162 | 179 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2021 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.
from pandapower.control.controller.characteristic_control import CharacteristicControl
from pandapower.control.util.characteristic ... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
2,
15069,
357,
66,
8,
1584,
12,
1238,
2481,
416,
2059,
286,
15035,
741,
290,
39313,
403,
71,
30288,
5136,
329,
6682,
18963,
198,
2,
290,
6682,
4482,
8987,
357,
... | 3.363095 | 336 |
""" Loading strategies for Query
* `QueryLoaderBase`: base class
* `PrimaryQueryLoader` for the primary query (top level)
* `RelatedQueryLoader` for related queries (joined queries)
"""
from __future__ import annotations
from collections import abc
import sqlalchemy as sa
from jessiql.query_object import SelectedR... | [
37811,
12320,
10064,
329,
43301,
198,
198,
9,
4600,
20746,
17401,
14881,
63,
25,
2779,
1398,
198,
9,
4600,
35170,
20746,
17401,
63,
329,
262,
4165,
12405,
357,
4852,
1241,
8,
198,
9,
4600,
9819,
20746,
17401,
63,
329,
3519,
20743,
357... | 3.112732 | 754 |
"""
TAPnx setup script.
See license in LICENSE.txt.
"""
import os
from setuptools import setup
# provide a long description using reStructuredText
LONG_DESCRIPTION = r"""
**TAPnx** is a Python package that lets you...
Read the `docs`_ or see usage examples and demos on `GitHub`_.
.. _GitHub: https://github.com/t... | [
37811,
198,
51,
2969,
77,
87,
9058,
4226,
13,
198,
198,
6214,
5964,
287,
38559,
24290,
13,
14116,
13,
198,
37811,
198,
198,
11748,
28686,
198,
198,
6738,
900,
37623,
10141,
1330,
9058,
198,
198,
2,
2148,
257,
890,
6764,
1262,
302,
4... | 2.691034 | 725 |
"""Module for defining types used in neumann package."""
import numpy as np
boolnp = np.uint8 # np.bool
intnp = int # np.int
longnp = np.int64 # np.long
doublenp = np.float64 # np.double
complexnp = np.complex128
| [
37811,
26796,
329,
16215,
3858,
973,
287,
497,
40062,
5301,
526,
15931,
198,
198,
11748,
299,
32152,
355,
45941,
198,
198,
30388,
37659,
796,
45941,
13,
28611,
23,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
45941,
13,
30388,
1... | 2.2 | 115 |
# Generated by Django 3.1.4 on 2021-09-07 10:57
from django.db import migrations, models
import report.models
| [
2,
2980,
515,
416,
37770,
513,
13,
16,
13,
19,
319,
33448,
12,
2931,
12,
2998,
838,
25,
3553,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
198,
11748,
989,
13,
27530,
628
] | 3.027027 | 37 |
#!/usr/bin/python3
import dbus
import time
import sys
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GObject
import json
DBUS_BUS_ENOCEAN_NAME = 'com.devicehive.enocean'
DBUS_BUS_BLE_NAME = 'com.devicehive.bluetooth'
SWITCH_ADDRESS = '00:2A:1A:B8'
BULB_ADDRESS = '20:C3:8F:F5:49:B4'
bulb_on_v... | [
2,
48443,
14629,
14,
8800,
14,
29412,
18,
198,
198,
11748,
288,
10885,
198,
11748,
640,
198,
11748,
25064,
198,
6738,
288,
10885,
13,
12417,
26268,
13,
4743,
571,
1330,
360,
16286,
38,
13383,
39516,
198,
6738,
308,
72,
13,
260,
1930,
... | 2.143426 | 251 |
import uuid
import graphql
import github
__all__ = [
"HTTPClient",
]
| [
11748,
334,
27112,
198,
198,
11748,
4823,
13976,
198,
198,
11748,
33084,
628,
198,
198,
834,
439,
834,
796,
685,
198,
220,
220,
220,
366,
40717,
11792,
1600,
198,
60,
198
] | 2.516129 | 31 |
from setuptools import setup, find_packages
setup(name="qtstyles",
version="0.0.3",
install_requires=[
"QtPy>=1.4.1"
],
description="A collection of Qt style sheets and helpful classes for applying them.",
long_description=open("README.md").read(),
# https://s... | [
6738,
900,
37623,
10141,
1330,
9058,
11,
1064,
62,
43789,
201,
198,
201,
198,
40406,
7,
3672,
2625,
39568,
47720,
1600,
201,
198,
220,
220,
220,
220,
220,
2196,
2625,
15,
13,
15,
13,
18,
1600,
201,
198,
220,
220,
220,
220,
220,
27... | 2.399254 | 268 |
import numpy as np
import scipy as sp
import scipy.misc
'''
im = scipy.misc.lena()
factors = [2, 4, 8, 16, 32]
'''
im = imread('hummingbird.png')
#im = im[0:120, 0:120]
#factors = [2, 3, 4, 5, 6]
im = im[54:, 103:-104]
factors = [2, 3, 8, 17, 32]
im = sum(im, 2)
figure('image'), clf()
subplot(2, 3, 1)
imshow(im)
f... | [
198,
11748,
299,
32152,
355,
45941,
198,
11748,
629,
541,
88,
355,
599,
198,
11748,
629,
541,
88,
13,
44374,
198,
198,
7061,
6,
198,
320,
796,
629,
541,
88,
13,
44374,
13,
75,
8107,
3419,
198,
22584,
669,
796,
685,
17,
11,
604,
... | 1.975728 | 206 |
# -*- coding: utf-8 -*-
# This is a test file intended to be used with pytest
# pytest automatically runs all the function starting with "test_"
# see https://docs.pytest.org for more information
from dummy_module import dummy_function
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
770,
318,
257,
1332,
2393,
5292,
284,
307,
973,
351,
12972,
9288,
198,
2,
12972,
9288,
6338,
4539,
477,
262,
2163,
3599,
351,
366,
9288,
62,
1,
198,
2,
766,
3740,... | 3.552239 | 67 |
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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 r... | [
2,
19617,
28,
40477,
12,
23,
198,
2,
15069,
33448,
383,
12905,
2667,
32388,
3457,
13,
1074,
13,
1439,
2489,
10395,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
34... | 2.935771 | 3,254 |
import gym
import numpy as np
import matplotlib.pyplot as plt
import cv2
import torch
import torch.nn as nn
import random
#Initializing models and hyper parameters
env = gym.envs.make("CartPole-v1")
env.reset()
#Initializing policy parameters
numStates = 4
numActions = 2
hiddenDim = 50
lr = 0.0005
mo... | [
11748,
11550,
201,
198,
11748,
299,
32152,
355,
45941,
201,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
201,
198,
11748,
269,
85,
17,
201,
198,
11748,
28034,
201,
198,
11748,
28034,
13,
20471,
355,
299,
77,
201,
198,... | 2.456067 | 239 |
import json
from json import JSONDecodeError
| [
11748,
33918,
198,
6738,
33918,
1330,
19449,
10707,
1098,
12331,
628,
628,
198
] | 3.769231 | 13 |
from rest_framework import status
from rest_framework.response import Response
from threepio import logger
from api.v2.exceptions import failure_response
from api.v2.serializers.details import UserAllocationSourceSerializer
from api.v2.views.base import AuthModelViewSet
from core.models import (
AllocationSource, ... | [
6738,
1334,
62,
30604,
1330,
3722,
198,
6738,
1334,
62,
30604,
13,
26209,
1330,
18261,
198,
6738,
294,
260,
538,
952,
1330,
49706,
198,
198,
6738,
40391,
13,
85,
17,
13,
1069,
11755,
1330,
5287,
62,
26209,
198,
6738,
40391,
13,
85,
... | 2.959821 | 448 |
from django.urls import path, include
from .views import (
UserListAPIView, ClientListAPIView, ClientFolderListAPIView,
DocumentListAPIView, UserClientAPIView, UserClientDetailAPIView,
FolderClientAPIView, FolderAPIView, DocumentAPIView, DocumentDetailAPIView,
user_by_name
)
urlpatterns = [
path('a... | [
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
11,
2291,
198,
6738,
764,
33571,
1330,
357,
198,
220,
220,
220,
11787,
8053,
2969,
3824,
769,
11,
20985,
8053,
2969,
3824,
769,
11,
20985,
41092,
8053,
2969,
3824,
769,
11,
198,
220,
220,
... | 2.396078 | 510 |
import concurrent.futures
from typing import Optional
from discord import Guild, Role
from discord import utils
from discord.ext import commands, tasks
from requests.exceptions import HTTPError
from twitch import TwitchClient
from SECRET import twitch_client_id
from models import UserData
from utils.database import g... | [
11748,
24580,
13,
69,
315,
942,
198,
6738,
19720,
1330,
32233,
198,
198,
6738,
36446,
1330,
16446,
11,
20934,
198,
6738,
36446,
1330,
3384,
4487,
198,
6738,
36446,
13,
2302,
1330,
9729,
11,
8861,
198,
6738,
7007,
13,
1069,
11755,
1330,
... | 3.804688 | 128 |
version = "3.40"
| [
9641,
796,
366,
18,
13,
1821,
1,
198
] | 2.125 | 8 |
# main.py -- Chapter 7 - Gesture Controller
##################################################################################
# Title : Gesture Controller Test Application
# Filename : main.py
# Author : JWB
# Origin Date : 01/07/2019
# Version ... | [
2,
1388,
13,
9078,
1377,
7006,
767,
532,
44641,
495,
22741,
198,
29113,
29113,
14468,
2235,
198,
2,
11851,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1058,
220,
220,
44641,
495,
22741,
6208,
1567... | 2.83878 | 1,377 |
# Copyright (c) 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | [
2,
15069,
357,
66,
8,
2211,
4946,
25896,
5693,
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.003294 | 18,213 |
"""
python bindings for OMNeT++
"""
# this module exposes public attributes of all relevant modules
from ._ccanvas import *
from ._chistogram import *
from ._cmessage import *
from ._cobject import *
from ._coutvector import *
from ._cpacket import *
from ._cqueue import *
from ._csimplemodule import *
from ._csimtime... | [
37811,
198,
29412,
34111,
329,
32468,
8199,
51,
4880,
198,
37811,
198,
198,
2,
428,
8265,
32142,
1171,
12608,
286,
477,
5981,
13103,
198,
6738,
47540,
535,
272,
11017,
1330,
1635,
198,
6738,
47540,
354,
396,
21857,
1330,
1635,
198,
6738... | 3.395062 | 162 |
import os
import logging
from argparse import ArgumentParser
from concurrent.futures import ThreadPoolExecutor, as_completed
from .lib.saj import StreamAnalyticsJobs
from .lib.utils import chkpath, mklog
if __name__ == "__main__":
main()
| [
11748,
28686,
198,
11748,
18931,
198,
198,
6738,
1822,
29572,
1330,
45751,
46677,
198,
6738,
24580,
13,
69,
315,
942,
1330,
14122,
27201,
23002,
38409,
11,
355,
62,
785,
16838,
198,
6738,
764,
8019,
13,
82,
1228,
1330,
13860,
37702,
140... | 3.220779 | 77 |
"""Add the share/reconstruct method to the Syft Module defined here:
https://github.com/OpenMined/PySyft/blob/dev/src/syft/lib/torch/module.py
"""
# stdlib
from collections import OrderedDict
import copy
# third party
import syft as sy
import torch
import sympc.module as sympc_module
from sympc.session import Sess... | [
37811,
4550,
262,
2648,
14,
260,
41571,
2446,
284,
262,
1632,
701,
19937,
5447,
994,
25,
198,
198,
5450,
1378,
12567,
13,
785,
14,
11505,
44,
1389,
14,
20519,
13940,
701,
14,
2436,
672,
14,
7959,
14,
10677,
14,
1837,
701,
14,
8019,
... | 2.69863 | 292 |
"""utils for file manager
"""
import os
from utils import getdate_now, randkey
def store_file(filename, chunks, filetype, chunkpath=None):
""" to store a file and return file address
"""
filepath = os.path.join('/mnt/media', filetype)
filepath = os.path.join(filepath, getdate_now().strftime('%Y%m/%d/%... | [
37811,
26791,
329,
2393,
4706,
198,
37811,
198,
11748,
28686,
198,
198,
6738,
3384,
4487,
1330,
651,
4475,
62,
2197,
11,
43720,
2539,
198,
198,
4299,
3650,
62,
7753,
7,
34345,
11,
22716,
11,
2393,
4906,
11,
16058,
6978,
28,
14202,
259... | 2.209302 | 731 |
from splinter import Browser
from bs4 import BeautifulSoup as bs
from webdriver_manager.chrome import ChromeDriverManager
import pandas as pd
import requests
| [
6738,
4328,
3849,
1330,
34270,
198,
6738,
275,
82,
19,
1330,
23762,
50,
10486,
355,
275,
82,
198,
6738,
3992,
26230,
62,
37153,
13,
46659,
1330,
13282,
32103,
13511,
198,
11748,
19798,
292,
355,
279,
67,
220,
220,
198,
11748,
7007,
62... | 3.790698 | 43 |
#!/usr/bin/env python3
### Importing
# Importing External Packages
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
from pyrogram.errors import exceptions, UserNotParticipant
from pyrogram.types import Update, Message
from pymongo import MongoClient
from mega import *
from mega.errors import Requ... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
628,
198,
21017,
17267,
278,
198,
2,
17267,
278,
34579,
6400,
1095,
198,
6738,
12972,
39529,
13,
19199,
1330,
554,
1370,
9218,
3526,
21864,
11,
554,
1370,
9218,
3526,
9704,
929,
198,
67... | 3.442006 | 319 |
from flask import jsonify
from models.Booking import BookingDAO
from models.Person import PersonDAO
from models.Room import RoomDAO
from models.AvailablePerson import AvailablePersonDAO
from models.AvailableRoom import AvailableRoomDAO
class Booking(object):
"""
This method, as the name says, communicates ... | [
6738,
42903,
1330,
33918,
1958,
198,
198,
6738,
4981,
13,
10482,
278,
1330,
4897,
278,
5631,
46,
198,
6738,
4981,
13,
15439,
1330,
7755,
5631,
46,
198,
6738,
4981,
13,
41178,
1330,
10096,
5631,
46,
198,
198,
6738,
4981,
13,
10493,
154... | 3.549587 | 242 |
""" Inspired by https://github.com/ahoucbvtw/RegiFamily_shiny"""
""" Detecting multiple bright spots in an image with Python and OpenCV """
# import the necessary packages
from imutils import contours
from skimage import measure
import numpy as np
import argparse
import imutils
import cv2 | [
37811,
45827,
416,
3740,
1378,
12567,
13,
785,
14,
993,
280,
21101,
85,
4246,
14,
8081,
72,
24094,
62,
1477,
3541,
37811,
198,
37811,
35874,
278,
3294,
6016,
10222,
287,
281,
2939,
351,
11361,
290,
4946,
33538,
37227,
198,
2,
1330,
26... | 3.802632 | 76 |
# coding=utf-8
from django.contrib.auth.models import AnonymousUser
from django.contrib.contenttypes.models import ContentType
from django.utils.text import capfirst, force_text
from rest_framework import viewsets, mixins, status, views as rest_views
from rest_framework.decorators import action
from rest_framework.resp... | [
2,
19617,
28,
40477,
12,
23,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
27530,
1330,
19200,
12982,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
11299,
19199,
13,
27530,
1330,
14041,
6030,
198,
6738,
42625,
14208,
13,
26791,
... | 3.569721 | 251 |
# by Kami Bigdely
# Extract class
full_names = ['Elizabeth Debicki', 'Jim Carrey']
birth_year = [1990, 1962]
movies = [['Tenet', 'Vita & Virgina', 'Guardians of the Galexy', 'The Great Gatsby'],\
['Ace Ventura', 'The Mask', 'Dubm and Dumber', 'The Truman Show', 'Yes Man']]
email = ['deb@makeschool.com', 'jim@make... | [
2,
416,
509,
6277,
4403,
2934,
306,
198,
2,
29677,
1398,
198,
198,
12853,
62,
14933,
796,
37250,
43568,
8965,
624,
72,
3256,
705,
18050,
1879,
4364,
20520,
198,
24280,
62,
1941,
796,
685,
19891,
11,
20033,
60,
198,
76,
20526,
796,
1... | 2.342857 | 280 |
class Vector:
"""
A class for vector calculations in an n dimensional vector space.
Supports addition and multiplying with a scalar.
"""
def add(self, z2):
"""
Adds the vector z2 to this vector and returns the result.
"""
assert(len(self.entries) == len(z2.entries))
... | [
4871,
20650,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
317,
1398,
329,
15879,
16765,
287,
281,
299,
38517,
15879,
2272,
13,
198,
220,
220,
220,
45267,
3090,
290,
48816,
351,
257,
16578,
283,
13,
198,
220,
220,
220,
37227,
6... | 2.29037 | 675 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
from cec2013.cec2013 import *
import matplotlib.pyplot as plt
from multiprocessing.dummy import Pool as ThreadPool
import multiprocessing
import xlwt
# standard DE
# standard CDE
# NCDE
CEC_benchmark(benchmark_fun_set=range(1,21)) | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
269,
721,
6390,
13,
344,
66,
6390,
1330,
1635,
198,
11748,
2603,
2... | 2.571429 | 119 |
from colorsys import rgb_to_hls, hls_to_rgb
""" USEFUL FUNCTIONS """
""" CONSTANTS """
# Background color of app
BG_COLOR = "#292929"
# Background color of Song Tables
STBG_COLOR = "#06603d"
# Widget color
W_COLOR = "#84bd00"
# White (green) color
WHITE = "#e1f0e1"
# Black (green) color
BLACK = "#0a330a"
# Font fo... | [
6738,
7577,
893,
1330,
46140,
62,
1462,
62,
71,
7278,
11,
289,
7278,
62,
1462,
62,
81,
22296,
198,
198,
37811,
23210,
46476,
29397,
4177,
11053,
37227,
628,
628,
198,
37811,
7102,
2257,
1565,
4694,
37227,
198,
2,
25353,
3124,
286,
598... | 2.319965 | 2,269 |
from flask import Blueprint, render_template
from flaskr.db import get_db
bp = Blueprint('blog', __name__)
@bp.route('/') | [
6738,
42903,
1330,
39932,
11,
8543,
62,
28243,
198,
6738,
42903,
81,
13,
9945,
1330,
651,
62,
9945,
628,
198,
46583,
796,
39932,
10786,
14036,
3256,
11593,
3672,
834,
8,
628,
198,
31,
46583,
13,
38629,
10786,
14,
11537
] | 3.205128 | 39 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2017 by University of Kassel and Fraunhofer Institute for Wind Energy and
# Energy System Technology (IWES), Kassel. All rights reserved. Use of this source code is governed
# by a BSD-style license that can be found in the LICENSE file.
from math import pi
from numpy impo... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
2,
15069,
357,
66,
8,
1584,
12,
5539,
416,
2059,
286,
15035,
741,
290,
39313,
403,
71,
30288,
5136,
329,
3086,
6682,
290,
198,
2,
6682,
4482,
8987,
357,
40,
54,... | 1.855515 | 12,375 |
TASKS = {
"binary_classification": 1,
"multi_class_classification": 2,
"entity_extraction": 4,
"extractive_question_answering": 5,
"summarization": 8,
"single_column_regression": 10,
"speech_recognition": 11,
}
DATASETS_TASKS = ["text-classification", "question-answering-extractive"]
| [
51,
1921,
27015,
796,
1391,
198,
220,
220,
220,
366,
39491,
62,
4871,
2649,
1298,
352,
11,
198,
220,
220,
220,
366,
41684,
62,
4871,
62,
4871,
2649,
1298,
362,
11,
198,
220,
220,
220,
366,
26858,
62,
2302,
7861,
1298,
604,
11,
198... | 2.492063 | 126 |
#!/Users/robertpoenaru/.pyenv/shims/python
import reshape_matrix as sh
import numpy as np
N = 5
M = 7
m = sh.Shaper(N, M)
mat = np.arange((N * M)).reshape(N, M) + 1
print(mat)
trunc_mat = m.Truncate(mat, 2, 2)
print(trunc_mat)
ext_mat = m.Extend(mat, 1, 3)
print(ext_mat)
| [
2,
48443,
14490,
14,
305,
4835,
79,
6571,
11493,
11757,
9078,
24330,
14,
1477,
12078,
14,
29412,
198,
198,
11748,
27179,
1758,
62,
6759,
8609,
355,
427,
198,
11748,
299,
32152,
355,
45941,
198,
198,
45,
796,
642,
198,
44,
796,
767,
... | 2.074627 | 134 |
# Copyright (c) 2014, German Neuroinformatics Node (G-Node)
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted under the terms of the BSD License. See
# LICENSE file in the root of the Project.
from __future__ import (absolute_import, division,... | [
2,
15069,
357,
66,
8,
1946,
11,
2679,
13782,
259,
18982,
873,
19081,
357,
38,
12,
19667,
8,
198,
2,
198,
2,
1439,
2489,
10395,
13,
198,
2,
198,
2,
2297,
396,
3890,
290,
779,
287,
2723,
290,
13934,
5107,
11,
351,
393,
1231,
198,
... | 3.517857 | 112 |
"""
Taken from https://github.com/maartenbreddels/ipyvolume/pull/178
"""
import numpy as np
import matplotlib.cm
import matplotlib.colors
from ipyvolume import TransferFunction
def linear_transfer_function(
color, min_opacity=0, max_opacity=0.05, reverse_opacity=False, n_elements=256
):
"""Transfer function o... | [
37811,
198,
51,
1685,
422,
3740,
1378,
12567,
13,
785,
14,
2611,
23996,
65,
26504,
1424,
14,
541,
88,
29048,
14,
31216,
14,
23188,
198,
37811,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
29487,
8019,
13,
11215,
198,
11748,
2... | 2.611474 | 1,377 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import unittest2 as ... | [
2,
19617,
28,
40477,
12,
23,
198,
2,
15069,
1946,
41689,
1628,
20420,
357,
3826,
27342,
9865,
3843,
20673,
13,
9132,
737,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
3826,
38559,
24290,
737,
198,
198,
6738,
1... | 3.007246 | 138 |
from collections import Counter
from operator import itemgetter
INVENTORY = {
'A': {'price': 50, 'offer': [{'cnt': 3, 'price': 130}, {'cnt': 5, 'price': 200}]},
'B': {'price': 30, 'offer': [{'cnt': 2, 'price': 45}], 'free': {'sku': 'E', 'cnt': 2}},
'C': {'price': 20},
'D': {'price': 15},
'E': {'pr... | [
198,
6738,
17268,
1330,
15034,
198,
6738,
10088,
1330,
2378,
1136,
353,
198,
198,
1268,
53,
3525,
15513,
796,
1391,
198,
220,
220,
220,
705,
32,
10354,
1391,
6,
20888,
10354,
2026,
11,
705,
47895,
10354,
685,
90,
6,
66,
429,
10354,
... | 1.959502 | 642 |
# Generated by Django 2.2.6 on 2019-11-06 13:24
from django.db import migrations, models
| [
2,
2980,
515,
416,
37770,
362,
13,
17,
13,
21,
319,
13130,
12,
1157,
12,
3312,
1511,
25,
1731,
201,
198,
201,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
201,
198,
201,
198
] | 2.567568 | 37 |
# Copyright 2016-2020 Blue Marble Analytics LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
2,
15069,
1584,
12,
42334,
4518,
36891,
30437,
11419,
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,... | 2.057467 | 2,993 |
import f3b
import f3b.datas_pb2
import f3b.custom_params_pb2
import f3b.animations_kf_pb2
import f3b.physics_pb2
from . import Relations
from ..F3bContext import *
from ..Utils import *
from .. import Logger as log
from ..tools import F3bLod
from ..Mesh import *;
| [
11748,
277,
18,
65,
198,
11748,
277,
18,
65,
13,
19608,
292,
62,
40842,
17,
198,
11748,
277,
18,
65,
13,
23144,
62,
37266,
62,
40842,
17,
198,
11748,
277,
18,
65,
13,
11227,
602,
62,
74,
69,
62,
40842,
17,
198,
11748,
277,
18,
... | 2.394958 | 119 |
# Copyright (C) 2006-2018, Stefan Schwarzer <sschwarzer@sschwarzer.net>
# and ftputil contributors (see `doc/contributors.txt`)
# See the file LICENSE for licensing terms.
"""
ftp_stat_cache.py - cache for (l)stat data
"""
import time
import ftputil.error
import ftputil.lrucache
# This module shouldn't be used by ... | [
2,
15069,
357,
34,
8,
4793,
12,
7908,
11,
28842,
29726,
9107,
1279,
824,
354,
5767,
9107,
31,
824,
354,
5767,
9107,
13,
3262,
29,
198,
2,
290,
10117,
1996,
346,
20420,
357,
3826,
4600,
15390,
14,
3642,
2455,
669,
13,
14116,
63,
8,... | 2.418408 | 2,249 |
################################################
# Script to read the results of Clustering.cpp #
################################################
from ROOT import TCanvas, TFile, gStyle
from Isis.plot_tools import ColorList
gStyle.SetOptTitle( 0 )
# Gets the scatter plots from the file
ifile = TFile.Open( "Cluster... | [
29113,
14468,
198,
2,
12327,
284,
1100,
262,
2482,
286,
1012,
436,
1586,
13,
20322,
1303,
198,
29113,
14468,
198,
198,
6738,
15107,
2394,
1330,
309,
6090,
11017,
11,
309,
8979,
11,
308,
21466,
198,
6738,
16530,
13,
29487,
62,
31391,
1... | 2.854599 | 337 |
import cv2
import numpy as np
import glob
import os
import argparse
def get_noise(img, value=10):
'''
#生成噪声图像
value= 大小控制雨滴的多少
'''
noise = np.random.uniform(0, 256, img.shape[0:2])
# 控制噪声水平,取浮点数,只保留最大的一部分作为噪声
v = value * 0.01
noise[np.where(noise < (256 - v))] = 0
# 噪声做初次模糊
k ... | [
11748,
269,
85,
17,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
15095,
198,
11748,
28686,
198,
11748,
1822,
29572,
198,
198,
4299,
651,
62,
3919,
786,
7,
9600,
11,
1988,
28,
940,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
22... | 1.610724 | 1,436 |
from .fermi import * # NOQA
| [
6738,
764,
2232,
11632,
1330,
1635,
220,
1303,
8005,
48,
32,
198
] | 2.416667 | 12 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Provide some examples using GMR.
See also the `gmr.py` example beforehand. In this example, we delve a bit deeper into GMR using 2D letters as training
data.
"""
import numpy as np
from scipy.io import loadmat
import matplotlib.pyplot as plt
from pyrobolearn.models.gm... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
15946,
485,
617,
6096,
1262,
6951,
49,
13,
198,
198,
6214,
635,
262,
4600,
39870,
81,
13,
9078,
63,
1672,
2709... | 2.222535 | 1,065 |
from mido import MidiFile
mid = MidiFile('outfile.mid')
for i,track in enumerate(mid.tracks):
# print('Track {}:{}'.format(i,track.name))
for msg in track:
if msg.type == 'key_signature':
m = str(msg)
print(m[33])
| [
6738,
3095,
78,
1330,
7215,
72,
8979,
198,
198,
13602,
220,
796,
7215,
72,
8979,
10786,
448,
7753,
13,
13602,
11537,
198,
198,
1640,
1312,
11,
11659,
287,
27056,
378,
7,
13602,
13,
46074,
2599,
198,
220,
220,
220,
220,
220,
220,
220... | 1.978571 | 140 |
import scapy.all as S
import urllib.parse as urlparse
from typing import Tuple
import codecs
WEBSITE = 'infosec.cs.tau.ac.il'
def parse_packet(packet) -> Tuple[str]:
"""
If the given packet is a login request to the course website, return the
username and password as a tuple => ('123456789', 'opensesame... | [
11748,
629,
12826,
13,
439,
355,
311,
198,
11748,
2956,
297,
571,
13,
29572,
355,
19016,
29572,
198,
6738,
19720,
1330,
309,
29291,
198,
11748,
40481,
82,
628,
198,
8845,
4462,
12709,
796,
705,
10745,
577,
66,
13,
6359,
13,
83,
559,
... | 2.724458 | 969 |
# Problem Statement: https://www.hackerrank.com/challenges/validating-postalcode/problem
regex_integer_in_range = r'^[1-9]\d{5}$'
regex_alternating_repetitive_digit_pair = r'(\d)(?=\d\1)' | [
2,
20647,
21983,
25,
3740,
1378,
2503,
13,
31153,
8056,
962,
13,
785,
14,
36747,
34120,
14,
12102,
803,
12,
7353,
282,
8189,
14,
45573,
198,
198,
260,
25636,
62,
41433,
62,
259,
62,
9521,
796,
374,
6,
61,
58,
16,
12,
24,
60,
59,... | 2.410256 | 78 |
# 🚨 Don't change the code below 👇
from typing import Counter
print("Welcome to the Love Calculator!")
name1 = input("What is your name? \n")
name2 = input("What is their name? \n")
# 🚨 Don't change the code above 👆
#Write your code below this line 👇
#Convert names to lower case
lower_name1 = name1.lower()
lowe... | [
2,
12520,
248,
101,
2094,
470,
1487,
262,
2438,
2174,
50169,
229,
198,
6738,
19720,
1330,
15034,
628,
198,
4798,
7203,
14618,
284,
262,
5896,
43597,
2474,
8,
198,
3672,
16,
796,
5128,
7203,
2061,
318,
534,
1438,
30,
3467,
77,
4943,
... | 2.569652 | 402 |
import sys, os
import numpy as np
import pickle
import argparse
# local imports
from shared import my_module as mymod
from importlib import reload
reload(mymod)
'-----------------------------------------------------------------------------------'
# Make some arrays
arr_1 = np.array([45, 6, 94, 11, 33, 79, 103, 62])... | [
11748,
25064,
11,
28686,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2298,
293,
198,
11748,
1822,
29572,
198,
198,
2,
1957,
17944,
198,
6738,
4888,
1330,
616,
62,
21412,
355,
616,
4666,
198,
6738,
1330,
8019,
1330,
18126,
198,
260,
... | 2.910737 | 1,602 |
import MySQLdb
import json
import random
import string
db = MySQLdb.connect(host="localhost",user="he",passwd="REDADCTED",db="game")
cur = db.cursor()
json_data = open('/var/www/json/npc.json').read()
npcList = json.loads(json_data)
emptyDB()
for npcType in npcList:
try:
npcList[npcType]['hardware']
#MD, FBI... | [
11748,
33476,
9945,
198,
11748,
33918,
198,
11748,
4738,
198,
11748,
4731,
198,
198,
9945,
796,
33476,
9945,
13,
8443,
7,
4774,
2625,
36750,
1600,
7220,
2625,
258,
1600,
6603,
16993,
2625,
22083,
2885,
4177,
1961,
1600,
9945,
2625,
6057,
... | 2.414931 | 576 |
outcomes = ["Stay Home", "Play Golf", "Play Golf", "Stay Home", "Play Golf", "Stay Home", "Play Golf"]
groups = set(outcomes)
# Lambda is basically anonymous funcs
# The below can be converted to max(set(outcomes), lambda x: outcomes.count(x))
# 1. It's a key/value pair
# the output of set(outcomes) feeds into key=ou... | [
448,
8988,
796,
14631,
25681,
5995,
1600,
366,
11002,
19709,
1600,
366,
11002,
19709,
1600,
366,
25681,
5995,
1600,
366,
11002,
19709,
1600,
366,
25681,
5995,
1600,
366,
11002,
19709,
8973,
198,
198,
24432,
796,
900,
7,
448,
8988,
8,
19... | 3.037736 | 159 |
from sapextractor.utils.table_count import get
| [
6738,
473,
431,
742,
40450,
13,
26791,
13,
11487,
62,
9127,
1330,
651,
198
] | 3.357143 | 14 |
"""
This module contains classes that can score unlabelled objects
by usefulness of their labels for a model.
These classes have public interface in common, but rely on
different scoring functions and scoring tools internally.
A notion of so called tools is of particular importance. In context
of this module, the word... | [
37811,
198,
1212,
8265,
4909,
6097,
326,
460,
4776,
9642,
397,
11978,
5563,
198,
1525,
37496,
286,
511,
14722,
329,
257,
2746,
13,
198,
4711,
6097,
423,
1171,
7071,
287,
2219,
11,
475,
8814,
319,
198,
39799,
9689,
5499,
290,
9689,
489... | 2.340431 | 7,138 |
# Copyright (c) 2020 Intel Corporation. All Rights Reserved.
#
# 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 use, copy, mod... | [
2,
15069,
357,
66,
8,
12131,
8180,
10501,
13,
1439,
6923,
33876,
13,
198,
2,
198,
2,
2448,
3411,
318,
29376,
7520,
11,
1479,
286,
3877,
11,
284,
597,
1048,
16727,
257,
198,
2,
4866,
286,
428,
3788,
290,
3917,
10314,
3696,
357,
116... | 3.519231 | 416 |
import helpers as h
import random
#rf is function that takes a "locks" list (see "formats" functions in micro.py)
#canR is list of indices that can be regenerated
#sf is a score function that takes a string (artifact) and returns a score where higher is better
#s is string (artifact)
#sett is Settings object
#s i... | [
11748,
49385,
355,
289,
198,
11748,
4738,
198,
197,
2,
41871,
318,
2163,
326,
2753,
257,
366,
28860,
1,
1351,
357,
3826,
366,
687,
1381,
1,
5499,
287,
4580,
13,
9078,
8,
198,
197,
2,
5171,
49,
318,
1351,
286,
36525,
326,
460,
307,... | 3.424 | 125 |
# constants.py
SOCKET_TIMEOUT = 5
BUFFER_SIZE = 1000
LOAD_BALANCER_QUEUE_SIZE = 50
LEADER_QUEUE_SIZE = 50
HEART_BEAT = 1
#Test constants | [
2,
38491,
13,
9078,
198,
50,
11290,
2767,
62,
34694,
12425,
796,
642,
198,
19499,
45746,
62,
33489,
796,
8576,
198,
35613,
62,
33,
1847,
20940,
1137,
62,
48,
8924,
8924,
62,
33489,
796,
2026,
198,
2538,
2885,
1137,
62,
48,
8924,
892... | 2.305085 | 59 |
import sys
import args
import models_small as models
import hypera2c as H
import utils
from atari_data import MultiEnvironment
import warnings
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch, os, gym, time, glob, argparse, sys
from torch.optim import Adam
from scipy.misc import i... | [
11748,
25064,
198,
11748,
26498,
198,
11748,
4981,
62,
17470,
355,
4981,
198,
11748,
8718,
64,
17,
66,
355,
367,
198,
11748,
3384,
4487,
198,
6738,
379,
2743,
62,
7890,
1330,
15237,
31441,
198,
198,
11748,
14601,
198,
11748,
299,
32152,... | 2.272352 | 727 |
import pytest
import numpy as np
import pandas as pd
from sklearn.exceptions import NotFittedError
from feature_engine.discretisers import EqualFrequencyDiscretiser, EqualWidthDiscretiser, DecisionTreeDiscretiser
| [
11748,
12972,
9288,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
19798,
292,
355,
279,
67,
198,
6738,
1341,
35720,
13,
1069,
11755,
1330,
1892,
37,
2175,
12331,
198,
198,
6738,
3895,
62,
18392,
13,
15410,
1186,
21572,
1330,
28701,
37... | 3.677966 | 59 |
"""saml sp views"""
from urllib.parse import ParseResult, parse_qsl, urlparse, urlunparse
from django.contrib.auth import logout
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import Http404, HttpRequest, HttpResponse
from django.http.response import HttpResponseBadRequest
from django.short... | [
37811,
37687,
75,
599,
5009,
37811,
198,
6738,
2956,
297,
571,
13,
29572,
1330,
2547,
325,
23004,
11,
21136,
62,
80,
6649,
11,
19016,
29572,
11,
19016,
403,
29572,
198,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
1330,
2604,
44... | 2.405457 | 3,115 |
import numpy as np
import torch
from collections import namedtuple
from torch.nn.parallel import DistributedDataParallel as DDP
from rlpyt.agents.base import BaseAgent, AgentStep
from rlpyt.models.qpg.conv import PiConvTiedModel, QDoubleConvTiedModel
from rlpyt.utils.quick_args import save__init__args
from rlpyt.dist... | [
198,
11748,
299,
32152,
355,
45941,
198,
11748,
28034,
198,
6738,
17268,
1330,
3706,
83,
29291,
198,
6738,
28034,
13,
20471,
13,
1845,
29363,
1330,
4307,
6169,
6601,
10044,
29363,
355,
360,
6322,
198,
198,
6738,
374,
75,
9078,
83,
13,
... | 2.393876 | 1,437 |
from django.http import response
from django.shortcuts import redirect, render
from django.http import HttpResponse
import requests
from .forms import New_Test, Update_Patient_info
from django.views.decorators.csrf import csrf_exempt
from diagnose.models import Diagnose
import os
import time
from django.contrib import ... | [
6738,
42625,
14208,
13,
4023,
1330,
2882,
198,
6738,
42625,
14208,
13,
19509,
23779,
1330,
18941,
11,
8543,
198,
6738,
42625,
14208,
13,
4023,
1330,
367,
29281,
31077,
198,
11748,
7007,
198,
6738,
764,
23914,
1330,
968,
62,
14402,
11,
1... | 2.942308 | 156 |
import atexit
import contextlib
import os
import pathlib
import requests
import shlex
import subprocess
import sys
@contextlib.contextmanager
try:
user = os.environ['GH_USER']
token = os.environ['GH_TOKEN']
except KeyError:
raise RuntimeError('You must set GH_USER and GH_TOKEN environ vars')
else:
... | [
11748,
379,
37023,
198,
11748,
4732,
8019,
198,
11748,
28686,
198,
11748,
3108,
8019,
198,
11748,
7007,
198,
11748,
427,
2588,
198,
11748,
850,
14681,
198,
11748,
25064,
628,
628,
198,
198,
31,
22866,
8019,
13,
22866,
37153,
628,
198,
2... | 2.755682 | 176 |
from ..parser import parse
# Regression test for weird edge case in which hr gets moved outside of quote
| [
6738,
11485,
48610,
1330,
21136,
628,
628,
628,
628,
198,
2,
3310,
2234,
1332,
329,
7650,
5743,
1339,
287,
543,
39436,
3011,
3888,
2354,
286,
9577,
198
] | 4.185185 | 27 |
#!/usr/bin/env python
"""
@package ion.agents.platform.rsn.simulator.logger
@file ion/agents/platform/rsn/simulator/logger.py
@author Carlos Rueda
@brief Logger configuration for the OMS simulator.
"""
__author__ = 'Carlos Rueda'
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
37811,
198,
31,
26495,
22088,
13,
49638,
13,
24254,
13,
3808,
77,
13,
14323,
8927,
13,
6404,
1362,
198,
31,
7753,
220,
220,
220,
22088,
14,
49638,
14,
24254,
14,
3808,
77,
14,
... | 2.666667 | 90 |
# Generated by Django 2.0.6 on 2018-06-18 20:50
from django.db import migrations, models
| [
2,
2980,
515,
416,
37770,
362,
13,
15,
13,
21,
319,
2864,
12,
3312,
12,
1507,
1160,
25,
1120,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.84375 | 32 |
from elastic import ask_delete_index, get_indices, parse_indices
host = "localhost:9200"
products = { \
'glads2_mm' : ['dev', 'test', 'prod'], \
'glads2_vk' : ['dev', 'test', 'prod'], \
'glads2_ok' : ['dev', 'test', 'prod'], \
'glads2_gp' : ['dev', 'test', 'prod'], \... | [
6738,
27468,
1330,
1265,
62,
33678,
62,
9630,
11,
651,
62,
521,
1063,
11,
21136,
62,
521,
1063,
628,
198,
4774,
796,
366,
36750,
25,
24,
2167,
1,
198,
29498,
796,
1391,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
... | 1.866667 | 285 |
a = float(input ('Digite a 1° nota do aluno: '))
b = float(input ('Digite a 2° nota do aluno: '))
m = (a + b) / 2
if m < 5:
print ('Sua média foi de {}, REPROVADO!'.format(m))
elif m >= 7:
print ('Você foi aprovado, sua média foi de {}'.format(m))
else:
print ('Sua média foi de {}, RECUPERAÇÃO!'.format(m))... | [
64,
796,
12178,
7,
15414,
19203,
19511,
578,
257,
352,
7200,
407,
64,
466,
435,
36909,
25,
705,
4008,
198,
65,
796,
12178,
7,
15414,
19203,
19511,
578,
257,
362,
7200,
407,
64,
466,
435,
36909,
25,
705,
4008,
198,
76,
796,
357,
64... | 2.084416 | 154 |
sepatu = {"nama": "Sepatu Niko", "harga": 150000, "diskon": 30000}
baju = {"nama": "Baju Unikloh", "harga": 80000, "diskon": 8000}
celana = {"nama": "Celana Lepis", "harga": 200000, "diskon": 60000}
harga_sepatu = sepatu["harga"] - sepatu["diskon"]
harga_baju = baju["harga"] - baju["diskon"]
harga_celana = celana["harg... | [
325,
8071,
84,
796,
19779,
77,
1689,
1298,
366,
19117,
33419,
11271,
78,
1600,
366,
71,
853,
64,
1298,
1315,
2388,
11,
366,
39531,
261,
1298,
513,
2388,
92,
198,
65,
1228,
84,
796,
19779,
77,
1689,
1298,
366,
33,
1228,
84,
791,
11... | 2.043269 | 208 |
from flask import Flask, jsonify, request
from multiprocessing import Value
counter = Value('i', 0)
app = Flask(__name__)
a = []
help_message = """
API Usage:
- GET /api/list
- POST /api/add data={"key": "value"}
- GET /api/get/<id>
- PUT /api/update/<id> data={"key": "value_to_replace"}
- DELETE /api/de... | [
6738,
42903,
1330,
46947,
11,
33918,
1958,
11,
2581,
198,
6738,
18540,
305,
919,
278,
1330,
11052,
198,
198,
24588,
796,
11052,
10786,
72,
3256,
657,
8,
198,
1324,
796,
46947,
7,
834,
3672,
834,
8,
198,
198,
64,
796,
17635,
198,
167... | 2.286585 | 328 |
"""Moontracker package initialization."""
| [
37811,
16632,
756,
81,
10735,
5301,
37588,
526,
15931,
198
] | 4.2 | 10 |
import io
from contextlib import redirect_stderr, redirect_stdout
from dataclasses import dataclass, field
from typing import Generator, List
from ward.errors import FixtureError
from ward.fixtures import FixtureCache
from ward.models import Scope
from ward.test_result import TestOutcome, TestResult
from ward.testing ... | [
11748,
33245,
198,
6738,
4732,
8019,
1330,
18941,
62,
301,
1082,
81,
11,
18941,
62,
19282,
448,
198,
6738,
4818,
330,
28958,
1330,
4818,
330,
31172,
11,
2214,
198,
6738,
19720,
1330,
35986,
11,
7343,
198,
198,
6738,
15305,
13,
48277,
... | 3.833333 | 90 |
import hashlib
from typing import Iterable, Callable
from mabooia.collections import Stream, LinkedList
| [
11748,
12234,
8019,
198,
6738,
19720,
1330,
40806,
540,
11,
4889,
540,
198,
198,
6738,
285,
397,
2238,
544,
13,
4033,
26448,
1330,
13860,
11,
7502,
276,
8053,
628,
628,
628
] | 3.548387 | 31 |
# https://www.quora.com/Why-do-we-use-the-Ornstein-Uhlenbeck-Process-in-the-exploration-of-DDPG
import random
import copy
import numpy as np
class OUNoise:
"""
Ornstein-Uhlenbeck process.
"""
def __init__(self, size, mu=0., theta=0.15, sigma=0.2):
"""
Initialise parameters and noise pr... | [
2,
3740,
1378,
2503,
13,
421,
5799,
13,
785,
14,
5195,
12,
4598,
12,
732,
12,
1904,
12,
1169,
12,
5574,
77,
5714,
12,
34653,
11925,
27343,
12,
18709,
12,
259,
12,
1169,
12,
20676,
6944,
12,
1659,
12,
35,
6322,
38,
198,
198,
1174... | 2.066667 | 420 |
#!/usr/bin/env python3
"""
The data types for an Ocean Salinity DTBXY
"""
import numpy as np
# data type list of lists. The inner lists are there for each file sub-block.
datatype = [
[('MaxValid', 'float32')],
[('MinValid', 'float32')],
# REGION
[('region_count', 'uin... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
37811,
198,
464,
1366,
3858,
329,
281,
10692,
4849,
6269,
360,
22737,
34278,
198,
37811,
198,
198,
11748,
299,
32152,
355,
45941,
198,
198,
2,
1366,
2099,
1351,
286,
8341,
13,
383,... | 2.112751 | 1,694 |
# python code to find out what set of dividers give an accurate set of N=12 frequencies for a top
# octave musical note generator.
# there are a bunch of print statements that can be uncommented to output various things
# this script is optimized to show the master clock frequencies that give the lowest percent error o... | [
2,
21015,
2438,
284,
1064,
503,
644,
900,
286,
13576,
364,
1577,
281,
7187,
900,
286,
399,
28,
1065,
19998,
329,
257,
1353,
198,
2,
19318,
1015,
10530,
3465,
17301,
13,
198,
2,
612,
389,
257,
7684,
286,
3601,
6299,
326,
460,
307,
... | 2.238123 | 1,705 |
"""Constants for physical simulation"""
flowRate = 10 # the amount of water flowing (in ml) from the mixture vessel per second when tap is open
heatRate = 1 # the amount of heat increase (in degrees celsius) in mixture vessel when heater is on
temperatureDecay = 0.1 # amount of temperature loss (... | [
37811,
34184,
1187,
329,
3518,
18640,
37811,
198,
11125,
32184,
796,
838,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
262,
2033,
286,
1660,
17609,
357,
259,
25962,
8,
422,
262,
11710,
8837,
583,
1218,
618,
9814,
318,
1280,
198,... | 3.36534 | 427 |
#!/usr/bin/env python
#
# Upgrade the OpenStack with Clustering Status Control.
# Usage: $ ./do-upgrade.py -o cloud:xenial-newton [application-name]
#
import argparse
import logging
import six
import subprocess
import time
import yaml
logging.basicConfig(
filename='os-upgrade.log',
level=logging.DEBUG,
f... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
198,
2,
24236,
262,
4946,
25896,
351,
1012,
436,
1586,
12678,
6779,
13,
198,
2,
29566,
25,
720,
24457,
4598,
12,
929,
9526,
13,
9078,
532,
78,
6279,
25,
87,
268,
498,
12,
3605,
... | 2.684189 | 2,454 |
import pytorch_lightning as pl
import torch
import torch.nn as nn
class GPT2(pl.LightningModule):
"""
GPT-2 from `language Models are Unsupervised Multitask Learners <https://d4mucfpksywv.cloudfront.net/
better-language-models/language-models.pdf>`_
Paper by: Alec Radford, Jeffrey Wu, Rewon Child, ... | [
11748,
12972,
13165,
354,
62,
2971,
768,
355,
458,
198,
11748,
28034,
198,
11748,
28034,
13,
20471,
355,
299,
77,
628,
198,
198,
4871,
402,
11571,
17,
7,
489,
13,
15047,
768,
26796,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
22... | 2.275068 | 738 |