content stringlengths 1 1.04M | input_ids listlengths 1 774k | ratio_char_token float64 0.38 22.9 | token_count int64 1 774k |
|---|---|---|---|
"""
Defines an AI which picks randomly
"""
import random
from quagen.ai import AI
class RandomAI(AI):
"""
Literally picks a random spot to move. More useful for benchmarking other
AIs than used against a human in a real game.
"""
def get_max_strength(self):
"""
Returns:
... | [
37811,
198,
7469,
1127,
281,
9552,
543,
11103,
15456,
198,
37811,
198,
11748,
4738,
198,
198,
6738,
627,
11286,
13,
1872,
1330,
9552,
628,
198,
4871,
14534,
20185,
7,
20185,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
48414,
... | 2.463977 | 347 |
#------------------------------------------------------------------------------
#
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions d... | [
2,
10097,
26171,
198,
2,
198,
2,
220,
15069,
357,
66,
8,
5075,
11,
2039,
28895,
11,
3457,
13,
198,
2,
220,
1439,
2489,
10395,
13,
198,
2,
198,
2,
220,
770,
3788,
318,
2810,
1231,
18215,
739,
262,
2846,
286,
262,
347,
10305,
198,... | 3.104488 | 5,905 |
import picamera
import time
import os
import json
import pygame
import RPi.GPIO as GPIO
from PIL import Image, ImageDraw, ImageFont
import traceback
prev_button_status = False
time_pressed = 0
taking_pictures = False
button_pin = 17
num_pictures = 1
first_delay = 5
following_delay = 5
screen_width = 1920
screen_height... | [
11748,
8301,
18144,
198,
11748,
640,
198,
11748,
28686,
198,
11748,
33918,
198,
11748,
12972,
6057,
198,
11748,
25812,
72,
13,
16960,
9399,
355,
50143,
198,
6738,
350,
4146,
1330,
7412,
11,
7412,
25302,
11,
7412,
23252,
198,
11748,
12854,... | 2.42623 | 488 |
# Exercício Python 01: Faça um programa que leia a largura e a altura de uma parede em metros, calcule a sua área e a quantidade de tinta necessária para pintá-la, sabendo que cada litro de tinta pinta uma área de 2 metros quadrados.
l = float(input('Qual a largura da parede: '))
a = float(input('Qual a altura da pare... | [
2,
1475,
2798,
8836,
66,
952,
11361,
5534,
25,
18350,
50041,
23781,
1430,
64,
8358,
443,
544,
257,
2552,
5330,
304,
257,
5988,
5330,
390,
334,
2611,
279,
1144,
68,
795,
1138,
4951,
11,
2386,
23172,
257,
424,
64,
6184,
94,
21468,
304... | 2.489011 | 182 |
"""
Convert results files.
"""
import os
import sys
import pickle
import yaml
if __name__ == "__main__":
output_path = sys.argv[1]
joint_config_path = sys.argv[2]
result_paths = sys.argv[3:]
with open(joint_config_path, "r") as fp:
config = yaml.load(fp)
output = dict(config=config)
... | [
37811,
198,
3103,
1851,
2482,
3696,
13,
198,
37811,
628,
198,
11748,
28686,
198,
11748,
25064,
198,
11748,
2298,
293,
198,
11748,
331,
43695,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
628,
220,
220,
220,
5072,
... | 2.139205 | 352 |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class CdmCreateClusterReqCluster:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict):... | [
2,
19617,
25,
3384,
69,
12,
23,
198,
198,
11748,
302,
198,
11748,
2237,
628,
198,
198,
6738,
289,
84,
707,
68,
291,
75,
2778,
21282,
74,
7295,
13,
26791,
13,
4023,
62,
26791,
1330,
5336,
270,
1096,
62,
1640,
62,
46911,
1634,
628,
... | 1.821098 | 5,299 |
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-权限中心(BlueKing-IAM) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with th... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
24893,
1087,
14573,
15708,
318,
10607,
284,
1104,
262,
1280,
2723,
2055,
416,
1642,
5525,
241,
251,
165,
110,
116,
162,
247,
118,
12859,
239,
12,
30266,
225,... | 1.981546 | 1,734 |
# Generated by Django 3.0.11 on 2021-01-06 13:35
from django.db import migrations, models
| [
2,
2980,
515,
416,
37770,
513,
13,
15,
13,
1157,
319,
33448,
12,
486,
12,
3312,
1511,
25,
2327,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.875 | 32 |
# %%
import json
from pathlib import Path
import requests
#%%
secrets_file = Path("./bing-search/secrets.json")
if secrets_file.exists() is True:
with open(secrets_file, "rt") as json_data:
secrets = json.load(json_data)
else:
secrets = {
"config_id": "xxxxxx",
"subscription_key1": "xxxxxx"... | [
2,
43313,
198,
11748,
33918,
198,
6738,
3108,
8019,
1330,
10644,
198,
11748,
7007,
628,
198,
2,
16626,
198,
2363,
8004,
62,
7753,
796,
10644,
7,
1911,
14,
4623,
12,
12947,
14,
2363,
8004,
13,
17752,
4943,
198,
198,
361,
13141,
62,
7... | 2.334311 | 341 |
import os
import shlex
import subprocess
import threading
import select
import functools
import sublime
def _process(commands, callback=None, working_dir=None, wait_for_completion=None, **kwargs):
'''Process one or more OS commands.'''
if wait_for_completion is None:
wait_for_completion = False
... | [
11748,
28686,
198,
11748,
427,
2588,
198,
11748,
850,
14681,
198,
11748,
4704,
278,
198,
11748,
2922,
198,
11748,
1257,
310,
10141,
198,
198,
11748,
41674,
198,
198,
4299,
4808,
14681,
7,
9503,
1746,
11,
23838,
28,
14202,
11,
1762,
62,
... | 2.043889 | 1,800 |
from nltk import word_tokenize, WordNetLemmatizer
from plotly.graph_objs import Scatter, Bar
from wordcloud import WordCloud
def generate_plots(df):
"""
Generate plot objected to be rendered int the dashboard:
- Bar chart to plot distribution of genre
- Bar chart to plot distribution of disast... | [
6738,
299,
2528,
74,
1330,
1573,
62,
30001,
1096,
11,
9678,
7934,
43,
368,
6759,
7509,
198,
6738,
7110,
306,
13,
34960,
62,
672,
8457,
1330,
1446,
1436,
11,
2409,
198,
6738,
1573,
17721,
1330,
9678,
18839,
628,
198,
4299,
7716,
62,
... | 1.936847 | 2,391 |
#!/usr/bin/env python
"分支子进程,用os.wait观察其退出状态"
import os
EXIT_STAT_INT = 0
def child():
"子进程"
global EXIT_STAT_INT
EXIT_STAT_INT += 1
print('Hello from child', os.getpid(), EXIT_STAT_INT)
os._exit(EXIT_STAT_INT)
def main():
"父进程"
while True:
new_pid_int = os.fork()
if new_pid_int == 0:
child()
els... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
1,
26344,
228,
162,
242,
107,
36310,
32573,
249,
163,
101,
233,
171,
120,
234,
18796,
101,
418,
13,
17077,
164,
100,
224,
43380,
253,
17739,
114,
34460,
222,
49035,
118,
163,
232,
35... | 1.891473 | 258 |
from abc import ABC
import numpy as np
l1 = L1()
l2 = L2()
| [
6738,
450,
66,
1330,
9738,
198,
198,
11748,
299,
32152,
355,
45941,
628,
628,
198,
198,
75,
16,
796,
406,
16,
3419,
198,
75,
17,
796,
406,
17,
3419,
198
] | 2.166667 | 30 |
import os
import re
import math
import tqdm
import requests
import zlib
from collections import namedtuple
Downloaded_file = namedtuple('Downloaded_file', 'path basename crc32')
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description='''
A file downloader, which returns ... | [
11748,
28686,
198,
11748,
302,
198,
11748,
10688,
198,
11748,
256,
80,
36020,
198,
11748,
7007,
198,
11748,
1976,
8019,
198,
6738,
17268,
1330,
3706,
83,
29291,
198,
198,
10002,
276,
62,
7753,
796,
3706,
83,
29291,
10786,
10002,
276,
62... | 2.737401 | 377 |
import os
import pkgutil
import re
from collections import namedtuple
from subprocess import check_call
from typing import Dict, List, NamedTuple, Tuple
from cognite.client._api_client import APIClient, CogniteCollectionResponse, CogniteResponse
| [
11748,
28686,
198,
11748,
279,
10025,
22602,
198,
11748,
302,
198,
6738,
17268,
1330,
3706,
83,
29291,
198,
6738,
850,
14681,
1330,
2198,
62,
13345,
198,
6738,
19720,
1330,
360,
713,
11,
7343,
11,
34441,
51,
29291,
11,
309,
29291,
198,
... | 3.691176 | 68 |
#!/usr/bin/env python3
import discord
from discord.ext import commands
import json
import random
import asyncio
import subprocess
import operator
import configparser
import glob
import emoji
import datetime
import sys
import traceback
client = commands.Bot(command_prefix=("plzz ", "Plzz ", "plz ", "Plz "))
client.remov... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
11748,
36446,
198,
6738,
36446,
13,
2302,
1330,
9729,
198,
11748,
33918,
198,
11748,
4738,
198,
11748,
30351,
952,
198,
11748,
850,
14681,
198,
11748,
10088,
198,
11748,
4566,
48610,
... | 2.441956 | 11,164 |
# Review Questions
# Algorithm Workbench
# 1. Write a statement that creates a list with the following
# strings: 'Einstein','Newton','Copernicus', and 'Kepler'.
names = ['Einstein','Newton','Copernicus','Kepler']
print(names)
# 2. Assume names references a list. Write a for loop
# that displays each element of the ... | [
2,
6602,
20396,
198,
198,
2,
978,
42289,
5521,
26968,
198,
198,
2,
352,
13,
19430,
257,
2643,
326,
8075,
257,
1351,
351,
262,
1708,
198,
2,
13042,
25,
705,
36,
11962,
41707,
3791,
1122,
41707,
13379,
1142,
24552,
3256,
290,
705,
889... | 2.851852 | 864 |
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A module to manipulate device manufacturing information.
The "Device Data" is a set of mapping data storing manufacturing information for
DUT (device ... | [
2,
15069,
2177,
383,
18255,
1505,
7294,
46665,
13,
1439,
2489,
10395,
13,
198,
2,
5765,
286,
428,
2723,
2438,
318,
21825,
416,
257,
347,
10305,
12,
7635,
5964,
326,
460,
307,
198,
2,
1043,
287,
262,
38559,
24290,
2393,
13,
198,
198,... | 2.986894 | 4,578 |
import json
import requests
data_dir = 'data/'
countries = requests.get('https://restcountries.eu/rest/v2/all?fields=name;alpha2Code').json()
# download stats for each country
for country in countries:
code = country['alpha2Code']
print(code)
response = requests.get('https://api.wigle.net/api/v2/stats/reg... | [
11748,
33918,
198,
11748,
7007,
198,
198,
7890,
62,
15908,
796,
705,
7890,
14,
6,
198,
9127,
1678,
796,
7007,
13,
1136,
10786,
5450,
1378,
2118,
9127,
1678,
13,
12496,
14,
2118,
14,
85,
17,
14,
439,
30,
25747,
28,
3672,
26,
26591,
... | 2.878049 | 287 |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
from aes import AESCipher
import json
if __name__ == "__main__":
key = 'd4f7d2adf42c34a3'
iv = "5c6ca7c26b1b068d"
body_plaintext_1 = '{"status": 200, "message": "ok", "result": {"id": 4, "version": "1.1.2", "rsa": "1234567890", "patch": {"released": [], "... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
532,
9,
12,
19617,
25,
41002,
12,
23,
532,
9,
12,
198,
198,
6738,
257,
274,
1330,
34329,
34,
10803,
198,
11748,
33918,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
... | 1.915757 | 641 |
from fopid_control import fpid
from struct import pack, unpack
import socket
from select import select
'''
This is a proof-of-concept code for running real-time
FO PID control from Python using a UDP socket
'''
UDP_IP = "127.0.0.1"
UDP_PORT_REMOTE = 5101 # The port where the computed control law is sent (client port... | [
6738,
277,
404,
312,
62,
13716,
1330,
277,
35317,
198,
6738,
2878,
1330,
2353,
11,
555,
8002,
198,
11748,
17802,
198,
6738,
2922,
1330,
2922,
198,
198,
7061,
6,
198,
1212,
318,
257,
6617,
12,
1659,
12,
43169,
2438,
329,
2491,
1103,
... | 2.82296 | 723 |
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
from HTMLObfuscator import HTMLObfuscator
import optparse
# Press the green button in the gutter to run the script.
if __na... | [
2,
770,
318,
257,
6291,
11361,
4226,
13,
198,
198,
2,
4332,
15576,
10,
37,
940,
284,
12260,
340,
393,
6330,
340,
351,
534,
2438,
13,
198,
2,
4332,
11198,
15576,
284,
2989,
8347,
329,
6097,
11,
3696,
11,
2891,
9168,
11,
4028,
11,
... | 2.793605 | 344 |
from unittest.case import skip
from test.deploy.deploy_test_case import DeployTestCase
| [
6738,
555,
715,
395,
13,
7442,
1330,
14267,
198,
198,
6738,
1332,
13,
2934,
1420,
13,
2934,
1420,
62,
9288,
62,
7442,
1330,
34706,
14402,
20448,
628
] | 3.296296 | 27 |
from .CellState import CellState
import copy
import pyopencl as cl
import sys
import os
import pickle
import csv
import numpy
import inspect
import imp
import configparser
import importlib
class Simulator:
"""
This class is in charge of running the simulation, creating the various models
and stepping them forward ... | [
6738,
764,
28780,
9012,
1330,
12440,
9012,
198,
11748,
4866,
198,
11748,
12972,
9654,
565,
355,
537,
198,
11748,
25064,
198,
11748,
28686,
198,
11748,
2298,
293,
198,
11748,
269,
21370,
198,
11748,
299,
32152,
198,
11748,
10104,
198,
1174... | 3.66624 | 782 |
## @ingroup Methods-Weights-Correlations-General_Aviation
# landing_gear.py
#
# Created: Feb 2018, M. Vegh
# Modified:
# ----------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------
from SUAVE.Core import Data,Units
impor... | [
2235,
2488,
278,
3233,
25458,
12,
1135,
2337,
12,
10606,
39468,
12,
12218,
62,
7355,
3920,
198,
2,
9581,
62,
31763,
13,
9078,
198,
2,
220,
198,
2,
15622,
25,
220,
3158,
2864,
11,
337,
13,
8016,
456,
198,
2,
40499,
25,
220,
198,
... | 2.830909 | 550 |
import numpy as np
from math import pi
from numpy.linalg import norm
def circle_point(p, q):
"""
special math operation
:param p: a vector (1,4)
:param q: a vector (1,4)
:return: a vector with shape (1,4)
"""
p_0 = p[0]
p_v = p[1:]
q_0 = q[0]
q_v = q[1:]
result = np.zeros... | [
11748,
299,
32152,
355,
45941,
198,
6738,
10688,
1330,
31028,
198,
6738,
299,
32152,
13,
75,
1292,
70,
1330,
2593,
628,
198,
4299,
9197,
62,
4122,
7,
79,
11,
10662,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
2041,
10688,
4... | 2.032021 | 6,527 |
'''
Created on Dec 23, 2016
@author: safdar
'''
import cv2
from operations.baseoperation import Operation
import pickle
from utils.plotter import Image
from utils.plotter import Graph
| [
7061,
6,
198,
41972,
319,
4280,
2242,
11,
1584,
198,
198,
31,
9800,
25,
1932,
27455,
198,
7061,
6,
198,
11748,
269,
85,
17,
198,
6738,
4560,
13,
8692,
27184,
1330,
14680,
198,
11748,
2298,
293,
198,
6738,
3384,
4487,
13,
29487,
353,... | 3.363636 | 55 |
# Copyright 2018 Timo Nolle
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in t... | [
2,
220,
15069,
2864,
5045,
78,
399,
349,
293,
198,
2,
198,
2,
220,
770,
1430,
318,
1479,
3788,
25,
345,
460,
17678,
4163,
340,
290,
14,
273,
13096,
198,
2,
220,
340,
739,
262,
2846,
286,
262,
22961,
3611,
5094,
13789,
355,
3199,
... | 2.79078 | 564 |
'''
Author: Leon-Francis
Date: 2021-07-07 22:13:56
Contact: leon_francis@163.com
LastEditTime: 2021-07-09 00:46:49
LastEditors: Leon-Francis
Description: socket_server
FilePath: /Network_Security_Experiment/client.py
(C)Copyright 2020-2021, Leon-Francis
'''
import socket
from crypto import get_RSA_keys, get_random_byte... | [
7061,
6,
198,
13838,
25,
10592,
12,
42885,
271,
198,
10430,
25,
33448,
12,
2998,
12,
2998,
2534,
25,
1485,
25,
3980,
198,
17829,
25,
443,
261,
62,
8310,
1192,
271,
31,
24136,
13,
785,
198,
5956,
18378,
7575,
25,
33448,
12,
2998,
1... | 1.780041 | 2,455 |
import unittest
from flatten import parse_line
import extractionMap as extractionMap
# userClick: "tutorial.scr,9-13-2018,12:16:12:890,1536866172890,1,1.0,userClick:297_639;region:QnA;NA;NA,false,false,false,false,false,false"
# clickActionLabel: "tutorial.scr,... | [
11748,
555,
715,
395,
198,
6738,
27172,
268,
1330,
21136,
62,
1370,
198,
11748,
22236,
13912,
355,
22236,
13912,
198,
2,
2836,
8164,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
... | 2.164336 | 572 |
from macpie import lltools
| [
6738,
8352,
21749,
1330,
32660,
31391,
628,
628,
628,
628,
628,
628,
198
] | 3 | 13 |
__author__ = 'ershadmoi'
import re
import sys
# Small utility method to copy between two streams
# Main method that will do code generation magic
# Call main only if explicity invoked
if __name__ == "__main__":
main(sys.argv)
| [
834,
9800,
834,
796,
705,
364,
18108,
5908,
72,
6,
198,
198,
11748,
302,
198,
11748,
25064,
198,
198,
2,
10452,
10361,
2446,
284,
4866,
1022,
734,
15190,
198,
198,
2,
8774,
2446,
326,
481,
466,
2438,
5270,
5536,
198,
198,
2,
4889,
... | 3.232877 | 73 |
from django.conf import settings
from storages.backends.s3boto3 import S3Boto3Storage
| [
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
6738,
336,
273,
1095,
13,
1891,
2412,
13,
82,
18,
65,
2069,
18,
1330,
311,
18,
33,
2069,
18,
31425,
628,
628
] | 2.966667 | 30 |
#
# Copyright 2018-2019 IBM Corp. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | [
2,
198,
2,
15069,
2864,
12,
23344,
19764,
11421,
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,
345,
743,
407,
779,
428,
2393,
2845,
287,
118... | 3.560606 | 264 |
'''
Problem 47
The first two consecutive numbers to have two distinct prime factors are:
14 = 2 × 7
15 = 3 × 5
The first three consecutive numbers to have three distinct prime factors are:
644 = 2² × 7 × 23
645 = 3 × 5 × 43
646 = 2 × 17 × 19.
Find the first four consecutive integers to have four distinct prime fact... | [
7061,
6,
198,
40781,
6298,
198,
464,
717,
734,
12785,
3146,
284,
423,
734,
7310,
6994,
5087,
389,
25,
198,
198,
1415,
796,
362,
13958,
767,
198,
1314,
796,
513,
13958,
642,
198,
198,
464,
717,
1115,
12785,
3146,
284,
423,
1115,
7310... | 3.423313 | 163 |
import jieba
test_sent = (
"李小福是创新办主任也是云计算方面的专家; 什么是八一双鹿\n"
"例如我输入一个带“韩玉赏鉴”的标题,在自定义词库中也增加了此词为N类\n"
"「台中」正確應該不會被切開。mac上可分出「石墨烯」;此時又可以分出來凱特琳了。"
)
words = jieba.cut(test_sent)
print('/'.join(words))
# -------------加载自定义词典----------------
# import jieba
# jieba.load_userdict("userdict.txt")
# import jieba.posseg as ps... | [
11748,
474,
494,
7012,
628,
198,
9288,
62,
34086,
796,
357,
198,
1,
30266,
236,
22887,
237,
163,
99,
237,
42468,
26344,
249,
23877,
108,
27950,
252,
10310,
119,
20015,
119,
20046,
253,
42468,
12859,
239,
164,
106,
94,
163,
106,
245,
... | 0.791636 | 1,363 |
"""
Implementation of attack methods. Running this file as a program will
apply the attack to the model specified by the config file and store
the examples in an .npy file.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
... | [
37811,
201,
198,
3546,
32851,
286,
1368,
5050,
13,
18162,
428,
2393,
355,
257,
1430,
481,
201,
198,
39014,
262,
1368,
284,
262,
2746,
7368,
416,
262,
4566,
2393,
290,
3650,
201,
198,
1169,
6096,
287,
281,
764,
77,
9078,
2393,
13,
20... | 2.04375 | 1,920 |
#!/usr/bin/python3
'''
Semelhantes aos scripts for_sem_else_v1 e for_com_else_v2
Porem usando conjunto,set
Ficando bem mais simples de entender
Explicacao das linhas 26 e 27
Chamamos o metodo intersection do conjunto PALAVRAS_PROIBIDAS
Ele precisa de outro conjunto para funcionar
Usando o set, transforman... | [
2,
48443,
14629,
14,
8800,
14,
29412,
18,
198,
198,
7061,
6,
198,
13900,
417,
71,
39781,
257,
418,
14750,
329,
62,
43616,
62,
17772,
62,
85,
16,
304,
329,
62,
785,
62,
17772,
62,
85,
17,
198,
47,
29625,
514,
25440,
11644,
403,
1... | 2.44586 | 471 |
"""Package to visualise and simulate a Rubik's Cube."""
class Cube:
"""
A class which represents a Rubik's Cube.
Attributes
----------
cube : list of list of list of str
3-dimentional list of size 6*N*N for an NxN cube which stores
all stickers of the cube. Each sticker... | [
37811,
27813,
284,
5874,
786,
290,
29308,
257,
6256,
1134,
338,
23315,
526,
15931,
201,
198,
201,
198,
201,
198,
4871,
23315,
25,
201,
198,
220,
220,
220,
37227,
201,
198,
220,
220,
220,
317,
1398,
543,
6870,
257,
6256,
1134,
338,
2... | 2.319421 | 1,174 |
f1 = open("./part/pic-import.tex",mode="r",encoding="utf-8")
content = f1.read()
f1.close()
rep = content.replace(r' \\','')
with open("./part/pic-import.tex",mode="w",encoding="utf-8") as f2:
f2.write(rep)
| [
69,
16,
796,
1280,
7,
1911,
14,
3911,
14,
16564,
12,
11748,
13,
16886,
1600,
14171,
2625,
81,
1600,
12685,
7656,
2625,
40477,
12,
23,
4943,
198,
11299,
796,
277,
16,
13,
961,
3419,
198,
69,
16,
13,
19836,
3419,
198,
198,
7856,
796... | 2.193878 | 98 |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
2,
15069,
13130,
3012,
11419,
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... | 2.673032 | 6,441 |
from django.db import models
from profiles.models import Profile
from tools.random_token import generate_random_token
from .spell import Spell
class Spellbook(models.Model):
"""A spellbook of a character"""
"""Spellbook name"""
name = models.CharField(
verbose_name="Name",
max_length=50... | [
6738,
42625,
14208,
13,
9945,
1330,
4981,
198,
198,
6738,
16545,
13,
27530,
1330,
13118,
198,
6738,
4899,
13,
25120,
62,
30001,
1330,
7716,
62,
25120,
62,
30001,
198,
198,
6738,
764,
46143,
1330,
11988,
628,
198,
4871,
11988,
2070,
7,
... | 2.808841 | 837 |
from flytekitplugins.spark import Spark
from flytekitplugins.spark.task import new_spark_session
import flytekit
from flytekit import task
from flytekit.common.tasks.sdk_runnable import ExecutionParameters
from flytekit.extend import Image, ImageConfig, SerializationSettings
| [
6738,
6129,
660,
15813,
37390,
13,
2777,
668,
1330,
17732,
198,
6738,
6129,
660,
15813,
37390,
13,
2777,
668,
13,
35943,
1330,
649,
62,
2777,
668,
62,
29891,
198,
198,
11748,
6129,
660,
15813,
198,
6738,
6129,
660,
15813,
1330,
4876,
... | 3.4875 | 80 |
import os, fnmatch, importlib
BASEDIR = os.path.dirname(os.path.abspath(__file__))
SELF_FILE = os.path.abspath(__file__)
SERVICE_FILENAME = os.environ.get("SERVICE_FILENAME", "services.py")
all_services = find_all(SERVICE_FILENAME, BASEDIR)
for file_path in all_services:
relative_python_path = file_path.repl... | [
11748,
28686,
11,
24714,
15699,
11,
1330,
8019,
198,
198,
33,
42827,
4663,
796,
28686,
13,
6978,
13,
15908,
3672,
7,
418,
13,
6978,
13,
397,
2777,
776,
7,
834,
7753,
834,
4008,
198,
50,
37738,
62,
25664,
796,
28686,
13,
6978,
13,
... | 2.586592 | 179 |
import pytest
import requests
import httpretty
import json
from context import optimizely
@httpretty.activate
@httpretty.activate
| [
11748,
12972,
9288,
198,
11748,
7007,
198,
11748,
2638,
16100,
198,
11748,
33918,
198,
6738,
4732,
1330,
27183,
306,
628,
198,
31,
4023,
16100,
13,
39022,
628,
198,
31,
4023,
16100,
13,
39022,
198
] | 3.941176 | 34 |
import unittest
import datetime as dt
from src.config.appConfig import getConfig
from src.fetchers.genUnitOutagesFetcher import fetchMajorGenUnitOutages
from src.typeDefs.outage import IOutage
from typing import List
| [
11748,
555,
715,
395,
198,
11748,
4818,
8079,
355,
288,
83,
198,
6738,
12351,
13,
11250,
13,
1324,
16934,
1330,
651,
16934,
198,
6738,
12351,
13,
34045,
3533,
13,
5235,
26453,
7975,
1095,
37,
316,
2044,
1330,
21207,
24206,
13746,
26453,... | 3.460317 | 63 |
''' Global and Local Variable Scopes
Variables defined inside a function body have a local scope.
Variables defined outside a function have a global scope.
Global variables can be accessed anywhere in your python file.
Localvariables can only be accesses inside the function it belongs to.
I can use the... | [
7061,
6,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8060,
290,
10714,
35748,
1446,
13920,
198,
23907,
2977,
5447,
2641,
257,
2163,
1767,
423,
257,
1957,
8354,
13,
198,
23907,
2977,
5447,
235... | 3.181132 | 265 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-06-08 13:17
from __future__ import unicode_literals
from django.db import migrations, models
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2980,
515,
416,
37770,
352,
13,
940,
13,
22,
319,
2177,
12,
3312,
12,
2919,
1511,
25,
1558,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
... | 2.736842 | 57 |
# coding=utf-8
"""
Manages Github requests
"""
import json
import typing
import requests
from esst import LOGGER
BASE_URL = 'https://api.github.com/'
def get_latest_release(owner: str, repo: str) -> typing.Tuple[str, str, str]:
"""
Args:
owner: owner of the Github repo
repo: name of the ... | [
2,
19617,
28,
40477,
12,
23,
198,
37811,
198,
5124,
1095,
38994,
7007,
198,
37811,
198,
198,
11748,
33918,
198,
11748,
19720,
198,
198,
11748,
7007,
198,
198,
6738,
1658,
301,
1330,
41605,
30373,
198,
198,
33,
11159,
62,
21886,
796,
7... | 2.695238 | 210 |
import os
import matplotlib.pyplot as plt
from osgeo import gdal
import numpy
import pygeoprocessing
CUR_DIR = os.path.dirname(__file__)
DATA_DIR = os.path.join(CUR_DIR, '..', '..', 'docker', 'data')
if __name__ == '__main__':
unproj_dem = os.path.join(DATA_DIR, 'ASTGTM2_N37W120_dem.tif')
render(unproj_dem,... | [
11748,
28686,
198,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
6738,
28686,
469,
78,
1330,
308,
31748,
198,
11748,
299,
32152,
198,
11748,
12972,
469,
404,
305,
919,
278,
198,
198,
34,
4261,
62,
34720,
796,
2868... | 1.954492 | 857 |
import numpy as np
from matplotlib import pyplot as plt
T = 10e-6 # signal duration (s)
Dt = 0.1e-6 # sampling interval (s)
T1 = 5e-6 # pulse "on" duration (s)
A = 1 # signal amplitude
t = np.arange(-T/2, T/2, Dt) # time axis
x = Α * (np.abs(t) <= T1/2).astype(float)
plt.close('all')... | [
11748,
299,
32152,
355,
45941,
198,
6738,
2603,
29487,
8019,
1330,
12972,
29487,
355,
458,
83,
198,
198,
51,
796,
838,
68,
12,
21,
220,
220,
1303,
6737,
9478,
357,
82,
8,
198,
35,
83,
796,
657,
13,
16,
68,
12,
21,
1303,
19232,
1... | 1.868526 | 251 |
# -*- coding: utf-8 -*-
#
# Copyright(c) 2014 palmhold.com
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
198,
2,
15069,
7,
66,
8,
1946,
18057,
2946,
13,
785,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
345,
7... | 2.428409 | 880 |
import csv
readMonedas() | [
11748,
269,
21370,
198,
198,
961,
9069,
276,
292,
3419
] | 2.5 | 10 |
# qr_lstsq_eigs.py
"""Volume 1A: QR 2 (Least Squares and Computing Eigenvalues).
<Name>
<Class>
<Date>"""
import numpy as np
from cmath import sqrt
from scipy import linalg as la
from matplotlib import pyplot as plt
# Problem 1
def least_squares(A, b):
"""Calculate the least squares solutions to Ax = b using QR ... | [
2,
10662,
81,
62,
75,
6448,
80,
62,
68,
9235,
13,
9078,
198,
37811,
31715,
352,
32,
25,
42137,
362,
357,
3123,
459,
5056,
3565,
290,
38589,
412,
9324,
27160,
737,
198,
27,
5376,
29,
198,
27,
9487,
29,
198,
27,
10430,
29,
37811,
... | 2.575514 | 1,119 |
import pandas as pd
import duckdb
import datetime
| [
11748,
19798,
292,
355,
279,
67,
198,
11748,
22045,
9945,
198,
11748,
4818,
8079,
198
] | 3.333333 | 15 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2014-2015 pocsuite developers (http://seebug.org)
See the file 'docs/COPYING' for copying permission
"""
#命令行
from pocsuite import pocsuite_cli
#验证模块
from pocsuite import pocsuite_verify
#攻击模块
from pocsuite import pocsuite_attack
#控制台模式
from pocsuite impo... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
37811,
198,
15269,
357,
66,
8,
1946,
12,
4626,
279,
420,
2385,
578,
6505,
357,
4023,
1378,
325,
1765,
1018,
13,
... | 2.214612 | 219 |
"""Run CNN from NAIP data."""
import tensorflow as tf
import params
# Should import these from gather_cliff_images or from common parameters file
# TODO: (what I was doing)
# inputs are 8 x 8 x 16 tensors along with 16 x 1 tensors -- tf doesn't like this
# can we have a dense feeding into a cnn, or vice versa?
d... | [
37811,
10987,
8100,
422,
11746,
4061,
1366,
526,
15931,
198,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
11748,
42287,
628,
198,
2,
10358,
1330,
777,
422,
6431,
62,
565,
733,
62,
17566,
393,
422,
2219,
10007,
2393,
628,
198,
2,
16... | 2.565531 | 1,526 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Paint Factory Puzzle
# Author: mu.ammad.ud.din@gmail.com
# Last Update: 09 March 2019
# License: MIT
from support_services.utils import compareCustomers, compareChoices, analyzePop, compare_to_key
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
2,
23467,
19239,
23966,
198,
2,
6434,
25,
38779,
13,
26035,
13,
463,
13,
25194,
31,
14816,
13,
785,
198,
2... | 2.704082 | 98 |
import urllib
import sqlite3
from datetime import datetime
from math import log
# Download stock data from Google Finance
if __name__ == "__main__":
try:
# Get indices tickers
index_list=[".DJI",".INX"]
# Open SQLite database
sql_conn=sqlite3.connect("/ho... | [
11748,
2956,
297,
571,
201,
198,
11748,
44161,
578,
18,
201,
198,
6738,
4818,
8079,
1330,
4818,
8079,
201,
198,
6738,
10688,
1330,
2604,
201,
198,
201,
198,
2,
10472,
4283,
1366,
422,
3012,
15007,
201,
198,
220,
220,
220,
220,
201,
... | 2.191489 | 376 |
"""
Contains Qt-widgets to visualize measurements.
"""
import math
import time
from PyQt5.QtCore import Qt, QTimer, pyqtSlot, QPointF
from PyQt5.QtGui import QPen, QBrush, QPolygonF, QLinearGradient, QColor, QPainter
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QGraphicsScene, QGraphicsView, QGraphicsTextItem
fro... | [
37811,
198,
4264,
1299,
33734,
12,
28029,
11407,
284,
38350,
13871,
13,
198,
37811,
198,
198,
11748,
10688,
198,
11748,
640,
198,
6738,
9485,
48,
83,
20,
13,
48,
83,
14055,
1330,
33734,
11,
1195,
48801,
11,
12972,
39568,
38963,
11,
11... | 2.28678 | 2,950 |
"""Unit tests for orbitpy.preprocess module.
"""
import unittest
import json
import numpy
import sys, os | [
37811,
26453,
5254,
329,
13066,
9078,
13,
3866,
14681,
8265,
13,
198,
37811,
198,
198,
11748,
555,
715,
395,
198,
11748,
33918,
198,
11748,
299,
32152,
198,
11748,
25064,
11,
28686
] | 3.387097 | 31 |
import numpy as np
from .base import Metric
| [
11748,
299,
32152,
355,
45941,
198,
198,
6738,
764,
8692,
1330,
3395,
1173,
628
] | 3.285714 | 14 |
import logging
import pandas as pd
from mlblocks import MLPipeline
LOGGER = logging.getLogger(__name__)
| [
11748,
18931,
198,
198,
11748,
19798,
292,
355,
279,
67,
198,
6738,
25962,
27372,
1330,
10373,
47,
541,
4470,
198,
198,
25294,
30373,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
628,
198
] | 3 | 36 |
#!/usr/bin/python3.7
# -*- coding: utf-8 -*-
# @Time : 2019/5/7 23:08
# @Email : jtyoui@qq.com
# @Software: PyCharm
from .Japan import cut, analysis # 日语单词提取
| [
2,
48443,
14629,
14,
8800,
14,
29412,
18,
13,
22,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2488,
7575,
220,
220,
220,
1058,
13130,
14,
20,
14,
22,
2242,
25,
2919,
198,
2,
2488,
15333,
220,
1058,
4... | 1.873563 | 87 |
import numpy as np
from scipy import stats
from scipy.signal import butter, filtfilt
import warnings
from .data import peakdet
def estimate_fundamental(dat, samplerate, highcut=3000, normalize=-1, four_search_range=(-20, 20)):
"""
Estimates the fundamental frequency in the data.
:param dat: one di... | [
11748,
299,
32152,
355,
45941,
198,
6738,
629,
541,
88,
1330,
9756,
198,
6738,
629,
541,
88,
13,
12683,
282,
1330,
9215,
11,
1226,
27110,
2326,
198,
11748,
14601,
198,
198,
6738,
764,
7890,
1330,
9103,
15255,
628,
628,
628,
628,
198,
... | 2.597536 | 487 |
all_firewalls = {u'firewalls': [{u'budget': 10287,
u'cloud': {u'cloudId': 1},
u'customer': {u'customerId': 11111},
u'description': u'application1203',
u'firewallId': 125571,
... | [
439,
62,
6495,
86,
5691,
796,
1391,
84,
6,
6495,
86,
5691,
10354,
685,
90,
84,
6,
37315,
10354,
838,
27800,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
... | 1.379774 | 7,436 |
import torch
import torch.nn as nn
import torch.nn.functional as F
import os
from .backbone import Basenet
| [
11748,
28034,
198,
11748,
28034,
13,
20471,
355,
299,
77,
198,
11748,
28034,
13,
20471,
13,
45124,
355,
376,
198,
11748,
28686,
198,
198,
6738,
764,
1891,
15992,
1330,
6455,
268,
316,
198,
220,
220,
220,
220,
628,
198,
220,
220,
220,
... | 2.403509 | 57 |
import matplotlib.pyplot as plt
import matplotlib.collections as plt_collections
from matplotlib.widgets import Button
import csv
csvFilaPath = 'log.csv'
frames = dict()
with open(csvFilaPath, 'r') as file:
rows = csv.reader(file, delimiter=',')
for row in rows:
if len(row) < 3 or not row[0].starts... | [
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
2603,
29487,
8019,
13,
4033,
26448,
355,
458,
83,
62,
4033,
26448,
198,
6738,
2603,
29487,
8019,
13,
28029,
11407,
1330,
20969,
198,
11748,
269,
21370,
198,
198,
40664... | 2.288611 | 2,318 |
import os
import sys
root_dir_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(root_dir_path)
| [
11748,
28686,
198,
11748,
25064,
198,
198,
15763,
62,
15908,
62,
6978,
796,
28686,
13,
6978,
13,
397,
2777,
776,
7,
418,
13,
6978,
13,
22179,
7,
418,
13,
6978,
13,
15908,
3672,
7,
834,
7753,
834,
828,
705,
492,
6,
4008,
198,
17597... | 2.357143 | 56 |
# file: train_cdsa_f_att.py
# author: Yue Jian
# Copyright (C) 2020. All Rights Reserved.
import pandas as pd
import numpy as np
import jieba
import copy
from keras.preprocessing.text import Tokenizer
from keras_preprocessing.sequence import pad_sequences
from keras.models import Model
from keras.layers import Input,... | [
2,
2393,
25,
4512,
62,
66,
9310,
64,
62,
69,
62,
1078,
13,
9078,
198,
2,
1772,
25,
32854,
40922,
198,
2,
15069,
357,
34,
8,
12131,
13,
1439,
6923,
33876,
13,
198,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
299,
32152,
355... | 2.222802 | 1,342 |
import setuptools
packages = setuptools.find_packages(exclude=['docs', 'tests'])
setuptools.setup(name='shnootalk_cc_server', version='testing', packages=packages)
| [
11748,
900,
37623,
10141,
198,
198,
43789,
796,
900,
37623,
10141,
13,
19796,
62,
43789,
7,
1069,
9152,
28,
17816,
31628,
3256,
705,
41989,
6,
12962,
198,
2617,
37623,
10141,
13,
40406,
7,
3672,
11639,
1477,
77,
1025,
971,
62,
535,
62... | 3.113208 | 53 |
import pytest
import securemailbox
from securemailbox.models import Message, Mailbox
@pytest.fixture
# Force fixture to be used if not explicitly imported
@pytest.fixture(autouse=True)
| [
11748,
12972,
9288,
198,
198,
11748,
5713,
4529,
3524,
198,
6738,
5713,
4529,
3524,
13,
27530,
1330,
16000,
11,
11099,
3524,
628,
198,
31,
9078,
9288,
13,
69,
9602,
628,
198,
2,
5221,
29220,
284,
307,
973,
611,
407,
11777,
17392,
198,... | 3.454545 | 55 |
import pickle
import numpy as np
if __name__ == '__main__':
model = None
cv = None
# with open('assets/cv.pkl', 'rb') as f:
# cv = pickle.load(f)
#
# with open('assets/lda15.pkl', 'rb') as f:
# model = pickle.load(f)[0]
#
# text = "My husband and I wanted to get away but... | [
11748,
2298,
293,
198,
11748,
299,
32152,
355,
45941,
628,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
2746,
796,
6045,
198,
220,
220,
220,
269,
85,
796,
6045,
198,
220,
220,
220,
130... | 2.957233 | 795 |
# -*- coding: utf-8 -*-
from atf_regparser.preprocs import USCode
from regparser.test_utils.xml_builder import XMLBuilder
def test_uscode_transform():
"""US Code issues"""
with XMLBuilder("PART") as ctx:
with ctx.REGTEXT(ID="RT1"):
with ctx.SECTION():
ctx.SECTNO(u"§ 478.103... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
379,
69,
62,
2301,
48610,
13,
3866,
1676,
6359,
1330,
1294,
10669,
198,
6738,
842,
48610,
13,
9288,
62,
26791,
13,
19875,
62,
38272,
1330,
23735,
32875,
628,
198,
... | 1.992982 | 285 |
import numpy as np
from yt.testing import assert_array_almost_equal
from yt.utilities.math_utils import \
get_sph_r_component, \
get_sph_theta_component, \
get_sph_phi_component, \
get_cyl_r_component, \
get_cyl_z_component, \
get_cyl_theta_component, \
get_cyl_r, get_cyl_theta, \
get_c... | [
11748,
299,
32152,
355,
45941,
198,
198,
6738,
331,
83,
13,
33407,
1330,
6818,
62,
18747,
62,
28177,
62,
40496,
198,
6738,
331,
83,
13,
315,
2410,
13,
11018,
62,
26791,
1330,
3467,
198,
220,
220,
220,
651,
62,
82,
746,
62,
81,
62,... | 1.771593 | 521 |
from django.core.management.base import BaseCommand
from django.utils import timezone
from geo.models import County, AdminRegion, Tract
from indicators.models import CensusValue, CensusVariable, CensusSource
REGIONAL_COUNTIES = (
'Allegheny',
'Washington',
'Butler',
'Armstrong',
'Westmoreland',
... | [
6738,
42625,
14208,
13,
7295,
13,
27604,
13,
8692,
1330,
7308,
21575,
198,
6738,
42625,
14208,
13,
26791,
1330,
640,
11340,
198,
198,
6738,
40087,
13,
27530,
1330,
3418,
11,
32053,
47371,
11,
309,
974,
198,
6738,
21337,
13,
27530,
1330,... | 2.566802 | 247 |
from typing import (
Any, Dict, List, Literal, Optional, Sequence, SupportsInt, Union
)
from ..route import Route
from ..utils import MISSING
from .base import Requester
| [
6738,
19720,
1330,
357,
198,
220,
220,
220,
4377,
11,
360,
713,
11,
7343,
11,
25659,
1691,
11,
32233,
11,
45835,
11,
45267,
5317,
11,
4479,
198,
8,
198,
198,
6738,
11485,
38629,
1330,
18956,
198,
6738,
11485,
26791,
1330,
49684,
2751,... | 3.52 | 50 |
import os
import random
import string
import pymongo
import pysam
from utils import Xpos
class SequencesClient(object):
'''Manages CRAMS for all chromosomes. Assumes one CRAM per chromosome.'''
@staticmethod
@staticmethod
| [
11748,
28686,
198,
11748,
4738,
198,
11748,
4731,
198,
198,
11748,
279,
4948,
25162,
198,
11748,
279,
893,
321,
198,
6738,
3384,
4487,
1330,
1395,
1930,
628,
198,
4871,
24604,
3007,
11792,
7,
15252,
2599,
198,
220,
220,
220,
705,
7061,
... | 3.273973 | 73 |
import folium
# Latitude, Longitude
LOCATION_DATA = [
("41.90093256", "12.48331626"),
("41.89018285", "12.49235900"),
("41.89868519", "12.47684474"),
("41.89454167", "12.48303163"),
("41.90226256", "12.45739340"),
("41.90269661", "12.46635787"),
("41.91071023", "12.47635640"),
("41.9026... | [
11748,
5955,
1505,
198,
198,
2,
5476,
3984,
11,
5882,
3984,
198,
29701,
6234,
62,
26947,
796,
685,
198,
220,
220,
220,
5855,
3901,
13,
12865,
6052,
11645,
1600,
366,
1065,
13,
2780,
2091,
1433,
2075,
12340,
198,
220,
220,
220,
5855,
... | 1.919795 | 586 |
# -*- coding: utf-8 -*-
import threading
import socket
import select
import Queue
import re
import UserRoom
import Utils
# def find_key_in_ring(self, typeOfKeyRing, id_key, type_of_searched_key):
# if typeOfKeyRing == 'pub':
# ring = self.pub_keyring
# else:
# ring = self.p... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
11748,
4704,
278,
198,
11748,
17802,
198,
11748,
2922,
198,
11748,
4670,
518,
198,
11748,
302,
198,
11748,
11787,
41178,
198,
11748,
7273,
4487,
628,
198,
220,
220,
220,
... | 1.896774 | 310 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2020, Anima Istanbul
#
# This module is part of anima and is released under the MIT
# License: http://www.opensource.org/licenses/MIT
def createArnoldTextureSettings():
"""The patched version of the original file
"""
import pymel.core as pm
import maya.cmds... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
15069,
357,
66,
8,
2321,
12,
42334,
11,
1052,
8083,
25299,
198,
2,
198,
2,
770,
8265,
318,
636,
286,
2355,
64,
290,
318,
2716,
739,
262,
17168,
198,
2,
13789,
2... | 2.129522 | 1,714 |
import pafy
import os
songs = """
www.youtube.com/watch?v=PT2_F-1esPk
https://www.youtube.com/watch?v=ek7cafqgYB4
https://www.youtube.com/watch?v=HQnC1UHBvWA
https://www.youtube.com/watch?v=s8XIgR5OGJc
"""
#songs="https://www.youtube.com/watch?v=otv7lJmLJtQ"
#unsure of their artist/title
unsure_songs = []
root = "./o... | [
11748,
279,
1878,
88,
198,
11748,
28686,
198,
198,
82,
28079,
796,
37227,
198,
2503,
13,
11604,
13,
785,
14,
8340,
30,
85,
28,
11571,
17,
62,
37,
12,
16,
274,
47,
74,
198,
5450,
1378,
2503,
13,
11604,
13,
785,
14,
8340,
30,
85,
... | 2.275862 | 290 |
# coding=utf-8
# Copyright 2019 The Tensor2Robot Authors.
#
# 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 ... | [
2,
19617,
28,
40477,
12,
23,
198,
2,
15069,
13130,
383,
309,
22854,
17,
14350,
313,
46665,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
345,
743,
407,
779,
428,
... | 2.589711 | 1,594 |
#2.08 microns.
import numpy as np
from scipy.interpolate import RectBivariateSpline
from scipy.interpolate import interp2d
from scipy.integrate import cumtrapz
import opticstools as ot
import matplotlib.pyplot as plt
mm = np.genfromtxt('2x2_4um_ex.m00', skip_header=4)
x = np.linspace(-8,8,97)
y = np.linspace(0-7.5,2... | [
2,
17,
13,
2919,
12314,
12212,
13,
198,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
629,
541,
88,
13,
3849,
16104,
378,
1330,
48599,
33,
42524,
26568,
500,
198,
6738,
629,
541,
88,
13,
3849,
16104,
378,
1330,
987,
79,
17,
67,
1... | 2.076687 | 652 |
#!/usr/bin/env python3
# -*- coding=utf-8 -*-
import cv2 as cv
import numpy as np
"""
决策树算法
opencv中机器学习模块的决策树算法分为两个类别,一个是随机森林,另一个强化分类,这两种算法都属于决策树算法,相关api如下
cv.ml.StatModel.predict(samples, results, flags)
- sample 输入样本
- results 预测结果
"""
if "__main__" == __name__:
main()
cv.... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
201,
198,
2,
532,
9,
12,
19617,
28,
40477,
12,
23,
532,
9,
12,
201,
198,
201,
198,
11748,
269,
85,
17,
355,
269,
85,
201,
198,
11748,
299,
32152,
355,
45941,
201,
198,
201,
198,
... | 1.188153 | 287 |
"""
matplotlylib
============
This module converts matplotlib figure objects into JSON structures which can
be understood and visualized by Plotly.
Most of the functionality should be accessed through the parent directory's
'tools' module or 'plotly' package.
"""
from __future__ import absolute_import
from .rendere... | [
37811,
198,
6759,
29487,
306,
8019,
198,
25609,
198,
198,
1212,
8265,
26161,
2603,
29487,
8019,
3785,
5563,
656,
19449,
8573,
543,
460,
198,
1350,
7247,
290,
5874,
1143,
416,
28114,
306,
13,
198,
198,
6943,
286,
262,
11244,
815,
307,
... | 3.914286 | 105 |
"""
100 DAYS OF PROGRAMMING CHALLENGE
+++++++ DAY 8 ++++++++
Write a program that accepts a comma separated sequence of words as input and prints the words in a comma-separated sequence after sorting them alphabetically.
Suppose the following input is supplied to the program:
without,hello,bag,world
Then, the output sh... | [
37811,
198,
3064,
24644,
50,
3963,
46805,
44,
2751,
5870,
7036,
1677,
8264,
198,
14030,
45340,
24644,
807,
1343,
14030,
45340,
198,
16594,
257,
1430,
326,
18178,
257,
39650,
11266,
8379,
286,
2456,
355,
5128,
290,
20842,
262,
2456,
287,
... | 3.666667 | 117 |
import os
import datetime
import sys
import json
import numpy as np
from elasticsearch import Elasticsearch, RequestsHttpConnection
TYPE_HEADER_NAME = "Ce-Type"
REQUEST_ID_HEADER_NAME = "Ce-Requestid"
CLOUD_EVENT_ID = "Ce-id"
# in seldon case modelid is node in graph as graph can have multiple models
MODELID_HEADER_NA... | [
11748,
28686,
198,
11748,
4818,
8079,
198,
11748,
25064,
198,
11748,
33918,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
27468,
12947,
1330,
48567,
12947,
11,
9394,
3558,
43481,
32048,
198,
198,
25216,
62,
37682,
1137,
62,
20608,
796,
3... | 2.822835 | 254 |
# Generated by Django 2.1.4 on 2018-12-10 05:38
from django.db import migrations, models
import django.db.models.deletion
| [
2,
2980,
515,
416,
37770,
362,
13,
16,
13,
19,
319,
2864,
12,
1065,
12,
940,
8870,
25,
2548,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
198,
11748,
42625,
14208,
13,
9945,
13,
27530,
13,
2934,
1616,
295,
6... | 2.818182 | 44 |
from chapter_11.name_function import get_formatted_name
print("enter q to quit")
while True:
first = input("enter first name: ")
if first == 'q':
break
last = input("enter last name: ")
if last == 'q':
break
print(get_formatted_name(first, last)) | [
6738,
6843,
62,
1157,
13,
3672,
62,
8818,
1330,
651,
62,
687,
16898,
62,
3672,
628,
198,
4798,
7203,
9255,
10662,
284,
11238,
4943,
198,
4514,
6407,
25,
198,
220,
220,
220,
717,
796,
5128,
7203,
9255,
717,
1438,
25,
366,
8,
198,
2... | 2.567568 | 111 |
# -*- coding: utf-8 -*-
# @Author : Evil0ctal
# @Time : 2021/07/09
# @Function:
# Enter the number of hours and salary rate, calculate the total salary and output to the console.
hours = input("Please input the total hours of the employee worked: ")
rate = input("Please input the hour rate of the employee pay: ")
... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2488,
13838,
220,
1058,
10461,
15,
310,
282,
198,
2,
2488,
7575,
220,
220,
220,
1058,
33448,
14,
2998,
14,
2931,
198,
2,
2488,
22203,
25,
198,
2,
6062,
262,
1271,... | 3.121547 | 362 |
from pieces.queen import Queen
# Represent a rook piece
# Inherits from queen to reuse code for horizontal movement checking
# Inherited constructor
# Update the piece value
# The rook is allowed to move horizontally to any square that is
# unobstructed and does not contain a friendly piec... | [
6738,
5207,
13,
4188,
268,
1330,
7542,
201,
198,
201,
198,
201,
198,
2,
10858,
257,
10929,
3704,
201,
198,
2,
47025,
896,
422,
16599,
284,
32349,
2438,
329,
16021,
3356,
10627,
201,
198,
201,
198,
220,
220,
220,
1303,
47025,
863,
23... | 3.577114 | 201 |
import numpy as np
import pandas as pd
def CIA(df:pd.DataFrame):
"""
Chemical Index of Alteration
type: molecular
ref: Nesbitt and Young (1982)
"""
return 100 * df.Al2O3 / (df.Al2O3 + df.CaO + df.Na2O + df.K2O)
def CIW(df:pd.DataFrame):
"""
Chemical Index of Weathering
type:... | [
11748,
299,
32152,
355,
45941,
198,
11748,
19798,
292,
355,
279,
67,
628,
198,
4299,
7688,
7,
7568,
25,
30094,
13,
6601,
19778,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
24872,
12901,
286,
32770,
341,
198,
220,
220,
220,
... | 2.013846 | 650 |
from enum import Enum
import pytest
from antidote.core import DependencyContainer
from antidote.exceptions import DuplicateDependencyError, UndefinedContextError
from antidote.providers.indirect import IndirectProvider
from antidote.providers.factory import FactoryProvider
@pytest.fixture
@pytest.fixture
@pytes... | [
6738,
33829,
1330,
2039,
388,
198,
198,
11748,
12972,
9288,
198,
198,
6738,
50131,
13,
7295,
1330,
37947,
1387,
29869,
198,
6738,
50131,
13,
1069,
11755,
1330,
49821,
5344,
35,
2690,
1387,
12331,
11,
13794,
18156,
21947,
12331,
198,
6738,... | 2.778302 | 212 |
"""
evaluates a trained Neural Network on its salient features regarding the time and feature dimension
creates a saliency heatmap
model should be trained beforehand
"""
import pandas
import pandas as pd
import torch
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pyplot import step
from statsmodels.... | [
37811,
198,
18206,
12632,
257,
8776,
47986,
7311,
319,
663,
49156,
3033,
5115,
262,
640,
290,
3895,
15793,
198,
20123,
274,
257,
3664,
6160,
4894,
8899,
198,
19849,
815,
307,
8776,
27091,
198,
37811,
198,
11748,
19798,
292,
198,
11748,
... | 2.243305 | 3,473 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# License: MIT (see LICENSE file provided)
# vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
"""
**polib** allows you to manipulate, create, modify gettext files (pot, po
and mo files). You can load existing files, iterate through it's entries,
add, modify entr... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
198,
2,
13789,
25,
17168,
357,
3826,
38559,
24290,
2393,
2810,
8,
198,
2,
43907,
25,
900,
4292,
8658,
7400,
11338,... | 2.09882 | 21,534 |
from Cells.Cell import Cell
from Feedback import Feedback
| [
6738,
39794,
13,
28780,
1330,
12440,
198,
6738,
37774,
1330,
37774,
628
] | 4.916667 | 12 |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
| [
6738,
42625,
14208,
13,
18211,
1330,
2034,
16934,
198,
6738,
42625,
14208,
13,
26791,
13,
41519,
1330,
334,
1136,
5239,
62,
75,
12582,
355,
4808,
198
] | 3.461538 | 26 |
# -*- coding: utf-8 -*-
import urlparse
from flask import current_app
def is_allowed_archive(filename):
""" Check if a filename is a allowed archive """
return '.' in filename and filename.rsplit('.', 1)[1] in \
current_app.config['SUPPORTED_ARCHIVE_EXTENSIONS']
def is_meta_file(filename):
"""... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
11748,
19016,
29572,
198,
198,
6738,
42903,
1330,
1459,
62,
1324,
628,
198,
4299,
318,
62,
40845,
62,
17474,
7,
34345,
2599,
198,
220,
220,
220,
37227,
6822,
611,
... | 2.746269 | 469 |
from django.contrib import admin
# Register your models here.
from .models import Board
admin.site.register(Board) | [
6738,
42625,
14208,
13,
3642,
822,
1330,
13169,
198,
198,
2,
17296,
534,
4981,
994,
13,
198,
6738,
764,
27530,
1330,
5926,
198,
198,
28482,
13,
15654,
13,
30238,
7,
29828,
8
] | 3.625 | 32 |