content stringlengths 1 1.05M | input_ids listlengths 1 883k | ratio_char_token float64 1 22.9 | token_count int64 1 883k |
|---|---|---|---|
import unittest
from mock import Mock
from test.robotTestUtil import RobotTestUtil
if __name__ == '__main__':
unittest.main()
| [
11748,
555,
715,
395,
198,
6738,
15290,
1330,
44123,
198,
6738,
1332,
13,
305,
13645,
14402,
18274,
346,
1330,
16071,
14402,
18274,
346,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
555,
... | 2.829787 | 47 |
import click
| [
11748,
3904,
628,
198
] | 3.75 | 4 |
import copy
import os
import json
from pathlib import Path
from typing import Callable, Optional
from . import rust, version
def patch_iso_raw(config_str: str, notifier: BaseProgressNotifier):
if notifier is None:
raise ValueError("notifier is None")
return rust.patch_iso(config_str, notifier)
de... | [
11748,
4866,
198,
11748,
28686,
198,
11748,
33918,
198,
6738,
3108,
8019,
1330,
10644,
198,
6738,
19720,
1330,
4889,
540,
11,
32233,
198,
198,
6738,
764,
1330,
17000,
11,
2196,
628,
628,
198,
4299,
8529,
62,
26786,
62,
1831,
7,
11250,
... | 2.721154 | 312 |
# -*- coding: UTF-8 -*-
import os
from secistsploit.core.exploit import *
from secistsploit.core.http.http_client import HTTPClient
| [
2,
532,
9,
12,
19617,
25,
41002,
12,
23,
532,
9,
12,
198,
11748,
28686,
198,
6738,
792,
1023,
489,
30711,
13,
7295,
13,
20676,
30711,
1330,
1635,
198,
6738,
792,
1023,
489,
30711,
13,
7295,
13,
4023,
13,
4023,
62,
16366,
1330,
146... | 2.891304 | 46 |
from pathlib import Path
import logging
import xarray
from time import time
from typing import Union
#
from .io import opener
from .rinex2 import rinexnav2, _scan2
from .rinex3 import rinexnav3, _scan3
# for NetCDF compression. too high slows down with little space savings.
COMPLVL = 1
def readrinex(rinexfn: Path, o... | [
6738,
3108,
8019,
1330,
10644,
198,
11748,
18931,
198,
11748,
2124,
18747,
198,
6738,
640,
1330,
640,
198,
6738,
19720,
1330,
4479,
198,
2,
198,
6738,
764,
952,
1330,
21996,
198,
6738,
764,
7640,
87,
17,
1330,
374,
500,
87,
28341,
17,... | 2.117988 | 1,551 |
from typing import TYPE_CHECKING
import networkx as nx
from .fas import eades_fas
if TYPE_CHECKING: # Prevent circular import
from .pref_dag import PrefDAG
def add_indiff(self, a: str, b: str, **attr):
"""Try to dd the indifference relation `a ~ b`, and throw an error if the expected
coh... | [
6738,
19720,
1330,
41876,
62,
50084,
2751,
198,
11748,
3127,
87,
355,
299,
87,
198,
6738,
764,
69,
292,
1330,
304,
2367,
62,
69,
292,
198,
361,
41876,
62,
50084,
2751,
25,
220,
220,
1303,
31572,
18620,
1330,
198,
220,
220,
220,
422,... | 2.371127 | 1,517 |
from __future__ import unicode_literals
from django.views import generic
from .models import {% for model in app.models %}{{ model.name }}{% if not loop.last %}, {% endif %}{% endfor %}
{% for model in app.models %}class {{ model.name }}IndexView(generic.ListView):
model = {{ model.name }}
template_name = '... | [
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
198,
6738,
42625,
14208,
13,
33571,
1330,
14276,
198,
198,
6738,
764,
27530,
1330,
1391,
4,
329,
2746,
287,
598,
13,
27530,
4064,
18477,
90,
2746,
13,
3672,
1782,
18477,
... | 2.898876 | 178 |
""" Reviews permissions."""
# Python
import logging
# Django Rest Framework
from rest_framework.permissions import BasePermission
| [
37811,
20871,
21627,
526,
15931,
198,
198,
2,
11361,
198,
11748,
18931,
198,
198,
2,
37770,
8324,
25161,
220,
198,
6738,
1334,
62,
30604,
13,
525,
8481,
1330,
7308,
5990,
3411,
628
] | 4.1875 | 32 |
import sys
import torch
import timeit
sys.path.append('../JDE')
from mot.models.backbones import ShuffleNetV2
from sosnet import SOSNet
if __name__ == '__main__':
print('SOSNet PK ShuffleNetV2')
model1 = ShuffleNetV2(
stage_repeat={'stage2': 4, 'stage3': 8, 'stage4': 4},
stage_out_ch... | [
11748,
25064,
201,
198,
11748,
28034,
201,
198,
11748,
640,
270,
201,
198,
17597,
13,
6978,
13,
33295,
10786,
40720,
41,
7206,
11537,
201,
198,
6738,
2369,
13,
27530,
13,
1891,
35095,
1330,
911,
18137,
7934,
53,
17,
201,
198,
6738,
26... | 2.081886 | 806 |
import pandas as pd
NETMHCPAN_3_0_DEST = "test_netmhcpan_3_0_alleles.py"
NETMHCPAN_3_0_SOURCE = "netmhcpan_3_0_alleles.txt"
NETMHCPAN_4_0_DEST = "test_netmhcpan_4_0_alleles.py"
NETMHCPAN_4_0_SOURCE = "netmhcpan_4_0_alleles.txt"
special_chars = " *:-,/."
netmhcpan_3_0_alleles = generate(
src=NETMHCPAN_3_0_SOURC... | [
11748,
19798,
292,
355,
279,
67,
198,
198,
12884,
36208,
8697,
1565,
62,
18,
62,
15,
62,
35,
6465,
796,
366,
9288,
62,
3262,
76,
71,
66,
6839,
62,
18,
62,
15,
62,
6765,
829,
13,
9078,
1,
198,
12884,
36208,
8697,
1565,
62,
18,
... | 1.81746 | 252 |
# from linked_list.linked_list import LinkedList
# def test_import():
# assert LinkedList
| [
2,
422,
6692,
62,
4868,
13,
25614,
62,
4868,
1330,
7502,
276,
8053,
628,
198,
2,
825,
1332,
62,
11748,
33529,
198,
2,
220,
220,
220,
220,
6818,
7502,
276,
8053,
198
] | 3 | 32 |
import requests
import re
import json
headers = {
"Origin": "https://bj.meituan.com",
"Host": "apimobile.meituan.com",
"Referer": "https://bj.meituan.com/s/%E7%81%AB%E9%94%85/",
"Cookie": "uuid=692a53319ce54d0c91f3.1597223761.1.0.0; ci=1; rvct=1; _lxsdk_cuid=173e1f47707c8-0dcd4ff30b4ae3-3323765-e1000-1... | [
11748,
7007,
198,
11748,
302,
198,
11748,
33918,
198,
198,
50145,
796,
1391,
198,
220,
220,
220,
366,
39688,
1298,
366,
5450,
1378,
50007,
13,
1326,
270,
7258,
13,
785,
1600,
198,
220,
220,
220,
366,
17932,
1298,
366,
499,
320,
3579,
... | 1.869266 | 436 |
from __future__ import annotations
import json
from typing import List, Dict
from entity_resolution import EntityResolution
| [
6738,
11593,
37443,
834,
1330,
37647,
198,
198,
11748,
33918,
198,
198,
6738,
19720,
1330,
7343,
11,
360,
713,
198,
198,
6738,
9312,
62,
29268,
1330,
20885,
4965,
2122,
198
] | 4.233333 | 30 |
import subprocess
import sys
import os
subprocess = subprocess
sys = sys
os = os
def output(command: str, remlstc: bool) -> str:
"""
Get output from console command.
If remlstc is True, it's return an output without a useless newline.
:param command: The command.
:param remlstc: R... | [
11748,
850,
14681,
201,
198,
11748,
25064,
201,
198,
11748,
28686,
201,
198,
201,
198,
201,
198,
7266,
14681,
796,
850,
14681,
201,
198,
17597,
796,
25064,
201,
198,
418,
796,
28686,
201,
198,
201,
198,
4299,
5072,
7,
21812,
25,
965,
... | 2.811828 | 186 |
# -*- coding: utf-8 -*-
"""
Program to batch create categories.
The program expects a generator containing a list of page titles to be used as
base.
The following command line parameters are supported:
-always (not implemented yet) Don't ask, just do the edit.
-overwrite (not implemented yet).
-parent... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
15167,
284,
15458,
2251,
9376,
13,
198,
198,
464,
1430,
13423,
257,
17301,
7268,
257,
1351,
286,
2443,
8714,
284,
307,
973,
355,
198,
8692,
13,
198,
198,
4... | 2.531768 | 724 |
"""Classification and regression loss functions for object detection.
Localization losses:
* WeightedL2LocalizationLoss
* WeightedSmoothL1LocalizationLoss
Classification losses:
* WeightedSoftmaxClassificationLoss
* WeightedSigmoidClassificationLoss
"""
from abc import ABCMeta
from abc import abstractmethod
impo... | [
37811,
9487,
2649,
290,
20683,
2994,
5499,
329,
2134,
13326,
13,
198,
198,
14565,
1634,
9089,
25,
198,
1635,
14331,
276,
43,
17,
14565,
1634,
43,
793,
198,
1635,
14331,
276,
7556,
5226,
43,
16,
14565,
1634,
43,
793,
198,
198,
9487,
... | 3.621359 | 103 |
import json
from datetime import datetime, timedelta
from dateutil import parser as dateparser
from django.contrib.auth.decorators import user_passes_test
from django.db.models import Q
from django.http import HttpResponseNotFound, JsonResponse
from django.shortcuts import render
from django.utils import timezone
fro... | [
11748,
33918,
198,
6738,
4818,
8079,
1330,
4818,
8079,
11,
28805,
12514,
198,
6738,
3128,
22602,
1330,
30751,
355,
3128,
48610,
198,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
12501,
273,
2024,
1330,
2836,
62,
6603,
274,
62,... | 2.413226 | 2,616 |
import os
from torch.utils.data import Dataset,DataLoader
import torch
import torch.nn as nn
from sklearn.metrics import f1_score
def build_corpus(split, make_vocab=True, data_dir="data"):
""""""
assert split in ['train', 'dev', 'test']
word_lists = []
tag_lists = []
with open(os.path.join(data_di... | [
11748,
28686,
198,
6738,
28034,
13,
26791,
13,
7890,
1330,
16092,
292,
316,
11,
6601,
17401,
198,
11748,
28034,
198,
11748,
28034,
13,
20471,
355,
299,
77,
198,
6738,
1341,
35720,
13,
4164,
10466,
1330,
277,
16,
62,
26675,
198,
198,
4... | 2.110638 | 1,410 |
'''
Created on 28 Jan 2021
@author: thomasgumbricht
'''
from string import whitespace
def CheckWhitespace(s):
'''
'''
return True in [c in s for c in whitespace]
s = 'dumsnut'
print (CheckWhitespace(s)) | [
7061,
6,
198,
41972,
319,
2579,
2365,
33448,
198,
198,
31,
9800,
25,
294,
16911,
70,
388,
1671,
30830,
198,
7061,
6,
198,
198,
6738,
4731,
1330,
13216,
10223,
198,
198,
4299,
6822,
1199,
2737,
10223,
7,
82,
2599,
198,
220,
220,
220,... | 2.149123 | 114 |
"""
link: https://leetcode.com/problems/longest-palindrome
problem: s
solution: map
"""
| [
198,
37811,
198,
198,
8726,
25,
3740,
1378,
293,
316,
8189,
13,
785,
14,
1676,
22143,
14,
6511,
395,
12,
18596,
521,
5998,
198,
198,
45573,
25,
264,
198,
198,
82,
2122,
25,
3975,
220,
198,
198,
37811,
628
] | 2.435897 | 39 |
import yaml
import os
import sys
current_dir = os.path.dirname(os.path.realpath(__file__))
project_dir = os.path.realpath(os.path.join(current_dir, ".."))
| [
11748,
331,
43695,
198,
11748,
28686,
198,
11748,
25064,
198,
198,
14421,
62,
15908,
796,
28686,
13,
6978,
13,
15908,
3672,
7,
418,
13,
6978,
13,
5305,
6978,
7,
834,
7753,
834,
4008,
198,
16302,
62,
15908,
796,
28686,
13,
6978,
13,
... | 2.644068 | 59 |
from django.shortcuts import render
from django.shortcuts import redirect
from django.shortcuts import get_object_or_404
from django.utils import timezone
from .forms import QuestionForm
from .forms import AnswerForm
from .models import Question
from .models import Answer
| [
6738,
42625,
14208,
13,
19509,
23779,
1330,
8543,
198,
6738,
42625,
14208,
13,
19509,
23779,
1330,
18941,
198,
6738,
42625,
14208,
13,
19509,
23779,
1330,
651,
62,
15252,
62,
273,
62,
26429,
198,
6738,
42625,
14208,
13,
26791,
1330,
640,
... | 4.029412 | 68 |
"""
Unit tests for labe. Most not mocked yet, hence slow.
"""
import collections
import socket
import pytest
import requests
from labe.oci import get_figshare_download_link, get_terminal_url
def no_internet(host="8.8.8.8", port=53, timeout=3):
"""
Host: 8.8.8.8 (google-public-dns-a.google.com)
OpenPort... | [
37811,
198,
26453,
5254,
329,
2248,
68,
13,
4042,
407,
29180,
1865,
11,
12891,
3105,
13,
198,
37811,
198,
198,
11748,
17268,
198,
11748,
17802,
198,
198,
11748,
12972,
9288,
198,
11748,
7007,
198,
198,
6738,
2248,
68,
13,
1733,
1330,
... | 2.47619 | 231 |
"""tests dynamic cards and dynamic load cards"""
import unittest
from io import StringIO
import numpy as np
import pyNastran
from pyNastran.bdf.bdf import BDF, read_bdf, CrossReferenceError
from pyNastran.bdf.cards.test.utils import save_load_deck
#ROOT_PATH = pyNastran.__path__[0]
if __name__ == '__main__': # prag... | [
37811,
41989,
8925,
4116,
290,
8925,
3440,
4116,
37811,
198,
11748,
555,
715,
395,
198,
6738,
33245,
1330,
10903,
9399,
198,
11748,
299,
32152,
355,
45941,
198,
198,
11748,
12972,
45,
459,
2596,
198,
6738,
12972,
45,
459,
2596,
13,
65,
... | 2.779528 | 127 |
import subprocess
import argparse
import os
import random
from collections import OrderedDict
from parse import parse
from bokeh.io import export_png
from bokeh.plotting import figure, output_file, show, save
from bokeh.models import ColumnDataSource, FactorRange
from bokeh.transform import factor_cmap
from bokeh.layou... | [
11748,
850,
14681,
198,
11748,
1822,
29572,
198,
11748,
28686,
198,
11748,
4738,
198,
6738,
17268,
1330,
14230,
1068,
35,
713,
198,
6738,
21136,
1330,
21136,
198,
6738,
1489,
365,
71,
13,
952,
1330,
10784,
62,
11134,
198,
6738,
1489,
36... | 2.232337 | 736 |
# -*- coding: utf-8 -*-
# BCDI: tools for pre(post)-processing Bragg coherent X-ray diffraction imaging data
# (c) 07/2017-06/2019 : CNRS UMR 7344 IM2NP
# (c) 07/2019-05/2021 : DESY PHOTON SCIENCE
# authors:
# Jerome Carnis, carnis_jerome@yahoo.fr
from pathlib import Path
import unittest
from bcdi.u... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
2,
347,
8610,
40,
25,
4899,
329,
662,
7,
7353,
13219,
36948,
1709,
9460,
24870,
1395,
12,
2433,
814,
7861,
19560,
1366,
198,
2,
220,
220,
357,
66,
8,
8753,
14,
... | 2.524752 | 202 |
"""
# [REPO NAME]
## Table of contents
[Here you can use a table of contents to keep your README structured.]
## Overview
[Here you give a short overview over the motivation behind your project and what problem it solves.]
## How to use it
[Here you can explain how your tool/project is usable.]
### Requirements an... | [
37811,
198,
2,
685,
2200,
16402,
36751,
60,
198,
198,
2235,
8655,
286,
10154,
220,
198,
58,
4342,
345,
460,
779,
257,
3084,
286,
10154,
284,
1394,
534,
20832,
11682,
20793,
8183,
198,
198,
2235,
28578,
198,
58,
4342,
345,
1577,
257,
... | 4.295455 | 132 |
# -*- coding: utf-8 -*-
from ..core import db
from ..helpers import JSONSerializer
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
11485,
7295,
1330,
20613,
198,
6738,
11485,
16794,
364,
1330,
19449,
32634,
7509,
628
] | 2.896552 | 29 |
#!/usr/bin/python3
# Demonstrates OpenGL color triangle
# Ben Smith
# benjamin.coder.smith@gmail.com
#
# based heavily on ccube.cpp
# OpenGL SuperBible
# Program by Richard S. Wright Jr.
import math
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
ESCAPE = b'\033'
xRot... | [
2,
48443,
14629,
14,
8800,
14,
29412,
18,
201,
198,
201,
198,
2,
7814,
2536,
689,
30672,
3124,
22950,
201,
198,
2,
3932,
4176,
201,
198,
2,
1888,
13337,
13,
66,
12342,
13,
21453,
31,
14816,
13,
785,
201,
198,
2,
201,
198,
2,
191... | 2.182524 | 515 |
import binascii
from base64 import b64decode
from typing import Optional
from fastapi import Depends, Header, status
from fastapi.exceptions import HTTPException
| [
11748,
9874,
292,
979,
72,
198,
6738,
2779,
2414,
1330,
275,
2414,
12501,
1098,
198,
6738,
19720,
1330,
32233,
198,
198,
6738,
3049,
15042,
1330,
2129,
2412,
11,
48900,
11,
3722,
198,
6738,
3049,
15042,
13,
1069,
11755,
1330,
14626,
169... | 3.837209 | 43 |
import torch.nn as nn
import os
import torch.optim as optim
from tqdm import tqdm
import numpy as np
import torch
import torch.nn.functional as nnf
import SimpleITK as sitk
import json
from scipy import ndimage
import medpy.io as mio
from Utils import find_binary_object
from MyDataloader import get_train_... | [
11748,
28034,
13,
20471,
355,
299,
77,
201,
198,
11748,
28686,
201,
198,
11748,
28034,
13,
40085,
355,
6436,
201,
198,
6738,
256,
80,
36020,
1330,
256,
80,
36020,
201,
198,
11748,
299,
32152,
355,
45941,
201,
198,
11748,
28034,
201,
1... | 2.884146 | 164 |
import beneath
from generators import earthquakes
with open("schemas/earthquake.graphql", "r") as file:
EARTHQUAKES_SCHEMA = file.read()
if __name__ == "__main__":
p = beneath.Pipeline(parse_args=True)
p.description = "Continually pings the USGS earthquake API"
earthquakes = p.generate(earthquakes.ge... | [
11748,
11061,
198,
198,
6738,
27298,
1330,
29781,
198,
198,
4480,
1280,
7203,
1416,
4411,
292,
14,
16442,
421,
539,
13,
34960,
13976,
1600,
366,
81,
4943,
355,
2393,
25,
198,
220,
220,
220,
31834,
4221,
10917,
10206,
1546,
62,
50,
339... | 2.495327 | 214 |
# Copyright 2020 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" file... | [
2,
15069,
12131,
6186,
13,
785,
11,
3457,
13,
393,
663,
29116,
13,
1439,
6923,
33876,
13,
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,
2845,
28... | 2.504654 | 967 |
# Minimal setup.py
#
# Enables installing requirements as declared in setup.cfg.
# From this directory, run:
# pip install .
from setuptools import setup
setup()
| [
2,
1855,
4402,
9058,
13,
9078,
198,
2,
198,
2,
2039,
2977,
15975,
5359,
355,
6875,
287,
9058,
13,
37581,
13,
198,
2,
3574,
428,
8619,
11,
1057,
25,
198,
2,
220,
220,
220,
220,
7347,
2721,
764,
198,
198,
6738,
900,
37623,
10141,
... | 3.34 | 50 |
# -*- coding:utf-8 -*-
"""
common models
"""
from django.db import models
from apps.common.models import BaseModel
from apps.datasource.models import DsInterfaceInfo
| [
2,
532,
9,
12,
19617,
25,
40477,
12,
23,
532,
9,
12,
198,
37811,
198,
220,
220,
220,
2219,
4981,
198,
37811,
198,
6738,
42625,
14208,
13,
9945,
1330,
4981,
198,
6738,
6725,
13,
11321,
13,
27530,
1330,
7308,
17633,
198,
198,
6738,
... | 2.951613 | 62 |
import random
from typing import Optional
from .grid import *
| [
11748,
4738,
198,
6738,
19720,
1330,
32233,
198,
6738,
764,
25928,
1330,
1635,
628
] | 4.5 | 14 |
from keras_segmentation.pretrained import pspnet_101_voc12
pspnet_101_voc12() | [
6738,
41927,
292,
62,
325,
5154,
341,
13,
5310,
13363,
1330,
279,
2777,
3262,
62,
8784,
62,
18893,
1065,
198,
198,
862,
79,
3262,
62,
8784,
62,
18893,
1065,
3419
] | 2.6 | 30 |
from odbAccess import *
from abaqusConstants import *
from textRepr import *
import timeit
import numpy as np
import os
import sys
start_time = timeit.default_timer()
index = sys.argv[-1]
# print(index)
# index = float(index)
index = int(index)
# print(index)
odbFile = os.path.join(os.getcwd(), "single_element_simul... | [
6738,
267,
9945,
15457,
1330,
1635,
198,
6738,
450,
30188,
385,
34184,
1187,
1330,
1635,
198,
6738,
2420,
6207,
81,
1330,
1635,
198,
11748,
640,
270,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
28686,
198,
11748,
25064,
628,
198,
96... | 2.404715 | 509 |
"""
Tools to perform analyses by shuffling in time, as in Landau & Fries (2012) and
Fiebelkorn et al. (2013).
"""
import os
import yaml
import numpy as np
import statsmodels.api as sm
from statsmodels.stats.multitest import multipletests
from .utils import avg_repeated_timepoints, dft
# Load the details of the behavi... | [
37811,
198,
33637,
284,
1620,
13523,
416,
32299,
1359,
287,
640,
11,
355,
287,
6379,
559,
1222,
376,
1678,
357,
6999,
8,
290,
198,
37,
494,
6667,
74,
1211,
2123,
435,
13,
357,
6390,
737,
198,
37811,
198,
198,
11748,
28686,
198,
1174... | 2.392256 | 3,564 |
from m5.objects import *
# https://en.wikipedia.org/wiki/Raspberry_Pi
# https://en.wikipedia.org/wiki/ARM_Cortex-A7
# Instruction Cache
# Data Cache
# L2 Cache
# L3 Cache, NONE
# TLB Cache, NONE
# end
| [
198,
6738,
285,
20,
13,
48205,
1330,
1635,
198,
198,
2,
3740,
1378,
268,
13,
31266,
13,
2398,
14,
15466,
14,
49,
17653,
62,
38729,
198,
2,
3740,
1378,
268,
13,
31266,
13,
2398,
14,
15466,
14,
33456,
62,
34,
26158,
12,
32,
22,
19... | 2.518072 | 83 |
from .create_db import Session, engine, Base
from .models import User, Post, Tag
__all__ = [
"Session",
"engine",
"Base",
"User",
"Post",
"Tag",
]
| [
6738,
764,
17953,
62,
9945,
1330,
23575,
11,
3113,
11,
7308,
198,
6738,
764,
27530,
1330,
11787,
11,
2947,
11,
17467,
198,
198,
834,
439,
834,
796,
685,
198,
220,
220,
220,
366,
36044,
1600,
198,
220,
220,
220,
366,
18392,
1600,
198... | 2.356164 | 73 |
"""
Given a binary tree and a sum, determine if the tree has a root-to-leaf path
such that adding up all the values along the path equals the given sum.
Note: A leaf is a node with no children.
Example:
Given the below binary tree and sum = 22,
5
/ \
4 8
... | [
37811,
198,
220,
220,
220,
11259,
257,
13934,
5509,
290,
257,
2160,
11,
5004,
611,
262,
5509,
468,
257,
6808,
12,
1462,
12,
33201,
3108,
220,
198,
220,
220,
220,
884,
326,
4375,
510,
477,
262,
3815,
1863,
262,
3108,
21767,
262,
1813... | 2.379135 | 393 |
import nltk
nltk.download('vader_lexicon') | [
11748,
299,
2528,
74,
198,
77,
2528,
74,
13,
15002,
10786,
85,
5067,
62,
2588,
4749,
11537
] | 2.470588 | 17 |
from tkinter import*
from tkinter import Button, font
from tkinter.font import BOLD
import tkinter.ttk as ttk
from tkhtmlview import HTMLLabel
from tkhtmlview import HTMLText
| [
6738,
256,
74,
3849,
1330,
9,
198,
6738,
256,
74,
3849,
1330,
20969,
11,
10369,
198,
6738,
256,
74,
3849,
13,
10331,
1330,
347,
15173,
198,
11748,
256,
74,
3849,
13,
926,
74,
355,
256,
30488,
198,
6738,
256,
74,
6494,
1177,
1330,
... | 3.070175 | 57 |
import pyqtgraph as pg
import pyqtgraph.exporters
import numpy as np
import math
from time import sleep
f = 10
t = 0
Samples = 1000
# while True:
# y2 = np.sin( 2* np.pi * f * t)
# print(y)
# t+=0.01
# sleep(0.25)
# define the data
theTitle = "pyqtgraph plot"
y2 = []
# create plot
plt = pg.plot()... | [
11748,
12972,
80,
25297,
1470,
355,
23241,
198,
11748,
12972,
80,
25297,
1470,
13,
1069,
1819,
1010,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
10688,
198,
6738,
640,
1330,
3993,
198,
198,
69,
796,
838,
198,
83,
796,
657,
198,
50... | 2.222222 | 297 |
#--- Exercicio 2 - Dicionrios
#--- Escreva um programa que leia os dados de 11 jogadores
#--- Jogador: Nome, Posicao, Numero, PernaBoa
#--- Crie um dicionario para armazenar os dados
#--- Imprima todos os jogadores e seus dados
lista_jogador = []
for i in range(0,11):
dicionario_jogador = {'Nome':'', 'Posicao':''... | [
2,
6329,
1475,
2798,
46441,
362,
532,
360,
47430,
380,
418,
198,
2,
6329,
16319,
260,
6862,
23781,
1430,
64,
8358,
443,
544,
28686,
9955,
418,
390,
1367,
48342,
324,
2850,
198,
2,
6329,
449,
519,
7079,
25,
399,
462,
11,
18574,
3970,... | 2.224638 | 414 |
# Iterate over epochs.
for epoch in range(3):
print(f'Epoch {epoch+1}')
# Iterate over the batches of the dataset.
for step, x_batch_train in enumerate(train_data):
with tf.GradientTape() as tape:
reconstructed = autoencoder(x_batch_train)
# Compute reconstruction loss
loss = mse_loss(x_b... | [
2,
40806,
378,
625,
36835,
82,
13,
198,
1640,
36835,
287,
2837,
7,
18,
2599,
198,
220,
220,
220,
3601,
7,
69,
6,
13807,
5374,
1391,
538,
5374,
10,
16,
92,
11537,
628,
220,
1303,
40806,
378,
625,
262,
37830,
286,
262,
27039,
13,
... | 2.613281 | 256 |
################################################################
# Generate top-N words for topics, one per line, to stdout
################################################################
import os
import sys
import argparse
import numpy as np
import file_handling as fh
if __name__ == "__main__":
main()
| [
29113,
29113,
198,
2,
2980,
378,
1353,
12,
45,
2456,
329,
10233,
11,
530,
583,
1627,
11,
284,
14367,
448,
198,
29113,
29113,
198,
11748,
28686,
198,
11748,
25064,
198,
11748,
1822,
29572,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
... | 4.430556 | 72 |
# Quando tivermos um programa onde claramente temos um caso
# indesejvel, ento podemos usar a funo do python dita
# try_and_except.
# Vamos supor que desejamos fazer uma funo que faa uma
# diviso, ento podemos fazer a seguinte estrutura de
# cdigo
# veja que nesse caso, se dermos o argumento zero, ento
# iremos ganhar... | [
2,
2264,
25440,
256,
1428,
16785,
23781,
1430,
64,
319,
2934,
10212,
3263,
68,
2169,
418,
23781,
6124,
78,
198,
2,
773,
2771,
73,
626,
11,
920,
78,
24573,
368,
418,
514,
283,
257,
1257,
78,
466,
21015,
288,
5350,
198,
2,
1949,
62,... | 2.400709 | 282 |
from jnius import autoclass, cast
from kivy.logger import Logger
from plyer_lach.facades import Email
from plyer_lach.platforms.android import activity
Intent = autoclass('android.content.Intent')
AndroidString = autoclass('java.lang.String')
URI = autoclass('android.net.Uri')
| [
6738,
474,
77,
3754,
1330,
1960,
420,
31172,
11,
3350,
198,
6738,
479,
452,
88,
13,
6404,
1362,
1330,
5972,
1362,
198,
6738,
35960,
263,
62,
75,
620,
13,
38942,
2367,
1330,
9570,
198,
6738,
35960,
263,
62,
75,
620,
13,
24254,
82,
... | 3.043478 | 92 |
"""Main class for sudoku game. Run this to solve the game."""
from board import Board
# ENTRIES contains the values of each cell
ENTRIES = [0, 0, 0, 2, 6, 0, 7, 0, 1, 6, 8, 0, 0, 7, 0, 0, 9, 0, 1,
9, 0, 0, 0, 4, 5, 0, 0, 8, 2, 0, 1, 0, 0, 0, 4, 0, 0,
0, 4, 6, 0, 2, 9, 0, 0, 0, 5, 0, 0, 0, 3, 0, 2... | [
37811,
13383,
1398,
329,
424,
67,
11601,
983,
13,
5660,
428,
284,
8494,
262,
983,
526,
15931,
198,
6738,
3096,
1330,
5926,
198,
198,
2,
12964,
5446,
11015,
4909,
262,
3815,
286,
1123,
2685,
198,
3525,
7112,
1546,
796,
685,
15,
11,
6... | 1.758755 | 257 |
import abc
| [
11748,
450,
66,
198
] | 2.75 | 4 |
# Generated by Django 2.2.10 on 2020-03-04 09:21
from django.db import migrations, models
import django.db.models.deletion
| [
2,
2980,
515,
416,
37770,
362,
13,
17,
13,
940,
319,
12131,
12,
3070,
12,
3023,
7769,
25,
2481,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
198,
11748,
42625,
14208,
13,
9945,
13,
27530,
13,
2934,
1616,
295,
... | 2.840909 | 44 |
#!/usr/bin/env python
import os
import sys
import smtplib
import time
import syslog
import telegram
import yaml
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
# Author:: Alexander Schedrov (schedrow@gmail.com)
# Copyright:: Copyright (c) 2019 Alexander Schedrov
# License:: MIT
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
11748,
28686,
198,
11748,
25064,
220,
198,
11748,
895,
83,
489,
571,
198,
11748,
640,
198,
11748,
25064,
6404,
198,
11748,
573,
30536,
198,
11748,
331,
43695,
198,
198,
6738,
3053,
13,
... | 3.098039 | 102 |
# -*- coding: utf-8 -*-
#
# MIT License
#
# Copyright (c) 2018-2019 Groupe Allo-Media
#
# 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 r... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
198,
2,
17168,
13789,
198,
2,
198,
2,
15069,
357,
66,
8,
2864,
12,
23344,
402,
472,
431,
1439,
78,
12,
13152,
198,
2,
198,
2,
2448,
3411,
318,
29376,
7520,
11,
... | 3.615222 | 473 |
from .mock_api.utils import GetSelection
from .viewAccounts import ViewAccounts
from .addAccount import AddAccount
| [
6738,
764,
76,
735,
62,
15042,
13,
26791,
1330,
3497,
4653,
1564,
198,
6738,
764,
1177,
30116,
82,
1330,
3582,
30116,
82,
198,
6738,
764,
2860,
30116,
1330,
3060,
30116,
628
] | 3.741935 | 31 |
import torch
import torchvision
from torchvision import datasets, transforms
from torch.utils.data import DataLoader
import os
| [
11748,
28034,
198,
11748,
28034,
10178,
198,
6738,
28034,
10178,
1330,
40522,
11,
31408,
198,
6738,
28034,
13,
26791,
13,
7890,
1330,
6060,
17401,
198,
11748,
28686,
628,
198
] | 4.448276 | 29 |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
2,
15069,
33448,
43208,
21852,
1766,
1539,
12052,
201,
198,
2,
201,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
201,
198,
2,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,... | 2.657312 | 1,354 |
# Copyright 2020 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 th... | [
2,
15069,
12131,
6186,
13,
785,
11,
3457,
13,
393,
663,
29116,
13,
1439,
6923,
33876,
13,
198,
2,
198,
2,
220,
220,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
11074,
198,
2,
220,
220,
921,
743,
... | 2.585652 | 1,617 |
# (C) Copyright 2005-2021 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at... | [
2,
357,
34,
8,
15069,
5075,
12,
1238,
2481,
2039,
28895,
11,
3457,
1539,
9533,
11,
15326,
198,
2,
1439,
2489,
10395,
13,
198,
2,
198,
2,
770,
3788,
318,
2810,
1231,
18215,
739,
262,
2846,
286,
262,
347,
10305,
198,
2,
5964,
3017,
... | 3.284047 | 257 |
import mnist_loader
import network2
import numpy as np
training_data, validation_data, test_data = mnist_loader.load_data_wrapper()
eta = 0.9
m_b_s = 10
epochs = 30
trials = 10
trial_ev = []
for t in xrange(trials):
net = network2.Network([784, 50, 50, 50, 50, 10], cost=network2.CrossEntropyCost)
net.defaul... | [
11748,
285,
77,
396,
62,
29356,
198,
11748,
3127,
17,
198,
11748,
299,
32152,
355,
45941,
628,
198,
34409,
62,
7890,
11,
21201,
62,
7890,
11,
1332,
62,
7890,
796,
285,
77,
396,
62,
29356,
13,
2220,
62,
7890,
62,
48553,
3419,
198,
... | 2.642173 | 313 |
from abc import ABC, abstractmethod
from typing import List, Any
from ipaddress import IPv4Address
from dataclasses import dataclass, FrozenInstanceError
from types import SimpleNamespace
from enum import Enum, auto
| [
6738,
450,
66,
1330,
9738,
11,
12531,
24396,
198,
6738,
19720,
1330,
7343,
11,
4377,
198,
6738,
20966,
21975,
1330,
25961,
19,
20231,
198,
6738,
4818,
330,
28958,
1330,
4818,
330,
31172,
11,
23673,
33384,
12331,
198,
6738,
3858,
1330,
1... | 4.036364 | 55 |
import cobra
from optaux import resources
resource_dir = resources.__path__[0]
met_to_rs = {'EX_pydam_e': ['PDX5PS', 'PYDXK', 'PYDXNK'],
'EX_orot_e': ['DHORTS', 'UPPRT', 'URIK2'],
'EX_thr__L_e': ['PTHRpp', 'THRS'],
'EX_pro__L_e': ['AMPTASEPG', 'P5CR'],
'EX_skm_e': ... | [
11748,
22843,
430,
198,
198,
6738,
2172,
14644,
1330,
4133,
198,
198,
31092,
62,
15908,
796,
4133,
13,
834,
6978,
834,
58,
15,
60,
198,
198,
4164,
62,
1462,
62,
3808,
796,
1391,
6,
6369,
62,
79,
5173,
321,
62,
68,
10354,
37250,
57... | 1.850772 | 583 |
import os
import sys
def get_workdir():
"""
get_workdir() -> workdir: [str]
Returns the current workdir.
"""
return os.path.realpath(os.path.dirname(sys.argv[0]))
| [
11748,
28686,
198,
11748,
25064,
628,
198,
4299,
651,
62,
1818,
15908,
33529,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
651,
62,
1818,
15908,
3419,
4613,
670,
15908,
25,
685,
2536,
60,
628,
220,
220,
220,
16409,
262,
1459,
670,
... | 2.415584 | 77 |
import csv
import MySQLdb
# installing MySQL: https://dev.mysql.com/doc/refman/8.0/en/osx-installation-pkg.html
# how to start, watch: https://www.youtube.com/watch?v=3vsC05rxZ8c
# or read this (absolutely helpful) guide: https://www.datacamp.com/community/tutorials/mysql-python
# this is mainly created to get a data... | [
11748,
269,
21370,
198,
11748,
33476,
9945,
198,
198,
2,
15975,
33476,
25,
3740,
1378,
7959,
13,
28744,
13976,
13,
785,
14,
15390,
14,
5420,
805,
14,
23,
13,
15,
14,
268,
14,
418,
87,
12,
17350,
341,
12,
35339,
13,
6494,
198,
2,
... | 3.284593 | 1,019 |
import numpy as np
import pytest
from ..shear_bias_meas import (
measure_shear_metadetect, estimate_m_and_c,
estimate_m_and_c_patch_avg)
| [
11748,
299,
32152,
355,
45941,
198,
11748,
12972,
9288,
198,
198,
6738,
11485,
7091,
283,
62,
65,
4448,
62,
1326,
292,
1330,
357,
198,
220,
220,
220,
3953,
62,
7091,
283,
62,
4164,
324,
316,
478,
11,
8636,
62,
76,
62,
392,
62,
66,... | 2.307692 | 65 |
from mininet.net import Mininet
from mininet.node import Controller, UserSwitch, IVSSwitch, OVSSwitch
from mininet.log import info, setLogLevel
setLogLevel("info")
import importlib
switch_num = 1
host_num = 1
client_num = 1
| [
6738,
949,
42504,
13,
3262,
1330,
1855,
42504,
198,
6738,
949,
42504,
13,
17440,
1330,
22741,
11,
11787,
38978,
11,
8363,
5432,
42248,
11,
440,
53,
5432,
42248,
198,
6738,
949,
42504,
13,
6404,
1330,
7508,
11,
900,
11187,
4971,
198,
1... | 3.038961 | 77 |
from rest_framework import permissions
__author__ = "Ville Myllynen"
__copyright__ = "Copyright 2017, Ohsiha Project"
__credits__ = ["Ville Myllynen"]
__license__ = "MIT"
__version__ = "1.0"
__maintainer__ = "Ville Myllynen"
__email__ = "ville.myllynen@student.tut.fi"
__status__ = "Development"
| [
6738,
1334,
62,
30604,
1330,
21627,
628,
198,
834,
9800,
834,
796,
366,
53,
8270,
2011,
297,
2047,
268,
1,
198,
834,
22163,
4766,
834,
796,
366,
15269,
2177,
11,
3966,
13396,
3099,
4935,
1,
198,
834,
66,
20696,
834,
796,
14631,
53,
... | 2.684685 | 111 |
##
# Copyright (c) 2016, Microsoft Corporation
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions... | [
2235,
198,
2,
15069,
357,
66,
8,
1584,
11,
5413,
10501,
198,
198,
2,
1439,
2489,
10395,
13,
198,
2,
2297,
396,
3890,
290,
779,
287,
2723,
290,
13934,
5107,
11,
351,
393,
1231,
220,
198,
2,
17613,
11,
389,
10431,
2810,
326,
262,
... | 3.016616 | 1,324 |
# 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 u... | [
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,
383,
7054,... | 2.940162 | 986 |
#!/usr/bin/env python
import boto
import boto.ec2
import sys
from boto.ec2.connection import EC2Connection
import pprint
account_string = "YOUR_ACCOUNT_STRING" #change this for each AWS account
####main program execution####
regions = sys.argv[1:]
volume_info = ""
if len(regions) == 0:
regions=['us... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
201,
198,
11748,
275,
2069,
201,
198,
11748,
275,
2069,
13,
721,
17,
201,
198,
11748,
25064,
201,
198,
6738,
275,
2069,
13,
721,
17,
13,
38659,
1330,
13182,
17,
32048,
201,
198,
11748,
27... | 2.533528 | 686 |
# one hop helper function | [
2,
530,
1725,
31904,
2163
] | 5 | 5 |
from collections import OrderedDict
import numpy as np
from tqdm import tqdm
import tensorflow as tf
from .player import MCTSPlayer, RandomPlayer, OptimalPlayer
from .evaluator import evaluate
from .mcts_tree import MCTSNode, mcts
from .utilities import sample_distribution
__all__ = ["train_alphago", "self_play", "p... | [
6738,
17268,
1330,
14230,
1068,
35,
713,
198,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
256,
80,
36020,
1330,
256,
80,
36020,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
198,
6738,
764,
7829,
1330,
337,
4177,
50,
14140,
11,
1... | 2.445239 | 5,314 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-08-29 14:52
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2980,
515,
416,
37770,
352,
13,
24,
13,
22,
319,
1584,
12,
2919,
12,
1959,
1478,
25,
4309,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
1... | 2.724638 | 69 |
import numpy as np
import matplotlib.pyplot as plt
from .rule_manager import RuleManager
| [
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
198,
6738,
764,
25135,
62,
37153,
1330,
14330,
13511,
198
] | 3.333333 | 27 |
#!/usr/bin/python3.6
# -*- coding: utf-8 -*-
# @Time : 2020/6/25 22:41
# @Author : Yongfei Liu
# @Email : liuyf3@shanghaitech.edu.cn
import numpy as np
import os.path as osp
import os
import pickle
from collections import OrderedDict
import torch
import json
from detectron2.data.datasets.builtin_meta import CO... | [
2,
48443,
14629,
14,
8800,
14,
29412,
18,
13,
21,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2488,
7575,
220,
220,
220,
1058,
12131,
14,
21,
14,
1495,
2534,
25,
3901,
198,
2,
2488,
13838,
220,
1058,
... | 2.484076 | 157 |
# -*- coding: utf-8 -*-
"""
Attributes:
config (dict): Description
logger (logging.Logger): Description
"""
import logging
import pymongo
logger = None
config = {}
def init(the_logger: logging.Logger, mongo_maps: list):
"""init
Args:
the_logger (logging.Logger): Description
mongo_m... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
29021,
25,
198,
220,
220,
220,
4566,
357,
11600,
2599,
12489,
198,
220,
220,
220,
49706,
357,
6404,
2667,
13,
11187,
1362,
2599,
12489,
198,
37811,
198,
1174... | 2.29661 | 1,652 |
# input
N, M = map(int, input().split())
As = [*map(int, input().split())]
Bs = [*map(int, input().split())]
# compute
# output
print(sum(A > B for B in Bs for A in As))
| [
2,
5128,
198,
45,
11,
337,
796,
3975,
7,
600,
11,
5128,
22446,
35312,
28955,
198,
1722,
796,
30138,
8899,
7,
600,
11,
5128,
22446,
35312,
3419,
15437,
198,
37000,
796,
30138,
8899,
7,
600,
11,
5128,
22446,
35312,
3419,
15437,
198,
1... | 2.529412 | 68 |
#!/usr/bin/python
a, b = [int(i) for i in input().split()]
c = a * b
if c % 2 == 0:
print('[:=[first]')
else:
print('[second]=:]')
| [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
198,
64,
11,
275,
796,
685,
600,
7,
72,
8,
329,
1312,
287,
5128,
22446,
35312,
3419,
60,
198,
66,
796,
257,
1635,
275,
198,
198,
361,
269,
4064,
362,
6624,
657,
25,
198,
220,
220,
220,
... | 2.073529 | 68 |
import os
from shutil import which
from .pipeline_config import load_config
__all__ = ["load_config"]
| [
11748,
28686,
198,
6738,
4423,
346,
1330,
543,
198,
6738,
764,
79,
541,
4470,
62,
11250,
1330,
3440,
62,
11250,
198,
198,
834,
439,
834,
796,
14631,
2220,
62,
11250,
8973,
628
] | 3.25 | 32 |
import os
import sys
import stakkr.stakkr_compose as sc
import subprocess
import unittest
base_dir = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, base_dir + '/../')
# https://docs.python.org/3/library/unittest.html#assert-methods
if __name__ == "__main__":
unittest.main()
| [
11748,
28686,
198,
11748,
25064,
198,
11748,
336,
461,
38584,
13,
301,
461,
38584,
62,
785,
3455,
355,
629,
198,
11748,
850,
14681,
198,
11748,
555,
715,
395,
198,
198,
8692,
62,
15908,
796,
28686,
13,
6978,
13,
397,
2777,
776,
7,
4... | 2.555556 | 117 |
import os,sys
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
sys.path.append(BASE_DIR)
import datetime
import time
from backtesting.backtest import Backtest
from backtesting.data import HistoricCSVDataHandler
from backtesting.execution import SimulatedExecutionHandler
from backtesting.portfolio import Portfolio... | [
11748,
28686,
11,
17597,
198,
33,
11159,
62,
34720,
796,
28686,
13,
6978,
13,
15908,
3672,
7,
418,
13,
6978,
13,
15908,
3672,
7,
834,
7753,
834,
4008,
198,
17597,
13,
6978,
13,
33295,
7,
33,
11159,
62,
34720,
8,
198,
11748,
4818,
... | 1.918291 | 1,334 |
import matplotlib.pylab as plt
import numpy as np
import pandas as pd
from COMMONTOOL import PTCureve
DB = pd.read_csv('0_228.txt')
# DB = pd.read_csv('../3 /322.txt')
# target_time = 100
# for i in range(0, len(DB)):
# if DB['KCNTOMS'].loc[i] != target_time:
# DB.drop([i], inplace=True)
# else:
# ... | [
11748,
2603,
29487,
8019,
13,
79,
2645,
397,
355,
458,
83,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
19798,
292,
355,
279,
67,
198,
6738,
22240,
1340,
10468,
3535,
1330,
350,
4825,
495,
303,
198,
198,
11012,
796,
279,
67,
13,
... | 1.860124 | 1,773 |
# -*- coding: utf-8 -*-
"""
Transparent PNG conversion
~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from PIL import Image
def get_new_size(original_size):
"""
Returns each width and height plus 2px.
:param original_size: Original image's size
:return: Width / height after calculation
:rtype: tuple
"""
... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
198,
8291,
8000,
36182,
11315,
198,
27156,
15116,
4907,
198,
198,
37811,
198,
6738,
350,
4146,
1330,
7412,
628,
198,
4299,
651,
62,
3605,
62,
7857,
7,
14986,... | 2.788136 | 236 |
from django.core.management.commands import makemessages
| [
6738,
42625,
14208,
13,
7295,
13,
27604,
13,
9503,
1746,
1330,
787,
37348,
1095,
628
] | 3.866667 | 15 |
"""Views for users"""
from flask_restful import Resource
from flask import jsonify, request
from app.api.v2.users.models import UserModel
from app.api.v2.decorator import token_required, get_token
from app.api.v2.send_email import send
| [
37811,
7680,
82,
329,
2985,
37811,
198,
6738,
42903,
62,
2118,
913,
1330,
20857,
198,
6738,
42903,
1330,
33918,
1958,
11,
2581,
198,
6738,
598,
13,
15042,
13,
85,
17,
13,
18417,
13,
27530,
1330,
11787,
17633,
198,
6738,
598,
13,
15042... | 3.256757 | 74 |
# -*- coding: utf-8 -*-
import sys
import os
import traceback
import ujson
from pprint import pprint
from textblob import TextBlob as tb
from textblob import Word as wd
import shutil
from collections import defaultdict
from gensim.corpora import Dictionary
from socialconfig import config
if __name__ == "__main__":
... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
11748,
25064,
198,
11748,
28686,
198,
11748,
12854,
1891,
198,
11748,
334,
17752,
198,
6738,
279,
4798,
1330,
279,
4798,
198,
6738,
2420,
2436,
672,
1330,
8255,
3629,
672,... | 3.030534 | 131 |
from pages.demo_page import DemoPage
| [
6738,
5468,
13,
9536,
78,
62,
7700,
1330,
34588,
9876,
628,
628
] | 3.333333 | 12 |
from helpers.cyclic_list import CyclicList
from helpers.coordinates2d import Coordinates2D
RUN_TEST = False
TEST_SOLUTION = 7
TEST_INPUT_FILE = 'test_input_day_03.txt'
INPUT_FILE = 'input_day_03.txt'
START = Coordinates2D((0, 0)) # top left corner
TRAJECTORY = Coordinates2D((3, 1)) # right 3, down 1
ARGS = [START... | [
6738,
49385,
13,
15539,
291,
62,
4868,
1330,
28007,
291,
8053,
198,
6738,
49385,
13,
37652,
17540,
17,
67,
1330,
22819,
17540,
17,
35,
628,
198,
49,
4944,
62,
51,
6465,
796,
10352,
198,
51,
6465,
62,
50,
3535,
35354,
796,
767,
198,
... | 2.280156 | 257 |
###############################################
# LeetCode Problem Number : 112
# Difficulty Level : Easy
# URL : https://leetcode.com/problems/path-sum/
###############################################
from binary_search_tree.tree_node import TreeNode
| [
29113,
7804,
4242,
21017,
198,
2,
1004,
316,
10669,
20647,
7913,
1058,
13539,
198,
2,
27419,
5684,
1058,
16789,
198,
2,
10289,
1058,
3740,
1378,
293,
316,
8189,
13,
785,
14,
1676,
22143,
14,
6978,
12,
16345,
14,
198,
29113,
7804,
4242... | 4.362069 | 58 |
st1 = input()
st2 = input()
st3 = input()
listy = [st1, st2, st3]
listy.sort()
print(listy[0])
print(listy[1])
print(listy[2])
| [
301,
16,
796,
5128,
3419,
198,
301,
17,
796,
5128,
3419,
198,
301,
18,
796,
5128,
3419,
198,
4868,
88,
796,
685,
301,
16,
11,
336,
17,
11,
336,
18,
60,
198,
4868,
88,
13,
30619,
3419,
198,
4798,
7,
4868,
88,
58,
15,
12962,
198... | 2.048387 | 62 |
# Copyright 2017 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 agreed to in writing, sof... | [
2,
15069,
2177,
19764,
11421,
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,
921,
743,... | 2.957219 | 374 |
import sys, os, errno, shutil, signal, subprocess
from glob import glob
signal.signal(signal.SIGINT, sigint_handler)
# BEGIN SCRIPT
printTitle()
print bcolors.FAIL
print "Exit script anytime with CTRL+C"
print bcolors.ENDC
# Check argument number
if len(sys.argv) < 3:
print "Usage: {} SRC_DIRECTORY ANDROID_RESOU... | [
11748,
25064,
11,
28686,
11,
11454,
3919,
11,
4423,
346,
11,
6737,
11,
850,
14681,
198,
6738,
15095,
1330,
15095,
628,
220,
198,
12683,
282,
13,
12683,
282,
7,
12683,
282,
13,
50,
3528,
12394,
11,
43237,
600,
62,
30281,
8,
198,
198,... | 2.528061 | 1,176 |
import logging
from typing import Callable, Dict
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
# the accelerator library is a requirement for the Trainer
# but it is optional for grousnd base user of kornia.
try:
from accelerate import Accelerator
except ImportError:
Accelerator =... | [
11748,
18931,
198,
6738,
19720,
1330,
4889,
540,
11,
360,
713,
198,
198,
11748,
28034,
198,
11748,
28034,
13,
20471,
355,
299,
77,
198,
6738,
28034,
13,
26791,
13,
7890,
1330,
6060,
17401,
198,
198,
2,
262,
44219,
5888,
318,
257,
9079... | 3.4 | 175 |
# python3.7
"""Implements JPEG compression on images."""
import cv2
import numpy as np
try:
import nvidia.dali.fn as fn
import nvidia.dali.types as types
except ImportError:
fn = None
from utils.formatting_utils import format_range
from .base_transformation import BaseTransformation
__all__ = ['JpegComp... | [
2,
21015,
18,
13,
22,
198,
37811,
3546,
1154,
902,
48561,
19794,
319,
4263,
526,
15931,
198,
198,
11748,
269,
85,
17,
198,
11748,
299,
32152,
355,
45941,
198,
198,
28311,
25,
198,
220,
220,
220,
1330,
299,
21744,
13,
67,
7344,
13,
... | 2.981818 | 110 |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 15 00:31:35 2021
@author: RayaBit
"""
from flask import Flask, render_template, Response
from imutils.video import VideoStream
from skeletonDetector import skeleton
import cv2
from skeleton3DDetector import Skeleton3dDetector
from visualization import Visualizer
import t... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
41972,
319,
2892,
3158,
1315,
3571,
25,
3132,
25,
2327,
33448,
198,
198,
31,
9800,
25,
7760,
64,
13128,
198,
37811,
198,
198,
6738,
42903,
1330,
46947,
11,
... | 3.007246 | 138 |
"""Define the :class:`Thread`."""
import threading
from schedsi.cpu import request as cpurequest
from schedsi.cpu.time import Time
#: Whether to log individual times, or only the sum
LOG_INDIVIDUAL = True
| [
37811,
7469,
500,
262,
1058,
4871,
25,
63,
16818,
63,
526,
15931,
198,
198,
11748,
4704,
278,
198,
6738,
6038,
13396,
13,
36166,
1330,
2581,
355,
31396,
495,
6138,
198,
6738,
6038,
13396,
13,
36166,
13,
2435,
1330,
3862,
628,
198,
2,
... | 3.28125 | 64 |
import copy
from pyBRML import utils
from pyBRML import Array
def multiply_potentials(list_of_potentials):
"""
Returns the product of each potential in list_of_potentials, useful for
calculating joint probabilities.
For example, if the joint probability of a system is defined as
p(A,B,C) = p(... | [
11748,
4866,
198,
6738,
12972,
11473,
5805,
1330,
3384,
4487,
198,
6738,
12972,
11473,
5805,
1330,
15690,
198,
198,
4299,
29162,
62,
13059,
14817,
7,
4868,
62,
1659,
62,
13059,
14817,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,... | 3.178571 | 420 |
import re | [
11748,
302
] | 4.5 | 2 |
from django import template
register = template.Library()
register.inclusion_tag('mapas/mapa.html', takes_context=True)(mostrar_resumen_mapa)
register.filter('quitar_char',quitar_char)
register.filter('replace_text',replace_text)
register.filter('truncar_string',truncar_string)
def get_range(value):
"""
Fil... | [
6738,
42625,
14208,
1330,
11055,
198,
198,
30238,
796,
11055,
13,
23377,
3419,
198,
198,
30238,
13,
259,
4717,
62,
12985,
10786,
8899,
292,
14,
8899,
64,
13,
6494,
3256,
2753,
62,
22866,
28,
17821,
5769,
1712,
20040,
62,
411,
20080,
6... | 2.625 | 320 |