content stringlengths 1 1.04M | input_ids listlengths 1 774k | ratio_char_token float64 0.38 22.9 | token_count int64 1 774k |
|---|---|---|---|
import os
import time
import numpy as np
import tensorflow as tf
import config
from scipy.misc import imread, imresize, imsave
from tensorflow.contrib import rnn
from data_manager import DataManager
from utils import sparse_tuple_from, resize_image, label_to_array, ground_truth_to_word, levenshtein
os.environ['TF_CPP... | [
11748,
28686,
198,
11748,
640,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
11748,
4566,
198,
6738,
629,
541,
88,
13,
44374,
1330,
545,
961,
11,
545,
411,
1096,
11,
545,
21928,
198,
6738,
11192,
... | 2.956897 | 116 |
"""Extract information from haproxy config files.
"""
import argparse
import json
import logging
import os
import re
import serverscripts
import sys
HAPROXY_CFG = "/etc/haproxy/haproxy.cfg"
SITE = re.compile(
r"""
^acl # 'acl' at the start of the line.
\s+ # Whitespac... | [
37811,
11627,
974,
1321,
422,
387,
36436,
4566,
3696,
13,
198,
198,
37811,
198,
11748,
1822,
29572,
198,
11748,
33918,
198,
11748,
18931,
198,
11748,
28686,
198,
11748,
302,
198,
11748,
9597,
6519,
82,
198,
11748,
25064,
628,
198,
39,
2... | 2.076008 | 2,355 |
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""AggregatorGRPCServer module."""
from grpc import server, ssl_server_credentials
from concurrent.futures import ThreadPoolExecutor
from multiprocessing import cpu_count
from logging import getLogger
from time import sleep
from openfl... | [
2,
15069,
357,
34,
8,
12131,
12,
1238,
2481,
8180,
10501,
198,
2,
30628,
55,
12,
34156,
12,
33234,
7483,
25,
24843,
12,
17,
13,
15,
198,
198,
37811,
46384,
2301,
1352,
10761,
5662,
10697,
8265,
526,
15931,
198,
198,
6738,
1036,
1475... | 2.219442 | 3,837 |
from discord import Embed
from error import EmbedError
from roller.initiative import Initiative
from roller.roller import Roller
class HelpHandler():
"""Handles help requests for the bot
:var int colour: The colour we will use for the help messages
"""
colour = 0x00BFFF
async def handler(self,... | [
6738,
36446,
1330,
13302,
276,
198,
6738,
4049,
1330,
13302,
276,
12331,
198,
6738,
24471,
13,
259,
8846,
876,
1330,
18362,
198,
6738,
24471,
13,
10646,
1330,
24945,
628,
198,
4871,
10478,
25060,
33529,
198,
220,
220,
220,
37227,
12885,
... | 2.493642 | 865 |
import cv2
from deuterium import deuterium
class VideoCamera(object):
"""Video camera class, to generate streaming. Requires 4 inputs: first video, second video, switcher and detection algorithm"""
def __init__(self, first_path, second_path, switcher, detection):
"""init method for VideoCamera, cont... | [
11748,
269,
85,
17,
198,
198,
6738,
390,
11894,
1505,
1330,
390,
11894,
1505,
628,
198,
4871,
7623,
35632,
7,
15252,
2599,
198,
220,
220,
220,
37227,
10798,
4676,
1398,
11,
284,
7716,
11305,
13,
26848,
604,
17311,
25,
717,
2008,
11,
... | 2.488971 | 544 |
from flask import Flask, render_template
import csv, json
app = Flask(__name__)
@app.route("/")
if __name__ == "__main__":
app.run() | [
6738,
42903,
1330,
46947,
11,
8543,
62,
28243,
198,
11748,
269,
21370,
11,
33918,
198,
1324,
796,
46947,
7,
834,
3672,
834,
8,
198,
198,
31,
1324,
13,
38629,
7203,
14,
4943,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
12... | 2.686275 | 51 |
"""
Tester
If using an exception assert statement, use following:
env = Envs()
env.set_running_unit_tests()
"""
from datetime import datetime
from typing import List, Tuple, Any
import pytest
from numpy import ndarray, array, dtype
from numpy import zeros, array_equal
from numpy.random import randint, seed
fr... | [
37811,
198,
51,
7834,
198,
198,
1532,
1262,
281,
6631,
6818,
2643,
11,
779,
1708,
25,
198,
220,
220,
220,
17365,
796,
2039,
14259,
3419,
198,
220,
220,
220,
17365,
13,
2617,
62,
20270,
62,
20850,
62,
41989,
3419,
198,
37811,
198,
67... | 2.218725 | 7,434 |
sl = Solution()
t1 = [7,1,5,3,6,4]
res = sl.maxProfit(t1)
print(res)
sl = Solution()
t1 = [1,2,3,4,5]
res = sl.maxProfit(t1)
print(res)
sl = Solution()
t1 = list(range(1000, -1, -1))
res = sl.maxProfit(t1)
print(res)
| [
198,
6649,
796,
28186,
3419,
198,
83,
16,
796,
685,
22,
11,
16,
11,
20,
11,
18,
11,
21,
11,
19,
60,
198,
411,
796,
1017,
13,
9806,
2964,
11147,
7,
83,
16,
8,
198,
4798,
7,
411,
8,
198,
198,
6649,
796,
28186,
3419,
198,
83,
... | 1.881356 | 118 |
substantivo = input("Por favor, insira um substantivo: ")
adjetivo = input("Por favor, insira um adjetivo: ")
verbo = input("Por favor, insira um verbo: ")
animal = input("Por favor, insira o nome de um animal")
print("Sua biblioteca maluca:")
print(substantivo, adjetivo, verbo, "sobre o(a)", animal, "preguiçoso(a)")
| [
7266,
18797,
23593,
796,
5128,
7203,
47,
273,
2661,
11,
1035,
8704,
23781,
5925,
23593,
25,
366,
8,
198,
324,
31173,
23593,
796,
5128,
7203,
47,
273,
2661,
11,
1035,
8704,
23781,
9224,
316,
23593,
25,
366,
8,
198,
332,
2127,
796,
51... | 2.636364 | 121 |
#!/usr/bin/env python
# encoding: utf-8
import sys
import os
import time
import cactus
def create(path):
"Creates a new project at the given path."
if os.path.exists(path):
if raw_input('Path %s exists, move aside (y/n): ' % path) == 'y':
os.rename(path, '%s.%s.moved' % (path, int(time.time())))
else:
... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
21004,
25,
3384,
69,
12,
23,
198,
198,
11748,
25064,
198,
11748,
28686,
198,
11748,
640,
198,
198,
11748,
269,
34144,
198,
198,
4299,
2251,
7,
6978,
2599,
198,
197,
1,
16719,
274,... | 2.441718 | 326 |
from account import Account
from time_zone import TimeZone
if __name__ == '__main__':
main()
| [
6738,
1848,
1330,
10781,
198,
6738,
640,
62,
11340,
1330,
3862,
26961,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1388,
3419,
198
] | 3.125 | 32 |
import unittest
import mock
import numpy
import six
import chainer
from chainer import _backprop_utils
from chainer.backends import cuda
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product({
'y_shape': [(4,), (0,), (2, 3), ()],
'x_shape': [(3,), (0,), (4, 1... | [
11748,
555,
715,
395,
198,
198,
11748,
15290,
198,
11748,
299,
32152,
198,
11748,
2237,
198,
198,
11748,
6333,
263,
198,
6738,
6333,
263,
1330,
4808,
1891,
22930,
62,
26791,
198,
6738,
6333,
263,
13,
1891,
2412,
1330,
269,
15339,
198,
... | 2.679245 | 159 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Trashman v1.5.0
# A Python trash manager.
# Copyright (C) 2011-2018, Chris Warrick.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redis... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
21004,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
48161,
805,
410,
16,
13,
20,
13,
15,
198,
2,
317,
11361,
13913,
4706,
13,
198,
2,
15069,
357,
34,
8,
2813,
12,... | 2.814815 | 1,053 |
from math import e, sin, cos
import pandas as pd
from sympy import Symbol, integrate, lambdify
x = Symbol('x')
h = 0.1
n = 10
x0 = 0
dy = lambda x, y: - y + sin(x)
y = lambda x: 1 / 2 * (3 * e ** (-x) - cos(x) + sin(x))
exact = pd.DataFrame([(x0 + k * h, y(x0 + k * h)) for k in range(-2, n + 1)])
exact = exact.r... | [
6738,
10688,
1330,
304,
11,
7813,
11,
8615,
198,
11748,
19798,
292,
355,
279,
67,
198,
6738,
10558,
88,
1330,
38357,
11,
19386,
11,
19343,
67,
1958,
198,
198,
87,
796,
38357,
10786,
87,
11537,
198,
198,
71,
796,
657,
13,
16,
198,
... | 1.92023 | 1,567 |
###################################################################
# Numexpr - Fast numerical array expression evaluator for NumPy.
#
# License: MIT
# Author: See AUTHORS.txt
#
# See LICENSE.txt and LICENSES/*.txt for details about copyright and
# rights to use.
##########################################... | [
29113,
29113,
21017,
198,
2,
220,
31835,
31937,
532,
12549,
29052,
7177,
5408,
5418,
84,
1352,
329,
31835,
20519,
13,
198,
2,
198,
2,
220,
220,
220,
220,
220,
13789,
25,
17168,
198,
2,
220,
220,
220,
220,
220,
6434,
25,
220,
4091,
... | 2.512742 | 4,552 |
import logging
import datetime
from lxml import etree
from cachetools.func import ttl_cache
from crawl_service.util.new_session import new_session
from crawl_service.crawler.request_executor import RequestExecutorManage
@ttl_cache(ttl=7200)
if __name__ == '__main__':
print(get_atcoder_contest_data("ConanYu"))
| [
11748,
18931,
198,
11748,
4818,
8079,
198,
6738,
300,
19875,
1330,
2123,
631,
198,
6738,
40428,
3202,
10141,
13,
20786,
1330,
256,
28781,
62,
23870,
198,
6738,
27318,
62,
15271,
13,
22602,
13,
3605,
62,
29891,
1330,
649,
62,
29891,
198,... | 2.981308 | 107 |
"""Python library to connect deCONZ and Home Assistant to work together."""
import logging
from .api import APIItems
from .deconzdevice import DeconzDevice
_LOGGER = logging.getLogger(__name__)
URL = "/sensors"
class Sensors(APIItems):
"""Represent deCONZ sensors."""
class DeconzSensor(DeconzDevice):
"""... | [
37811,
37906,
5888,
284,
2018,
390,
10943,
57,
290,
5995,
15286,
284,
670,
1978,
526,
15931,
198,
198,
11748,
18931,
198,
198,
6738,
764,
15042,
1330,
7824,
23022,
198,
6738,
764,
12501,
13569,
25202,
1330,
4280,
13569,
24728,
198,
198,
... | 2.368271 | 5,944 |
""" Demonstrates partitioning arrays """
def list_diff(list_a, list_b):
""" Expects two lists. Returns an array of the items in a that aren't in b. """
return [item for item in list_a if item not in list_b]
if __name__ == "__main__":
A = [
('Las Vegas', 'Nevada'),
('Los Angeles', 'Californ... | [
37811,
7814,
2536,
689,
18398,
278,
26515,
37227,
198,
198,
4299,
1351,
62,
26069,
7,
4868,
62,
64,
11,
1351,
62,
65,
2599,
198,
220,
220,
220,
37227,
23600,
82,
734,
8341,
13,
16409,
281,
7177,
286,
262,
3709,
287,
257,
326,
3588,
... | 2.34127 | 252 |
from django.contrib import admin
from invoices.models import Invoice, InvoiceLine
admin.site.register(Invoice, InvoiceAdmin)
| [
6738,
42625,
14208,
13,
3642,
822,
1330,
13169,
198,
198,
6738,
800,
78,
1063,
13,
27530,
1330,
10001,
2942,
11,
10001,
2942,
13949,
628,
628,
198,
28482,
13,
15654,
13,
30238,
7,
19904,
2942,
11,
10001,
2942,
46787,
8,
198
] | 3.25 | 40 |
import vk_api
from vk_api import VkUpload
from vk_api.longpoll import VkLongPoll
from vk_api.exceptions import ApiError
from application.settings import BOT_TOKEN
from ..utilites.logger import set_logger
logger = set_logger(__name__)
| [
11748,
410,
74,
62,
15042,
198,
6738,
410,
74,
62,
15042,
1330,
569,
74,
41592,
198,
6738,
410,
74,
62,
15042,
13,
6511,
30393,
1330,
569,
74,
14617,
39176,
198,
6738,
410,
74,
62,
15042,
13,
1069,
11755,
1330,
5949,
72,
12331,
198,... | 2.878049 | 82 |
from __future__ import division, absolute_import, print_function
__all__ = ['Resolver', 'Node']
from collections import (defaultdict, namedtuple)
from networkx import (DiGraph, dfs_preorder_nodes, topological_sort, number_of_nodes, number_of_edges)
import logging
from .repository import *
Node = namedtuple('Node', ... | [
6738,
11593,
37443,
834,
1330,
7297,
11,
4112,
62,
11748,
11,
3601,
62,
8818,
198,
198,
834,
439,
834,
796,
37250,
4965,
14375,
3256,
705,
19667,
20520,
198,
198,
6738,
17268,
1330,
357,
12286,
11600,
11,
3706,
83,
29291,
8,
198,
6738... | 3.245283 | 106 |
# Functions for modifying data
__author__ = "Matteo Golin"
# Imports
import operator
from datetime import datetime, timedelta
from tools.constants import DATE_FORMAT, LESSON_LABELS, X_OPTIONS
# Modifying data
def convert_time_minutes(milliseconds: int) -> float:
"""Converts time in milliseconds to time in minut... | [
2,
40480,
329,
30620,
1366,
198,
834,
9800,
834,
796,
366,
19044,
660,
78,
402,
24910,
1,
198,
198,
2,
1846,
3742,
198,
11748,
10088,
198,
6738,
4818,
8079,
1330,
4818,
8079,
11,
28805,
12514,
198,
6738,
4899,
13,
9979,
1187,
1330,
... | 2.796312 | 1,193 |
import Foundation, objc
import AppKit
from Foundation import NSLog, NSAutoreleasePool, NSObject
from threading import Thread
import os
from PyObjCTools.TestSupport import *
if __name__ == "__main__":
main()
| [
11748,
5693,
11,
26181,
66,
198,
11748,
2034,
20827,
198,
6738,
5693,
1330,
399,
8634,
519,
11,
10551,
315,
382,
1274,
27201,
11,
10896,
10267,
198,
6738,
4704,
278,
1330,
14122,
198,
11748,
28686,
198,
6738,
9485,
49201,
4177,
10141,
1... | 3.3125 | 64 |
raw_path = "."
dde_paper_json_path = os.path.join(raw_path,
"dde_paper_v4.json")
dde_index_path = os.path.join(raw_path, "dde/db_dde_sim")
dde_corpus_query_path = os.path.join(raw_path, "db_dde_corpus_query.json")
print(dde_corpus_query_path)
dde_paper_dict, dde_index, dde_corpus_qu... | [
1831,
62,
6978,
796,
366,
526,
198,
1860,
68,
62,
20189,
62,
17752,
62,
6978,
796,
28686,
13,
6978,
13,
22179,
7,
1831,
62,
6978,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,... | 2.028 | 250 |
"""
motifscan.region.parsers
------------------------
Parsers to read the genomic region files.
"""
import logging
from motifscan.exceptions import RegionFileFormatError
logger = logging.getLogger(__name__)
def is_track_header(line):
"""Returns if the line is a header line used in genome tracks/browsers."""
... | [
37811,
198,
27926,
361,
35836,
13,
36996,
13,
79,
945,
364,
198,
22369,
198,
198,
47,
945,
364,
284,
1100,
262,
45752,
3814,
3696,
13,
198,
37811,
198,
198,
11748,
18931,
198,
198,
6738,
32702,
35836,
13,
1069,
11755,
1330,
17718,
897... | 2.360047 | 1,697 |
'''
Messages to be received by sum nodes
'''
def increment(amount):
'''
:param int amount: An integer amount by which to increment.
'''
return {'type': 'increment', 'amount': amount}
| [
7061,
6,
198,
36479,
1095,
284,
307,
2722,
416,
2160,
13760,
198,
7061,
6,
628,
198,
4299,
18703,
7,
17287,
2599,
198,
220,
705,
7061,
198,
220,
1058,
17143,
493,
2033,
25,
1052,
18253,
2033,
416,
543,
284,
18703,
13,
198,
220,
705,... | 3.163934 | 61 |
#! /usr/local/bin/env python3
# Sandbox file
| [
2,
0,
1220,
14629,
14,
12001,
14,
8800,
14,
24330,
21015,
18,
198,
198,
2,
3837,
3524,
2393,
198
] | 2.421053 | 19 |
import unittest2 as unittest
from serene.elements.elements import (Class, ClassInstanceLink,
ClassNode, Column, ColumnLink,
DataLink, DataNode,
DataProperty, Mapping,
... | [
11748,
555,
715,
395,
17,
355,
555,
715,
395,
198,
198,
6738,
384,
25924,
13,
68,
3639,
13,
68,
3639,
1330,
357,
9487,
11,
5016,
33384,
11280,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2... | 1.655039 | 258 |
from app.models import User
| [
6738,
598,
13,
27530,
1330,
11787,
198
] | 4 | 7 |
from setuptools import find_packages, setup
setup(name="kafkian",
version="0.13.0",
description="Opinionated Kafka Python client on top of Confluent python library",
long_description=readme(),
long_description_content_type="text/markdown",
classifiers=[
'Development Status :: 3 ... | [
6738,
900,
37623,
10141,
1330,
1064,
62,
43789,
11,
9058,
628,
198,
198,
40406,
7,
3672,
2625,
74,
1878,
74,
666,
1600,
198,
220,
220,
220,
220,
220,
2196,
2625,
15,
13,
1485,
13,
15,
1600,
198,
220,
220,
220,
220,
220,
6764,
2625... | 2.287154 | 397 |
import importlib
from utils.config import ZONES_CONFIG, EXCHANGES_CONFIG
# Prepare all parsers
CONSUMPTION_PARSERS = {}
PRODUCTION_PARSERS = {}
PRODUCTION_PER_MODE_FORECAST_PARSERS = {}
PRODUCTION_PER_UNIT_PARSERS = {}
EXCHANGE_PARSERS = {}
PRICE_PARSERS = {}
CONSUMPTION_FORECAST_PARSERS = {}
GENERATION_FORECAST_PARS... | [
11748,
1330,
8019,
198,
198,
6738,
3384,
4487,
13,
11250,
1330,
1168,
39677,
62,
10943,
16254,
11,
7788,
3398,
15567,
1546,
62,
10943,
16254,
198,
198,
2,
43426,
477,
13544,
364,
198,
10943,
50,
5883,
11571,
2849,
62,
27082,
50,
4877,
... | 2.37013 | 616 |
# -*- coding: utf-8 -*- #
# Copyright 2016 Google LLC. 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 requir... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
1303,
198,
2,
15069,
1584,
3012,
11419,
13,
1439,
6923,
33876,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,... | 2.640449 | 2,403 |
#!/usr/bin/env python
# coding: latin-1
"""
nat_topo.py: a mininet topology for testing the NAT/Kiwi implementation
Jonny Shipton, Cambridge University Computer Lab, August 2016
This software was developed by the University of Cambridge,
Computer Laboratory under EPSRC NaaS Project EP/K034723/1
Use of this source c... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
19617,
25,
3042,
259,
12,
16,
198,
198,
37811,
198,
32353,
62,
4852,
78,
13,
9078,
25,
257,
949,
42504,
1353,
1435,
329,
4856,
262,
10149,
14,
42,
14246,
72,
7822,
198,
18219,
3... | 2.583184 | 4,460 |
"""
add_isotropic_velocities.py: add vp and vs velocity for the absolute velocity netcdf files.
"""
import click
import numpy as np
import xarray as xr
@click.command()
@click.option('--target_netcdf', required=True, type=str)
if __name__ == "__main__":
main() # pylint: disable=no-value-for-parameter
| [
37811,
198,
2860,
62,
271,
46084,
62,
626,
420,
871,
13,
9078,
25,
751,
410,
79,
290,
3691,
15432,
329,
262,
4112,
15432,
2010,
66,
7568,
3696,
13,
198,
37811,
198,
11748,
3904,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2124,
... | 2.853211 | 109 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see Astropy LICENSE.rst
"""
Register conversion methods for cosmology objects with Astropy Cosmology.
With this registered, we can start with a Cosmology from
``mypackage`` and convert it to an astropy Cosmology instance.
>>> from mypackage.... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
49962,
739,
257,
513,
12,
565,
682,
347,
10305,
3918,
5964,
532,
766,
8304,
28338,
38559,
24290,
13,
81,
301,
198,
198,
37811,
198,
38804,
11315,
5050,
329,
8615,
2... | 2.702786 | 1,615 |
# -*- coding:utf-8 -*-
from home_list_page_ui import HomeListPageUI
class HomeListPage(HomeListPageUI):
"""
页面对象(PO): HOME列表页面
"""
def gesture_item(self):
"""
点击"Gesture"列表项
"""
self.gesture_item_loc().click()
def alert_item(self):
"""
点击"Alert"列表项... | [
2,
532,
9,
12,
19617,
25,
40477,
12,
23,
532,
9,
12,
198,
198,
6738,
1363,
62,
4868,
62,
7700,
62,
9019,
1330,
5995,
8053,
9876,
10080,
628,
198,
4871,
5995,
8053,
9876,
7,
16060,
8053,
9876,
10080,
2599,
198,
220,
220,
220,
37227... | 1.400626 | 639 |
# CommonMark.py - setup.py
from setuptools import setup, Command
setup(
name="CommonMark",
packages=['CommonMark'],
scripts=['bin/cmark.py'],
version="0.5.4",
license="BSD License",
description="Python parser for the CommonMark Markdown spec",
author="Bibek Kafle <bkafle662@gmail.com>, " ... | [
2,
8070,
9704,
13,
9078,
532,
9058,
13,
9078,
198,
6738,
900,
37623,
10141,
1330,
9058,
11,
9455,
628,
198,
198,
40406,
7,
198,
220,
220,
220,
1438,
2625,
17227,
9704,
1600,
198,
220,
220,
220,
10392,
28,
17816,
17227,
9704,
6,
4357... | 2.721443 | 499 |
'''
https://leetcode.com/problems/array-of-doubled-pairs/
954. Array of Doubled Pairs
Given an integer array of even length arr, return true if it is possible to reorder arr such that
arr[2 * i + 1] = 2 * arr[2 * i] for every 0 <= i < len(arr) / 2, or false otherwise.
'''
'''
Accepted
'''
import... | [
7061,
6,
198,
220,
220,
220,
3740,
1378,
293,
316,
8189,
13,
785,
14,
1676,
22143,
14,
18747,
12,
1659,
12,
67,
280,
9342,
12,
79,
3468,
14,
628,
220,
220,
220,
860,
4051,
13,
15690,
286,
5728,
9342,
350,
3468,
628,
220,
220,
22... | 2.538813 | 219 |
'''Get definitions for a word'''
# Do a "pip install PyDictionary" from command line first.
from PyDictionary import PyDictionary
DICT = PyDictionary()
CHECK_WORD = "house"
print(DICT.meaning(CHECK_WORD))
print("-----------")
print(DICT.synonym(CHECK_WORD))
print("-----------")
print(DICT.antonym(CHECK_WORD))
print("-... | [
7061,
6,
3855,
17336,
329,
257,
1573,
7061,
6,
198,
2,
2141,
257,
366,
79,
541,
2721,
9485,
35,
14188,
1,
422,
3141,
1627,
717,
13,
198,
6738,
9485,
35,
14188,
1330,
9485,
35,
14188,
198,
198,
35,
18379,
796,
9485,
35,
14188,
3419... | 3.066225 | 151 |
import os
import biotas
import pandas as pd
proj_dir = r'E:\Manuscript\CT_River_2015'
dbName = 'ctr_2015_v2.db'
data_dir = os.path.join(proj_dir,'Data')
db_dir = os.path.join(proj_dir,'Data',dbName)
det = 5 ... | [
11748,
28686,
198,
11748,
3182,
313,
292,
198,
11748,
19798,
292,
355,
279,
67,
198,
1676,
73,
62,
15908,
796,
374,
6,
36,
7479,
5124,
15817,
59,
4177,
62,
42204,
62,
4626,
6,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,... | 2.030899 | 712 |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import shutil
import numpy as np
from MA_SSRL.utils.download import download_and_extract_archive, download_url
from ... | [
2,
15069,
357,
66,
8,
3203,
11,
3457,
13,
290,
663,
29116,
13,
198,
198,
2,
770,
2723,
2438,
318,
11971,
739,
262,
17168,
5964,
1043,
287,
262,
198,
2,
38559,
24290,
2393,
287,
262,
6808,
8619,
286,
428,
2723,
5509,
13,
198,
198,
... | 2.273452 | 2,761 |
from scapy.all import *
import matplotlib.pyplot as plt
from binascii import hexlify
from threading import Thread
from datetime import datetime
import time
if __name__ == "__main__":
na = Network_Analyzer(30, 0.5)
try:
while True:
print("New sequence")
na.run_capture_thread("s... | [
6738,
629,
12826,
13,
439,
1330,
1635,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
6738,
9874,
292,
979,
72,
1330,
17910,
75,
1958,
198,
6738,
4704,
278,
1330,
14122,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198... | 2.111682 | 779 |
# From https://github.com/lvwerra/jupyterplot
__all__ = ['ProgressPlot']
# Cell
import IPython
import matplotlib.pyplot as plt
try:
from portilooplot.plot_learning_curve import PlotLearningCurve
except:
from portilooplot.plot_learning_curve import PlotLearningCurve
# so sorry for this hack :( the first impor... | [
2,
3574,
3740,
1378,
12567,
13,
785,
14,
6780,
15448,
430,
14,
73,
929,
88,
353,
29487,
198,
198,
834,
439,
834,
796,
37250,
32577,
43328,
20520,
198,
198,
2,
12440,
198,
11748,
6101,
7535,
198,
11748,
2603,
29487,
8019,
13,
9078,
2... | 2.389243 | 2,510 |
#!/usr/bin/env python
import sys
for line in sys.stdin:
line = line.strip()
key_value = line.split(",")
key_in = key_value[0]
value_in = key_value[1]
if value_in == 'ABC' or value_in.isdigit():
show = key_in.strip()
value = value_in.strip()
print( '%s\t%s' % (s... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
11748,
25064,
198,
198,
1640,
1627,
287,
25064,
13,
19282,
259,
25,
198,
220,
220,
220,
1627,
220,
220,
220,
220,
220,
220,
796,
1627,
13,
36311,
3419,
198,
220,
220,
220,
1994,
62,
... | 2.036585 | 164 |
from django.test import TestCase
from django.contrib.auth.models import User, Permission, Group, ContentType
from .models import Product, VariantType, Item, Variant
# Create your tests here.
| [
6738,
42625,
14208,
13,
9288,
1330,
6208,
20448,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
27530,
1330,
11787,
11,
2448,
3411,
11,
4912,
11,
14041,
6030,
198,
6738,
764,
27530,
1330,
8721,
11,
38215,
6030,
11,
9097,
11,
3... | 3.730769 | 52 |
import numpy as np
from schedgym.sched_env import SchedEnv
DATA_PATH = 'vmagent/data/Huawei-East-1.csv'
if __name__ == "__main__":
env = SchedEnv(5, 40, 90, DATA_PATH, render_path='../test.p',
allow_release=False, double_thr=32)
MAX_STEP = 1e4
env.reset(np.random.randint(0, MAX_STEP))
... | [
11748,
299,
32152,
355,
45941,
198,
6738,
6038,
1360,
76,
13,
1416,
704,
62,
24330,
1330,
27774,
4834,
85,
198,
198,
26947,
62,
34219,
796,
705,
14761,
25781,
14,
7890,
14,
38202,
38247,
12,
25234,
12,
16,
13,
40664,
6,
198,
198,
36... | 2.205674 | 282 |
import unittest
import numpy as np
from robo.models.bayesian_linear_regression import BayesianLinearRegression
if __name__ == "__main__":
unittest.main()
| [
11748,
555,
715,
395,
198,
11748,
299,
32152,
355,
45941,
198,
198,
6738,
686,
2127,
13,
27530,
13,
24406,
35610,
62,
29127,
62,
2301,
2234,
1330,
4696,
35610,
14993,
451,
8081,
2234,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
1... | 2.927273 | 55 |
# -*- Mode: Python -*-
import os
import sys
import coro
import caesure.proto
from caesure.bitcoin import *
import coro.asn1.python
import coro.asn1.ber
from coro.log import Facility
LOG = Facility ('db')
# pub/sub for new blocks.
# BlockDB file format: (<8 bytes of size> <block>)+
#
# Note: this is very close to... | [
2,
532,
9,
12,
10363,
25,
11361,
532,
9,
12,
198,
198,
11748,
28686,
198,
11748,
25064,
198,
11748,
1162,
78,
198,
11748,
1275,
274,
495,
13,
1676,
1462,
198,
198,
6738,
1275,
274,
495,
13,
35395,
1330,
1635,
198,
198,
11748,
1162,
... | 2.738281 | 256 |
# coding=utf-8
# Copyright 2021, The Facebook, Inc. and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/... | [
2,
19617,
28,
40477,
12,
23,
198,
2,
15069,
33448,
11,
383,
3203,
11,
3457,
13,
290,
383,
12905,
2667,
32388,
3457,
13,
1074,
13,
1439,
2489,
10395,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
... | 2.62302 | 947 |
import theano
| [
11748,
262,
5733,
198
] | 3.5 | 4 |
# ## Importing modules
# Figure 3: Importing needed resources
import cocotb
from cocotb.triggers import FallingEdge
import random
# ### The tinyalu_utils module
# All testbenches use tinyalu_utils, so store it in a central
# place and add its path to the sys path so we can import it
from pathlib import Path
parent_... | [
2,
22492,
17267,
278,
13103,
198,
198,
2,
11291,
513,
25,
17267,
278,
2622,
4133,
198,
11748,
8954,
313,
65,
198,
6738,
8954,
313,
65,
13,
2213,
328,
5355,
1330,
42914,
37021,
198,
11748,
4738,
198,
198,
2,
44386,
383,
7009,
282,
84... | 3.025253 | 198 |
#---------------------------------------#
global R,B,C,G
R='\033[1;31m';B='\033[1;34m';C='\033[1;37m';G='\033[1;32m';Format="\033[0m";Letra="\033[38;5;15m";Fundo="\033[48;5;19m"
from os import system;from os import execl; from sys import executable; from sys import argv; from os import name; from time import sleep
#---... | [
2,
3880,
26866,
2,
198,
20541,
371,
11,
33,
11,
34,
11,
38,
198,
49,
11639,
59,
44427,
58,
16,
26,
3132,
76,
17020,
33,
11639,
59,
44427,
58,
16,
26,
2682,
76,
17020,
34,
11639,
59,
44427,
58,
16,
26,
2718,
76,
17020,
38,
1163... | 2.507018 | 1,140 |
#!/usr/bin/env python
import requests
import socket
import json
import threading
from time import sleep, strftime, localtime
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
11748,
7007,
198,
11748,
17802,
198,
11748,
33918,
198,
11748,
4704,
278,
198,
6738,
640,
1330,
3993,
11,
965,
31387,
11,
1957,
2435,
628
] | 3.818182 | 33 |
# Generated by Django 2.0.9 on 2019-01-22 14:28
from django.db import migrations
| [
2,
2980,
515,
416,
37770,
362,
13,
15,
13,
24,
319,
13130,
12,
486,
12,
1828,
1478,
25,
2078,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
628
] | 2.766667 | 30 |
test_cases = int(input().strip())
user_input_lines = []
for i in range(test_cases):
line_input = input()
user_input_lines.append(line_input)
for line_input in user_input_lines:
line_input_parsed = line_input.split(" ")
a = int(line_input_parsed[0])
b = int(line_input_parsed[1])
N = int(line_in... | [
9288,
62,
33964,
796,
493,
7,
15414,
22446,
36311,
28955,
198,
198,
7220,
62,
15414,
62,
6615,
796,
17635,
198,
1640,
1312,
287,
2837,
7,
9288,
62,
33964,
2599,
198,
220,
220,
220,
1627,
62,
15414,
796,
5128,
3419,
198,
220,
220,
22... | 2.193069 | 202 |
from typing import List, Type, Generator
from evidently.analyzers.base_analyzer import Analyzer
from evidently.analyzers.regression_performance_analyzer import RegressionPerformanceAnalyzer
from evidently.model_monitoring.monitoring import ModelMonitor, ModelMonitoringMetric, MetricsType
| [
6738,
19720,
1330,
7343,
11,
5994,
11,
35986,
198,
198,
6738,
27450,
13,
38200,
47031,
13,
8692,
62,
38200,
9107,
1330,
16213,
9107,
198,
6738,
27450,
13,
38200,
47031,
13,
2301,
2234,
62,
26585,
62,
38200,
9107,
1330,
3310,
2234,
32273... | 4.231884 | 69 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pypolyback import config, log
class _ApiObject(object):
"""
Api properties that will be avaliable on endpoints
Properties:
vars: dictionary api custom variables
config: current config object
supported_methods: supported http ... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
220,
198,
198,
6738,
279,
4464,
3366,
1891,
1330,
4566,
11,
2604,
198,
198,
4871,
4808,
32,
14415,
10267,
7,
15252,
2599,
... | 2.34386 | 285 |
# coding=utf-8
import logging
from typing import List, Any, Union, Set
from funcy import first
from golos.block import Block
from golos.consts import *
from golos.utils import resolve_identifier
from golosbase.chains import known_chains
from golosbase.connector import Connector
from golosbase.storage import configSto... | [
2,
19617,
28,
40477,
12,
23,
198,
11748,
18931,
198,
6738,
19720,
1330,
7343,
11,
4377,
11,
4479,
11,
5345,
198,
198,
6738,
1257,
948,
1330,
717,
198,
198,
6738,
43791,
418,
13,
9967,
1330,
9726,
198,
6738,
43791,
418,
13,
1102,
644... | 2.210757 | 15,748 |
import datetime
import json
import math
import time
import uuid
import requests
from flask import request, g, current_app
from sqlalchemy import desc, func
from apps.auth.models.users import User
from apps.autotest.business.monkey import MonkeyDeviceUsingBusiness
from apps.autotest.models.monkey import MonkeyDeviceUs... | [
11748,
4818,
8079,
198,
11748,
33918,
198,
11748,
10688,
198,
11748,
640,
198,
11748,
334,
27112,
198,
198,
11748,
7007,
198,
6738,
42903,
1330,
2581,
11,
308,
11,
1459,
62,
1324,
198,
6738,
44161,
282,
26599,
1330,
1715,
11,
25439,
198... | 3.682119 | 151 |
import sys
import inspect
import importlib
| [
198,
198,
11748,
25064,
198,
11748,
10104,
198,
11748,
1330,
8019,
628,
198
] | 3.615385 | 13 |
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (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.mozilla.org/MPL/
#
# Softwa... | [
2,
25998,
9,
347,
43312,
38559,
24290,
9878,
11290,
25998,
9,
198,
2,
10628,
25,
4904,
43,
352,
13,
16,
14,
38,
6489,
362,
13,
15,
14,
41257,
6489,
362,
13,
16,
198,
2,
198,
2,
383,
10154,
286,
428,
2393,
389,
2426,
284,
262,
... | 3.751515 | 495 |
from . import _generate_function
Count = _generate_function('COUNT')
Distinct = _generate_function('DISTINCT')
Integral = _generate_function('INTEGRAL')
Mean = _generate_function('MEAN')
Median = _generate_function('MEDIAN')
Mode = _generate_function('MODE')
Spread = _generate_function('SPREAD')
StdDev = _generate_fun... | [
6738,
764,
1330,
4808,
8612,
378,
62,
8818,
198,
198,
12332,
796,
4808,
8612,
378,
62,
8818,
10786,
34,
28270,
11537,
198,
20344,
4612,
796,
4808,
8612,
378,
62,
8818,
10786,
35,
8808,
1268,
4177,
11537,
198,
34500,
1373,
796,
4808,
8... | 2.920635 | 126 |
# coding: utf-8
from __future__ import absolute_import
import unittest
from flask import json
from six import BytesIO
from openapi_server.models.category import Category # noqa: E501
from openapi_server.test import BaseTestCase
class TestProductController(BaseTestCase):
"""ProductController integration test s... | [
2,
19617,
25,
3384,
69,
12,
23,
198,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
11748,
555,
715,
395,
198,
198,
6738,
42903,
1330,
33918,
198,
6738,
2237,
1330,
2750,
4879,
9399,
198,
198,
6738,
1280,
15042,
62,
15388,
... | 2.246316 | 475 |
from covering_segments import *
assert(optimal_points([\
Segment(start = 1, end = 3), \
Segment(start = 2, end = 5), \
Segment(start = 3, end = 6), \
]) == [3])
assert(optimal_points([\
Segment(start = 4, end = 7), \
Segment(start = 1, end = 3), \
Segment(start = 2, end = 5), \
Segment(start = 5, end = 6), \
... | [
6738,
9505,
62,
325,
11726,
1330,
1635,
198,
198,
30493,
7,
8738,
4402,
62,
13033,
26933,
59,
198,
197,
41030,
434,
7,
9688,
796,
352,
11,
886,
796,
513,
828,
3467,
198,
197,
41030,
434,
7,
9688,
796,
362,
11,
886,
796,
642,
828,
... | 2.368794 | 141 |
# Generated by Django 3.1.4 on 2021-06-03 15:01
from django.db import migrations, models
| [
2,
2980,
515,
416,
37770,
513,
13,
16,
13,
19,
319,
33448,
12,
3312,
12,
3070,
1315,
25,
486,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.84375 | 32 |
import sys
import torch
import argparse
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as models
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import random
import sys, os
sys.path.append('.')
sys.path.append('..')
from torch.autograd impor... | [
11748,
25064,
198,
11748,
28034,
198,
11748,
1822,
29572,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
28034,
13,
20471,
355,
299,
77,
198,
11748,
28034,
13,
20471,
13,
45124,
355,
376,
198,
11748,
28034,
10178,
13,
27530,
355,
4981,
... | 2.359338 | 846 |
import argparse
import sys
from JsonParser.json_parser import JsonParser
from JsonParser.utils import is_file, is_readable, find_files
from dashboard import generate_dashboard
if __name__ == "__main__":
parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group()
group.add_argument("... | [
11748,
1822,
29572,
198,
11748,
25064,
198,
6738,
449,
1559,
46677,
13,
17752,
62,
48610,
1330,
449,
1559,
46677,
220,
198,
6738,
449,
1559,
46677,
13,
26791,
1330,
318,
62,
7753,
11,
318,
62,
46155,
11,
1064,
62,
16624,
198,
6738,
30... | 2.746341 | 410 |
#!/usr/bin/env python3
import csv
ELECTION_2017_ID = 1
PLACES_FILES = {
"WPC": "westminster"
}
RESULTS_FILES = {
ELECTION_2017_ID: "2017 UKPGE electoral data 4"
}
if __name__ == "__main__":
run()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
11748,
269,
21370,
198,
198,
36,
16779,
2849,
62,
5539,
62,
2389,
796,
352,
198,
198,
6489,
2246,
1546,
62,
46700,
1546,
796,
1391,
198,
220,
220,
220,
366,
54,
5662,
1298,
366,
... | 2.204082 | 98 |
from dataclasses import dataclass, field
from enum import Enum
from typing import Optional, List, Dict
from com.mesoor.mesoor_recommendation import sdk
@dataclass
class JobDetail:
"""
职位信息。如果属性有默认值,可留空。
"""
# 职位名
name: str
# 职位描述
description: str
# 公司
employer: str
# 学历要求
... | [
6738,
4818,
330,
28958,
1330,
4818,
330,
31172,
11,
2214,
198,
6738,
33829,
1330,
2039,
388,
198,
6738,
19720,
1330,
32233,
11,
7343,
11,
360,
713,
198,
198,
6738,
401,
13,
6880,
2675,
13,
6880,
2675,
62,
47335,
437,
341,
1330,
264,
... | 1.531112 | 2,041 |
from __future__ import unicode_literals
from django.contrib.auth.models import AbstractUser, Group, UserManager
from accounts.my_fields import UserRoleField
class CustomUserManager(UserManager):
"""
Manager for User objects, automaticly adding the users
in teachers or students group, depending on their... | [
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
628,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
27530,
1330,
27741,
12982,
11,
4912,
11,
11787,
13511,
198,
198,
6738,
5504,
13,
1820,
62,
25747,
1330,
11787,
47445... | 3.116071 | 224 |
import pygame
import numpy as np
import random as rand
import time
#YOU CAN CHANGE THESE
pygame.init()
screen = pygame.display.set_mode([300,400])
startingx = 90
startingy = -50
next_piece = random_shape_gen([startingx+140,startingy+100])
current_piece = random_shape_gen([startingx,startingy])
in... | [
11748,
12972,
6057,
201,
198,
11748,
299,
32152,
355,
45941,
201,
198,
11748,
4738,
355,
43720,
201,
198,
11748,
640,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
2,
36981,
15628,
5870,
27746,
48947,
201,
198,... | 2.078202 | 2,225 |
import os
from dotenv import load_dotenv
import random
from datetime import datetime
import discord
from discord.ext import commands
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
ERRORPATH = os.getenv('ERROR_PATH')
GUILD = os.getenv('DISCORD_GUILD')
bot = commands.Bot(command_prefix='-')
@bot.event
@bot.event
... | [
198,
11748,
28686,
198,
6738,
16605,
24330,
1330,
3440,
62,
26518,
24330,
198,
11748,
4738,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
11748,
36446,
198,
6738,
36446,
13,
2302,
1330,
9729,
198,
198,
2220,
62,
26518,
24330,
3419,
198,
... | 3.003165 | 316 |
import argparse
MODEL_TYPES = ['longformer']
| [
11748,
1822,
29572,
201,
198,
201,
198,
33365,
3698,
62,
9936,
47,
1546,
796,
37250,
6511,
16354,
20520,
201,
198
] | 2.45 | 20 |
import numpy as np
from numpy.linalg import norm
from scipy.special import gammaln
from scipy.optimize import linear_sum_assignment
from sklearn.preprocessing import normalize
# log ratio of vMF constants. V is dimension of directions (i.e. vocabulary - 1)
def matching_upd(cosac_topics, cent, T, ... | [
11748,
299,
32152,
355,
45941,
198,
6738,
299,
32152,
13,
75,
1292,
70,
1330,
2593,
198,
6738,
629,
541,
88,
13,
20887,
1330,
308,
6475,
282,
77,
198,
6738,
629,
541,
88,
13,
40085,
1096,
1330,
14174,
62,
16345,
62,
562,
16747,
198,... | 2.373239 | 568 |
import socket
import os
UDP_IP = "192.168.10.4"
UDP_PORT = 50005
#@TODO: there should be a main command interface
# that can receive commands when program is
# running to determine if sending or requesting:
# data.
#PATH for reading the file and where to write the file received.
#dir_path = os.pat... | [
11748,
17802,
198,
11748,
28686,
198,
198,
52,
6322,
62,
4061,
796,
366,
17477,
13,
14656,
13,
940,
13,
19,
1,
198,
52,
6322,
62,
15490,
796,
23336,
20,
198,
198,
2,
31,
51,
3727,
46,
25,
612,
815,
307,
257,
1388,
3141,
7071,
19... | 2.4 | 685 |
from django.db import models
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from django.utils import timezone
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
from core.models.mixins import SoftDeleteMix... | [
6738,
42625,
14208,
13,
9945,
1330,
4981,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
6738,
42625,
14208,
13,
26791,
13,
41519,
1330,
651,
5239,
62,
75,
12582,
355,
4808,
198,
6738,
42625,
14208,
13,
26791,
1330,
640,
11340,
19... | 3.727273 | 99 |
# coding: utf-8
'''
エリアのcentroidを計算する
input:
area_id, name, MultiPolygon(WKT)
output:
area_id, centroid (lon), centroid (lat), name
'''
from snlocest.argparse import GzipFileType
from snlocest.areadata import AreaData
if __name__ == '__main__':
args = parse_args()
areas = AreaData(path=args.gxmltsv)
... | [
2,
19617,
25,
3384,
69,
12,
23,
198,
198,
7061,
6,
198,
23544,
12675,
11839,
5641,
1087,
3882,
31758,
164,
101,
230,
163,
106,
245,
33623,
25748,
198,
198,
15414,
25,
198,
20337,
62,
312,
11,
1438,
11,
15237,
34220,
14520,
7,
54,
... | 2.310345 | 203 |
import torch as T
import numpy as np
dev = T.device('cuda') if T.cuda.is_available() else T.device('cpu')
def temporal_padding(x, paddings=(1, 0), pad_value=0):
"""Pad the middle dimension of a 3D tensor
with `padding[0]` values left and `padding[1]` values right.
Modified from keras.backend.tempo... | [
11748,
28034,
355,
309,
198,
11748,
299,
32152,
355,
45941,
198,
7959,
796,
309,
13,
25202,
10786,
66,
15339,
11537,
611,
309,
13,
66,
15339,
13,
271,
62,
15182,
3419,
2073,
309,
13,
25202,
10786,
36166,
11537,
628,
198,
4299,
21964,
... | 2.506244 | 1,041 |
'''
routing logic and some tools
'''
from functools import wraps
import asyncio
import re
import inspect
from urllib.parse import urlparse, urljoin
from .util import logger
# from bottle import route
# key-value map for url pattern -> process func mapping
default_router = None
class Router:
'''
collections ... | [
7061,
6,
198,
81,
13660,
9156,
290,
617,
4899,
198,
7061,
6,
198,
6738,
1257,
310,
10141,
1330,
27521,
198,
11748,
30351,
952,
198,
11748,
302,
198,
11748,
10104,
198,
6738,
2956,
297,
571,
13,
29572,
1330,
19016,
29572,
11,
19016,
22... | 1.966933 | 1,875 |
#!/usr/bin/python3
"""TVS image largest contour extraction method"""
import cv2
import numpy as np
def extract_largest_contour(black_white_image, method_parameters):
"""Extract largest contour on an black and white image via OpenCV"""
_, contours, _ = cv2.findContours(black_white_image.copy(), cv2.RETR_EXTERN... | [
2,
48443,
14629,
14,
8800,
14,
29412,
18,
198,
37811,
6849,
50,
2939,
4387,
542,
454,
22236,
2446,
37811,
198,
11748,
269,
85,
17,
198,
11748,
299,
32152,
355,
45941,
628,
198,
4299,
7925,
62,
28209,
62,
3642,
454,
7,
13424,
62,
111... | 2.690821 | 207 |
from enum import Enum
from pathlib import Path
import numpy as np
import pandas as pd
if __name__ == '__main__':
dataset_data_frame = load_dataset()
| [
6738,
33829,
1330,
2039,
388,
198,
6738,
3108,
8019,
1330,
10644,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
19798,
292,
355,
279,
67,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
2... | 2.888889 | 54 |
# -*- coding: utf-8 -*-
# Credits: Benjamin Dartigues, Emmanuel Bouilhol, Hayssam Soueidan, Macha Nikolski
# These functions are specific for plotting the results produced by the analysis scripts
import matplotlib
from loguru import logger
from scipy.interpolate import interp1d
import constants
from mpi_calculator i... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
29501,
25,
14533,
29032,
328,
947,
11,
32390,
14551,
346,
3937,
11,
367,
592,
37687,
22862,
68,
27610,
11,
7080,
64,
11271,
10220,
4106,
198,
198,
2,
2312,
5499,
38... | 2.17775 | 7,865 |
import torch
import torch.nn.functional as F
import torch.nn as nn
| [
11748,
28034,
198,
11748,
28034,
13,
20471,
13,
45124,
355,
376,
198,
11748,
28034,
13,
20471,
355,
299,
77,
628
] | 3.4 | 20 |
from django.shortcuts import render
from blog.models import Category, Post
from django.http import HttpResponse
from users.models import Profile, Follower
from django.contrib.auth.models import User
| [
6738,
42625,
14208,
13,
19509,
23779,
1330,
8543,
198,
6738,
4130,
13,
27530,
1330,
21743,
11,
2947,
198,
6738,
42625,
14208,
13,
4023,
1330,
367,
29281,
31077,
198,
6738,
2985,
13,
27530,
1330,
13118,
11,
376,
47030,
198,
6738,
42625,
... | 3.901961 | 51 |
# -*- coding: utf-8 -*-
# @Time : 2019/10/28 15:10
# @Author : ChenLi
# @Site :
# @File : pyqtgraph01.py
# import pyqtgraph.examples
# pyqtgraph.examples.run()
# import pyqtgraph as pg
# import numpy as np
# x = np.random.normal(size=1000)
# y = np.random.normal(size=1000)
# pg.plot(x, y, pen=None, symbol... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2488,
7575,
220,
220,
220,
1058,
13130,
14,
940,
14,
2078,
1315,
25,
940,
198,
2,
2488,
13838,
220,
1058,
12555,
32304,
198,
2,
2488,
29123,
220,
220,
220,
1058,
... | 2.441941 | 577 |
#funcion para realizar los cálculos.
dinero = float(input('Ingresa tu cantidad en US$: ')) #Solicitamos el dinero al usuario
print('Ingresaste ', dinero,'US$. Serían:') #Llamamos y mostramos la cantidad
monedas(dinero)
| [
2,
20786,
295,
31215,
1103,
528,
283,
22346,
269,
6557,
75,
3129,
418,
13,
198,
198,
25194,
3529,
796,
12178,
7,
15414,
10786,
27682,
14625,
12777,
18548,
32482,
551,
1294,
3,
25,
705,
4008,
1303,
36949,
3628,
321,
418,
1288,
16278,
3... | 2.611765 | 85 |
pulsera1 = dict()
pulsera2 = dict()
pulsera3 = dict()
URL = str()
| [
79,
377,
2655,
64,
16,
796,
8633,
3419,
198,
79,
377,
2655,
64,
17,
796,
8633,
3419,
198,
79,
377,
2655,
64,
18,
796,
8633,
3419,
198,
198,
21886,
796,
965,
3419,
628,
628,
628,
198
] | 2.027778 | 36 |
"""
Read and write data from/to files
"""
| [
37811,
198,
5569,
290,
3551,
1366,
422,
14,
1462,
3696,
198,
37811,
198
] | 3.230769 | 13 |
from collections import UserList
from typing import TYPE_CHECKING, Iterable, Union, overload, Any, Generator
import copy
from amulet.api.entity import Entity
import weakref
if TYPE_CHECKING:
from amulet.api.chunk import Chunk
if __name__ == "__main__":
import amulet_nbt
from amulet.api.chunk import Chu... | [
6738,
17268,
1330,
11787,
8053,
198,
6738,
19720,
1330,
41876,
62,
50084,
2751,
11,
40806,
540,
11,
4479,
11,
31754,
11,
4377,
11,
35986,
198,
11748,
4866,
198,
6738,
38335,
13,
15042,
13,
26858,
1330,
20885,
198,
11748,
4939,
5420,
198... | 2.474227 | 388 |
import socket, ssl
from datetime import datetime
Header = '''
HTTP/1.0 500 Internal Server Error
Date: {now}
Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips mod_fcgid/2.3.9 PHP/5.4.16
Last-Modified: {now}
Cache-Control: max-age=0
Content-Type: text/html; charset=UTF-8
<html>
<head>
<title>500 Inte... | [
11748,
17802,
11,
264,
6649,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
198,
39681,
796,
705,
7061,
198,
40717,
14,
16,
13,
15,
5323,
18628,
9652,
13047,
198,
10430,
25,
1391,
2197,
92,
198,
10697,
25,
24843,
14,
17,
13,
19,
13,
... | 2.583333 | 168 |
from .views import authorise, success
from django.conf.urls import url
urlpatterns = [
url(r'^authorise/$', authorise, name='sage-api-authorise'),
url(r'^success/$', success, name='sage-api-success'),
]
| [
6738,
764,
33571,
1330,
1772,
786,
11,
1943,
198,
6738,
42625,
14208,
13,
10414,
13,
6371,
82,
1330,
19016,
198,
198,
6371,
33279,
82,
796,
685,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
9800,
786,
32624,
3256,
1772,
786,
11,
1438,
... | 2.717949 | 78 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/dialogflow_v2beta1/proto/entity_type.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 g... | [
2,
2980,
515,
416,
262,
8435,
11876,
17050,
13,
220,
8410,
5626,
48483,
0,
198,
2,
2723,
25,
23645,
14,
17721,
14,
38969,
519,
11125,
62,
85,
17,
31361,
16,
14,
1676,
1462,
14,
26858,
62,
4906,
13,
1676,
1462,
198,
198,
11748,
250... | 2.496843 | 22,647 |
# -*- coding: utf-8 -*-
from troposphere_mate import Template, iam
from ...core.canned import MultiEnvBasicConfig, Constant
from ...core.mate import DEFAULT_LABELS_FIELD
from .const_aws_service_name import create_assume_role_policy_document, AWSServiceName
from .const_aws_managed_policy_arn import AWSManagedPolicyArn
... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
6738,
14673,
22829,
62,
9830,
1330,
37350,
11,
1312,
321,
198,
6738,
2644,
7295,
13,
66,
3577,
1330,
15237,
4834,
85,
26416,
16934,
11,
20217,
198,
6738,
2644,
7295... | 3.156863 | 102 |
import math
import copy
from functools import reduce
with open("input.txt", "r") as file:
foods = []
ingredients = set()
allergens = set()
# iterate over every line in a file
for line in file.read().split("\n"):
ingre, aller = line[:-1].split(" (contains ")
ingre = ingre.split(" ")
... | [
11748,
10688,
201,
198,
11748,
4866,
201,
198,
6738,
1257,
310,
10141,
1330,
4646,
201,
198,
201,
198,
4480,
1280,
7203,
15414,
13,
14116,
1600,
366,
81,
4943,
355,
2393,
25,
201,
198,
220,
9013,
796,
17635,
201,
198,
220,
9391,
796,
... | 2.185792 | 549 |
# coding=utf-8
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------... | [
2,
19617,
28,
40477,
12,
23,
198,
2,
16529,
1783,
10541,
198,
2,
15069,
357,
66,
8,
5413,
10501,
13,
1439,
2489,
10395,
13,
198,
2,
49962,
739,
262,
17168,
13789,
13,
4091,
13789,
13,
14116,
287,
262,
1628,
6808,
329,
5964,
1321,
... | 3.785969 | 4,775 |
# -*- coding: utf-8 -*- #
# Copyright 2021 Google LLC. 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 requir... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
1303,
198,
2,
15069,
33448,
3012,
11419,
13,
1439,
6923,
33876,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198... | 3.072165 | 582 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import collections
import datetime
import pytz
from odoo import fields, http
from odoo.http import request
from odoo.tools import html_escape as escape, html2plaintext
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2142,
286,
10529,
2238,
13,
4091,
38559,
24290,
2393,
329,
1336,
6634,
290,
15665,
3307,
13,
198,
198,
11748,
17268,
198,
11748,
4818,
8079,
198,
11748,
12972,
22877,
... | 3.461538 | 78 |
#!/opt/anaconda3/envs/py27/bin/python
# -*- coding: UTF-8 -*-
import cgi, os, sys
import cgitb; cgitb.enable()
from pandas import *
import numpy as np
import twd97
from pyproj import Proj
import tempfile as tf
Latitude_Pole, Longitude_Pole = 23.61000, 120.9900
Xcent, Ycent = twd97.fromwgs84(Latitude_Pole, Longitude_P... | [
2,
48443,
8738,
14,
272,
330,
13533,
18,
14,
268,
14259,
14,
9078,
1983,
14,
8800,
14,
29412,
198,
2,
532,
9,
12,
19617,
25,
41002,
12,
23,
532,
9,
12,
198,
198,
11748,
269,
12397,
11,
28686,
11,
25064,
198,
11748,
269,
18300,
6... | 2.062649 | 1,261 |
import logging
import os
import pickle
import random
import json
import numpy as np
import torch
import glob
import re
import shutil
try:
from torch.utils.tensorboard import SummaryWriter
except:
from tensorboardX import SummaryWriter
from torch import nn
from torch.distributions import Categorical
from torc... | [
11748,
18931,
198,
11748,
28686,
198,
11748,
2298,
293,
198,
11748,
4738,
198,
11748,
33918,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
28034,
198,
11748,
15095,
198,
11748,
302,
198,
11748,
4423,
346,
198,
198,
28311,
25,
198,
... | 3.381818 | 220 |
# Django modules.
from django.http import HttpResponseBadRequest, HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
# !Triplinker modules:
# Current app modules.
from accounts.forms.forms import AddPhotoToUserGalleryForm
from accounts.models.TLAccount_frequest import TLAccount
def photos_o... | [
2,
37770,
13103,
13,
198,
6738,
42625,
14208,
13,
4023,
1330,
367,
29281,
31077,
22069,
18453,
11,
367,
29281,
31077,
7738,
1060,
198,
6738,
42625,
14208,
13,
19509,
23779,
1330,
8543,
11,
651,
62,
15252,
62,
273,
62,
26429,
198,
198,
... | 2.498214 | 560 |