content stringlengths 1 1.04M | input_ids listlengths 1 774k | ratio_char_token float64 0.38 22.9 | token_count int64 1 774k |
|---|---|---|---|
import breve
class Test( breve.Control ):
'''def iterate( self ):
self.object.energy -= self.increm
if 0 >= self.object.energy or self.object.energy >= 1:
self.increm = 0
self.object.adjustSize()
if self.increm != 0:
print self.object.temp'''
breve.Test = Test
breve.CustomObject = C... | [
11748,
1449,
303,
201,
198,
201,
198,
4871,
6208,
7,
1449,
303,
13,
15988,
15179,
201,
198,
201,
198,
197,
7061,
6,
4299,
11629,
378,
7,
2116,
15179,
201,
198,
197,
197,
944,
13,
15252,
13,
22554,
48185,
2116,
13,
1939,
2787,
201,
... | 2.382716 | 162 |
#!/usr/bin/python
"""
Tool to analyze some datalogger raw data
"""
from __future__ import print_function
import os
import sys
import argparse
import json
parser = argparse.ArgumentParser(description="Tool to analyze some datalogger raw data")
parser.add_argument("-i", "--input-file", help="file to read from", required... | [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
37811,
198,
25391,
284,
16602,
617,
4818,
11794,
1362,
8246,
1366,
198,
37811,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
11748,
28686,
198,
11748,
25064,
198,
11748,
1822,
29572,
... | 2.394279 | 804 |
from os.path import *
REPO_DIR = abspath(join(dirname(realpath(__file__)), pardir, pardir))
TOKEN_PATH = join(REPO_DIR, '.hooks', '.token')
VERSION_PATH = join(REPO_DIR, 'res', 'version.txt')
| [
6738,
28686,
13,
6978,
1330,
1635,
198,
198,
2200,
16402,
62,
34720,
796,
2352,
6978,
7,
22179,
7,
15908,
3672,
7,
5305,
6978,
7,
834,
7753,
834,
36911,
41746,
343,
11,
41746,
343,
4008,
198,
10468,
43959,
62,
34219,
796,
4654,
7,
2... | 2.573333 | 75 |
'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/80C4285C-779E-DD11-9889-001617E30CA4.root',
'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7... | [
6,
41871,
952,
1378,
20924,
21370,
66,
9487,
28,
46406,
66,
1878,
5,
6978,
33223,
2701,
273,
14,
30903,
13,
354,
14,
46406,
14,
8095,
14,
7890,
14,
50246,
278,
2919,
14,
36734,
76,
873,
14,
1847,
20034,
2943,
46,
14,
34,
44700,
62... | 1.964692 | 10,734 |
# vim: ai:sw=4:ts=4:sta:et:fo=croql
# coding=utf-8
| [
2,
43907,
25,
257,
72,
25,
2032,
28,
19,
25,
912,
28,
19,
25,
38031,
25,
316,
25,
6513,
28,
19915,
13976,
198,
2,
19617,
28,
40477,
12,
23,
198
] | 1.7 | 30 |
from typing import Type
from pyspark.sql.functions import col, lit, when
from impc_etl.shared import utils
from impc_etl.workflow.config import ImpcConfig
from pyspark.sql.session import SparkSession
import luigi
from luigi.contrib.spark import PySparkTask
from pyspark.sql.types import StringType
| [
6738,
19720,
1330,
5994,
198,
6738,
279,
893,
20928,
13,
25410,
13,
12543,
2733,
1330,
951,
11,
6578,
11,
618,
198,
6738,
848,
66,
62,
316,
75,
13,
28710,
1330,
3384,
4487,
198,
6738,
848,
66,
62,
316,
75,
13,
1818,
11125,
13,
112... | 3.180851 | 94 |
from collections import deque
if __name__ == "__main__":
main() | [
6738,
17268,
1330,
390,
4188,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1388,
3419
] | 2.956522 | 23 |
from setuptools import setup
from likeasrt import VERSION
setup(
name="like-a-srt",
version=VERSION,
description=(
"CLI to generate SRT subtitles automatically from audio files, "
"using Azure Speech"
),
long_description=readme(),
long_description_content_type="text/markdown"... | [
6738,
900,
37623,
10141,
1330,
9058,
198,
198,
6738,
588,
292,
17034,
1330,
44156,
2849,
628,
198,
198,
40406,
7,
198,
220,
220,
220,
1438,
2625,
2339,
12,
64,
12,
82,
17034,
1600,
198,
220,
220,
220,
2196,
28,
43717,
11,
198,
220,
... | 2.376726 | 507 |
from .testapp.models import Thing
| [
6738,
764,
9288,
1324,
13,
27530,
1330,
21561,
198
] | 3.777778 | 9 |
import click
from .config import PyjjConfig
from .database import Database as Db
from .messages import msg, header, content, division
from .utils import validate_url
pass_config = click.make_pass_decorator(PyjjConfig, ensure=True)
@click.group(help="A CLI tool for bookmark management")
@pass_config
def pyjj(config... | [
11748,
3904,
198,
198,
6738,
764,
11250,
1330,
9485,
41098,
16934,
198,
6738,
764,
48806,
1330,
24047,
355,
360,
65,
198,
6738,
764,
37348,
1095,
1330,
31456,
11,
13639,
11,
2695,
11,
7297,
198,
6738,
764,
26791,
1330,
26571,
62,
6371,
... | 2.510626 | 1,788 |
from bs4 import BeautifulSoup
from .utils.request import get
from typing import Optional
class User:
"""
Represents a Roblox user.
"""
def __init__(self, user_id: int):
"""
Construct a new user class.
:param user_id: The User's ID.
"""
response =... | [
6738,
275,
82,
19,
1330,
23762,
50,
10486,
201,
198,
6738,
764,
26791,
13,
25927,
1330,
651,
201,
198,
6738,
19720,
1330,
32233,
201,
198,
201,
198,
201,
198,
4871,
11787,
25,
201,
198,
220,
220,
220,
37227,
201,
198,
220,
220,
220,... | 2.36413 | 368 |
import unittest
# def test___init__(self):
# # open_vas_override = OpenVASOverride()
# assert False # TODO: implement your test here
#
# def test_make_object(self):
# # open_vas_override = OpenVASOverride()
# # self.assertEqual(expected, open_vas_override.make_object(oid, name... | [
11748,
555,
715,
395,
628,
198,
198,
2,
220,
220,
220,
220,
825,
1332,
17569,
15003,
834,
7,
944,
2599,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1280,
62,
11017,
62,
2502,
13154,
796,
4946,
53,
1921,
37961,
3419,
198,... | 2.327813 | 2,053 |
"""Create a new tournament."""
from scorecard import db
from scorecard.models.tournament import Tournament
def create(name, start_date, end_date):
"""Create a tournament."""
tournament = Tournament.query.filter_by(name=name, start_date=start_date, end_date=end_date).first()
if tournament is None:
... | [
37811,
16447,
257,
649,
7756,
526,
15931,
198,
198,
6738,
4776,
9517,
1330,
20613,
198,
6738,
4776,
9517,
13,
27530,
13,
83,
5138,
1330,
9595,
628,
198,
4299,
2251,
7,
3672,
11,
923,
62,
4475,
11,
886,
62,
4475,
2599,
198,
220,
220,... | 3.013333 | 150 |
from operator import attrgetter
import torch
from continual import CoModule
from pytorch_lightning.utilities.parsing import AttributeDict
from ride.core import Configs, RideMixin
from ride.utils.logging import getLogger
from ride.utils.utils import name
logger = getLogger("co3d")
| [
6738,
10088,
1330,
708,
81,
1136,
353,
198,
198,
11748,
28034,
198,
6738,
37639,
1330,
1766,
26796,
198,
6738,
12972,
13165,
354,
62,
2971,
768,
13,
315,
2410,
13,
79,
945,
278,
1330,
3460,
4163,
35,
713,
198,
6738,
6594,
13,
7295,
... | 3.380952 | 84 |
# Generated by Django 3.1.7 on 2021-04-13 20:33
from django.db import migrations, models
| [
2,
2980,
515,
416,
37770,
513,
13,
16,
13,
22,
319,
33448,
12,
3023,
12,
1485,
1160,
25,
2091,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.84375 | 32 |
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
cv2.namedWindow("frame")
cv2.createTrackbar("test", "frame", 50, 500, nothing)
cv2.createTrackbar("color/gray", "frame", 0, 1, nothing)
while True:
ret, frame = cap.read()
if not ret:
break
test = cv2.getTrackbarPos("test", "frame")
fo... | [
11748,
269,
85,
17,
198,
11748,
299,
32152,
355,
45941,
628,
198,
198,
11128,
796,
269,
85,
17,
13,
10798,
49630,
7,
15,
8,
198,
33967,
17,
13,
13190,
27703,
7203,
14535,
4943,
198,
33967,
17,
13,
17953,
24802,
5657,
7203,
9288,
160... | 2.169884 | 259 |
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
198,
2,
15069,
2177,
12,
25579,
4946,
7311,
278,
5693,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
... | 3.823232 | 396 |
#!/usr/bin/env python#
#
# 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
# ... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
2,
198,
2,
198,
2,
49962,
284,
262,
24843,
10442,
5693,
357,
1921,
37,
8,
739,
530,
198,
2,
393,
517,
18920,
5964,
11704,
13,
220,
4091,
262,
28536,
2393,
198,
2,
9387,
351,
428,
670,
... | 2.238262 | 2,002 |
"""
The following simple example demonstarates how a module can initialize a counter from a file
when it is imported and save the counter's updated value automatically when the program terminates
without relying on the application making an explicit call into this module at termination
"""
try:
with open("counterfi... | [
37811,
198,
464,
1708,
2829,
1672,
3222,
7364,
689,
703,
257,
8265,
460,
41216,
257,
3753,
422,
257,
2393,
198,
12518,
340,
318,
17392,
290,
3613,
262,
3753,
338,
6153,
1988,
6338,
618,
262,
1430,
5651,
689,
198,
19419,
17965,
319,
26... | 3.576355 | 203 |
# being a bit too dynamic
# pylint: disable=E1101
from pandas.util.decorators import cache_readonly
import pandas.core.common as com
import numpy as np
def scatter_matrix(frame, alpha=0.5, figsize=None, **kwds):
"""
Draw a matrix of scatter plots.
Parameters
----------
kwds : other plotting key... | [
2,
852,
257,
1643,
1165,
8925,
198,
2,
279,
2645,
600,
25,
15560,
28,
36,
1157,
486,
198,
198,
6738,
19798,
292,
13,
22602,
13,
12501,
273,
2024,
1330,
12940,
62,
961,
8807,
198,
11748,
19798,
292,
13,
7295,
13,
11321,
355,
401,
1... | 2.228203 | 8,063 |
from .news import news_router
| [
6738,
764,
10827,
1330,
1705,
62,
472,
353,
198
] | 3.333333 | 9 |
#!/usr/bin/env python
"""
Monitors the availability of the TCP port, runs external process if port is unavailable,
but not more frequently than cooldown timeout. Persistent information is stored in /tmp
"""
import argparse
import contextlib
import datetime
import logging.handlers
import os
import random
import ... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
37811,
198,
220,
220,
220,
2892,
6742,
262,
11500,
286,
262,
23633,
2493,
11,
4539,
7097,
1429,
611,
2493,
318,
23485,
11,
198,
220,
220,
220,
475,
407,
517,
6777,
621,
20869,
26827,
... | 3.583333 | 144 |
# -*- coding: utf-8 -*-
"""
Domain model implementation
"""
__author__ = 'Samir Adrik'
__email__ = 'samir.adrik@gmail.com'
from .expenses import Expenses
from .currency import Currency
from .address import Address
from .percent import Percent
from .family import Family
from .entity import Entity
from .person import... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
37811,
198,
43961,
2746,
7822,
198,
198,
37811,
198,
198,
834,
9800,
834,
796,
705,
16305,
343,
1215,
12602,
6,
198,
834,
12888,
834,
796,
705,
37687,
343,
13,
32... | 3.694268 | 157 |
from typing import Callable, Dict, Tuple
import numpy as np
from numpy import cumsum
from copy import deepcopy
from ..utils.utilities import calculate_best_intervention_and_effect
def get_relevant_results(results: Callable, replicates: int) -> Dict[str, tuple]:
"""
When we get results from a notebook they are... | [
6738,
19720,
1330,
4889,
540,
11,
360,
713,
11,
309,
29291,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
299,
32152,
1330,
269,
5700,
388,
198,
6738,
4866,
1330,
2769,
30073,
198,
6738,
11485,
26791,
13,
315,
2410,
1330,
15284,
62,
... | 2.491903 | 494 |
#
# VUsbTools.Log
# Micah Elizabeth Scott <micah@vmware.com>
#
# Implements parsers for USB log files. Currently
# this includes slurping usbAnalyzer data out of the
# VMX log, and parsing the XML logs exported by
# Ellisys Visual USB.
#
# Copyright (C) 2005-2010 VMware, Inc. Licensed under the MIT
# License, please se... | [
2,
198,
2,
569,
5842,
65,
33637,
13,
11187,
198,
2,
7631,
993,
10674,
4746,
1279,
9383,
993,
31,
14761,
1574,
13,
785,
29,
198,
2,
198,
2,
1846,
1154,
902,
13544,
364,
329,
8450,
2604,
3696,
13,
16888,
198,
2,
428,
3407,
40066,
... | 2.463681 | 2,836 |
#!/usr/bin/python3
from collections import Counter
from htsworkflow.submission.encoded import ENCODED
import psycopg2
import pandas
if __name__ == '__main__':
main()
| [
2,
48443,
14629,
14,
8800,
14,
29412,
18,
198,
198,
6738,
17268,
1330,
15034,
198,
6738,
289,
912,
1818,
11125,
13,
7266,
3411,
13,
12685,
9043,
1330,
412,
7792,
3727,
1961,
198,
198,
11748,
17331,
22163,
70,
17,
198,
11748,
19798,
29... | 2.83871 | 62 |
"""Create hash from a dictionary."""
import os
import hashlib
from .serializers import pumpJsonDump
from typing import List
def create_hash_from_dict(index_dict: dict, salt: str = "",
get_env: bool = True, keys: List[str] = None):
"""Create a hash for the index."""
# If get_env set a... | [
37811,
16447,
12234,
422,
257,
22155,
526,
15931,
198,
11748,
28686,
198,
11748,
12234,
8019,
198,
6738,
764,
46911,
11341,
1330,
8901,
41,
1559,
35,
931,
198,
6738,
19720,
1330,
7343,
628,
198,
4299,
2251,
62,
17831,
62,
6738,
62,
1160... | 2.554084 | 453 |
import logging
from rich.logging import RichHandler
FORMAT = "%(message)s"
logging.basicConfig(level="INFO", format=FORMAT, datefmt="[%X]", handlers=[RichHandler()])
log = logging.getLogger("rich")
| [
11748,
18931,
198,
198,
6738,
5527,
13,
6404,
2667,
1330,
3998,
25060,
198,
198,
21389,
1404,
796,
36521,
7,
20500,
8,
82,
1,
198,
6404,
2667,
13,
35487,
16934,
7,
5715,
2625,
10778,
1600,
5794,
28,
21389,
1404,
11,
3128,
69,
16762,
... | 3.030303 | 66 |
tabby_cat="\tI'm tabbed in."
persian_cat="I'm split\non a line."
backslash_cat="I'm\\a\\cat."
fat_cat="""
I'll do a list:
\t* Cat food
\t* Fishies
\t* Catnip\n\t* Grass
"""
print tabby_cat
print persian_cat
print backslash_cat
print fat_cat | [
8658,
1525,
62,
9246,
2625,
59,
83,
40,
1101,
7400,
3077,
287,
526,
201,
198,
19276,
666,
62,
9246,
2625,
40,
1101,
6626,
59,
13159,
257,
1627,
526,
201,
198,
1891,
6649,
1077,
62,
9246,
2625,
40,
1101,
6852,
64,
6852,
9246,
526,
... | 2.153846 | 117 |
import pandas as pd
iris = pd.read_csv('IRIS.csv')
# print(iris.head(5))
# split data attributes and label attribute
attributes = iris.drop(['species'], axis=1)
labels = iris['species']
# import and build hieratchy cluster model
from scipy.cluster.hierarchy import linkage, dendrogram
hc = linkage(attributes, 'single... | [
11748,
19798,
292,
355,
279,
67,
198,
198,
29616,
796,
279,
67,
13,
961,
62,
40664,
10786,
4663,
1797,
13,
40664,
11537,
198,
2,
3601,
7,
29616,
13,
2256,
7,
20,
4008,
198,
198,
2,
6626,
1366,
12608,
290,
6167,
11688,
198,
1078,
7... | 2.583012 | 259 |
import argparse
import logging
import sys
from aiohttp import web
from prometheus_client.core import REGISTRY
from cloudflare_exporter.collector import CloudflareCollector
from cloudflare_exporter.config import (DEFAULT_HOST,
DEFAULT_LOGS_FETCH,
... | [
11748,
1822,
29572,
198,
11748,
18931,
198,
11748,
25064,
198,
198,
6738,
257,
952,
4023,
1330,
3992,
198,
6738,
1552,
36916,
62,
16366,
13,
7295,
1330,
23337,
1797,
40405,
198,
198,
6738,
6279,
2704,
533,
62,
1069,
26634,
13,
33327,
27... | 1.840909 | 352 |
from django.apps import AppConfig
| [
6738,
42625,
14208,
13,
18211,
1330,
2034,
16934,
628
] | 3.888889 | 9 |
from zoil.well import get_production_data | [
6738,
1976,
9437,
13,
4053,
1330,
651,
62,
25493,
62,
7890
] | 3.727273 | 11 |
# Copyright 2020 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | [
2,
15069,
12131,
5413,
10501,
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,
733... | 3.875706 | 177 |
# !/usr/bin/env/python3
# Copyright (c) Facebook, Inc. and its affiliates.
# 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 ... | [
2,
5145,
14,
14629,
14,
8800,
14,
24330,
14,
29412,
18,
198,
2,
15069,
357,
66,
8,
3203,
11,
3457,
13,
290,
663,
29116,
13,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
345... | 2.124073 | 2,563 |
import os
from pkgutil import get_data
import torch
import dgl
import numpy as np
import requests
import zipfile
from scipy.spatial.distance import pdist, squareform
from data.tsp import distance_matrix_tensor_representation
import tqdm
from toolbox import utils
| [
11748,
28686,
198,
6738,
279,
10025,
22602,
1330,
651,
62,
7890,
198,
11748,
28034,
198,
11748,
288,
4743,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
7007,
198,
11748,
19974,
7753,
198,
6738,
629,
541,
88,
13,
2777,
34961,
13,
3024... | 3.428571 | 77 |
"""Segmentor library designed to learn how to segment images using GAs.
This libary actually does not incode the GA itself, instead it just defines
the search parameters the evaluation funtions and the fitness function (comming soon)."""
# DO: Research project-clean up the parameters class to reduce the search space... | [
37811,
41030,
434,
273,
5888,
3562,
284,
2193,
703,
284,
10618,
4263,
1262,
402,
1722,
13,
198,
770,
9195,
560,
1682,
857,
407,
753,
1098,
262,
14545,
2346,
11,
2427,
340,
655,
15738,
198,
220,
262,
2989,
10007,
262,
12660,
1257,
4524... | 2.593997 | 10,229 |
# PLUS ONE LEETCODE SOLUTION:
# creating a class.
# creating a function to solve the problem.
| [
2,
48635,
16329,
12509,
2767,
34,
16820,
36817,
35354,
25,
201,
198,
201,
198,
2,
4441,
257,
1398,
13,
201,
198,
201,
198,
220,
220,
220,
1303,
4441,
257,
2163,
284,
8494,
262,
1917,
13,
201
] | 2.888889 | 36 |
# Create structure with mavic 2 pro parameters
params = {'wingtype' : 'rotary',
'TOW' : 0.907, #kg
'max_speed' : 20, #m/s
'max_alt' : 6000, #m above sea level
'max_t' : 31, #min, no wind
'max_t_hover' : 29, #mi... | [
2,
13610,
4645,
351,
285,
615,
291,
362,
386,
10007,
198,
198,
37266,
796,
1391,
6,
5469,
4906,
6,
220,
220,
220,
220,
220,
220,
220,
1058,
220,
220,
705,
10599,
560,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
... | 1.535354 | 495 |
from __future__ import division
import os
import numpy as np
import math
import torch
import torchvision.transforms as transforms
from PIL import Image
import matplotlib as mpl
mpl.use('TkAgg')
import matplotlib.pyplot as plt
#plot_losses()
| [
6738,
11593,
37443,
834,
1330,
7297,
198,
11748,
28686,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
10688,
198,
11748,
28034,
198,
11748,
28034,
10178,
13,
7645,
23914,
355,
31408,
198,
6738,
350,
4146,
1330,
7412,
198,
11748,
2603,
2... | 3.25 | 76 |
import sys
from base import DP, least_common
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Expected exactly one argument - the .cnf file name")
exit(1)
DP(least_common)(sys.argv[1])
| [
11748,
25064,
198,
6738,
2779,
1330,
27704,
11,
1551,
62,
11321,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
611,
18896,
7,
17597,
13,
853,
85,
8,
14512,
362,
25,
198,
220,
220,
220,
220,
... | 2.369565 | 92 |
import numpy as np
import hmm
import utils
from cnn import CNNModel3 as CNNModel
from discriminator import Discriminator
from ea import EA
POOL_SIZE = 4
if __name__ == "__main__":
main()
| [
11748,
299,
32152,
355,
45941,
198,
198,
11748,
289,
3020,
198,
11748,
3384,
4487,
198,
6738,
269,
20471,
1330,
8100,
17633,
18,
355,
8100,
17633,
198,
6738,
6534,
20900,
1330,
8444,
3036,
20900,
198,
6738,
304,
64,
1330,
19814,
198,
19... | 2.911765 | 68 |
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | [
29113,
29113,
7804,
4242,
2235,
198,
2,
198,
2,
15069,
357,
66,
8,
6244,
1168,
3008,
5693,
290,
25767,
669,
13,
198,
2,
1439,
6923,
33876,
13,
198,
2,
198,
2,
770,
3788,
318,
2426,
284,
262,
8617,
286,
262,
1168,
3008,
5094,
13789... | 2.725182 | 1,652 |
# A straightforward implementation
# of the particle filter idea
#
# A particle filter is a sample based approach
# for recursive Bayesian filtering
# The particles are a population based discrete
# representation of a probability density function.
#
# The filter recursively updates
#
# - the particle locat... | [
2,
317,
15836,
7822,
201,
198,
2,
286,
262,
18758,
8106,
2126,
201,
198,
2,
201,
198,
2,
317,
18758,
8106,
318,
257,
6291,
1912,
3164,
201,
198,
2,
329,
45115,
4696,
35610,
25431,
201,
198,
2,
383,
13166,
389,
257,
3265,
1912,
288... | 3.01497 | 668 |
import os
import time
import sys
import argparse
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
import numpy as np
from configurator import read_config, select_data, select_model, select_loss, selec... | [
11748,
28686,
201,
198,
11748,
640,
201,
198,
11748,
25064,
201,
198,
11748,
1822,
29572,
201,
198,
201,
198,
11748,
28034,
201,
198,
11748,
28034,
13,
20471,
355,
299,
77,
201,
198,
11748,
28034,
13,
40085,
355,
6436,
201,
198,
6738,
... | 2.608755 | 731 |
import unittest
import os
import json
from unittest.mock import patch
import threading
from test.support import EnvironmentVarGuard
from urllib.parse import urlparse
from http.server import BaseHTTPRequestHandler, HTTPServer
from google.cloud import bigquery
from google.auth.exceptions import DefaultCredentialsError
... | [
11748,
555,
715,
395,
198,
11748,
28686,
198,
11748,
33918,
198,
6738,
555,
715,
395,
13,
76,
735,
1330,
8529,
198,
11748,
4704,
278,
198,
6738,
1332,
13,
11284,
1330,
9344,
19852,
24502,
198,
6738,
2956,
297,
571,
13,
29572,
1330,
19... | 3.789063 | 128 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: cve.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _re... | [
2,
2980,
515,
416,
262,
8435,
11876,
17050,
13,
220,
8410,
5626,
48483,
0,
198,
2,
2723,
25,
269,
303,
13,
1676,
1462,
198,
198,
11748,
25064,
198,
198,
62,
65,
796,
25064,
13,
9641,
62,
10951,
58,
15,
60,
1279,
513,
290,
357,
5... | 2.095222 | 8,748 |
from TextString import TextString
##
# The abstract class that is the basic plugin
##
| [
6738,
8255,
10100,
1330,
8255,
10100,
198,
2235,
198,
2,
383,
12531,
1398,
326,
318,
262,
4096,
13877,
198,
2235,
198
] | 4.095238 | 21 |
import calendar
from umalqurra.hijri_date import HijriDate
import jdatetime
from datetime import datetime
import re
def middle_east_parsed_date(text_date, kwargs):
"""
:param text_date:
:param kwargs: format : %d-%m-%Y for 12-7-1397.
:return:
"""
dict_month_numeric = dict((v, k) for k, v in e... | [
11748,
11845,
198,
6738,
334,
7617,
80,
333,
430,
13,
71,
2926,
380,
62,
4475,
1330,
367,
2926,
380,
10430,
198,
11748,
474,
19608,
8079,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
11748,
302,
628,
198,
198,
4299,
3504,
62,
23316,
... | 2.084577 | 804 |
#!/usr/bin/env python3
import math
from tuw_trinamic_iwos_revolute_controller.device.motor import Motor
from tuw_trinamic_iwos_revolute_controller.device.configuration_tool import ConfigurationTool
class Wheel:
"""
class representing a wheel controlled with Trinamic TMCM-1640
"""
def set_velocity(s... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
11748,
10688,
198,
198,
6738,
12777,
86,
62,
2213,
259,
18127,
62,
14246,
418,
62,
18218,
3552,
62,
36500,
13,
25202,
13,
76,
20965,
1330,
12533,
198,
6738,
12777,
86,
62,
2... | 2.725424 | 295 |
import os, numpy as np
from pymicro.file.file_utils import HST_read
from skimage.transform import radon
from matplotlib import pyplot as plt
'''
Example of use of the radon transform.
'''
data = HST_read('../data/mousse_250x250x250_uint8.raw', autoparse_filename=True, zrange=range(1))[:, :, 0]
fig, (ax1, ax2) = plt.su... | [
11748,
28686,
11,
299,
32152,
355,
45941,
198,
6738,
279,
4948,
2500,
13,
7753,
13,
7753,
62,
26791,
1330,
367,
2257,
62,
961,
198,
6738,
1341,
9060,
13,
35636,
1330,
2511,
261,
198,
6738,
2603,
29487,
8019,
1330,
12972,
29487,
355,
4... | 2.431604 | 424 |
import argparse
import math
parser = argparse.ArgumentParser(prog='PROG')
parser.add_argument('foo', type=perfect_square)
args = parser.parse_args()
print(args.foo) | [
11748,
1822,
29572,
198,
11748,
10688,
198,
198,
48610,
796,
1822,
29572,
13,
28100,
1713,
46677,
7,
1676,
70,
11639,
4805,
7730,
11537,
198,
48610,
13,
2860,
62,
49140,
10786,
21943,
3256,
2099,
28,
25833,
62,
23415,
8,
198,
22046,
796... | 3.055556 | 54 |
# -*- coding: utf-8 -*-
# Copyright 2019 Novo Nordisk Foundation Center for Biosustainability,
# Technical University of Denmark.
#
# 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... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
2,
15069,
13130,
5267,
78,
18687,
1984,
5693,
3337,
329,
347,
4267,
19542,
1799,
11,
198,
2,
20671,
2059,
286,
16490,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
... | 3.144482 | 879 |
from PuzzleLib.Backend import gpuarray
from PuzzleLib.Modules import SubtractMean, LCN
from PuzzleLib.Visual import loadImage, showImage
if __name__ == "__main__":
main()
| [
6738,
23966,
25835,
13,
7282,
437,
1330,
308,
19944,
18747,
198,
198,
6738,
23966,
25835,
13,
5841,
5028,
1330,
3834,
83,
974,
5308,
272,
11,
22228,
45,
198,
6738,
23966,
25835,
13,
36259,
1330,
3440,
5159,
11,
905,
5159,
628,
198,
19... | 3.087719 | 57 |
import decimal
import numpy as np
from collections import deque
import torch
from config import cfg
from utils.timer import Timer
from utils.logger import logger_info
import utils.distributed as dist
from utils.distributed import sum_tensor
def accuracy(output, target, topk=(1,)):
"""Computes the accuracy over th... | [
11748,
32465,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
17268,
1330,
390,
4188,
198,
198,
11748,
28034,
198,
6738,
4566,
1330,
30218,
70,
198,
6738,
3384,
4487,
13,
45016,
1330,
5045,
263,
198,
6738,
3384,
4487,
13,
6404,
1362,
133... | 2.70712 | 618 |
print(solve(int(input()))) | [
628,
198,
198,
4798,
7,
82,
6442,
7,
600,
7,
15414,
3419,
22305
] | 2.307692 | 13 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
ResophNotes.py
Convert to JSON and query ResophNotes notes from shell.
Copyright 2017 by Reiner Rottmann <reiner@rottmann.it
Released under the BSD License.
"""
import os
import sys
import base64
import uuid
import json
import argparse
import subprocess
import collect... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
4965,
2522,
16130,
13,
9078,
198,
198,
3103,
1851,
284,
19449,
290,
12405,
1874,
2522,
16130,
4710,
422,
75... | 1.997505 | 2,806 |
# Create a task list. A user is presented with the text below.
# Let them select an option to list all of their tasks, add a task to their list, delete a task, or quit the program.
# Make each option a different function in your program.
# Do NOT use Google. Do NOT use other students. Try to do this on your own.
... | [
198,
198,
2,
13610,
257,
4876,
1351,
13,
317,
2836,
318,
5545,
351,
262,
2420,
2174,
13,
198,
2,
3914,
606,
2922,
281,
3038,
284,
1351,
477,
286,
511,
8861,
11,
751,
257,
4876,
284,
511,
1351,
11,
12233,
257,
4876,
11,
393,
11238,... | 3.54902 | 102 |
import string
size = 10
mid_line = '-'.join([string.ascii_letters[size - x] for x in range(1, size)] + [string.ascii_letters[x] for x in range(size)])
lines = []
for x in range(2,size+1):
main = ''.join(string.ascii_letters[size - x] for x in range(1, x))
*main_list,_ = list(main)
reverse = ''.join(x for x ... | [
11748,
4731,
198,
7857,
796,
838,
198,
13602,
62,
1370,
796,
705,
12,
4458,
22179,
26933,
8841,
13,
292,
979,
72,
62,
15653,
58,
7857,
532,
2124,
60,
329,
2124,
287,
2837,
7,
16,
11,
2546,
15437,
1343,
685,
8841,
13,
292,
979,
72,... | 2.40249 | 241 |
from flask import Blueprint
from flask_restful import Api
from .. import models, request
from ..resource import Resource
from ..response import Response, no_content
from ..validator import matcher, schemas, validate_input, validate_schema
module = Blueprint('users', __name__, url_prefix='/users')
api = Api(module)
... | [
6738,
42903,
1330,
39932,
198,
6738,
42903,
62,
2118,
913,
1330,
5949,
72,
198,
198,
6738,
11485,
1330,
4981,
11,
2581,
198,
6738,
11485,
31092,
1330,
20857,
198,
6738,
11485,
26209,
1330,
18261,
11,
645,
62,
11299,
198,
6738,
11485,
12... | 3.595745 | 94 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... | [
2,
19617,
28,
40477,
12,
23,
198,
2,
17202,
39410,
25,
428,
2393,
373,
7560,
416,
262,
21624,
12994,
26144,
35986,
13,
17202,
198,
2,
17202,
2141,
407,
4370,
416,
1021,
4556,
345,
821,
1728,
345,
760,
644,
345,
389,
1804,
0,
17202,
... | 3.747664 | 107 |
import os
import asyncio
from datetime import datetime, timedelta
from influxdb import InfluxDBClient
asyncio.run(watch())
| [
11748,
28686,
198,
11748,
30351,
952,
198,
6738,
4818,
8079,
1330,
4818,
8079,
11,
28805,
12514,
198,
6738,
25065,
9945,
1330,
4806,
22564,
11012,
11792,
628,
198,
292,
13361,
952,
13,
5143,
7,
8340,
28955,
198
] | 3.472222 | 36 |
#Sort list, and sort list in reverse order
a = list()
a = [5, 2, 9, 1, 7, 6, 3, 8, 4]
b = list()
c = list()
b = sorted(a)
c = sorted(a, reverse = 1)
print(b)
print(c)
| [
2,
42758,
1351,
11,
290,
3297,
1351,
287,
9575,
1502,
201,
198,
201,
198,
64,
796,
1351,
3419,
201,
198,
64,
796,
685,
20,
11,
362,
11,
860,
11,
352,
11,
767,
11,
718,
11,
513,
11,
807,
11,
604,
60,
201,
198,
65,
796,
1351,
... | 2 | 91 |
import matplotlib as mt
mt.use('Agg')
import caffe
import numpy as np
import sys
if __name__ == "__main__":
# sys.argv[1] = net prefix
# sys.argv[2] = model prefix
# sys.argv[3] = model _iter_
# sys.argv[4] = output directory
if len(sys.argv) != 5:
raise ValueError("4 args required")
net = caffe.Net(sys.argv... | [
11748,
2603,
29487,
8019,
355,
45079,
198,
16762,
13,
1904,
10786,
46384,
11537,
198,
11748,
21121,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
25064,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
197,
2,
2... | 2.185484 | 248 |
# DO NOT EDIT! This file is automatically generated
import typing
from commercetools.helpers import RemoveEmptyValuesMixin
from commercetools.platform.models.store import (
Store,
StoreDraft,
StorePagedQueryResponse,
StoreUpdate,
StoreUpdateAction,
)
from commercetools.typing import OptionalListStr... | [
2,
8410,
5626,
48483,
0,
770,
2393,
318,
6338,
7560,
198,
11748,
19720,
198,
198,
6738,
4412,
66,
316,
10141,
13,
16794,
364,
1330,
17220,
40613,
40161,
35608,
259,
198,
6738,
4412,
66,
316,
10141,
13,
24254,
13,
27530,
13,
8095,
1330... | 2.386831 | 729 |
import bcrypt
from fastapi import APIRouter
from fastapi import HTTPException
from peewee import IntegrityError
from db import Person as PersonORM
from db import SQLITE_DB
from schema import Person as PersonSchema
person = APIRouter()
@person.post("/person")
| [
11748,
275,
29609,
198,
6738,
3049,
15042,
1330,
3486,
4663,
39605,
198,
6738,
3049,
15042,
1330,
14626,
16922,
198,
6738,
613,
413,
1453,
1330,
39348,
12331,
198,
198,
6738,
20613,
1330,
7755,
355,
7755,
1581,
44,
198,
6738,
20613,
1330,... | 3.652778 | 72 |
from rest_framework import status
from rest_framework.test import APIClient, APITestCase
from django.contrib.auth import get_user_model
from ..comment import Comment
| [
6738,
1334,
62,
30604,
1330,
3722,
198,
6738,
1334,
62,
30604,
13,
9288,
1330,
3486,
2149,
75,
1153,
11,
3486,
2043,
395,
20448,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
1330,
651,
62,
7220,
62,
19849,
198,
6738,
11485,
2389... | 3.711111 | 45 |
marks = [
[1, 0, 4, 8],
[0, 2, 0, 6],
[2, 4, 5, 2],
[9, 5, 8, 3]
]
d1=0
d2=0
c=[]
r=[]
for i in range(len(marks)):
r.append(0)
for j in range(len(marks)):
c.append(0)
if(i==j):
d1=marks[i][j]+d1
if (i+j==len(marks)-1):
d2+=marks[i][j]
r[i]+=marks[i][j]
c[j]+=marks[i][j]
print('r',i,'... | [
14306,
796,
685,
198,
220,
220,
220,
685,
16,
11,
657,
11,
604,
11,
807,
4357,
198,
220,
220,
220,
685,
15,
11,
362,
11,
657,
11,
718,
4357,
198,
220,
220,
220,
685,
17,
11,
604,
11,
642,
11,
362,
4357,
198,
220,
220,
220,
6... | 1.62614 | 329 |
from typing import List
from ...utils.byte_io_mdl import ByteIO
| [
6738,
19720,
1330,
7343,
198,
198,
6738,
2644,
26791,
13,
26327,
62,
952,
62,
9132,
75,
1330,
30589,
9399,
628
] | 3.3 | 20 |
import cli
if __name__ == "__main__":
cli.p()
| [
11748,
537,
72,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
537,
72,
13,
79,
3419,
628
] | 2.125 | 24 |
from pathlib import Path
import os
import time
import logging
import boto3
import papermill as pm
import watchtower
from package import config, utils
if __name__ == "__main__":
run_on_start = False if config.TEST_OUTPUTS_S3_BUCKET == "" else True
if not run_on_start:
exit()
cfn_client = boto3... | [
6738,
3108,
8019,
1330,
10644,
198,
11748,
28686,
198,
11748,
640,
198,
11748,
18931,
198,
198,
11748,
275,
2069,
18,
198,
11748,
3348,
17805,
355,
9114,
198,
11748,
2342,
36170,
198,
198,
6738,
5301,
1330,
4566,
11,
3384,
4487,
628,
19... | 2.296679 | 1,355 |
from mojeid_registration.page_objects.reg_page import RegistrationPage
from mojeid_registration.config import config as c
| [
6738,
6941,
18015,
312,
62,
2301,
33397,
13,
7700,
62,
48205,
13,
2301,
62,
7700,
1330,
24610,
9876,
198,
6738,
6941,
18015,
312,
62,
2301,
33397,
13,
11250,
1330,
4566,
355,
269,
628,
220,
220,
220,
220,
220,
220,
220,
220,
198
] | 3.142857 | 42 |
# import warnings
import torch
# from .nonlinear import lbfgs
# import scipy.sparse.linalg as sla
# import numpy as np
def rotmat(a,b):
"""
Adapted from http://www.netlib.org/templates/matlab/rotmat.m
Compute the Givens rotation matrix parameters for a and b.
"""
c = torch.zeros_like(a)
s = torch.zeros_like(a... | [
2,
1330,
14601,
198,
11748,
28034,
198,
198,
2,
422,
764,
13159,
29127,
1330,
18360,
69,
14542,
198,
2,
1330,
629,
541,
88,
13,
82,
29572,
13,
75,
1292,
70,
355,
1017,
64,
198,
2,
1330,
299,
32152,
355,
45941,
628,
198,
4299,
5724... | 2.124246 | 3,646 |
"Endpoint for site-specific static files."
import http.client
import os.path
import flask
blueprint = flask.Blueprint('site', __name__)
@blueprint.route('/static/<filename>')
def static(filename):
"Return the given site-specific static file."
dirpath = flask.current_app.config['SITE_STATIC_DIR']
if not... | [
1,
12915,
4122,
329,
2524,
12,
11423,
9037,
3696,
526,
198,
198,
11748,
2638,
13,
16366,
198,
11748,
28686,
13,
6978,
198,
198,
11748,
42903,
628,
198,
17585,
4798,
796,
42903,
13,
14573,
4798,
10786,
15654,
3256,
11593,
3672,
834,
8,
... | 2.686364 | 220 |
# ISLR Ch 4 by Carol Cui
%reset
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis, QuadraticDiscriminantAnalysis
from sklear... | [
2,
3180,
35972,
609,
604,
416,
5074,
327,
9019,
198,
4,
42503,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
6738,
1341,
35720,
13,
... | 2.22257 | 3,837 |
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic import TemplateView
from cajas.movement.models.movement_withdraw import MovementWithdraw
from cajas.office.models.officeCountry import OfficeCountry
from cajas.users.models.partner import Partner
from cajas.webclient.views.utils impor... | [
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
19816,
1040,
1330,
23093,
37374,
35608,
259,
198,
6738,
42625,
14208,
13,
33571,
13,
41357,
1330,
37350,
7680,
198,
198,
6738,
269,
1228,
292,
13,
21084,
434,
13,
27530,
13,
21084,
... | 3.189474 | 190 |
import json
from bs4 import BeautifulSoup
import requests
op=open('scrap.json')
data_dic,ask,check={},int(input('tell the rank of the movie you wanna see:- ')),json.load(op)
for i in check:
if i['Rank']==ask:
url=i["Link"]
page=requests.get(url)
soup=BeautifulSoup(page.text,"html.parser")
body_of_web=soup.... | [
11748,
33918,
198,
6738,
275,
82,
19,
1330,
23762,
50,
10486,
198,
11748,
7007,
198,
404,
28,
9654,
10786,
1416,
2416,
13,
17752,
11537,
198,
7890,
62,
67,
291,
11,
2093,
11,
9122,
34758,
5512,
600,
7,
15414,
10786,
33331,
262,
4279,
... | 2.414557 | 948 |
# Import the modules
import sys
import MinVel as mv
import numpy as np
# NOTES: May want to update temperature dependence of thermal expansivity using Holland and Powell's (2011)
# new revised equations (see figure 1 in that article). This will necessitate recalculating the first
# Gruneisen parameters... | [
2,
17267,
262,
13103,
198,
11748,
25064,
198,
11748,
1855,
46261,
355,
285,
85,
198,
11748,
299,
32152,
355,
45941,
198,
198,
2,
5626,
1546,
25,
1737,
765,
284,
4296,
5951,
21403,
286,
18411,
20628,
3458,
1262,
16070,
290,
19675,
338,
... | 1.603853 | 8,825 |
import os
import requests
from matroid import error
from matroid.src.helpers import api_call, batch_file_request
# https://staging.dev.matroid.com/docs/api/index.html#api-Images-Classify
@api_call(error.InvalidQueryError)
def classify_image(self, detectorId, file=None, url=None, **options):
"""
Classify an image ... | [
11748,
28686,
198,
11748,
7007,
198,
198,
6738,
2603,
3882,
1330,
4049,
198,
6738,
2603,
3882,
13,
10677,
13,
16794,
364,
1330,
40391,
62,
13345,
11,
15458,
62,
7753,
62,
25927,
198,
198,
2,
3740,
1378,
301,
3039,
13,
7959,
13,
6759,
... | 2.734694 | 1,274 |
#!/usr/bin/env python3
"""
Initialize tables in SQLITE db
"""
import argparse
from models import Base
from sqlalchemy import create_engine
from utils import database_string
@with_args
main() | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
37811,
198,
24243,
1096,
8893,
287,
16363,
12709,
20613,
198,
37811,
198,
11748,
1822,
29572,
198,
6738,
4981,
1330,
7308,
198,
6738,
44161,
282,
26599,
1330,
2251,
62,
18392,
198,
6... | 3.385965 | 57 |
#!/usr/bin/env python3
# 杂项
import math
import glob
from timeit import Timer
from yvhai.demo.base import YHDemo
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
10545,
251,
224,
165,
94,
117,
198,
198,
11748,
10688,
198,
11748,
15095,
198,
6738,
640,
270,
1330,
5045,
263,
198,
198,
6738,
331,
85,
44488,
13,
9536,
78,
13,
8692,
1330,
... | 2.446809 | 47 |
from PIL import Image
import numpy
import sys
argvs = sys.argv
argc = len(argvs)
src = "src.png" if argc <= 1 else argvs[1]
dest = "res.txt" if argc <= 2 else argvs[2]
print("{} => {}".format(src, dest))
img = Image.open(src).convert('RGB')
data = numpy.array(img)
w,h = img.size
sw = w
if sw % 8 != 0:
sw = sw + ... | [
6738,
350,
4146,
1330,
7412,
198,
11748,
299,
32152,
198,
11748,
25064,
198,
198,
853,
14259,
796,
25064,
13,
853,
85,
198,
853,
66,
796,
18896,
7,
853,
14259,
8,
198,
198,
10677,
796,
366,
10677,
13,
11134,
1,
611,
1822,
66,
19841,... | 2.010929 | 366 |
from __future__ import absolute_import, unicode_literals
from os import remove
from celery import shared_task
from VEnCode import DataTpm, Vencodes
from .models import Promoters154CellsBinarized, Enhancers154CellsBinarized
from .utils_views import *
# Create your tasks here
@shared_task
@shared_task
| [
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
11,
28000,
1098,
62,
17201,
874,
198,
6738,
28686,
1330,
4781,
198,
198,
6738,
18725,
1924,
1330,
4888,
62,
35943,
198,
198,
6738,
569,
4834,
10669,
1330,
6060,
51,
4426,
11,
9932,
40148,
... | 3.344086 | 93 |
import pandas as pd
from typing import List
from pandas.core.frame import DataFrame
from src.models.base_models import Model, RandomModel
| [
11748,
19798,
292,
355,
279,
67,
198,
6738,
19720,
1330,
7343,
198,
6738,
19798,
292,
13,
7295,
13,
14535,
1330,
6060,
19778,
198,
6738,
12351,
13,
27530,
13,
8692,
62,
27530,
1330,
9104,
11,
14534,
17633,
628,
628
] | 3.710526 | 38 |
import scipy,itertools,sys,os,time,logging
import scipy.constants as con
import numpy as np
import ctypes as C
from scipy.stats.mstats_basic import tmean
def fit_brightness_temp(wave,flux):
'''
function fitting a black body to given flux-wavelength
value.
Input: Flux at wavelength (microns)
Outpu... | [
11748,
629,
541,
88,
11,
270,
861,
10141,
11,
17597,
11,
418,
11,
2435,
11,
6404,
2667,
198,
11748,
629,
541,
88,
13,
9979,
1187,
355,
369,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
269,
19199,
355,
327,
198,
6738,
629,
541,
... | 2.149727 | 2,017 |
"""Dalton API Wrapper for WAX
This module provides a Python wrapper for the Atomic Asset API,
with plans to expand to WAX and Atomic Market API endpoints.
"""
__version__ = "0.3.0"
| [
37811,
35,
282,
1122,
7824,
27323,
2848,
329,
16400,
55,
201,
198,
201,
198,
1212,
8265,
3769,
257,
11361,
29908,
329,
262,
28976,
31433,
7824,
11,
220,
201,
198,
4480,
3352,
284,
4292,
284,
16400,
55,
290,
28976,
5991,
7824,
886,
130... | 3.031746 | 63 |
my_nums = num_generators(10)
while True:
try:
print(next(my_nums))
except StopIteration:
break
| [
198,
198,
1820,
62,
77,
5700,
796,
997,
62,
8612,
2024,
7,
940,
8,
198,
198,
4514,
6407,
25,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
19545,
7,
1820,
62,
77,
5700,
4008,
198,
220,
220,
220... | 2 | 61 |
#!/user/bin/env python
# -*-coding:utf-8 -*-
# @CreateTime : 2021/10/25 0:25
# @Author : xujiahui
# @Project : robust_python
# @File : try_wx_prc1.py
# @Version : V0.0.1
# @Desc : ?
import wx
if __name__ == "__main__":
app = MyApp()
app.MainLoop()
| [
2,
48443,
7220,
14,
8800,
14,
24330,
21015,
201,
198,
2,
532,
9,
12,
66,
7656,
25,
40477,
12,
23,
532,
9,
12,
201,
198,
2,
2488,
16447,
7575,
1058,
33448,
14,
940,
14,
1495,
657,
25,
1495,
201,
198,
2,
2488,
13838,
1058,
220,
... | 1.841463 | 164 |
"""Implementation of cron API.
"""
# import fnmatch
import logging
from treadmill import authz
# from treadmill import context
# from treadmill import cron
from treadmill import schema
# from treadmill.cron import model as cron_model
_LOGGER = logging.getLogger(__name__)
class API(object):
"""Treadmill Cron RE... | [
37811,
3546,
32851,
286,
1067,
261,
7824,
13,
198,
37811,
198,
198,
2,
1330,
24714,
15699,
198,
11748,
18931,
198,
198,
6738,
49246,
1330,
6284,
89,
198,
2,
422,
49246,
1330,
4732,
198,
2,
422,
49246,
1330,
1067,
261,
198,
6738,
49246... | 3.35461 | 141 |
print(foo()) # 5
print(foo(b=3)) # 7
print(foo(b=3,a=2)) # 8
| [
201,
198,
4798,
7,
21943,
28955,
1303,
642,
201,
198,
4798,
7,
21943,
7,
65,
28,
18,
4008,
1303,
767,
201,
198,
4798,
7,
21943,
7,
65,
28,
18,
11,
64,
28,
17,
4008,
1303,
807,
201,
198,
201,
198,
201,
198
] | 1.666667 | 42 |
import json
from unittest.mock import patch
from boddle import boddle
from detectem.ws import do_detection
from detectem.exceptions import SplashError, NoPluginsError
"""
Tests run with `autospec` to match function signature in case of change
"""
@patch('detectem.ws.get_detection_results', autospec=True)
@patch(... | [
11748,
33918,
198,
6738,
555,
715,
395,
13,
76,
735,
1330,
8529,
198,
198,
6738,
275,
5088,
293,
1330,
275,
5088,
293,
198,
198,
6738,
4886,
368,
13,
18504,
1330,
466,
62,
15255,
3213,
198,
6738,
4886,
368,
13,
1069,
11755,
1330,
45... | 3.049296 | 142 |
"""SpeedTester."""
import datetime
import json
import dateutil.parser
class SpeedTestResult(object):
"""Represents the results of a test performed by a SpeedTester."""
def __init__(self, download, startTime, ping=None, upload=None, endTime=None):
"""Results of a speedtest performed by a SpeedTester."... | [
37811,
22785,
51,
7834,
526,
15931,
198,
11748,
4818,
8079,
198,
11748,
33918,
198,
11748,
3128,
22602,
13,
48610,
628,
198,
4871,
8729,
14402,
23004,
7,
15252,
2599,
198,
220,
220,
220,
37227,
6207,
6629,
262,
2482,
286,
257,
1332,
615... | 2.696937 | 914 |
import torch.nn
from torch import nn
from transformers import BertModel
import numpy as np
| [
11748,
28034,
13,
20471,
198,
6738,
28034,
1330,
299,
77,
198,
6738,
6121,
364,
1330,
22108,
17633,
198,
11748,
299,
32152,
355,
45941,
628
] | 3.833333 | 24 |
"""Catalog of user objects"""
from .CatalogMenuWdg import *
| [
37811,
49015,
286,
2836,
5563,
37811,
198,
6738,
764,
49015,
23381,
54,
67,
70,
1330,
1635,
198
] | 3.529412 | 17 |
#You will receive a journal with some Collecting items, separated with ', ' (comma and space). After that, until receiving "Craft!" you will be receiving different commands.
#Commands (split by " - "):
#"Collect - {item}" – Receiving this command, you should add the given item in your inventory. If the item already exi... | [
2,
1639,
481,
3328,
257,
3989,
351,
617,
9745,
278,
3709,
11,
11266,
351,
46083,
705,
357,
785,
2611,
290,
2272,
737,
2293,
326,
11,
1566,
6464,
366,
14467,
2474,
345,
481,
307,
6464,
1180,
9729,
13,
198,
2,
6935,
1746,
357,
35312,
... | 3.178082 | 365 |
from typing import List
from rlbot.agents.base_agent import BaseAgent, GameTickPacket, SimpleControllerState
from rlbot.utils.structures.game_data_struct import GameTickPacket
from tmcp import TMCPHandler, TMCPMessage
from util.vec import Vec3
from util.utilities import physics_object, Vector
from policy import bas... | [
6738,
19720,
1330,
7343,
198,
198,
6738,
374,
75,
13645,
13,
49638,
13,
8692,
62,
25781,
1330,
7308,
36772,
11,
3776,
51,
624,
47,
8317,
11,
17427,
22130,
9012,
198,
6738,
374,
75,
13645,
13,
26791,
13,
7249,
942,
13,
6057,
62,
7890... | 3.29588 | 267 |
# -*- coding: utf-8 -*-
"""
Leetcode - Two Sum II
https://leetcode.com/problems/two-sum-ii-input-array-is-sorted
Created on Sun Nov 18 20:39:12 2018
@author: Arthur Dysart
"""
## REQUIRED MODULES
import sys
## MODULE DEFINITIONS
class Solution:
"""
One-pointer with binary search of sorted ... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
201,
198,
37811,
201,
198,
3123,
316,
8189,
532,
4930,
5060,
2873,
201,
198,
5450,
1378,
293,
316,
8189,
13,
785,
14,
1676,
22143,
14,
11545,
12,
16345,
12,
4178,
12,
15414... | 1.915412 | 2,258 |
# Generated by Django 2.2.3 on 2019-07-19 09:00
from django.db import migrations
| [
2,
2980,
515,
416,
37770,
362,
13,
17,
13,
18,
319,
13130,
12,
2998,
12,
1129,
7769,
25,
405,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
628
] | 2.766667 | 30 |
import pyximport; pyximport.install()
from gryphon.lib.exchange.coinbase_btc_usd import CoinbaseBTCUSDExchange
from gryphon.tests.environment.exchange_wrappers.live_orders import LiveOrdersTest
| [
11748,
12972,
87,
11748,
26,
12972,
87,
11748,
13,
17350,
3419,
198,
198,
6738,
308,
563,
746,
261,
13,
8019,
13,
1069,
3803,
13,
3630,
8692,
62,
18347,
66,
62,
385,
67,
1330,
45802,
35964,
29072,
3109,
3803,
198,
6738,
308,
563,
74... | 3.0625 | 64 |
# -*- coding: utf-8 -*-
import logging
from .test_project_base import TestProjectCommon
_logger = logging.getLogger(__name__)
class TestProjectConfig(TestProjectCommon):
"""Test module configuration and its effects on projects."""
@classmethod
@classmethod
def _set_feature_status(cls, is_enabled)... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
11748,
18931,
198,
198,
6738,
764,
9288,
62,
16302,
62,
8692,
1330,
6208,
16775,
17227,
198,
198,
62,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
... | 2.487252 | 706 |