content stringlengths 1 1.05M | input_ids listlengths 1 883k | ratio_char_token float64 1 22.9 | token_count int64 1 883k |
|---|---|---|---|
import sys, os
sys.path.append("./midlevel-reps")
from visualpriors.taskonomy_network import TaskonomyDecoder
import torch
import torch.nn.functional as F
import torch.nn as nn
SMOOTH = 1e-6
CHANNELS_TO_TASKS = {
1: ['colorization', 'edge_texture', 'edge_occlusion', 'keypoints3d', 'keypoints2d', 'reshading', 'd... | [
11748,
25064,
11,
28686,
198,
17597,
13,
6978,
13,
33295,
7,
1911,
14,
13602,
5715,
12,
260,
862,
4943,
198,
6738,
5874,
3448,
669,
13,
35943,
30565,
62,
27349,
1330,
15941,
30565,
10707,
12342,
198,
198,
11748,
28034,
198,
198,
11748,
... | 2.400835 | 479 |
import os,sys
import numpy as np
import pandas as pd
import geopandas as gpd
import matplotlib.pyplot as plt
import pygeos
from osgeo import gdal
from tqdm import tqdm
import igraph as ig
import contextily as ctx
from rasterstats import zonal_stats
import time
import pylab as pl
from IPython import display
import seabo... | [
11748,
28686,
11,
17597,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
30324,
392,
292,
355,
27809,
67,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
12972,
469,
418,
... | 2.214584 | 9,092 |
from channels.auth import AuthMiddlewareStack
from knox.auth import TokenAuthentication
from django.contrib.auth.models import AnonymousUser
from channels.db import database_sync_to_async
KnoxAuthMiddlewareStack = lambda inner: KnoxAuthMiddleware(AuthMiddlewareStack(inner))
| [
6738,
9619,
13,
18439,
1330,
26828,
34621,
1574,
25896,
198,
6738,
638,
1140,
13,
18439,
1330,
29130,
47649,
3299,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
27530,
1330,
19200,
12982,
198,
6738,
9619,
13,
9945,
1330,
6831,
... | 3.783784 | 74 |
"""Access / change tensor shape."""
import tensorflow as tf
import numpy as np
from .magik import tensor_compat
from .alloc import zeros_like
from .types import has_tensor, as_tensor, cast, dtype
from .shapes import shape, reshape, flatten, transpose, unstack
from ._math_for_indexing import cumprod, minimum, maximum
f... | [
37811,
15457,
1220,
1487,
11192,
273,
5485,
526,
15931,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
11748,
299,
32152,
355,
45941,
198,
198,
6738,
764,
19726,
1134,
1330,
11192,
273,
62,
5589,
265,
198,
6738,
764,
32332,
1330,
1976,
... | 3.252336 | 107 |
from flask import Blueprint, request
from aleph.core import db
from aleph.model import Alert
from aleph.search import DatabaseQueryResult
from aleph.views.forms import AlertSchema
from aleph.views.serializers import AlertSerializer
from aleph.views.util import require, obj_or_404
from aleph.views.util import parse_req... | [
6738,
42903,
1330,
39932,
11,
2581,
198,
198,
6738,
31341,
746,
13,
7295,
1330,
20613,
198,
6738,
31341,
746,
13,
19849,
1330,
23276,
198,
6738,
31341,
746,
13,
12947,
1330,
24047,
20746,
23004,
198,
6738,
31341,
746,
13,
33571,
13,
239... | 3.589744 | 117 |
# 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, software
# distributed under th... | [
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,
7330,
257,
4866,
286,
262,
13789,
379,
198,
2,... | 3.429487 | 312 |
from keras.models import Sequential
from keras.layers.convolutional import Convolution2D, MaxPooling2D, ZeroPadding2D
from keras.layers.core import Activation, Dense, Flatten, Dropout
from keras.optimizers import Adam
from keras.regularizers import l2
from keras import backend as K
def center_normalize(x)... | [
201,
198,
201,
198,
6738,
41927,
292,
13,
27530,
1330,
24604,
1843,
201,
198,
6738,
41927,
292,
13,
75,
6962,
13,
42946,
2122,
282,
1330,
34872,
2122,
17,
35,
11,
5436,
27201,
278,
17,
35,
11,
12169,
47,
26872,
17,
35,
201,
198,
6... | 2.809816 | 163 |
#!/usr/bin/env python3
import sys
import struct
import re
import os
from itertools import chain
import warnings
import tarfile
import sh
from tqdm import tqdm
from pydebhelper import *
from getLatestVersionAndURLWithGitHubAPI import getTargets
config = OrderedDict()
config["llvm"] = {
"descriptionLong": "LLVM e... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
11748,
25064,
198,
11748,
2878,
198,
11748,
302,
198,
11748,
28686,
198,
6738,
340,
861,
10141,
1330,
6333,
198,
11748,
14601,
198,
11748,
13422,
7753,
198,
198,
11748,
427,
198,
673... | 2.432331 | 1,330 |
# -*- encoding: utf-8 -*-
#
# Copyright 2017 Red Hat, Inc.
#
# 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 applicab... | [
2,
532,
9,
12,
21004,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
198,
2,
15069,
220,
2177,
2297,
10983,
11,
3457,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
345,
743... | 2.919795 | 586 |
"""Vehicle's app models."""
import uuid
from django.db import models
from .clients import Client
| [
37811,
37870,
1548,
338,
598,
4981,
526,
15931,
198,
198,
11748,
334,
27112,
198,
6738,
42625,
14208,
13,
9945,
1330,
4981,
198,
6738,
764,
565,
2334,
1330,
20985,
628
] | 3.413793 | 29 |
"""
Entradas
compra-->int-->c
salidas
Descuento-->flot-->d
"""
c=float(input("digite compra"))
#caja negra
d=(c*0.15)
total=(c-d)
#Salidas
print("el total a pagar es de :"+str(total))
| [
37811,
198,
14539,
6335,
292,
220,
198,
5589,
430,
46904,
600,
46904,
66,
198,
82,
10751,
292,
220,
198,
24564,
84,
50217,
46904,
2704,
313,
46904,
67,
198,
37811,
198,
66,
28,
22468,
7,
15414,
7203,
12894,
578,
552,
430,
48774,
198,
... | 2.149425 | 87 |
#LeetCode problem 429: N-ary Tree Level Order Traversal
"""
# Definition for a Node.
class Node:
def __init__(self, val=None, children=None):
self.val = val
self.children = children
"""
| [
2,
3123,
316,
10669,
1917,
42313,
25,
399,
12,
560,
12200,
5684,
8284,
4759,
690,
282,
220,
198,
37811,
198,
2,
30396,
329,
257,
19081,
13,
198,
4871,
19081,
25,
198,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
1188,
28,
14... | 2.653846 | 78 |
# importing the requests library
import requests
import json
# api-endpoint
URL = "http://127.0.0.1:80/water_mark"
# defining a params dict for the parameters to be sent to the API
# data is picture data
# tagString is the text to embed into picture.
data = {
"data":"This is the original text",
"tagStri... | [
2,
33332,
262,
7007,
5888,
220,
198,
11748,
7007,
220,
198,
11748,
33918,
198,
220,
220,
198,
2,
40391,
12,
437,
4122,
220,
198,
21886,
796,
366,
4023,
1378,
16799,
13,
15,
13,
15,
13,
16,
25,
1795,
14,
7050,
62,
4102,
1,
198,
2... | 2.813472 | 193 |
import torch
import torch.nn.functional as F
import torch.nn.init as init
from torch import nn, autograd
from torch.utils.data import DataLoader
from babi import BabiDataset, pad_collate
from torch.nn.utils import clip_grad_norm
torch.backends.cudnn.benchmark = True
torch.backends.cudnn.fastest = True
HIDDEN_DIM ... | [
11748,
28034,
198,
11748,
28034,
13,
20471,
13,
45124,
355,
376,
198,
11748,
28034,
13,
20471,
13,
15003,
355,
2315,
198,
6738,
28034,
1330,
299,
77,
11,
1960,
519,
6335,
198,
6738,
28034,
13,
26791,
13,
7890,
1330,
6060,
17401,
198,
... | 2.054339 | 2,558 |
from lake.models.tba_model import TBAModel
from lake.modules.transpose_buffer_aggregation import TransposeBufferAggregation
from lake.passes.passes import lift_config_reg
import magma as m
from magma import *
import fault
import tempfile
import kratos as k
import random as rand
import pytest
if __name__ == "__main__... | [
6738,
13546,
13,
27530,
13,
83,
7012,
62,
19849,
1330,
23799,
2390,
375,
417,
198,
6738,
13546,
13,
18170,
13,
7645,
3455,
62,
22252,
62,
9460,
43068,
1330,
3602,
3455,
28632,
46384,
43068,
198,
6738,
13546,
13,
6603,
274,
13,
6603,
2... | 3.188679 | 106 |
#! /usr/bin/python3
import sys, os, time
from typing import List, Tuple
from itertools import combinations
if __name__ == "__main__":
main() | [
2,
0,
1220,
14629,
14,
8800,
14,
29412,
18,
198,
198,
11748,
25064,
11,
28686,
11,
640,
198,
6738,
19720,
1330,
7343,
11,
309,
29291,
198,
6738,
340,
861,
10141,
1330,
17790,
628,
220,
220,
220,
220,
628,
628,
198,
198,
361,
11593,
... | 2.736842 | 57 |
import pygame | [
11748,
12972,
6057
] | 4.333333 | 3 |
import pkg_resources
from . import BrummiRepository
DEFAULTS = {
'templates': pkg_resources.resource_filename('brummi', 'templates'),
'out_path': 'docs',
}
| [
11748,
279,
10025,
62,
37540,
198,
198,
6738,
764,
1330,
1709,
388,
11632,
6207,
13264,
198,
198,
7206,
7708,
35342,
796,
1391,
198,
220,
220,
220,
705,
11498,
17041,
10354,
279,
10025,
62,
37540,
13,
31092,
62,
34345,
10786,
1671,
388,... | 2.677419 | 62 |
from pathlib import Path
import numpy as np
THIS_FILE = Path(__file__)
THIS_DIR = THIS_FILE.parent
DEFAULT_CONFIG_FILE = THIS_DIR / 'config' / 'default.yaml'
# Width/height of the visual screens
IMG_WIDTH = 1242
IMG_HEIGHT = 375
# INTRINISCS = np.array([[649.51905284, 0.00000000, 620.50000000],
# ... | [
6738,
3108,
8019,
1330,
10644,
198,
11748,
299,
32152,
355,
45941,
198,
198,
43559,
62,
25664,
796,
10644,
7,
834,
7753,
834,
8,
198,
43559,
62,
34720,
796,
12680,
62,
25664,
13,
8000,
198,
7206,
38865,
62,
10943,
16254,
62,
25664,
79... | 1.926121 | 379 |
# -*- coding: utf-8 -*-
## @package palette.core.color_transfer
#
# Color transfer.
# @author tody
# @date 2015/09/16
import numpy as np
from scipy.interpolate import Rbf
import matplotlib.pyplot as plt
from palette.core.lab_slices import LabSlice, LabSlicePlot, Lab2rgb_py
## Color transfer for ab co... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2235,
2488,
26495,
27043,
13,
7295,
13,
8043,
62,
39437,
198,
2,
198,
2,
220,
5315,
4351,
13,
198,
2,
220,
2488,
9800,
220,
220,
220,
220,
220,
284,
9892,
198,
2,
... | 2.640288 | 139 |
scoult = dict()
gols = list()
time = list()
temp = 0
while True:
scoult['Jogador'] = str(input('Qual o nome do jogador: '))
scoult['Nmero partidas'] = int(input('Quantas partidas foram jogadas? '))
for i in range(0,scoult['Nmero partidas']):
gols.append(int(input(f'Quantos gols foram marcados na par... | [
1416,
25955,
796,
8633,
3419,
198,
70,
10220,
796,
1351,
3419,
198,
2435,
796,
1351,
3419,
198,
29510,
796,
657,
198,
4514,
6407,
25,
198,
220,
220,
220,
629,
25955,
17816,
41,
519,
7079,
20520,
796,
965,
7,
15414,
10786,
46181,
267,
... | 2.102041 | 686 |
# Circles and squares
# Each can be rendered in vector or raster form
from Section07_Bridge.Brigde.Circle import Circle
from Section07_Bridge.Brigde.RasterRenderer import RasterRenderer
from Section07_Bridge.Brigde.VectorRenderer import VectorRenderer
if __name__ == '__main__':
raster = RasterRenderer()
vector... | [
2,
21239,
5427,
290,
24438,
198,
2,
5501,
460,
307,
15111,
287,
15879,
393,
374,
1603,
1296,
198,
6738,
7275,
2998,
62,
37385,
13,
33,
4359,
2934,
13,
31560,
293,
1330,
16291,
198,
6738,
7275,
2998,
62,
37385,
13,
33,
4359,
2934,
13... | 2.853333 | 150 |
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from utils import init
| [
11748,
299,
32152,
355,
45941,
198,
11748,
28034,
198,
11748,
28034,
13,
20471,
355,
299,
77,
198,
11748,
28034,
13,
40085,
355,
6436,
198,
198,
6738,
3384,
4487,
1330,
2315,
628,
628
] | 3.40625 | 32 |
from telethon import events, Button
from .login import user
from .. import jdbot
from ..bot.utils import cmd, TASK_CMD,split_list, press_event
from ..diy.utils import read, write
import asyncio
import re
| [
6738,
5735,
400,
261,
1330,
2995,
11,
20969,
198,
6738,
764,
38235,
1330,
2836,
198,
198,
6738,
11485,
1330,
474,
9945,
313,
198,
6738,
11485,
13645,
13,
26791,
1330,
23991,
11,
309,
1921,
42,
62,
34,
12740,
11,
35312,
62,
4868,
11,
... | 3.073529 | 68 |
#!/usr/bin/python
import box_requests
import requests
import os
import sys
import time
import socket
import optparse
import logging
o=optparse.OptionParser()
o.add_option('-v', '--verbose', action="store_true", dest="verbose",
default=False, help="Display username on success")
o.add_option('-d', '--debug', action="... | [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
198,
11748,
3091,
62,
8897,
3558,
198,
11748,
7007,
198,
11748,
28686,
198,
11748,
25064,
198,
11748,
640,
198,
11748,
17802,
198,
11748,
2172,
29572,
198,
11748,
18931,
198,
198,
78,
28,
8738,... | 2.643258 | 712 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Author: Ivar
"""
from Description import *
from Classification import *
if __name__ == "__main__":
inputdir = "../../../../data/LHA/dataset_1"
outputdir = inputdir+"/csv/exp/"+Util.now()
template = [
{
"name":"RAD",
... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
13838,
25,
314,
7785,
198,
37811,
198,
198,
6738,
12489,
1330,
1635,
198,
6738,
40984,
1330,
1635,
628,... | 1.751974 | 1,520 |
from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor, AdaBoostRegressor
from sklearn.neural_network import MLPRegressor
from sklearn.linear_model import ElasticNet, Ridge, Lasso, BayesianRidge, HuberRegressor
from xgboost import XGBRegressor
from lightgbm import LGBMRegressor
from pyemits.core.... | [
6738,
1341,
35720,
13,
1072,
11306,
1330,
14534,
34605,
8081,
44292,
11,
17701,
1153,
45686,
278,
8081,
44292,
11,
47395,
45686,
8081,
44292,
198,
6738,
1341,
35720,
13,
710,
1523,
62,
27349,
1330,
10373,
4805,
1533,
44292,
198,
6738,
134... | 2.965261 | 403 |
"""
knowledge graph representation using neo4j
this class uses py2neo with will be the final version
"""
import os
import json
from py2neo import Graph, Relationship, NodeMatcher, Node
from network_core.ogm.node_objects import Me, Contact, Misc
USERTYPE = "User"
CONTACTTYPE = "Contact"
ROOT_DIR = os.path.dirname(os.p... | [
37811,
198,
45066,
4823,
10552,
1262,
19102,
19,
73,
198,
5661,
1398,
3544,
12972,
17,
710,
78,
351,
481,
307,
262,
2457,
2196,
198,
37811,
198,
11748,
28686,
198,
11748,
33918,
198,
198,
6738,
12972,
17,
710,
78,
1330,
29681,
11,
397... | 2.072289 | 332 |
import numpy as np
from .chance import by_chance
from .exceptions import EmptyListError
| [
11748,
299,
32152,
355,
45941,
198,
198,
6738,
764,
39486,
1330,
416,
62,
39486,
198,
6738,
764,
1069,
11755,
1330,
33523,
8053,
12331,
628,
628,
198
] | 3.576923 | 26 |
import os
import pandas as pd
from sklearn.linear_model import ElasticNet
from sklearn.metrics import r2_score, mean_squared_error, mean_absolute_error
import argparse
import numpy as np
import json
import joblib
from get_data import read_config
if __name__ == '__main__':
args = argparse.ArgumentParser()
ar... | [
11748,
28686,
198,
11748,
19798,
292,
355,
279,
67,
198,
6738,
1341,
35720,
13,
29127,
62,
19849,
1330,
48567,
7934,
198,
6738,
1341,
35720,
13,
4164,
10466,
1330,
374,
17,
62,
26675,
11,
1612,
62,
16485,
1144,
62,
18224,
11,
1612,
62... | 3 | 154 |
"""
Visualisation of maximum/minimum magnitude for GCVS stars.
"""
import sys
import matplotlib.pyplot as plot
from pygcvs import read_gcvs
if __name__ == '__main__':
try:
gcvs_file = sys.argv[1]
except IndexError:
print('Usage: python plot_magnitudes.py <path to iii.dat>')
else:
... | [
37811,
198,
36259,
5612,
286,
5415,
14,
39504,
14735,
329,
20145,
20304,
5788,
13,
198,
37811,
198,
198,
11748,
25064,
198,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
7110,
198,
198,
6738,
12972,
36484,
14259,
1330,
1100,
62,
... | 2.255869 | 426 |
# Generated by Django 3.0.5 on 2020-04-21 07:24
from django.db import migrations
| [
2,
2980,
515,
416,
37770,
513,
13,
15,
13,
20,
319,
12131,
12,
3023,
12,
2481,
8753,
25,
1731,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
628
] | 2.766667 | 30 |
"""weideshop URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | [
37811,
732,
1460,
8548,
10289,
28373,
198,
198,
464,
4600,
6371,
33279,
82,
63,
1351,
11926,
32336,
284,
5009,
13,
1114,
517,
1321,
3387,
766,
25,
198,
220,
220,
220,
3740,
1378,
31628,
13,
28241,
648,
404,
305,
752,
13,
785,
14,
26... | 2.74055 | 582 |
#!/usr/bin/env python3
import os
import sys
import configparser
import fileinput
import netorlogging
import datetime
from shutil import copyfile
def _netor_config():
"""
It is used for updating the Neto home directory in the configuration files and scripts.
This is useful, if you want to have 2 working ... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
11748,
28686,
198,
11748,
25064,
198,
11748,
4566,
48610,
198,
11748,
2393,
15414,
198,
11748,
2010,
273,
6404,
2667,
198,
11748,
4818,
8079,
198,
6738,
4423,
346,
1330,
4866,
7... | 2.634556 | 6,841 |
import pytest
from zoo.auditing.models import Issue
from zoo.auditing.check_discovery import Effort, Kind, Severity
pytestmark = pytest.mark.django_db
query = """
mutation test ($input: CheckRepositoryByCommitInput!) {
checkRepositoryByCommit (input: $input) {
allCheckResults {
isFound
... | [
11748,
12972,
9288,
198,
198,
6738,
26626,
13,
3885,
1780,
13,
27530,
1330,
18232,
198,
6738,
26626,
13,
3885,
1780,
13,
9122,
62,
67,
40821,
1330,
27848,
419,
11,
14927,
11,
26434,
414,
628,
198,
9078,
9288,
4102,
796,
12972,
9288,
1... | 2.141593 | 226 |
# -*- coding: utf-8 -*-
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
198,
31373,
796,
48700,
13,
9979,
415,
10786,
15496,
11,
309,
22854,
37535,
0,
11537,
198,
82,
408,
796,
48700,
13,
36044,
341... | 2.436364 | 55 |
from random import randint
from typing import Optional
from behavioral.command.data import Trader
from behavioral.command.logic.generators import ItemsGenerator
| [
6738,
4738,
1330,
43720,
600,
198,
6738,
19720,
1330,
32233,
198,
198,
6738,
17211,
13,
21812,
13,
7890,
1330,
41956,
198,
6738,
17211,
13,
21812,
13,
6404,
291,
13,
8612,
2024,
1330,
17230,
8645,
1352,
628
] | 4.527778 | 36 |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 29 00:07:11 2015
@author: Shamir
"""
for i in range(len(os.listdir(sourcePath))): # we have 6 files corresponding to 6 gestures
print 'i = ', i
gesture = os.listdir(sourcePath)[i] ... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
41972,
319,
7031,
2447,
2808,
3571,
25,
2998,
25,
1157,
1853,
198,
198,
31,
9800,
25,
27957,
343,
198,
37811,
198,
220,
220,
220,
220,
198,
220,
220,
220,
... | 1.717973 | 6,276 |
if __name__ == "__main__":
main() | [
628,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
197,
12417,
3419
] | 2.235294 | 17 |
#!/usr/bin/env python
"""Informatics Matters Job Tester (JOTE).
Get help running this utility with 'jote --help'
"""
import argparse
import os
import shutil
import stat
from stat import S_IRGRP, S_IRUSR, S_IWGRP, S_IWUSR
import subprocess
import sys
from typing import Any, Dict, List, Optional, Tuple
from munch impo... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
37811,
818,
18982,
873,
30587,
15768,
309,
7834,
357,
41,
23051,
737,
198,
198,
3855,
1037,
2491,
428,
10361,
351,
705,
73,
1258,
1377,
16794,
6,
198,
37811,
198,
11748,
1822,
295... | 2.230471 | 14,453 |
"""
Subclass of the BaseCredContainer used for reading secrets from bitwarden password manager.
This class wraps the bitwarden CLI. See: https://bitwarden.com/help/article/cli/#using-an-api-key
Note that only the Enterprise version of bitwarden can (supported) hit the REST API.
In contrast, the API key that can be ... | [
37811,
198,
7004,
4871,
286,
262,
7308,
34,
445,
29869,
973,
329,
3555,
13141,
422,
1643,
904,
268,
9206,
4706,
13,
198,
1212,
1398,
27521,
262,
1643,
904,
268,
43749,
13,
220,
4091,
25,
220,
3740,
1378,
2545,
904,
268,
13,
785,
14,... | 3.029038 | 551 |
import colorednoise as cn
import librosa
import numpy as np
| [
11748,
16396,
3919,
786,
355,
269,
77,
198,
11748,
9195,
4951,
64,
198,
11748,
299,
32152,
355,
45941,
628,
628,
628,
628,
628,
628,
628,
628,
198
] | 2.814815 | 27 |
from django.db import models
from registeration.models import User
from chatroom.models import Chatroom
| [
6738,
42625,
14208,
13,
9945,
1330,
4981,
198,
6738,
7881,
341,
13,
27530,
1330,
11787,
198,
6738,
8537,
3823,
13,
27530,
1330,
24101,
3823,
628
] | 4.2 | 25 |
from __future__ import absolute_import
import unittest
import logging
import copy
import pickle
from plyplus.plyplus import STree
logging.basicConfig(level=logging.INFO)
if __name__ == '__main__':
unittest.main()
| [
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
198,
11748,
555,
715,
395,
198,
11748,
18931,
198,
11748,
4866,
198,
11748,
2298,
293,
198,
198,
6738,
35960,
9541,
13,
2145,
9541,
1330,
3563,
631,
198,
198,
6404,
2667,
13,
35487,
... | 3.027397 | 73 |
MAJOR_COLORS = ["White", "Red", "Black", "Yellow", "Violet"]
MINOR_COLORS = ["Blue", "Orange", "Green", "Brown", "Slate"]
print_color_map()
#testing each of 25 color pairs
if __name__ == '__main__':
print_color_map()
test_color_map(1, 'White', 'Blue')
test_color_map(2, 'White', 'Orange')
t... | [
198,
5673,
41,
1581,
62,
25154,
20673,
796,
14631,
12256,
1600,
366,
7738,
1600,
366,
9915,
1600,
366,
39499,
1600,
366,
53,
19194,
8973,
198,
23678,
1581,
62,
25154,
20673,
796,
14631,
14573,
1600,
366,
40141,
1600,
366,
13719,
1600,
3... | 2.26513 | 347 |
import discord_self_embed
from discord.ext import commands
bot = commands.Bot(command_prefix=".", self_bot=True)
bot.run("TOKEN_HERE")
| [
11748,
36446,
62,
944,
62,
20521,
198,
6738,
36446,
13,
2302,
1330,
9729,
198,
198,
13645,
796,
9729,
13,
20630,
7,
21812,
62,
40290,
2625,
33283,
2116,
62,
13645,
28,
17821,
8,
198,
198,
13645,
13,
5143,
7203,
10468,
43959,
62,
39,
... | 3.044444 | 45 |
import re
import copy
from operator import itemgetter
import music21 as m21
if __name__ == "__main__":
data = ['C4~', ['chord', 'E4~', 'G4~'], [
'chord', 'E4~', 'G4~'], ['chord', 'E4', 'G4']]
data2 = ['C4', ['trip', 'C4', 'E4', 'G4']]
data3 = ['C4~', 'C4', 'E4~', 'E4']
data4 = ['CC8', 'r8', ... | [
11748,
302,
198,
11748,
4866,
198,
6738,
10088,
1330,
2378,
1136,
353,
198,
11748,
2647,
2481,
355,
285,
2481,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1366,
796,
37250,
34,
19,
93,
... | 1.686144 | 599 |
# pylint: disable=no-name-in-module,too-many-arguments
import json
import re
import typing
from urllib.parse import urlparse
import warnings
from requests import Response
from fastapi.testclient import TestClient
from pydantic import BaseModel
import pytest
from starlette import testclient
from optimade import __api... | [
2,
279,
2645,
600,
25,
15560,
28,
3919,
12,
3672,
12,
259,
12,
21412,
11,
18820,
12,
21834,
12,
853,
2886,
198,
11748,
33918,
198,
11748,
302,
198,
11748,
19720,
198,
6738,
2956,
297,
571,
13,
29572,
1330,
19016,
29572,
198,
11748,
... | 2.864275 | 641 |
# -*- coding: utf-8 -*-
"""
Created on 2018/11/5
@author: susmote
"""
import time
import requests
import json
#
if __name__ == '__main__':
username = input(": ")
password = input(": ")
login_url = "https://passport.weibo.cn/sso/login"
headers = {
"Referer": "https://passport.weibo.cn/si... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
41972,
319,
2864,
14,
1157,
14,
20,
220,
198,
198,
31,
9800,
25,
2341,
76,
1258,
198,
37811,
198,
198,
11748,
640,
198,
11748,
7007,
198,
11748,
33918,
628... | 2.049658 | 1,752 |
import requests
import logging
logger = logging.getLogger(__name__)
| [
11748,
7007,
198,
11748,
18931,
198,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
628,
198
] | 3.227273 | 22 |
from django.urls import path, include
from apps.xero_workspace.views import ScheduleSyncView
urlpatterns = [
path('<int:workspace_id>/expense_group/', include('apps.fyle_expense.job_urls')),
path('<int:workspace_id>/settings/schedule/trigger/', ScheduleSyncView.as_view(), name="schedule_trigger"),
]
| [
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
11,
2291,
198,
198,
6738,
6725,
13,
87,
3529,
62,
5225,
10223,
13,
33571,
1330,
19281,
28985,
7680,
198,
198,
6371,
33279,
82,
796,
685,
198,
220,
220,
220,
3108,
10786,
27,
600,
25,
522... | 2.801802 | 111 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
16529,
26171,
198,
2,
198,
2,
220,
220,
15069,
2864,
12,
23344,
376,
7569,
13,
20185,
15302,
198,
2,
198,
2,
220,
220,
49962,
739,
262,
24843,
13789,
11,
10628,
3... | 2.092835 | 10,524 |
#!/usr/bin/env python3
#
# Plots the power spectra and Fourier-space biases for the HI.
#
import warnings
from mpi4py import MPI
rank = MPI.COMM_WORLD.rank
#warnings.filterwarnings("ignore")
if rank!=0: warnings.filterwarnings("ignore")
import numpy as np
import os, sys
import matplotlib.pyplot as plt
fro... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
198,
2,
1345,
1747,
262,
1176,
5444,
430,
290,
34296,
5277,
12,
13200,
29275,
329,
262,
36210,
13,
198,
2,
198,
11748,
14601,
198,
6738,
285,
14415,
19,
9078,
1330,
4904,
40,
... | 2.37946 | 1,149 |
from ndfinance.strategies import Strategy, PeriodicRebalancingStrategy
from ndfinance.brokers.base import order
from ndfinance.brokers.base.order import *
from ndfinance.strategies.utils import *
| [
6738,
299,
7568,
14149,
13,
2536,
2397,
444,
1330,
20561,
11,
18581,
291,
28951,
282,
5077,
13290,
4338,
198,
6738,
299,
7568,
14149,
13,
7957,
15949,
13,
8692,
1330,
1502,
198,
6738,
299,
7568,
14149,
13,
7957,
15949,
13,
8692,
13,
2... | 3.372881 | 59 |
# Shortest Unique Prefix
# https://www.interviewbit.com/problems/shortest-unique-prefix/
#
# Find shortest unique prefix to represent each word in the list.
#
# Example:
#
# Input: [zebra, dog, duck, dove]
# Output: {z, dog, du, dov}
# where we can see that
# zebra = z
# dog = dog
# duck = du
# dove = dov
# NOTE : Ass... | [
2,
10073,
395,
30015,
3771,
13049,
198,
2,
3740,
1378,
2503,
13,
3849,
1177,
2545,
13,
785,
14,
1676,
22143,
14,
19509,
395,
12,
34642,
12,
40290,
14,
198,
2,
198,
2,
9938,
35581,
3748,
21231,
284,
2380,
1123,
1573,
287,
262,
1351,
... | 2.575 | 240 |
from flask import Flask, render_template, send_from_directory
import serial
import serial.tools.list_ports
import threading
app = Flask(__name__)
class SerialHandler(object):
if __name__ == '__main__':
bind_ip = '127.0.0.1'
bind_port = 8000
serialhandler = SerialHandler()
run_server() | [
6738,
42903,
1330,
46947,
11,
8543,
62,
28243,
11,
3758,
62,
6738,
62,
34945,
198,
11748,
11389,
198,
11748,
11389,
13,
31391,
13,
4868,
62,
3742,
198,
11748,
4704,
278,
198,
198,
1324,
796,
46947,
7,
834,
3672,
834,
8,
628,
198,
19... | 3.030612 | 98 |
from agave_mock_server import app as application
if __name__ == "__main__":
application.run(host="0.0.0.0", ssl_context="adhoc")
| [
6738,
556,
1015,
62,
76,
735,
62,
15388,
1330,
598,
355,
3586,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
3586,
13,
5143,
7,
4774,
2625,
15,
13,
15,
13,
15,
13,
15,
1600,
264,
6649,
62... | 2.627451 | 51 |
from PIL import Image
import numpy as np
import torch
import torchvision.transforms.transforms as transforms
import os
from config import cfg
def preprocess_img(img_path):
""" Loads the desired image and prepares it
for VGG19 model.
Parameters:
img_path: path to the image
Returns:
... | [
6738,
350,
4146,
1330,
7412,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
28034,
198,
11748,
28034,
10178,
13,
7645,
23914,
13,
7645,
23914,
355,
31408,
198,
198,
11748,
28686,
198,
198,
6738,
4566,
1330,
30218,
70,
628,
198,
42... | 2.091139 | 1,580 |
import os
import platform
import sys
from os.path import relpath
sys.path.append('/usr/local/bin/dot')
sys.path.append('/usr/bin/dot')
from graphviz import Digraph
# struttura dati
# definisce il path
def pathfy(filepath):
prgpath = os.path.dirname(os.path.abspath(__file__))
pathz = relpath(filepath, prgpa... | [
11748,
28686,
198,
11748,
3859,
198,
11748,
25064,
198,
6738,
28686,
13,
6978,
1330,
823,
6978,
198,
17597,
13,
6978,
13,
33295,
10786,
14,
14629,
14,
12001,
14,
8800,
14,
26518,
11537,
198,
17597,
13,
6978,
13,
33295,
10786,
14,
14629,... | 2.614679 | 327 |
from .ChangeNotificationMessage import ChangeNotificationMessage
import json
| [
6738,
764,
19400,
3673,
2649,
12837,
1330,
9794,
3673,
2649,
12837,
198,
11748,
33918,
628
] | 5.2 | 15 |
import keras
import numpy as np
from schafkopf.players.data.load_data import load_data_bidding
from schafkopf.players.data.encodings import decode_on_hot_hand
import matplotlib.pyplot as plt
x_test, y_test = load_data_bidding('../data/test_data.p')
x_train, y_train = load_data_bidding('../data/train_data.p')
modelpat... | [
11748,
41927,
292,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
5513,
1878,
74,
404,
69,
13,
32399,
13,
7890,
13,
2220,
62,
7890,
1330,
3440,
62,
7890,
62,
65,
13494,
198,
6738,
5513,
1878,
74,
404,
69,
13,
32399,
13,
7890,
13,
... | 2.418327 | 753 |
"""Ce script est un exemple de matplotlib"""
import numpy as np
def moving_average(x, n, type='simple'):
"""
compute an n period moving average.
type is 'simple' | 'exponential'
"""
x = np.asarray(x)
if type == 'simple':
weights = np.ones(n)
else:
weights = np.exp(np.li... | [
198,
37811,
34,
68,
4226,
1556,
555,
409,
368,
1154,
390,
2603,
29487,
8019,
37811,
198,
198,
11748,
299,
32152,
355,
45941,
628,
198,
4299,
3867,
62,
23913,
7,
87,
11,
299,
11,
2099,
11639,
36439,
6,
2599,
198,
220,
220,
220,
37227... | 1.50099 | 5,555 |
import os
import sys
# Add relevant ranger module to PATH... there surely is a better way to do this...
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
from pymycobot import utils
port = utils.get_port_list()
print(port)
detect_result = utils.detect_port_of_basic()
print(detect_result)
| [
11748,
28686,
198,
11748,
25064,
198,
198,
2,
3060,
5981,
43570,
8265,
284,
46490,
986,
612,
10403,
318,
257,
1365,
835,
284,
466,
428,
986,
198,
17597,
13,
6978,
13,
28463,
7,
15,
11,
28686,
13,
6978,
13,
22179,
7,
418,
13,
6978,
... | 2.783784 | 111 |
# Generated by Django 3.2.5 on 2021-08-04 18:10
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
| [
2,
2980,
515,
416,
37770,
513,
13,
17,
13,
20,
319,
33448,
12,
2919,
12,
3023,
1248,
25,
940,
198,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
198,
11748,
42625,
142... | 3.019231 | 52 |
# Generated by Django 4.0.1 on 2022-02-21 03:56
from django.db import migrations, models
| [
2,
2980,
515,
416,
37770,
604,
13,
15,
13,
16,
319,
33160,
12,
2999,
12,
2481,
7643,
25,
3980,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.84375 | 32 |
from pathlib import Path
from common import DeviceNode, get_property_value
from PyFlow.Core.Common import *
from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper
| [
6738,
3108,
8019,
1330,
10644,
198,
198,
6738,
2219,
1330,
16232,
19667,
11,
651,
62,
26745,
62,
8367,
198,
6738,
9485,
37535,
13,
14055,
13,
17227,
1330,
1635,
198,
6738,
9485,
37535,
13,
14055,
13,
19667,
14881,
1330,
19081,
47,
1040,... | 3.755556 | 45 |
from typing import cast
from grizzly.context import GrizzlyContext
from grizzly.steps import * # pylint: disable=unused-wildcard-import # noqa: F403
from ....fixtures import BehaveFixture
| [
6738,
19720,
1330,
3350,
198,
198,
6738,
46307,
306,
13,
22866,
1330,
31106,
306,
21947,
198,
6738,
46307,
306,
13,
20214,
1330,
1635,
220,
1303,
279,
2645,
600,
25,
15560,
28,
403,
1484,
12,
21992,
9517,
12,
11748,
220,
1303,
645,
20... | 3.362069 | 58 |
"""Module for over expression tokenization."""
from .basic_regex_tokenizer import BasicRegexTokenizer
| [
37811,
26796,
329,
625,
5408,
11241,
1634,
526,
15931,
198,
6738,
764,
35487,
62,
260,
25636,
62,
30001,
7509,
1330,
14392,
3041,
25636,
30642,
7509,
628
] | 3.961538 | 26 |
#!/usr/bin/env python3
from pathlib import Path
from jq_normaliser import JqNormaliser, Filter
if __name__ == '__main__':
main()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
6738,
3108,
8019,
1330,
10644,
198,
198,
6738,
474,
80,
62,
11265,
5847,
1330,
449,
80,
26447,
5847,
11,
25853,
628,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
... | 2.76 | 50 |
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
# Author : Steeve Barbeau, Luca Invernizzi
# This program is published under a GPLv2 license
import re
from scapy.all import TCP, bind_layers, Packet, StrField
def _canonicalize_header(name):
''' Takes a header key (i.e., "Host" in "Host: www.google.com",
an... | [
2,
0,
1220,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
41002,
12,
23,
532,
9,
12,
198,
2,
6434,
1058,
520,
1453,
303,
2409,
1350,
559,
11,
7598,
64,
554,
933,
6457,
72,
198,
2,
770,
1430,
318,
3199,
739,... | 2.333333 | 1,017 |
import os
import unittest
from flask_app.boot import load_dot_env, reset, is_loaded, load_env
from tests.unit.testutils import BaseUnitTestCase, get_function_name
from unittest_data_provider import data_provider
if __name__ == '__main__':
unittest.main()
| [
11748,
28686,
198,
11748,
555,
715,
395,
198,
6738,
42903,
62,
1324,
13,
18769,
1330,
3440,
62,
26518,
62,
24330,
11,
13259,
11,
318,
62,
14578,
11,
3440,
62,
24330,
198,
6738,
5254,
13,
20850,
13,
9288,
26791,
1330,
7308,
26453,
1440... | 2.966292 | 89 |
x=[0,1,2,3,4]
y=[1,1.8,1.3,2.5,6.3]
print(QuadraticRegression(x,y))
| [
87,
41888,
15,
11,
16,
11,
17,
11,
18,
11,
19,
60,
198,
88,
41888,
16,
11,
16,
13,
23,
11,
16,
13,
18,
11,
17,
13,
20,
11,
21,
13,
18,
60,
198,
4798,
7,
4507,
41909,
1512,
8081,
2234,
7,
87,
11,
88,
4008,
628,
628
] | 1.479167 | 48 |
from typing import Any, Dict, Optional
from atcodertools.codegen.code_style_config import CodeStyleConfig
from atcodertools.codegen.models.code_gen_args import CodeGenArgs
from atcodertools.codegen.template_engine import render
from atcodertools.fmtprediction.models.format import (Format, ParallelPattern,
... | [
6738,
19720,
1330,
4377,
11,
360,
713,
11,
32233,
198,
198,
6738,
379,
19815,
861,
10141,
13,
8189,
5235,
13,
8189,
62,
7635,
62,
11250,
1330,
6127,
21466,
16934,
198,
6738,
379,
19815,
861,
10141,
13,
8189,
5235,
13,
27530,
13,
8189,... | 2.335052 | 388 |
"""
This module contains an implementation for Binance Futures (BinanceFuturesExchangeHandler)
"""
from __future__ import annotations
import pandas as pd
import typing
import json
import logging
import pandas as pd
from datetime import datetime
from dataclasses import dataclass
from . import futurespy as fp
from... | [
37811,
198,
220,
220,
220,
770,
8265,
4909,
281,
7822,
329,
347,
14149,
24002,
942,
357,
33,
14149,
37,
315,
942,
3109,
3803,
25060,
8,
198,
37811,
198,
6738,
11593,
37443,
834,
1330,
37647,
198,
198,
11748,
19798,
292,
355,
279,
67,
... | 3.776596 | 94 |
name = 'orbit'
__version__ = '1.0.10'
| [
3672,
796,
705,
42594,
6,
198,
834,
9641,
834,
796,
705,
16,
13,
15,
13,
940,
6,
628
] | 2.166667 | 18 |
import torch
from typing import Union, Iterable
def center(k: torch.Tensor) -> torch.Tensor:
"""Center features of a kernel by pre- and post-multiplying by the centering matrix H.
In other words, if k_ij is dot(x_i, x_j), the result will be dot(x_i - mu_x, x_j - mu_x).
:param k: a n by n Gram matrix of ... | [
11748,
28034,
198,
6738,
19720,
1330,
4479,
11,
40806,
540,
628,
198,
4299,
3641,
7,
74,
25,
28034,
13,
51,
22854,
8,
4613,
28034,
13,
51,
22854,
25,
198,
220,
220,
220,
37227,
23656,
3033,
286,
257,
9720,
416,
662,
12,
290,
1281,
... | 2.320261 | 306 |
#!/usr/bin/env python3
"""Copyright (c) 2020 Cisco and/or its affiliates.
This software is licensed to you under the terms of the Cisco Sample
Code License, Version 1.1 (the "License"). You may obtain a copy of the
License at
https://developer.cisco.com/docs/licenses
All use of the material herein must b... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
37811,
15269,
357,
66,
8,
12131,
28289,
290,
14,
273,
663,
29116,
13,
198,
1212,
3788,
318,
11971,
284,
345,
739,
262,
2846,
286,
262,
28289,
27565,
198,
10669,
13789,
11,
10628,
... | 2.804036 | 2,230 |
from PyQt4.QtGui import *
from PyQt4.QtCore import *
if __name__ == '__main__':
import sys
app = QApplication(sys.argv)
w = QWidget()
w.resize(1024, 768)
v = MyTabView(w)
w.show()
app.exec_() | [
6738,
9485,
48,
83,
19,
13,
48,
83,
8205,
72,
1330,
1635,
198,
6738,
9485,
48,
83,
19,
13,
48,
83,
14055,
1330,
1635,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1330,
25064,
198,
... | 2.055556 | 108 |
import logging
from itertools import cycle
import discord
from discord.ext import commands, tasks
from pyboss.controllers.guild import GuildController
from .utils import youtube
from .utils.checkers import is_guild_owner
logger = logging.getLogger(__name__)
| [
11748,
18931,
198,
6738,
340,
861,
10141,
1330,
6772,
198,
198,
11748,
36446,
198,
6738,
36446,
13,
2302,
1330,
9729,
11,
8861,
198,
198,
6738,
12972,
42820,
13,
3642,
36667,
13,
70,
3547,
1330,
16446,
22130,
198,
198,
6738,
764,
26791,... | 3.567568 | 74 |
import tensorflow as tf
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
from plotting import newfig, savefig
import matplotlib.gridspec as gridspec
import seaborn as sns
import time
from utilities import neural_net, fwd_gradients, heaviside, \
tf_session, mea... | [
11748,
11192,
273,
11125,
355,
48700,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
629,
541,
88,
13,
18908,
4873,
1330,
267,
2934,
600,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
6738,
29353,
1330,
649,
5647,
... | 1.828632 | 2,340 |
# Generated by Django 3.1.2 on 2020-11-12 06:53
from django.db import migrations, models
| [
2,
2980,
515,
416,
37770,
513,
13,
16,
13,
17,
319,
12131,
12,
1157,
12,
1065,
9130,
25,
4310,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.84375 | 32 |
from ciphers import StreamlinedNTRUPrime
# choose your parameters
p, q, w = 761, 4591, 286
print('Streamlined NTRU Prime Example for', f'p={p}, q={q}, w={w}')
print('-' * 50)
cipher = StreamlinedNTRUPrime(p, q, w, seed=1337)
print('Generating key pair ... ')
pk, sk = cipher.generate_keys()
print('En/decrypting...')... | [
6738,
269,
541,
7084,
1330,
13860,
10837,
45,
5446,
52,
26405,
198,
198,
2,
3853,
534,
10007,
198,
79,
11,
10662,
11,
266,
796,
767,
5333,
11,
604,
48952,
11,
39697,
198,
198,
4798,
10786,
12124,
10837,
399,
5446,
52,
5537,
17934,
3... | 2.73262 | 187 |
# -*- coding: utf-8 -*-
import os, sys, shutil, re
# ID3V2, ID3V3
if __name__ == '__main__':
if len(sys.argv) < 3:
print 'Usage: %s [cache folder] [output_folder]' %sys.argv[0]
sys.exit(0)
input_dir = sys.argv[1]
output_dir = sys.argv[2]
if not os.path.isdir(output_dir):... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
201,
198,
11748,
28686,
11,
25064,
11,
4423,
346,
11,
302,
201,
198,
201,
198,
2,
4522,
18,
53,
17,
11,
4522,
18,
53,
18,
201,
198,
201,
198,
361,
11593,
3672,
834,
662... | 1.877193 | 456 |
from typing import Dict, Iterable, Iterator, List, Sequence, Optional, Tuple
from word_ladder.types import WordDict
from word_ladder.rung import Rung
def get_word_with_letter_missing(word: str, position: int) -> str:
"""
>>> get_word_with_letter_missing('dog', 0)
'?og'
>>> get_word_with_letter_missing... | [
6738,
19720,
1330,
360,
713,
11,
40806,
540,
11,
40806,
1352,
11,
7343,
11,
45835,
11,
32233,
11,
309,
29291,
198,
6738,
1573,
62,
9435,
1082,
13,
19199,
1330,
9678,
35,
713,
198,
6738,
1573,
62,
9435,
1082,
13,
81,
2150,
1330,
371,... | 2.223113 | 1,497 |
"""Package init file.
We want the user to get everything right away upon `import nawrapper as nw`.
"""
from .power import *
from .maptools import *
from .covtools import *
from . import planck
| [
37811,
27813,
2315,
2393,
13,
198,
198,
1135,
765,
262,
2836,
284,
651,
2279,
826,
1497,
2402,
4600,
11748,
299,
707,
430,
2848,
355,
299,
86,
44646,
198,
37811,
198,
6738,
764,
6477,
1330,
1635,
198,
6738,
764,
76,
2373,
10141,
1330,... | 3.344828 | 58 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
4981,
11,
15720,
602,
628
] | 2.891892 | 37 |
from cloudify import ctx
from cloudify.decorators import operation
from a4c_common.wrapper_util import (USE_EXTERNAL_RESOURCE_KEY,handle_external_resource,handle_resource_ids)
from openstack import with_cinder_client
from openstack.volume import create
| [
6738,
6279,
1958,
1330,
269,
17602,
198,
6738,
6279,
1958,
13,
12501,
273,
2024,
1330,
4905,
198,
198,
6738,
257,
19,
66,
62,
11321,
13,
48553,
62,
22602,
1330,
357,
19108,
62,
6369,
31800,
1847,
62,
19535,
31033,
62,
20373,
11,
28144... | 3.445946 | 74 |
from typing import Iterator, List, Optional
from drift_report.domain.model import Model
MODEL_REPO = ModelRepository()
| [
6738,
19720,
1330,
40806,
1352,
11,
7343,
11,
32233,
198,
6738,
24260,
62,
13116,
13,
27830,
13,
19849,
1330,
9104,
628,
198,
198,
33365,
3698,
62,
2200,
16402,
796,
9104,
6207,
13264,
3419,
198
] | 3.588235 | 34 |
# PART 1
with open('input.txt') as input_file:
x_pos = 0
y_pos = 0
for line in input_file:
direction = line.split(' ')[0]
distance = int(line.split(' ')[1])
if direction == "forward":
x_pos += distance
elif direction == "down":
y_pos += distance
... | [
2,
16652,
352,
198,
4480,
1280,
10786,
15414,
13,
14116,
11537,
355,
5128,
62,
7753,
25,
198,
220,
220,
220,
2124,
62,
1930,
796,
657,
198,
220,
220,
220,
331,
62,
1930,
796,
657,
198,
220,
220,
220,
329,
1627,
287,
5128,
62,
7753... | 2.178019 | 646 |
from typing import Optional
from pydantic import BaseModel
from cosmopy.model import CosmosModel
if __name__ == "__main__":
passat = Car(make="VW", model="Passat")
print(f"Car: {passat}")
passat.save()
passat.model = "Golf"
golf = passat.save()
print(f"Model changed: {golf}")
passat ... | [
6738,
19720,
1330,
32233,
198,
198,
6738,
279,
5173,
5109,
1330,
7308,
17633,
198,
198,
6738,
8615,
76,
11081,
13,
19849,
1330,
39972,
17633,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
... | 2.31338 | 284 |
#!/usr/bin/env python
import rospy
import tf
import scipy.linalg as la
import numpy as np
from math import *
import mavros_msgs.srv
from mavros_msgs.msg import AttitudeTarget
from nav_msgs.msg import Odometry
from std_msgs.msg import *
from test.msg import *
from geometry_msgs.msg import *
from mavros_msgs.msg import *... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
11748,
686,
2777,
88,
198,
11748,
48700,
198,
11748,
629,
541,
88,
13,
75,
1292,
70,
355,
8591,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
10688,
1330,
1635,
198,
11748,
285,
615,
... | 1.919811 | 1,272 |
#!/usr/bin/env python3
import argparse
import asyncio
import json
from aiohttp import ClientSession, BasicAuth, ClientTimeout
import os
import aiohttp_github_helpers as h
GITHUB_USER = os.environ.get('GITHUB_USER', None)
GITHUB_PASS = os.environ.get('GITHUB_PASS', None)
TIMEOUT = ClientTimeout(total=20)
AUTH = None
i... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
11748,
1822,
29572,
198,
11748,
30351,
952,
198,
11748,
33918,
198,
6738,
257,
952,
4023,
1330,
20985,
36044,
11,
14392,
30515,
11,
20985,
48031,
198,
11748,
28686,
198,
11748,
... | 2.688654 | 379 |
# import support libraries
import os
import time
import numpy as np
# import main working libraries
import cv2
import torch
from torch.autograd import Variable
from torchvision import transforms
from PIL import Image
# import app libraries
from darknet import Darknet
from utils import *
from MeshPly import MeshPly
... | [
2,
1330,
1104,
12782,
198,
11748,
28686,
198,
11748,
640,
198,
11748,
299,
32152,
355,
45941,
198,
198,
2,
1330,
1388,
1762,
12782,
198,
11748,
269,
85,
17,
198,
11748,
28034,
198,
6738,
28034,
13,
2306,
519,
6335,
1330,
35748,
198,
6... | 2.652597 | 308 |
team_abbr_lookup = {
"Toronto Raptors": "TOR",
"Brooklyn Nets": "BRK",
"New York Knicks": "NYK",
"Boston Celtics": "BOS",
"Philadelphia 76ers": "PHI",
"Indiana Pacers": "IND",
"Chicago Bulls": "CHI",
"Cleveland Cavaliers": "CLE",
"Detroit Pistons": "DET",
"Milwaukee Bucks": "MIL... | [
198,
15097,
62,
397,
1671,
62,
5460,
929,
796,
1391,
198,
220,
220,
220,
366,
31359,
30836,
1298,
366,
32961,
1600,
198,
220,
220,
220,
366,
45534,
6213,
27811,
1298,
366,
11473,
42,
1600,
198,
220,
220,
220,
366,
3791,
1971,
24397,
... | 2.637852 | 1,527 |
from flask import Flask, request
import redis
app = Flask(__name__)
rconn = redis.StrictRedis()
| [
6738,
42903,
1330,
46947,
11,
2581,
198,
11748,
2266,
271,
198,
198,
1324,
796,
46947,
7,
834,
3672,
834,
8,
198,
198,
81,
37043,
796,
2266,
271,
13,
1273,
2012,
7738,
271,
3419,
628
] | 2.911765 | 34 |
import random
from collections import namedtuple
MatrixShape = namedtuple("MatrixShape", ["rows", "columns"])
| [
11748,
4738,
198,
198,
6738,
17268,
1330,
3706,
83,
29291,
628,
198,
46912,
33383,
796,
3706,
83,
29291,
7203,
46912,
33383,
1600,
14631,
8516,
1600,
366,
28665,
82,
8973,
8,
628,
198
] | 3.59375 | 32 |
import os.path
from typing import Any, Iterable, Mapping, Optional, Tuple
import tfx.v1 as tfx
from absl import logging
from ml_metadata.proto import metadata_store_pb2
from tfx.dsl.components.base.base_component import BaseComponent
from tfx.types.channel import Channel
from .base import BasePipelineHelper
from .int... | [
11748,
28686,
13,
6978,
198,
6738,
19720,
1330,
4377,
11,
40806,
540,
11,
337,
5912,
11,
32233,
11,
309,
29291,
198,
198,
11748,
256,
21373,
13,
85,
16,
355,
256,
21373,
198,
6738,
2352,
75,
1330,
18931,
198,
6738,
25962,
62,
38993,
... | 3.376147 | 109 |
"""Useful utility functions for services."""
import logging
import re
from datetime import datetime, timezone
from inspect import Parameter, Signature
from dateutil.parser import parse
from humanize import naturaldelta, naturaltime
logger = logging.getLogger(__name__)
WORDS = {'1': 'one', '2': 'two', '3': 'three', ... | [
37811,
11041,
913,
10361,
5499,
329,
2594,
526,
15931,
198,
198,
11748,
18931,
198,
11748,
302,
198,
6738,
4818,
8079,
1330,
4818,
8079,
11,
640,
11340,
198,
6738,
10104,
1330,
25139,
2357,
11,
34894,
198,
198,
6738,
3128,
22602,
13,
48... | 2.42243 | 3,210 |
import utils
m = utils.opener.raw("input/16.txt")
rm, tm, om = m.split("\n\n")
rules = {}
for line in rm.split("\n"):
name, expr = line.split(": ")
rules[name] = [[int(q) for q in x.split("-")] for x in expr.split(" or ")]
myticket = [int(x) for x in tm.split("\n")[1].split(",")]
tickets = [[int(q) for q in ... | [
11748,
3384,
4487,
198,
198,
76,
796,
3384,
4487,
13,
404,
877,
13,
1831,
7203,
15414,
14,
1433,
13,
14116,
4943,
198,
26224,
11,
256,
76,
11,
39030,
796,
285,
13,
35312,
7203,
59,
77,
59,
77,
4943,
198,
198,
38785,
796,
23884,
19... | 2.024631 | 609 |
from collections import Counter
import random
import math
###
# Parameters of assumptions
###
# How many initial investments and avg check size
num_seed_rounds = 50
invested_per_seed_round = 0.5
# Probabilities of different outcomes (prob, outcome multiple)
outcome_probs_seed = [ [0.01, 100], # N% chance of Mx ret... | [
198,
6738,
17268,
1330,
15034,
198,
11748,
4738,
198,
11748,
10688,
198,
198,
21017,
198,
2,
40117,
286,
14895,
198,
21017,
198,
198,
2,
1374,
867,
4238,
11115,
290,
42781,
2198,
2546,
198,
22510,
62,
28826,
62,
744,
82,
796,
2026,
19... | 2.126513 | 909 |