content stringlengths 1 1.04M | input_ids listlengths 1 774k | ratio_char_token float64 0.38 22.9 | token_count int64 1 774k |
|---|---|---|---|
class Solution:
"""
@param tickets:
@return: nothing
"""
## memory limitation
class Solution:
"""
@param tickets:
@return: nothing
"""
| [
4871,
28186,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
2488,
17143,
8587,
25,
220,
198,
220,
220,
220,
2488,
7783,
25,
2147,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
628,
198,
198,
2235,
4088,
17385,
628,
198,
... | 2.452055 | 73 |
# Create the dictionary
mydict = {'archiveType':'coral',
'Publication':{'author':'J. Doe','title':'The most important record'}}
#print the keys
mydict.keys()
| [
2,
13610,
262,
22155,
198,
198,
1820,
11600,
796,
1391,
6,
17474,
6030,
10354,
6,
66,
6864,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
15202,
341,
10354,
90,
6,
9800,
10354,
6,
41,
13,
31780,
41707,
7839,
10354,
6,
464,
74... | 2.725806 | 62 |
from django.core.urlresolvers import reverse_lazy
from django.http import HttpResponseRedirect
from main.models import *
| [
6738,
42625,
14208,
13,
7295,
13,
6371,
411,
349,
690,
1330,
9575,
62,
75,
12582,
198,
6738,
42625,
14208,
13,
4023,
1330,
367,
29281,
31077,
7738,
1060,
198,
6738,
1388,
13,
27530,
1330,
1635,
628,
198
] | 3.416667 | 36 |
"""Generic utility for encoding and decoding binary packets."""
from collections import namedtuple
import struct
def defpacket(name: str, **kwargs):
"""Define a protocol packet."""
fmt: str = ">" + "".join(kwargs.values())
msg_type = namedtuple(name, kwargs.keys()) # type: ignore
return _MessageType... | [
37811,
46189,
10361,
329,
21004,
290,
39938,
13934,
24624,
526,
15931,
198,
6738,
17268,
1330,
3706,
83,
29291,
198,
11748,
2878,
628,
198,
4299,
825,
8002,
316,
7,
3672,
25,
965,
11,
12429,
46265,
22046,
2599,
198,
220,
220,
220,
37227... | 3.147059 | 102 |
import pytest
import sys
import os
os.environ['SENTINEL_CONFIG'] = os.path.normpath(os.path.join(os.path.dirname(__file__), '../test_sentinel.conf'))
sys.path.append(os.path.normpath(os.path.join(os.path.dirname(__file__), '../../lib')))
@pytest.fixture
@pytest.fixture
@pytest.fixture
@pytest.fixture
@pytest.... | [
11748,
12972,
9288,
198,
11748,
25064,
198,
11748,
28686,
198,
418,
13,
268,
2268,
17816,
50,
3525,
1268,
3698,
62,
10943,
16254,
20520,
796,
28686,
13,
6978,
13,
27237,
6978,
7,
418,
13,
6978,
13,
22179,
7,
418,
13,
6978,
13,
15908,
... | 2.810458 | 153 |
##########################################################################
#
# Copyright (c) 2016, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | [
29113,
29113,
7804,
2235,
198,
2,
198,
2,
220,
15069,
357,
66,
8,
1584,
11,
7412,
7117,
8495,
3457,
13,
1439,
2489,
10395,
13,
198,
2,
198,
2,
220,
2297,
396,
3890,
290,
779,
287,
2723,
290,
13934,
5107,
11,
351,
393,
1231,
198,
... | 3.43459 | 1,353 |
import bpy
import bmesh
import argparse
import sys
import math
from mathutils import Vector, Matrix
scene = bpy.context.scene
scene_data=[]
all_objects = [ob for ob in scene.objects if ob.layers[0] and ob.type=='MESH']
for ob in all_objects:
obdata = ob.data
ob_name_tokens= ob.name.split('.')
ob_data={
... | [
11748,
275,
9078,
198,
11748,
275,
76,
5069,
198,
11748,
1822,
29572,
198,
11748,
25064,
198,
11748,
10688,
198,
6738,
10688,
26791,
1330,
20650,
11,
24936,
198,
198,
29734,
796,
275,
9078,
13,
22866,
13,
29734,
198,
198,
29734,
62,
789... | 2.264331 | 314 |
import os
from collections import OrderedDict
import numpy as np
from ConfigSpace.hyperparameters import NumericalHyperparameter, CategoricalHyperparameter, OrdinalHyperparameter, \
Constant
from pandas import DataFrame
from cave.analyzer.base_analyzer import BaseAnalyzer
from cave.utils.helpers import get_config... | [
11748,
28686,
198,
6738,
17268,
1330,
14230,
1068,
35,
713,
198,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
17056,
14106,
13,
49229,
17143,
7307,
1330,
399,
6975,
605,
38197,
17143,
2357,
11,
327,
2397,
12409,
38197,
17143,
2357,
11,
... | 2.192867 | 3,505 |
import pandas as pd
import numpy as np
import random
from sklearn.preprocessing import LabelEncoder
import nltk
from Stemmer import Stemmer
def dataPrepro(raw_text, y_enc):
'''
preprocess data, and tokenize
arg:
raw_test: pandes array, each line contains a text
y_enc: pandas array, each lin... | [
11748,
19798,
292,
355,
279,
67,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
4738,
198,
6738,
1341,
35720,
13,
3866,
36948,
1330,
36052,
27195,
12342,
198,
11748,
299,
2528,
74,
198,
6738,
520,
368,
647,
1330,
520,
368,
647,
198,
... | 2.024833 | 3,584 |
from typing import Tuple, Optional
# дум:ROOT
| [
6738,
19720,
1330,
309,
29291,
11,
32233,
628,
220,
220,
220,
1303,
12466,
112,
35072,
43108,
25,
13252,
2394,
628
] | 2.6 | 20 |
"""Create a summary report of the BIDS dataset."""
from ._report import make_report
| [
37811,
16447,
257,
10638,
989,
286,
262,
347,
14255,
27039,
526,
15931,
198,
198,
6738,
47540,
13116,
1330,
787,
62,
13116,
198
] | 3.863636 | 22 |
import unittest
import math
import numpy as np
from functools import reduce
from unittest.case import expectedFailure
import nibabel
def euler2mat(z=0, y=0, x=0):
''' Return matrix for rotations around z, y and x axes
Uses the z, then y, then x convention above
Parameters
----------
z : scalar
... | [
11748,
555,
715,
395,
198,
11748,
10688,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
1257,
310,
10141,
1330,
4646,
198,
6738,
555,
715,
395,
13,
7442,
1330,
2938,
50015,
198,
11748,
33272,
9608,
628,
198,
4299,
304,
18173,
17,
6759,
... | 2.22566 | 3,523 |
from boto3.session import Session
from rest_framework import status
from django.http import response
import botocore
import boto3
from core.settings import (
AWS_STORAGE_BUCKET_NAME,
AWS_SECRET_ACCESS_KEY,
AWS_ACCESS_KEY_ID,
)
from .errors import AWSDownloadError
| [
6738,
275,
2069,
18,
13,
29891,
1330,
23575,
198,
6738,
1334,
62,
30604,
1330,
3722,
198,
6738,
42625,
14208,
13,
4023,
1330,
2882,
198,
11748,
10214,
420,
382,
198,
11748,
275,
2069,
18,
198,
198,
6738,
4755,
13,
33692,
1330,
357,
19... | 2.926316 | 95 |
from django.forms import ModelForm
from autos.models import Make
# Create the form class.
| [
198,
6738,
42625,
14208,
13,
23914,
1330,
9104,
8479,
198,
6738,
44619,
13,
27530,
1330,
6889,
628,
198,
2,
13610,
262,
1296,
1398,
13,
198
] | 3.72 | 25 |
import pylab as pl
from PySpectrograph.Models import RSSModel
from PySpectrograph.Spectra import Spectrum
# create the spectrograph model
rss = RSSModel.RSSModel(grating_name="PG0900", gratang=15.875, camang=31.76496,
slit=1.50, xbin=2, ybin=2)
# print out some basic statistics
print(1e7 * r... | [
11748,
279,
2645,
397,
355,
458,
198,
198,
6738,
9485,
49738,
3828,
1470,
13,
5841,
1424,
1330,
25012,
17633,
198,
6738,
9485,
49738,
3828,
1470,
13,
49738,
430,
1330,
27217,
198,
198,
2,
2251,
262,
5444,
3828,
1470,
2746,
198,
42216,
... | 2.40552 | 471 |
"""
Classes related to working with XIA's Pixie16 electronics line
"""
| [
37811,
198,
9487,
274,
3519,
284,
1762,
351,
1395,
3539,
338,
46687,
1433,
17075,
1627,
198,
37811,
198
] | 3.944444 | 18 |
"""
Japanese language data.
This module contains a dict named 'hiragana' which maps hiragana
unicode characters to romaji pronunciations, as well as a
'romajiToHiragana' dict which maps romaji pronunciation to *lists* of
hiragana characters. There are multiple hiragana characters with the
same pronunciation, thus the ... | [
37811,
198,
25324,
3303,
1366,
13,
198,
198,
1212,
8265,
4909,
257,
8633,
3706,
705,
71,
343,
363,
2271,
6,
543,
8739,
289,
343,
363,
2271,
198,
46903,
1098,
3435,
284,
9267,
26436,
9668,
49652,
602,
11,
355,
880,
355,
257,
198,
6,
... | 1.844708 | 1,011 |
from django.db import models
from django.contrib.auth.models import User
from uuid import uuid4
# Does it make sense to have a Game model that could be saved as an instance with Chars linked to it? Good to research
name = models.CharField(max_length=100)
card = models.IntegerField(choices=CARD_CHOICES)
effect = ... | [
6738,
42625,
14208,
13,
9945,
1330,
4981,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
27530,
1330,
11787,
198,
6738,
334,
27112,
1330,
334,
27112,
19,
198,
198,
2,
8314,
340,
787,
2565,
284,
423,
257,
3776,
2746,
326,
714,
... | 3.879781 | 183 |
#!/usr/bin/env python
# coding: utf-8
# DO NOT EDIT
# Autogenerated from the notebook statespace_structural_harvey_jaeger.ipynb.
# Edit the notebook and then sync the output with this file.
#
# flake8: noqa
# DO NOT EDIT
# # Detrending, Stylized Facts and the Business Cycle
#
# In an influential article, Harvey and J... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
19617,
25,
3384,
69,
12,
23,
198,
198,
2,
8410,
5626,
48483,
198,
2,
5231,
519,
877,
515,
422,
262,
20922,
2585,
10223,
62,
7249,
1523,
62,
9869,
3304,
62,
73,
3609,
1362,
13,
... | 2.680136 | 5,593 |
from abc import abstractmethod
from starfish.core.imagestack.imagestack import ImageStack
from starfish.core.morphology.binary_mask import BinaryMaskCollection
from starfish.core.pipeline.algorithmbase import AlgorithmBase
| [
6738,
450,
66,
1330,
12531,
24396,
198,
198,
6738,
3491,
11084,
13,
7295,
13,
48466,
395,
441,
13,
48466,
395,
441,
1330,
7412,
25896,
198,
6738,
3491,
11084,
13,
7295,
13,
24503,
1435,
13,
39491,
62,
27932,
1330,
45755,
45195,
36307,
... | 3.688525 | 61 |
from django.db import models
from datetime import datetime
| [
6738,
42625,
14208,
13,
9945,
1330,
4981,
198,
6738,
4818,
8079,
1330,
4818,
8079,
628,
628
] | 3.875 | 16 |
# coding=utf-8
import logging
__author__ = 'Tyler Butler <tyler@tylerbutler.com>'
# Adapted from Marty Alchin: http://martyalchin.com/2008/jan/10/simple-plugin-framework/
#noinspection PyUnresolvedReferences,PyUnusedLocal
def load_plugins():
"""Load all plugins."""
# Ensure the built-in plugins are loaded... | [
2,
19617,
28,
40477,
12,
23,
198,
11748,
18931,
198,
198,
834,
9800,
834,
796,
705,
46807,
17389,
1279,
774,
1754,
31,
774,
1754,
4360,
1754,
13,
785,
29,
6,
198,
198,
2,
30019,
276,
422,
29876,
978,
24658,
25,
2638,
1378,
13822,
... | 3.003406 | 3,230 |
import random
import discord
import asyncio
from config import DISCORD_TOKEN
client = discord.Client()
@client.event
@client.event
client.run(DISCORD_TOKEN)
| [
11748,
4738,
198,
198,
11748,
36446,
198,
11748,
30351,
952,
198,
198,
6738,
4566,
1330,
13954,
34,
12532,
62,
10468,
43959,
198,
198,
16366,
796,
36446,
13,
11792,
3419,
628,
198,
31,
16366,
13,
15596,
628,
198,
198,
31,
16366,
13,
1... | 2.964286 | 56 |
from django.db import models
# Create your models here.
| [
6738,
42625,
14208,
13,
9945,
1330,
4981,
198,
198,
2,
13610,
534,
4981,
994,
13,
198
] | 3.5625 | 16 |
import os
import intake
import pandas as pd
import pytest
import xarray as xr
from intake_esm import config
here = os.path.abspath(os.path.dirname(__file__))
@pytest.mark.parametrize(
'chunks, expected_chunks',
[
({'time': 1, 'lat': 2, 'lon': 2}, (1, 1, 2, 2)),
({'time': 2, 'lat': 1, '... | [
11748,
28686,
198,
198,
11748,
10337,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
12972,
9288,
198,
11748,
2124,
18747,
355,
2124,
81,
198,
198,
6738,
10337,
62,
45798,
1330,
4566,
198,
198,
1456,
796,
28686,
13,
6978,
13,
397,
... | 2.171779 | 163 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
"""Contains functionality for representing data in a tabular format by parsing the provided file or list of files.
For more informat... | [
2,
20368,
22369,
12,
201,
198,
2,
15069,
357,
66,
8,
5413,
10501,
13,
1439,
2489,
10395,
13,
201,
198,
2,
20368,
22369,
12,
201,
198,
201,
198,
37811,
4264,
1299,
11244,
329,
10200,
1366,
287,
257,
7400,
934,
5794,
416,
32096,
262,
... | 2.402197 | 17,566 |
"""Functions for importing Losungen from the official download page"""
from typing import List
from zipfile import ZipFile
import datetime
import xml.etree.ElementTree as ET
import os
import re
import requests
import logging
from sqlalchemy.orm import Session
from losungen import SessionMaker
from losungen.models impor... | [
37811,
24629,
2733,
329,
33332,
5401,
2150,
268,
422,
262,
1743,
4321,
2443,
37811,
198,
6738,
19720,
1330,
7343,
198,
6738,
19974,
7753,
1330,
38636,
8979,
198,
11748,
4818,
8079,
198,
11748,
35555,
13,
316,
631,
13,
20180,
27660,
355,
... | 2.583706 | 1,117 |
import os
# set mkl thread count for numpy einsum/tensordot calls
# leave one CPU un used so we can still access this computer
import scipy.optimize
os.environ["MKL_NUM_THREADS"] = "{}".format(os.cpu_count() - 1)
# os.environ["MKL_NUM_THREADS"] = "40" # "{}".format(os.cpu_count() - 1)
import jax.numpy as jnp
from ja... | [
11748,
28686,
198,
2,
900,
33480,
75,
4704,
954,
329,
299,
32152,
304,
1040,
388,
14,
83,
641,
585,
313,
3848,
198,
2,
2666,
530,
9135,
555,
973,
220,
523,
356,
460,
991,
1895,
428,
3644,
198,
11748,
629,
541,
88,
13,
40085,
1096,... | 1.984344 | 6,451 |
from project_template.main import return_true
| [
6738,
1628,
62,
28243,
13,
12417,
1330,
1441,
62,
7942,
628
] | 4.272727 | 11 |
import sklearn.cross_validation as cv
from sklearn import tree
import pandas as pd
import numpy as np
import os.path
import pprint
import matplotlib.pyplot as plt
import seaborn as sns
import runExperiments
from pybrain.datasets import SupervisedDataSet
from pybrain.supervised.trainers import BackpropTrainer
from pybr... | [
11748,
1341,
35720,
13,
19692,
62,
12102,
341,
355,
269,
85,
198,
6738,
1341,
35720,
1330,
5509,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
28686,
13,
6978,
198,
11748,
279,
4798,
220,
198,
1... | 2.616484 | 1,189 |
import scipy.signal as signal
import torch
import torch.nn as nn
import numpy as np
import models
import gym
import wandb
def discounted_cumsum(rewards, reward_decay):
"""Taken from https://stackoverflow.com/questions/47970683/vectorize-a-numpy-discount-calculation"""
return signal.lfilter([1], [1, -reward_dec... | [
11748,
629,
541,
88,
13,
12683,
282,
355,
6737,
198,
11748,
28034,
198,
11748,
28034,
13,
20471,
355,
299,
77,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
4981,
198,
11748,
11550,
198,
11748,
11569,
65,
198,
198,
4299,
29686,
62,
... | 2.517241 | 145 |
lista = [1,2,3,4,5,6,7,89,9,8,5,5,2,1]
print(busqueda_binaria(lista, 9)) | [
198,
198,
4868,
64,
796,
685,
16,
11,
17,
11,
18,
11,
19,
11,
20,
11,
21,
11,
22,
11,
4531,
11,
24,
11,
23,
11,
20,
11,
20,
11,
17,
11,
16,
60,
198,
4798,
7,
10885,
421,
18082,
62,
8800,
10312,
7,
4868,
64,
11,
860,
4008... | 1.510204 | 49 |
import unittest
from exam_10apr.project.survivor import Survivor
if __name__ == '__main__':
unittest.main()
| [
11748,
555,
715,
395,
198,
6738,
2814,
62,
940,
499,
81,
13,
16302,
13,
48846,
452,
273,
1330,
23740,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
555,
715,
395,
13,
12417,
3419,
198
] | 2.674419 | 43 |
# 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,... | 3.823308 | 266 |
# Parse the input from the input file
input_file = 'example_input.txt'
inputs = []
outputs = []
with open(input_file) as input:
for line in input.readlines():
split_line = line.split(' | ')
# Sort every string alphabetically to make further analysis easier
inputs.append([''.join(sorted(digit)) for digi... | [
198,
2,
2547,
325,
262,
5128,
422,
262,
5128,
2393,
198,
15414,
62,
7753,
796,
705,
20688,
62,
15414,
13,
14116,
6,
198,
15414,
82,
796,
17635,
198,
22915,
82,
796,
17635,
198,
198,
4480,
1280,
7,
15414,
62,
7753,
8,
355,
5128,
25... | 2.374716 | 1,321 |
"""Unit tests for :mod:`pathcensus.nullmodels`."""
# pylint: disable=redefined-outer-name
import random
from itertools import product
import pytest
import numpy as np
from pathcensus.nullmodels import UBCM, UECM
from pathcensus.utils import rowsums, set_numba_seed
from pathcensus.utils import relclose
from tests.utils ... | [
37811,
26453,
5254,
329,
1058,
4666,
25,
63,
6978,
66,
7314,
13,
8423,
27530,
63,
526,
15931,
198,
2,
279,
2645,
600,
25,
15560,
28,
445,
18156,
12,
39605,
12,
3672,
198,
11748,
4738,
198,
6738,
340,
861,
10141,
1330,
1720,
198,
117... | 2.237991 | 1,832 |
try:
import matplotlib.pyplot as plt
except ModuleNotFoundError:
plt = None
import numpy as np
from scipy.interpolate import interp1d
from scipy.signal import medfilt
from rta.models.interpolant import Interpolant
from rta.models.spline import Spline
from rta.array_operations.dedupy import dedup_np
from rta.ma... | [
28311,
25,
198,
220,
220,
220,
1330,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
16341,
19937,
3673,
21077,
12331,
25,
198,
220,
220,
220,
458,
83,
796,
6045,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
629,
541,
88,
1... | 2.12406 | 1,064 |
import torch
import numpy as np
from util.image_pool import ImagePool
from .base_model import BaseModel
from . import networks
from . import losses
from util.metrics import PSNR
import pytorch_msssim
import random
import torch.nn.functional as F
| [
11748,
28034,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
7736,
13,
9060,
62,
7742,
1330,
7412,
27201,
198,
6738,
764,
8692,
62,
19849,
1330,
7308,
17633,
198,
6738,
764,
1330,
7686,
198,
6738,
764,
1330,
9089,
198,
6738,
7736,
13,
... | 3.617647 | 68 |
import h5py
import os
import unittest
import numpy as np
| [
11748,
289,
20,
9078,
198,
11748,
28686,
628,
628,
198,
11748,
555,
715,
395,
198,
11748,
299,
32152,
355,
45941,
198
] | 2.904762 | 21 |
import tcod as libtcodpy
from random import randint
from components.ai import BasicMonster
from components.equipment import EquipmentSlots
from components.equippable import Equippable
from components.fighter import Fighter
from components.item import Item
from components.stairs import Stairs
from entity import Entity... | [
11748,
256,
19815,
355,
9195,
83,
19815,
9078,
198,
6738,
4738,
1330,
43720,
600,
198,
198,
6738,
6805,
13,
1872,
1330,
14392,
40872,
198,
6738,
6805,
13,
4853,
4667,
1330,
22412,
11122,
1747,
198,
6738,
6805,
13,
4853,
3974,
540,
1330,... | 3.596154 | 208 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import pandas as pd
from collections import defaultdict
from random import randint
import six
| [
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
6738,
11593,
37443,
834,
1330,
7297,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
19798,
292,
355,
279,
67,
198,
6738,
1726... | 4.148148 | 54 |
from aocd import get_data
if __name__ == '__main__':
data = get_data(day=5, year=2018)
inp = data
print(part1(inp))
print(part2(inp))
| [
6738,
257,
420,
67,
1330,
651,
62,
7890,
628,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1366,
796,
651,
62,
7890,
7,
820,
28,
20,
11,
614,
28,
7908,
8,
198,
220,
220,
220,
287,
... | 2.123288 | 73 |
from .client import *
from .image_client import *
from .format_client import *
| [
6738,
764,
16366,
1330,
1635,
198,
6738,
764,
9060,
62,
16366,
1330,
1635,
198,
6738,
764,
18982,
62,
16366,
1330,
1635,
198
] | 3.590909 | 22 |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="swiftai",
version="0.1",
author="Aakash N S",
author_email="opensource@swiftace.ai",
description="Utilities and helper functions for Pytorch and FastAI deep learning libraries",
long_description=lon... | [
11748,
900,
37623,
10141,
198,
198,
4480,
1280,
7203,
15675,
11682,
13,
9132,
1600,
366,
81,
4943,
355,
277,
71,
25,
198,
220,
890,
62,
11213,
796,
277,
71,
13,
961,
3419,
198,
198,
2617,
37623,
10141,
13,
40406,
7,
198,
220,
1438,
... | 3 | 207 |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
import os
import logging
import nltk.data
from core import utils
from core.progressbar import ProgressBar, Percentage, Bar, ETA, FormatLabel, AnimatedMarker
import codecs
from modules.... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
11,
28000,
1098,
62,
17201,
874,
198,
11748,
25064,
220,
198,
260,
2220,
7,
17597,
8,
198,
17597,
13,
2617,
12286,
12685,
... | 3.214286 | 238 |
#!/usr/bin/env python
"""
Copyright 2018 Johns Hopkins University (Author: Jesus Villalba)
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""
import os
import logging
from jsonargparse import ArgumentParser, namespace_to_dict
import math
import numpy as np
from hyperion.hyp_defs import float_cpu, con... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
37811,
198,
15069,
2864,
25824,
21183,
2059,
220,
357,
13838,
25,
5803,
9757,
282,
7012,
8,
198,
220,
24843,
362,
13,
15,
220,
357,
4023,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
45... | 2.707483 | 441 |
from django.conf.urls import include
from django.urls import path
from rest_framework import routers
from .viewsets import UserViewSet
ROUTER = routers.DefaultRouter()
ROUTER.register(r'', UserViewSet, basename='User')
urlpatterns = (
path('', include(ROUTER.urls)),
)
| [
6738,
42625,
14208,
13,
10414,
13,
6371,
82,
1330,
2291,
198,
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
198,
198,
6738,
1334,
62,
30604,
1330,
41144,
198,
198,
6738,
764,
1177,
28709,
1330,
11787,
7680,
7248,
628,
198,
49,
2606,
5... | 2.957447 | 94 |
"""
Creating standalone Django apps is a PITA because you're not in a project, so
you don't have a settings.py file. I can never remember to define
DJANGO_SETTINGS_MODULE, so I run these commands which get the right env
automatically.
"""
import argparse
import os
import sys
from subprocess import call, check_output
... | [
37811,
198,
32071,
27669,
37770,
6725,
318,
257,
49040,
32,
780,
345,
821,
407,
287,
257,
1628,
11,
523,
198,
5832,
836,
470,
423,
257,
6460,
13,
9078,
2393,
13,
220,
314,
460,
1239,
3505,
284,
8160,
198,
35028,
1565,
11230,
62,
284... | 2.403175 | 315 |
from django.shortcuts import render, redirect
from django.http import HttpResponseRedirect
from django.contrib.auth import authenticate, login
from django.contrib.auth.models import User
from allauth.utils import generate_unique_username
from profiles.models import Profile
from profiles.forms import UpgradeUserForm, C... | [
6738,
42625,
14208,
13,
19509,
23779,
1330,
8543,
11,
18941,
198,
6738,
42625,
14208,
13,
4023,
1330,
367,
29281,
31077,
7738,
1060,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
1330,
8323,
5344,
11,
17594,
198,
6738,
42625,
14208,
... | 3.976471 | 85 |
from django.utils.importlib import import_module
| [
6738,
42625,
14208,
13,
26791,
13,
11748,
8019,
1330,
1330,
62,
21412,
628
] | 3.846154 | 13 |
# -*- coding: utf-8 -*-
from bhcrjyApp.AppUtils.HttpMessageTool import HttpUtils
from bhcrjyApp.app import loginCheck
from flask.blueprints import Blueprint
from flask import request, make_response
from flask import render_template, redirect, abort, url_for
bp = Blueprint('index', __name__, url_prefix='/')
@bp.rout... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
6738,
275,
71,
6098,
73,
88,
4677,
13,
4677,
18274,
4487,
13,
43481,
12837,
25391,
1330,
367,
29281,
18274,
4487,
198,
6738,
275,
71,
6098,
73,
88,
4677,
13,
1324... | 2.743842 | 203 |
from osr2mp4.ImageProcess.Objects.FrameObject import FrameObject
| [
6738,
267,
27891,
17,
3149,
19,
13,
5159,
18709,
13,
10267,
82,
13,
19778,
10267,
1330,
25184,
10267,
628
] | 3.473684 | 19 |
# coding: utf-8
from __future__ import absolute_import
from swagger_server.models.inline_response2001 import InlineResponse2001
from swagger_server.models.inline_response2002 import InlineResponse2002
from . import BaseTestCase
from six import BytesIO
from flask import json
class TestConceptsController(BaseTestCase... | [
2,
19617,
25,
3384,
69,
12,
23,
198,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
198,
6738,
1509,
7928,
62,
15388,
13,
27530,
13,
45145,
62,
26209,
14585,
1330,
554,
1370,
31077,
14585,
198,
6738,
1509,
7928,
62,
15388,
... | 2.226754 | 613 |
import os
from mock import patch
import pytest
from django.core.urlresolvers import reverse
from seahub.test_utils import BaseTestCase
TRAVIS = 'TRAVIS' in os.environ
| [
11748,
28686,
198,
6738,
15290,
1330,
8529,
198,
11748,
12972,
9288,
198,
198,
6738,
42625,
14208,
13,
7295,
13,
6371,
411,
349,
690,
1330,
9575,
198,
198,
6738,
384,
993,
549,
13,
9288,
62,
26791,
1330,
7308,
14402,
20448,
198,
198,
... | 3.053571 | 56 |
from inputs import get_gamepad
import serial
ser=serial.Serial('COM4',115200)
prevB=0
while True:
events = get_gamepad()
#X,Y [-32768,+32768]
#Z,RZ(RT,LT) [0,255]
local=ser.read_all()
if len(local)>0:
print(local.decode())
for event in events:
# print(event.ev_type, e... | [
6738,
17311,
1330,
651,
62,
6057,
15636,
201,
198,
11748,
11389,
201,
198,
2655,
28,
46911,
13,
32634,
10786,
9858,
19,
3256,
15363,
2167,
8,
201,
198,
47050,
33,
28,
15,
201,
198,
4514,
6407,
25,
201,
198,
220,
220,
220,
2995,
796,... | 1.690438 | 617 |
# -*- coding: utf-8 -*-
import util.flatfiles.shared
from util.conversions import *
'''
helper methods for formatting CSS flatfiles
All methods use ljust to left justify the field.
The integer argument to ljust specifies that a field has a width of exactly that integer value: the field
is padded with whitespace if t... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
11748,
7736,
13,
38568,
16624,
13,
28710,
198,
6738,
7736,
13,
1102,
47178,
1330,
1635,
198,
198,
7061,
6,
198,
2978,
525,
5050,
329,
33313,
17391,
6228,
16624,
198,
323... | 3.198113 | 212 |
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright (c) 2021 Dhruv Agarwal and authors of arboEL.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import os
import json
import math
import time
import torch
from... | [
2,
15069,
357,
66,
8,
3203,
11,
3457,
13,
290,
663,
29116,
13,
198,
2,
15069,
357,
66,
8,
33448,
20529,
622,
85,
2449,
283,
16783,
290,
7035,
286,
610,
2127,
3698,
13,
198,
2,
1439,
2489,
10395,
13,
198,
2,
198,
2,
770,
2723,
... | 3.278689 | 366 |
#!/usr/bin/python3
__author__ = "Colin Reese"
__copyright__ = "Copyright 2016, Interface Innovations"
__credits__ = ["Colin Reese"]
__license__ = "Apache 2.0"
__version__ = "1.0"
__maintainer__ = "Colin Reese"
__email__ = "support@interfaceinnovations.org"
__status__ = "Development"
if __name__ == "__main__":
ta... | [
2,
48443,
14629,
14,
8800,
14,
29412,
18,
198,
198,
834,
9800,
834,
796,
366,
5216,
259,
39929,
1,
198,
834,
22163,
4766,
834,
796,
366,
15269,
1584,
11,
26491,
43405,
602,
1,
198,
834,
66,
20696,
834,
796,
14631,
5216,
259,
39929,
... | 2.710744 | 121 |
#########################################################
## generate the ensemble predictions for task 2 ##
## created by Isaac Keohane isaackeohane95@gmail.com ##
#########################################################
import os
import sys
module_path = os.path.abspath(os.path.join('../src'))
if module_pa... | [
29113,
14468,
7804,
2,
198,
2235,
220,
220,
220,
7716,
262,
34549,
16277,
329,
4876,
362,
220,
220,
220,
220,
22492,
198,
2235,
220,
2727,
416,
19068,
3873,
1219,
1531,
318,
64,
330,
365,
1219,
1531,
3865,
31,
14816,
13,
785,
220,
2... | 2.590423 | 1,963 |
import tensorflow as tf
import keras
from keras.preprocessing import image
from keras.initializers import glorot_uniform
import numpy as np
import cv2
import os
import csv
IMG_SIZE = 224
color = {}
| [
11748,
11192,
273,
11125,
355,
48700,
198,
11748,
41927,
292,
198,
6738,
41927,
292,
13,
3866,
36948,
1330,
2939,
198,
6738,
41927,
292,
13,
36733,
11341,
1330,
26996,
313,
62,
403,
6933,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
... | 2.574713 | 87 |
#!/usr/bin/env python
####################
# Required Modules #
####################
# Generic/Built-in
import os
from typing import Dict
# Libs
import jsonschema
import tinydb
# Custom
from .base import TopicalRecords, AssociationRecords
from .config import SCHEMAS as schemas
##################
# Configurations #... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
14468,
4242,
198,
2,
20906,
3401,
5028,
1303,
198,
14468,
4242,
198,
198,
2,
42044,
14,
39582,
12,
259,
198,
11748,
28686,
198,
6738,
19720,
1330,
360,
713,
198,
198,
2,
7980,
8... | 3.559956 | 909 |
"""
Author: Ehsan Sadrfaridpour
Date: Aug 24, 2018
Purpose: map other labels to -1 and 1 labels,
make sure the number of 1 labels are smaller than the number of -1 labels for MLSVM framework
Usage: define the preferred mapping in the label_map which is a dictionary.
The key is the old/current label(s) in the file... | [
37811,
198,
13838,
25,
412,
11994,
272,
14668,
81,
16370,
312,
48681,
198,
10430,
25,
2447,
1987,
11,
2864,
198,
30026,
3455,
25,
3975,
584,
14722,
284,
532,
16,
290,
352,
14722,
11,
220,
198,
197,
15883,
1654,
262,
1271,
286,
352,
... | 2.438503 | 561 |
import os
from django.conf import global_settings
from django.contrib.auth import authenticate
from django.db.models import Q
from django.template import context
from django.test import TestCase
from django.test.utils import override_settings
@override_settings(
TEMPLATE_DIRS=(
os.path.join(os.path.d... | [
11748,
28686,
198,
198,
6738,
42625,
14208,
13,
10414,
1330,
3298,
62,
33692,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
1330,
8323,
5344,
198,
6738,
42625,
14208,
13,
9945,
13,
27530,
1330,
1195,
198,
6738,
42625,
14208,
13,
28... | 2.590643 | 1,368 |
""" Utility functions for creating Python scripts that expect to turn one file into another, or use stdin/stdout as part of a pipeline.
Copyright 2018 Ben Kehoe
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... | [
37811,
34030,
5499,
329,
4441,
11361,
14750,
326,
1607,
284,
1210,
530,
2393,
656,
1194,
11,
393,
779,
14367,
259,
14,
19282,
448,
355,
636,
286,
257,
11523,
13,
198,
198,
15269,
2864,
3932,
3873,
38979,
198,
198,
26656,
15385,
739,
2... | 2.834146 | 1,640 |
from __future__ import annotations
from typing import Any, Iterable, MutableMapping
from qtpy.QtWidgets import QTableWidget, QTableWidgetItem
from .object import BaseWidget, ContextMenuMixin, PyObjectBound | [
6738,
11593,
37443,
834,
1330,
37647,
198,
6738,
19720,
1330,
4377,
11,
40806,
540,
11,
13859,
540,
44,
5912,
198,
6738,
10662,
83,
9078,
13,
48,
83,
54,
312,
11407,
1330,
1195,
10962,
38300,
11,
1195,
10962,
38300,
7449,
198,
198,
67... | 3.678571 | 56 |
#!/usr/bin/env python3
import click
from anormbookmarker.model.__model__ import *
from anormbookmarker.model.BookmarkClassConstructor import tagbookmarks_table
from anormbookmarker.model.Word import WordMisSpelling
from anormbookmarker.test.test_enviroment import Tag
from anormbookmarker.test.test_enviroment import Bo... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
11748,
3904,
198,
6738,
281,
579,
2070,
4102,
263,
13,
19849,
13,
834,
19849,
834,
1330,
1635,
198,
6738,
281,
579,
2070,
4102,
263,
13,
19849,
13,
10482,
4102,
9487,
42316,
... | 3.145946 | 185 |
import os
from sovrin_common.setup_util import Setup
BASE_DIR = os.path.join(os.path.expanduser("~"), ".sovrin")
Setup(BASE_DIR).setupClient() | [
11748,
28686,
198,
198,
6738,
523,
85,
12769,
62,
11321,
13,
40406,
62,
22602,
1330,
31122,
198,
198,
33,
11159,
62,
34720,
796,
28686,
13,
6978,
13,
22179,
7,
418,
13,
6978,
13,
11201,
392,
7220,
7203,
93,
12340,
27071,
47272,
12769,... | 2.666667 | 54 |
#!/usr/bin/python3 -B
# Copyright 2022 Josh Pieper, jjp@pobox.com.
#
# 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 a... | [
2,
48443,
14629,
14,
8800,
14,
29412,
18,
532,
33,
198,
198,
2,
15069,
33160,
8518,
21690,
525,
11,
474,
34523,
31,
79,
672,
1140,
13,
785,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
36... | 1.927056 | 1,508 |
from setuptools import setup, find_packages
import codecs
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import package_information
if __name__ == '__main__':
# Setting up
setup(
name=package_information.name,
version=package_information.version,
author=package_information.author,... | [
6738,
900,
37623,
10141,
1330,
9058,
11,
1064,
62,
43789,
198,
11748,
40481,
82,
198,
11748,
28686,
198,
11748,
25064,
198,
17597,
13,
6978,
13,
28463,
7,
15,
11,
28686,
13,
6978,
13,
397,
2777,
776,
10786,
492,
6,
4008,
198,
11748,
... | 2.532009 | 453 |
"""
Predict next tools in the Galaxy workflows
using machine learning (recurrent neural network)
"""
import numpy as np
import argparse
import time
# machine learning library
import tensorflow as tf
from keras import backend as K
import keras.callbacks as callbacks
import extract_workflow_connections
import prepare_... | [
37811,
198,
47,
17407,
1306,
4899,
287,
262,
9252,
670,
44041,
198,
3500,
4572,
4673,
357,
8344,
6657,
17019,
3127,
8,
198,
37811,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
1822,
29572,
198,
11748,
640,
198,
198,
2,
4572,
4... | 2.90169 | 1,953 |
'''
Facial recognition data challenge
Data from Evgueni Ovtchinnikov: https://www.dropbox.com/sh/a62wxyw9fpzwt95/AABJE0CEAtqOuLXKo_sOTFMVa?dl=0
https://github.com/evgueni-ovtchinnikov
1. clean the dataset: select only images with more than one face
2. select 70% train 30% cross validation
'''
import numpy
from funct... | [
7061,
6,
198,
37,
18150,
9465,
1366,
4427,
198,
198,
6601,
422,
4319,
5162,
43850,
440,
36540,
354,
3732,
1134,
709,
25,
3740,
1378,
2503,
13,
14781,
3524,
13,
785,
14,
1477,
14,
64,
5237,
86,
5431,
86,
24,
46428,
89,
46569,
3865,
... | 2.087575 | 2,318 |
'''OpenGL extension EXT.gpu_program_parameters
The official definition of this extension is available here:
http://oss.sgi.com/projects/ogl-sample/registry/EXT/gpu_program_parameters.txt
Automatically generated by the get_gl_extensions script, do not edit!
'''
from OpenGL import platform, constants, constant, arrays... | [
7061,
6,
11505,
8763,
7552,
27489,
13,
46999,
62,
23065,
62,
17143,
7307,
198,
198,
464,
1743,
6770,
286,
428,
7552,
318,
1695,
994,
25,
198,
197,
4023,
1378,
793,
13,
82,
12397,
13,
785,
14,
42068,
14,
28678,
12,
39873,
14,
2301,
... | 3.155844 | 462 |
import re, unittest
from feature_reduction import *
# user pattern tests
# url pattern tests
# more url tests (if needed)
# https://mathiasbynens.be/demo/url-regex
# repeating pattern tests
# reduce tests
if __name__ == '__main__':
unittest.main()
| [
11748,
302,
11,
555,
715,
395,
198,
6738,
3895,
62,
445,
8110,
1330,
1635,
628,
197,
2,
2836,
3912,
5254,
628,
197,
2,
19016,
3912,
5254,
628,
197,
2,
517,
19016,
5254,
357,
361,
2622,
8,
198,
197,
2,
3740,
1378,
11018,
4448,
1492... | 2.977528 | 89 |
# Functions relevant for LISA-like orbits
#
# A LISA-like orbit has 3 satellites in a triangular configuration.
# Eccentricity and inclination combine to make the triangle
# tumble with a minimal amount of variation in the arm lengths
# See, e.g., K Rajesh Nayak et al, Class. Quantum Grav. 23, 1763 (2006).
import mat... | [
2,
40480,
5981,
329,
406,
22312,
12,
2339,
37015,
198,
2,
198,
2,
317,
406,
22312,
12,
2339,
13066,
468,
513,
20372,
287,
257,
46963,
8398,
13,
198,
2,
38308,
22317,
414,
290,
36793,
12082,
284,
787,
262,
22950,
220,
198,
2,
47978,
... | 2.507109 | 422 |
from Neural_Network import Neural_Network
if __name__ == '__main__':
ann, model = train_network()
save_ann(ann, model)
| [
6738,
47986,
62,
26245,
1330,
47986,
62,
26245,
628,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1529,
11,
2746,
796,
4512,
62,
27349,
3419,
198,
220,
220,
220,
3613,
62,
1236,
7,
1236,
11... | 2.847826 | 46 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# (c) Copyright 2003-2015 HP Development Company, L.P.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (a... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
198,
2,
357,
66,
8,
15069,
5816,
12,
4626,
6574,
7712,
5834,
11,
406,
13,
47,
13,
198,
2,
198,
2,
770,
1... | 1.910537 | 19,807 |
#encoding=UTF-8
"""
@author ideawu@163.com
@link http://www.ideawu.net/
"""
import new, socket
from buffer import *
LINK_ROLE_SERVER = 1
LINK_ROLE_CLIENT = 2
LINK_ROLE_ACCEPT = 3
class LinkBase:
# TODO: accept_all(self):
""" 判断是否已经读就绪 """
""" 进行一次网络读操作 """
""" 进行一次网络写操作
@return
-1: 错误
0 : 建议调用者关闭连接
"""
... | [
2,
12685,
7656,
28,
48504,
12,
23,
198,
37811,
198,
31,
9800,
1405,
707,
84,
31,
24136,
13,
785,
198,
31,
8726,
2638,
1378,
2503,
13,
485,
707,
84,
13,
3262,
14,
198,
37811,
198,
11748,
649,
11,
17802,
198,
6738,
11876,
1330,
1635... | 1.208511 | 470 |
from aws_cdk import (
aws_lambda as lambda_,
core,
)
if __name__ == "__main__":
main()
| [
6738,
3253,
82,
62,
10210,
74,
1330,
357,
198,
220,
220,
220,
3253,
82,
62,
50033,
355,
37456,
62,
11,
198,
220,
220,
220,
4755,
11,
198,
8,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
... | 2.145833 | 48 |
import dataclasses
from typing import List
@dataclasses.dataclass
class GasAtTemp:
"""Adsorption is in the selected loading units and composition is based on the compositionType of the isotherm """
InChIKey: str
name: str
composition: float
adsorption: float
@dataclasses.dataclass
class Temperatu... | [
11748,
4818,
330,
28958,
198,
6738,
19720,
1330,
7343,
628,
198,
31,
19608,
330,
28958,
13,
19608,
330,
31172,
198,
4871,
14345,
2953,
30782,
25,
198,
220,
220,
220,
37227,
2782,
82,
273,
1159,
318,
287,
262,
6163,
11046,
4991,
290,
1... | 3.293785 | 177 |
# -*- coding: utf-8 -*-
from qstrader.risk_manager.example import ExampleRiskManager
import os
import datetime
from qstrader.price_handler.yahoo_daily_csv_bar import YahooDailyCsvBarPriceHandler
from qstrader.compat import queue
# regime_hmm_backtest.py
import datetime
import pickle
import click
import numpy as np
fr... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
10662,
2536,
5067,
13,
19121,
62,
37153,
13,
20688,
1330,
17934,
49,
1984,
13511,
628,
198,
11748,
28686,
198,
11748,
4818,
8079,
198,
6738,
10662,
2536,
5067,
13,
... | 3.428144 | 334 |
"""<internal>"""
'''
zlib License
(C) 2020-2021 DeltaRazero
All rights reserved.
'''
# ***************************************************************************************
class _:
'<imports>'
import abc
from . import textio
from .misc import ptr_t
# *******************************************... | [
37811,
27,
32538,
29,
37811,
198,
198,
7061,
6,
198,
89,
8019,
13789,
198,
198,
7,
34,
8,
12131,
12,
1238,
2481,
16978,
49,
1031,
3529,
198,
3237,
2489,
10395,
13,
198,
7061,
6,
198,
198,
2,
41906,
17174,
8412,
2466,
8162,
198,
19... | 2.711055 | 398 |
import base64
import json
import logging
from dmsapi import DMSSession
| [
11748,
2779,
2414,
198,
11748,
33918,
198,
11748,
18931,
198,
6738,
288,
907,
15042,
1330,
14848,
5432,
2521,
628
] | 3.789474 | 19 |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | [
37811,
198,
15269,
12131,
383,
1881,
37535,
46665,
13,
1439,
2489,
10395,
13,
198,
198,
26656,
15385,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
5832,
743,
407,
779,
428,
2393,
2845,
287,
11846,
... | 3.022587 | 487 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import keras as k
from keras.layers import Dense, Dropout, Activation, Concatenate
from keras.optimizers import SGD
import os
import argparse
import shutil
import math
... | [
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
201,
198,
6738,
11593,
37443,
834,
1330,
7297,
201,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
201,
198,
201,
198,
201,
198,
11748,
11192,
273,
11125,
355,
48700,
201,
198,
11748,... | 1.962651 | 3,320 |
import os
import config
import logging
import time
from task_handler import CodeTask
import subprocess
from flask import Flask,request,render_template,url_for,jsonify
logging.basicConfig(level=logging.DEBUG)
app=Flask(__name__)
app.secret = config.KEY
@app.route('/')
@app.route('/compile')
@app.route('/about')
... | [
11748,
28686,
198,
11748,
4566,
198,
11748,
18931,
198,
11748,
640,
198,
6738,
4876,
62,
30281,
1330,
6127,
25714,
198,
11748,
850,
14681,
198,
198,
6738,
42903,
1330,
46947,
11,
25927,
11,
13287,
62,
28243,
11,
6371,
62,
1640,
11,
1775... | 2.727891 | 147 |
#!/usr/bin/env python
import webapp2
from google.appengine.api import app_identity
from google.appengine.api import mail
from conference import ConferenceApi
from models import SpeakerDict
import logging
SPEAKER_IDENTIFIER = 1234
app = webapp2.WSGIApplication([
('/crons/set_announcement', SetAnnouncementHandle... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
11748,
3992,
1324,
17,
198,
6738,
23645,
13,
1324,
18392,
13,
15042,
1330,
598,
62,
738,
414,
198,
6738,
23645,
13,
1324,
18392,
13,
15042,
1330,
6920,
198,
6738,
4495,
1330,
8785,
32,... | 3.045752 | 153 |
import logging
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models.signals import pre_save, post_save
from django.dispatch import receiver
from django_fsm import FSMFiel... | [
11748,
18931,
198,
198,
6738,
42625,
14208,
13,
26791,
13,
41519,
1330,
334,
1136,
5239,
62,
75,
12582,
355,
4808,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
27530,
1330,
11787,
198,
6738,
42625,
14208,
13,
7295,
13,
1069,
... | 3.4375 | 208 |
import inspect
import unittest
from itertools import product
from functools import partial
from pytf.core import Test
# Unittest compatibility loader
| [
11748,
10104,
198,
11748,
555,
715,
395,
198,
198,
6738,
340,
861,
10141,
1330,
1720,
198,
6738,
1257,
310,
10141,
1330,
13027,
198,
198,
6738,
12972,
27110,
13,
7295,
1330,
6208,
628,
198,
198,
2,
791,
715,
395,
17764,
40213,
628,
19... | 3.738095 | 42 |
print(*solve([*map(str.rstrip, open('data.txt'))]), sep='')
| [
198,
198,
4798,
46491,
82,
6442,
26933,
9,
8899,
7,
2536,
13,
81,
36311,
11,
1280,
10786,
7890,
13,
14116,
6,
4008,
46570,
41767,
28,
7061,
8,
198
] | 2.214286 | 28 |
from news_website.operations.tools import NewsUrlCache
if __name__=='__main__':
test_cache = TestNewsUrlCache()
test_cache.test_initialization()
test_cache.test_push()
test_cache.test_add_existed_ele()
test_cache.test_full()
test_cache.test_practice()
| [
6738,
1705,
62,
732,
12485,
13,
3575,
602,
13,
31391,
1330,
3000,
28165,
30562,
628,
198,
361,
11593,
3672,
834,
855,
6,
834,
12417,
834,
10354,
198,
220,
220,
220,
1332,
62,
23870,
796,
6208,
9980,
28165,
30562,
3419,
198,
220,
220,
... | 2.632075 | 106 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from ffmpymedia import __author__, __version__, __copyright__, __package__
from os.path import join as joinpath
import unittest
from ffmpymedia.media import *
from tests import TEST_FILE_PATH
class TestMediaStream(unittest.TestCase):
"""
Testes de criação dos o... | [
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,
6738,
31246,
3149,
88,
11431,
1330,
11593,
9800,
834,
11,
11593,
9641,
834,
11,
11593,
22163,
4766,
834,
11,
... | 1.689244 | 4,695 |
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.desk.reportview import build_match_conditions
from frappe.utils import flt, cint, getdate, now, date_diff
| [
2,
15069,
357,
66,
8,
2211,
11,
39313,
27768,
21852,
18367,
83,
13,
12052,
13,
290,
20420,
198,
2,
1114,
5964,
1321,
11,
3387,
766,
5964,
13,
14116,
198,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
11748,
5... | 3.472527 | 91 |
"""
Main plugin tests.
.. note:: Please to not run nosetests with this plugin for testing the plugin
itself. Also, mock.patch is not much help here as it would try to mock the
module that would be already imported by nose itself if plugin was installed
globally (it would take module from sys.modules).
"""
imp... | [
37811,
198,
13383,
13877,
5254,
13,
198,
198,
492,
3465,
3712,
4222,
284,
407,
1057,
43630,
316,
3558,
351,
428,
13877,
329,
4856,
262,
13877,
198,
220,
220,
2346,
13,
4418,
11,
15290,
13,
17147,
318,
407,
881,
1037,
994,
355,
340,
... | 4 | 101 |
from enum import Enum
from collections import deque, defaultdict
from functools import partial
class node_status(Enum):
"""List of possible visit status of graph nodes (graph traversal)."""
UNVISITED = 0
VISITED = 1
VISITING = 2
| [
6738,
33829,
1330,
2039,
388,
198,
6738,
17268,
1330,
390,
4188,
11,
4277,
11600,
198,
6738,
1257,
310,
10141,
1330,
13027,
198,
198,
4871,
10139,
62,
13376,
7,
4834,
388,
2599,
198,
220,
220,
220,
37227,
8053,
286,
1744,
3187,
3722,
... | 3.194805 | 77 |
from __future__ import absolute_import
from six import text_type
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.inspection import inspect
import sqlalchemy.orm as saorm
from . import entities as ents
from . import interfac... | [
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
198,
6738,
2237,
1330,
2420,
62,
4906,
198,
11748,
44161,
282,
26599,
355,
473,
198,
6738,
44161,
282,
26599,
13,
2302,
13,
32446,
283,
876,
1330,
6875,
62,
35226,
198,
6738,
44161,
... | 2.573326 | 1,882 |
#
# ayame.exception
#
# Copyright (c) 2011-2021 Akinori Hattori <hattya@gmail.com>
#
# SPDX-License-Identifier: MIT
#
__all__ = ['AyameError', 'ComponentError', 'ConversionError', 'MarkupError',
'RenderingError', 'ResourceError', 'RouteError', 'ValidationError']
| [
2,
198,
2,
38762,
480,
13,
1069,
4516,
198,
2,
198,
2,
220,
220,
15069,
357,
66,
8,
2813,
12,
1238,
2481,
48857,
10145,
48509,
10145,
1279,
5183,
774,
64,
31,
14816,
13,
785,
29,
198,
2,
198,
2,
220,
220,
30628,
55,
12,
34156,
... | 2.557522 | 113 |
"""
The evaluation entry point for WIDER Challenge 2019: Face Detection Accuracy+Runtime Track.
It will be the entrypoint for the evaluation docker once built.
Basically It downloads a list of images and run the face detector on each image.
Then the runtime and detection output will be reported to the evaluation syste... | [
37811,
198,
464,
12660,
5726,
966,
329,
370,
41237,
13879,
13130,
25,
15399,
46254,
33222,
10,
41006,
17762,
13,
198,
198,
1026,
481,
307,
262,
5726,
4122,
329,
262,
12660,
36253,
1752,
3170,
13,
198,
31524,
632,
21333,
257,
1351,
286,
... | 3.221865 | 933 |
import cv2
import torch.nn.functional as F
import torch
import matplotlib.pyplot as plt
import cv2
def normalize(imgs, img_type, **kwargs):
""" Normalizes differently depending on type
"""
if img_type in {"image"}:
return imgs/255.0
elif img_type == "mask" or img_type == "class":
retur... | [
11748,
269,
85,
17,
198,
11748,
28034,
13,
20471,
13,
45124,
355,
376,
198,
11748,
28034,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
269,
85,
17,
628,
198,
4299,
3487,
1096,
7,
9600,
82,
11,
33705,
62,... | 2.353261 | 184 |
# Copyright (c) 2017-2021 Neogeo-Technologies.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | [
2,
15069,
357,
66,
8,
2177,
12,
1238,
2481,
21227,
469,
78,
12,
25574,
5823,
13,
198,
2,
1439,
6923,
33876,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
345,
743,
198,
... | 3.660377 | 212 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Another useless python script
@author: ratin
"""
#TODO: Implement Authentication System
#TODO: Implement feature to save in Mongo the books which are asked often
#TODO: Implement feature to ask for the number of books sent in the API
import datetime
import sys
from js... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
6610,
13894,
21015,
4226,
198,
31,
9800,
25,
4227,
259,
198,
37811,
198,
2,
51,
3727,
46,
25,
48282,
... | 2.045923 | 1,067 |