content stringlengths 1 1.04M | input_ids listlengths 1 774k | ratio_char_token float64 0.38 22.9 | token_count int64 1 774k |
|---|---|---|---|
from flask import request
from . import api_blueprint
from data import db
from data import User
from data import CoffeeShop
@api_blueprint.route('/')
@api_blueprint.route('/add_user1')
@api_blueprint.route('/users1')
@api_blueprint.route('/coffeeshops1')
| [
6738,
42903,
1330,
2581,
198,
6738,
764,
1330,
40391,
62,
17585,
4798,
198,
6738,
1366,
1330,
20613,
198,
6738,
1366,
1330,
11787,
198,
6738,
1366,
1330,
19443,
29917,
628,
198,
31,
15042,
62,
17585,
4798,
13,
38629,
10786,
14,
11537,
6... | 2.988636 | 88 |
import numpy as np
#from pyminc.volumes.factory import *
import os
from sys import argv, exit
from os.path import exists
from os import makedirs
import argparse
#local modules defined in current project
from make_and_run_model import *
from predict import *
from prepare_data import *
from utils import *
from custom_lo... | [
11748,
299,
32152,
355,
45941,
198,
2,
6738,
12972,
1084,
66,
13,
10396,
8139,
13,
69,
9548,
1330,
1635,
198,
11748,
28686,
198,
6738,
25064,
1330,
1822,
85,
11,
8420,
198,
6738,
28686,
13,
6978,
1330,
220,
7160,
198,
6738,
28686,
133... | 3.037113 | 1,455 |
# -*- coding: utf-8 -*-
from flattrclient.validators import isInt
from flattrclient.validators import isStr
from flattrclient.validators import isBinary
from flattrclient.validators import isUrl
from flattrclient.validators import isStrList
from flattrclient.validators import validate
import sys
from pytest import rais... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
27172,
81,
16366,
13,
12102,
2024,
1330,
318,
5317,
198,
6738,
27172,
81,
16366,
13,
12102,
2024,
1330,
318,
13290,
198,
6738,
27172,
81,
16366,
13,
12102,
2024,
1... | 3.452632 | 95 |
from setuptools import setup
setup(name='airflow_impatient',
version='0.0.2',
description='Customized logging handlers, hooks and operators for Airflow to be run in K8s',
url='https://pypi.org/project/airflow-impatient/',
author='Shengyi Pan',
author_email='shengyi.pan@ibm.com',
lic... | [
6738,
900,
37623,
10141,
1330,
9058,
198,
198,
40406,
7,
3672,
11639,
958,
11125,
62,
320,
26029,
3256,
198,
220,
220,
220,
220,
220,
2196,
11639,
15,
13,
15,
13,
17,
3256,
198,
220,
220,
220,
220,
220,
6764,
11639,
15022,
1143,
189... | 2.536946 | 203 |
from copy import copy
#sbaas lims
from SBaaS_LIMS.lims_biologicalMaterial_query import lims_biologicalMaterial_query
#sbaas
from .stage01_resequencing_lineage_io import stage01_resequencing_lineage_io
from .stage01_resequencing_gd_query import stage01_resequencing_gd_query
#sbaas models
from .stage01_resequencing_linea... | [
6738,
4866,
1330,
4866,
198,
2,
82,
7012,
292,
1761,
82,
198,
6738,
18056,
7252,
50,
62,
43,
3955,
50,
13,
2475,
82,
62,
8482,
2770,
17518,
62,
22766,
1330,
1761,
82,
62,
8482,
2770,
17518,
62,
22766,
198,
2,
82,
7012,
292,
198,
... | 3.305882 | 170 |
# 1712
# (\s)*(int|void|float|char|double|string)((\s)|(\*))*(\&?)(\s)+([a-z])([a-z0-9])*(\s)*(\()(\s)*((int|void|float|char|double|string)((\s)|(\*))*(\&?)(\s)+([a-z])([a-z0-9])*((\s)*[,](\s)*(int|void|float|char|double|string)((\s)|(\*))*(\&?)(\s)+([a-z])([a-z0-9])*)*)?(\s)*(\))(\s)*;
# POLYNOMIAL
# nums:5
# POLYNOMI... | [
2,
1596,
1065,
198,
2,
357,
59,
82,
27493,
7,
600,
91,
19382,
91,
22468,
91,
10641,
91,
23352,
91,
8841,
5769,
38016,
82,
14726,
38016,
9,
4008,
9,
38016,
5,
30,
5769,
59,
82,
47762,
26933,
64,
12,
89,
60,
5769,
58,
64,
12,
89... | 1.786174 | 622 |
from .models import *
import json
from django.core.exceptions import PermissionDenied
import requests
import os
import base64
import urllib
from .models import OAuthCache
import random
from django.utils import timezone
from django.conf import settings
module_path = os.path.dirname(__file__)
REDIRECT_URI = settings.MY... | [
6738,
764,
27530,
1330,
1635,
198,
11748,
33918,
198,
6738,
42625,
14208,
13,
7295,
13,
1069,
11755,
1330,
2448,
3411,
21306,
798,
198,
11748,
7007,
198,
11748,
28686,
198,
11748,
2779,
2414,
198,
11748,
2956,
297,
571,
198,
6738,
764,
... | 2.56 | 575 |
import requests, json, sys, os, time, datetime
from werkzeug.exceptions import HTTPException
from flask import Flask, abort, request, jsonify, Response, make_response
from flask_restful import Resource
from flask_restful.utils import cors
from utils import TRUE_WORDS, FALSE_WORDS, NONE_WORDS
from utils.api import add_a... | [
11748,
7007,
11,
33918,
11,
25064,
11,
28686,
11,
640,
11,
4818,
8079,
198,
6738,
266,
9587,
2736,
1018,
13,
1069,
11755,
1330,
14626,
16922,
198,
6738,
42903,
1330,
46947,
11,
15614,
11,
2581,
11,
33918,
1958,
11,
18261,
11,
787,
62,... | 3.438017 | 121 |
import aio_pika
import aiopg
import asyncio
import json
import os
from aio_pika.pool import Pool
from distutils.util import strtobool
| [
11748,
257,
952,
62,
79,
9232,
198,
11748,
257,
14922,
70,
198,
11748,
30351,
952,
198,
11748,
33918,
198,
11748,
28686,
198,
6738,
257,
952,
62,
79,
9232,
13,
7742,
1330,
19850,
198,
6738,
1233,
26791,
13,
22602,
1330,
965,
83,
672,
... | 3.068182 | 44 |
import numpy as np
import cv2
import glob
import argparse
import pdb
import sys
#sys.path.append('../../../../../train_src/analysis/')
import pathlib
from PredictionsLoader import PredictionsLoaderNPY, PredictionsLoaderModel
from utils import seq_add_padding, add_padding
import pdb
sys.path.append('../../../train_src... | [
220,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
269,
85,
17,
198,
11748,
15095,
198,
11748,
1822,
29572,
198,
11748,
279,
9945,
198,
11748,
25064,
198,
2,
17597,
13,
6978,
13,
33295,
10786,
40720,
40720,
40720,
40720,
40720,
27432,
... | 2.294188 | 5,024 |
# Generated by Django 3.1.11 on 2021-05-27 21:02
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
| [
2,
2980,
515,
416,
37770,
513,
13,
16,
13,
1157,
319,
33448,
12,
2713,
12,
1983,
2310,
25,
2999,
198,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
198,
11748,
42625,
... | 3.038462 | 52 |
#!/usr/bin/python
from PythonCard import model
colhead = ['Expression','Value']
| [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
198,
6738,
11361,
16962,
1330,
2746,
198,
198,
4033,
2256,
796,
37250,
16870,
2234,
41707,
11395,
20520,
628,
198
] | 3.111111 | 27 |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2008-present MagicStack Inc. and the EdgeDB 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... | [
2,
198,
2,
770,
2723,
2393,
318,
636,
286,
262,
13113,
11012,
1280,
2723,
1628,
13,
198,
2,
198,
2,
15069,
3648,
12,
25579,
6139,
25896,
3457,
13,
290,
262,
13113,
11012,
7035,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11... | 2.997368 | 380 |
import os
import numpy as np
from util import load_data, ROOT_PATH,_sqdist
from sklearn.decomposition import PCA
if __name__ == '__main__':
for ind in range(400):
for sname in ['mnist_z','mnist_x','mnist_xz']:
precomp(sname,ind)
folder = ROOT_PATH+'/mnist_precomp/'
os.makedirs(folder, ... | [
11748,
28686,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
7736,
1330,
3440,
62,
7890,
11,
15107,
2394,
62,
34219,
11,
62,
31166,
17080,
198,
6738,
1341,
35720,
13,
12501,
296,
9150,
1330,
4217,
32,
198,
198,
361,
11593,
3672,
834,
... | 1.705059 | 929 |
# Copyright (c) 2017 Tigera, Inc. 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,
15069,
357,
66,
8,
2177,
17030,
64,
11,
3457,
13,
1439,
2489,
10395,
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,
1... | 1.601773 | 15,225 |
from django.shortcuts import render
from django.template import RequestContext
from ..conf import settings
| [
6738,
42625,
14208,
13,
19509,
23779,
1330,
8543,
198,
6738,
42625,
14208,
13,
28243,
1330,
19390,
21947,
198,
198,
6738,
11485,
10414,
1330,
6460,
628,
628
] | 4.269231 | 26 |
#This NMT Decoder will return two things: (1) The second decoder hidden state (2) The first decoder hidden state
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import math
import random
import numpy as np
#Implement of cGRU from nematus language toolkit paper ad... | [
2,
1212,
399,
13752,
34580,
481,
1441,
734,
1243,
25,
357,
16,
8,
383,
1218,
875,
12342,
7104,
1181,
357,
17,
8,
383,
717,
875,
12342,
7104,
1181,
198,
198,
11748,
28034,
198,
6738,
28034,
13,
2306,
519,
6335,
1330,
35748,
198,
1174... | 3.666667 | 90 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Base plugin class
"""
# Third party imports
import qdarkstyle
from qtpy.QtCore import Qt, Slot
from qtpy.QtGui import QKeySequence
from qtpy.QtWidgets import QDo... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
198,
2,
15069,
10673,
23688,
1082,
4935,
25767,
669,
198,
2,
49962,
739,
262,
2846,
286,
262,
17168,
13789,
198,
2,
357,
3826,
13997,
1082,
14,
834,
15003,
834,
13,... | 2.300294 | 3,400 |
from selenium import webdriver # necessary for web dynamic pages
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.ui import WebDriverWait
from app.bet_models.betting_data import BettingData
| [
6738,
384,
11925,
1505,
1330,
3992,
26230,
220,
1303,
3306,
329,
3992,
8925,
5468,
198,
6738,
384,
11925,
1505,
13,
12384,
26230,
13,
11321,
13,
1525,
1330,
2750,
198,
6738,
384,
11925,
1505,
13,
12384,
26230,
13,
11284,
1330,
2938,
62,... | 3.594937 | 79 |
from deap import benchmarks
from math import sin
| [
6738,
390,
499,
1330,
31747,
198,
6738,
10688,
1330,
7813,
628,
198
] | 4.25 | 12 |
import numpy as np
from autoarray.structures.arrays.two_d import array_2d
from autoarray.structures.grids.two_d import grid_2d
from autoarray.structures.grids.two_d import grid_2d_irregular
from skimage import measure
from functools import wraps
| [
11748,
299,
32152,
355,
45941,
201,
198,
6738,
8295,
18747,
13,
7249,
942,
13,
3258,
592,
13,
11545,
62,
67,
1330,
7177,
62,
17,
67,
201,
198,
6738,
8295,
18747,
13,
7249,
942,
13,
2164,
2340,
13,
11545,
62,
67,
1330,
10706,
62,
1... | 2.835165 | 91 |
import vacefron, randfacts, asyncpraw, datetime, json, requests
import disnake
from jokeapi import Jokes
from .utils import thecolor
from core.utils.HIDDEN import *
reddit = asyncpraw.Reddit(
client_id=client_id,
client_secret=client_secret,
username=username,
password=password,
user_a... | [
11748,
410,
558,
69,
1313,
11,
43720,
37473,
11,
355,
2047,
13155,
1831,
11,
4818,
8079,
11,
33918,
11,
7007,
201,
198,
11748,
595,
77,
539,
201,
198,
6738,
9707,
15042,
1330,
449,
3369,
201,
198,
201,
198,
6738,
764,
26791,
1330,
2... | 2.477124 | 153 |
#!/usr/bin/env python3
from pwn import *
binary = context.binary = ELF('./arm')
if args.REMOTE:
p = remote('172.104.14.64', 54732)
libc = ELF('./libc-2.23.so')
p.recvuntil('printf at ')
else:
if os.uname().machine == context.arch:
p = process(binary.path)
libc = binary.libc
else:
if args.GDB:
p = proce... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
6738,
279,
675,
1330,
1635,
198,
198,
39491,
796,
4732,
13,
39491,
796,
17852,
37,
7,
4458,
14,
1670,
11537,
198,
198,
361,
26498,
13,
40726,
23051,
25,
198,
197,
79,
796,
... | 2.14958 | 595 |
# -* coding: utf-8 *-
"""
:py:mod:`pynspector.doc_parser`
-------------------------------
Here you will find parsers for docstrings, this will help you to retrieve all
arguments, types and descriptions defined on docstrings.
You can use different parsers such as:
- sphinx_doc_parser
"""
# System imports
import re
impo... | [
2,
532,
9,
19617,
25,
3384,
69,
12,
23,
1635,
12,
198,
37811,
198,
25,
9078,
25,
4666,
25,
63,
79,
2047,
4443,
273,
13,
15390,
62,
48610,
63,
198,
1783,
24305,
198,
4342,
345,
481,
1064,
13544,
364,
329,
2205,
37336,
11,
428,
48... | 2.409278 | 1,940 |
import pymongo.errors
# Retry decorator with exponential backoff
def retry(tries=5, delay=0.1, backoff=2):
"""Retries a function or method until it returns True.
delay sets the initial delay in seconds, and backoff sets the factor by which
the delay should lengthen after each failure. backoff must be great... | [
11748,
279,
4948,
25162,
13,
48277,
198,
198,
2,
4990,
563,
11705,
1352,
351,
39682,
736,
2364,
198,
4299,
1005,
563,
7,
83,
1678,
28,
20,
11,
5711,
28,
15,
13,
16,
11,
736,
2364,
28,
17,
2599,
198,
220,
220,
220,
37227,
9781,
1... | 2.905923 | 287 |
from lib.Message import Message
from lib.User import User
| [
6738,
9195,
13,
12837,
1330,
16000,
198,
6738,
9195,
13,
12982,
1330,
11787,
628
] | 4.214286 | 14 |
from crafting.photography_enums import PhotoStyleType
from interactions import ParticipantTypeSingle, ParticipantType
from interactions.utils.interaction_elements import XevtTriggeredElement
from sims4.tuning.tunable import TunableEnumEntry
import sims4
logger = sims4.log.Logger('Photography', default_owner='rrodgers')... | [
6738,
21671,
13,
38611,
4867,
62,
268,
5700,
1330,
5555,
21466,
6030,
198,
6738,
12213,
1330,
29880,
6030,
28008,
11,
29880,
6030,
198,
6738,
12213,
13,
26791,
13,
3849,
2673,
62,
68,
3639,
1330,
1395,
1990,
83,
2898,
328,
10446,
20180,... | 3.647727 | 88 |
# Copyright (c) 2021, www.nestorbird.com and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
| [
2,
15069,
357,
66,
8,
33448,
11,
7324,
13,
77,
395,
273,
16944,
13,
785,
290,
20420,
198,
2,
1114,
5964,
1321,
11,
3387,
766,
5964,
13,
14116,
198,
198,
2,
1330,
5306,
27768,
198,
6738,
5306,
27768,
13,
19849,
13,
22897,
1330,
168... | 3.733333 | 45 |
"""Unit tests for network.py."""
# standard library
import unittest
from unittest.mock import MagicMock, sentinel, patch
from delphi.epidata.acquisition.covid_hosp.common.network import Network
import pandas as pd
# py3tester coverage target
__test_target__ = 'delphi.epidata.acquisition.covid_hosp.common.network'
| [
37811,
26453,
5254,
329,
3127,
13,
9078,
526,
15931,
198,
198,
2,
3210,
5888,
198,
11748,
555,
715,
395,
198,
6738,
555,
715,
395,
13,
76,
735,
1330,
6139,
44,
735,
11,
1908,
20538,
11,
8529,
198,
198,
6738,
1619,
34846,
13,
538,
... | 2.962963 | 108 |
from rest_framework import serializers
from rest_framework.serializers import ModelSerializer
from rest_framework.validators import UniqueValidator
from ..models.app import App, AppImage, Category
| [
6738,
1334,
62,
30604,
1330,
11389,
11341,
198,
6738,
1334,
62,
30604,
13,
46911,
11341,
1330,
9104,
32634,
7509,
198,
6738,
1334,
62,
30604,
13,
12102,
2024,
1330,
30015,
47139,
1352,
198,
198,
6738,
11485,
27530,
13,
1324,
1330,
2034,
... | 4.208333 | 48 |
import datetime
import logging
import os
import subprocess
import time
from threading import Thread
import GlobalConfig
from DataWriter import DataWriter
from FanCollector import FanCollector
from UPSCollector import UPSCollector
from SensorCollector import SensorCollector
LOG_FORMAT = "%(levelname)s - %(message)s"
l... | [
11748,
4818,
8079,
198,
11748,
18931,
198,
11748,
28686,
198,
11748,
850,
14681,
198,
11748,
640,
198,
6738,
4704,
278,
1330,
14122,
198,
198,
11748,
8060,
16934,
198,
6738,
6060,
34379,
1330,
6060,
34379,
198,
6738,
13836,
31337,
273,
13... | 3.382813 | 128 |
bl_info = {
"name": "3D Object to Photoshop",
"description": "選択形状をPhotoshopの3Dレイヤに",
"author": "Yukimi",
"version": (0,4),
"blender": (2, 6, 0),
"location": "object",
"warning": "",
"wiki_url": "",
"tracker_url": "http://yukimi-blend.blogspot.jp/",
"category": "Import-... | [
2436,
62,
10951,
796,
1391,
201,
198,
220,
220,
220,
366,
3672,
1298,
366,
18,
35,
9515,
284,
29153,
1600,
201,
198,
220,
220,
220,
366,
11213,
1298,
366,
34402,
116,
162,
232,
252,
37605,
95,
163,
232,
114,
31758,
27248,
25444,
564... | 2.024854 | 684 |
import snap
Graph = snap.GenRndGnm(snap.PNGraph, 100, 1000)
Nodes = snap.TIntFltH()
Edges = snap.TIntPrFltH()
snap.GetBetweennessCentr(Graph, Nodes, Edges, 1.0)
for node in Nodes:
print("node: %d centrality: %f" % (node, Nodes[node]))
for edge in Edges:
print("edge: (%d, %d) centrality: %f" % (edge.GetVal1(), ... | [
11748,
11495,
198,
198,
37065,
796,
11495,
13,
13746,
49,
358,
38,
21533,
7,
45380,
13,
47,
10503,
1470,
11,
1802,
11,
8576,
8,
198,
45,
4147,
796,
11495,
13,
51,
5317,
37,
2528,
39,
3419,
198,
7407,
3212,
796,
11495,
13,
51,
5317... | 2.2949 | 451 |
import random
Choices = ['rock','paper','scissors']
cs = 0
us = 0
u = 0
c = 0
ctr = 0
print("********************** Rock Paper Scissors **********************" )
print(" Made by Keshav Dev Kapil ")
user1 = user(input("Enter name of user1: "))
print("Welco... | [
11748,
4738,
201,
198,
201,
198,
22164,
1063,
796,
37250,
10823,
41707,
20189,
41707,
1416,
32555,
20520,
201,
198,
6359,
796,
657,
201,
198,
385,
796,
657,
201,
198,
84,
796,
657,
201,
198,
66,
796,
657,
201,
198,
24087,
796,
657,
... | 1.927574 | 1,146 |
import os
import smtplib
import imghdr
from email.message import EmailMessage
import yfinance as yf
import datetime as dt
import pandas as pd
from pandas_datareader import data as pdr
EMAIL_ADDRESS = os.environ.get('EMAIL_USER')
EMAIL_PASSWORD = os.environ.get('EMAIL_PASS')
| [
11748,
28686,
198,
11748,
895,
83,
489,
571,
198,
11748,
545,
456,
7109,
198,
6738,
3053,
13,
20500,
1330,
9570,
12837,
198,
198,
11748,
331,
69,
14149,
355,
331,
69,
198,
11748,
4818,
8079,
355,
288,
83,
198,
11748,
19798,
292,
355,
... | 2.808081 | 99 |
import time
from collections import Counter
from functools import partial
import csv
import json
import torch
from torch import nn
from torch.utils.data import DataLoader
from torch.utils.data.dataset import random_split
from torchtext.vocab import Vocab
from gensim.scripts.glove2word2vec import glove2word2vec
import ... | [
11748,
640,
198,
6738,
17268,
1330,
15034,
198,
6738,
1257,
310,
10141,
1330,
13027,
198,
198,
11748,
269,
21370,
198,
11748,
33918,
198,
11748,
28034,
198,
6738,
28034,
1330,
299,
77,
198,
6738,
28034,
13,
26791,
13,
7890,
1330,
6060,
... | 2.561024 | 1,016 |
"""
"""
import os, sys
import argparse
import numpy as np
from signal_processing.ecg_preproc import preprocess_signal, parallel_preprocess_signal
from signal_processing.ecg_features import compute_ecg_features
from models.load_model import load_model
from models.train_model_ml import train as train_ml
from models.trai... | [
37811,
198,
37811,
198,
11748,
28686,
11,
25064,
198,
11748,
1822,
29572,
198,
11748,
299,
32152,
355,
45941,
198,
198,
6738,
6737,
62,
36948,
13,
721,
70,
62,
3866,
36942,
1330,
662,
14681,
62,
12683,
282,
11,
10730,
62,
3866,
14681,
... | 2.477573 | 379 |
"""Helper functions for training models.
Several of the functions below implement approximate maximum likelihood
estimation by optimizing the scaled log likelihood. The scale factor used in
these cases is the reciprocal of the "count" for the given dist, unless this
count is less than 1.0, in which case the scale fact... | [
37811,
47429,
5499,
329,
3047,
4981,
13,
198,
198,
14945,
286,
262,
5499,
2174,
3494,
27665,
5415,
14955,
198,
395,
18991,
416,
45780,
262,
27464,
2604,
14955,
13,
383,
5046,
5766,
973,
287,
198,
27218,
2663,
318,
262,
48135,
286,
262,
... | 2.987684 | 2,517 |
import tempfile
import shutil
from unittest import TestCase
from unittest import mock
from lineflow import download
from lineflow.datasets.wmt14 import Wmt14, get_wmt14
| [
11748,
20218,
7753,
198,
11748,
4423,
346,
198,
6738,
555,
715,
395,
1330,
6208,
20448,
198,
6738,
555,
715,
395,
1330,
15290,
198,
198,
6738,
1627,
11125,
1330,
4321,
198,
6738,
1627,
11125,
13,
19608,
292,
1039,
13,
86,
16762,
1415,
... | 3.288462 | 52 |
from django.urls import path
from . import consumers
app_name = 'chat'
url_patterns = [
path('thread/<int:thread_id>/', consumers.ChatConsumer.as_asgi())
]
| [
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
198,
198,
6738,
764,
1330,
7008,
628,
198,
1324,
62,
3672,
796,
705,
17006,
6,
198,
198,
6371,
62,
33279,
82,
796,
685,
198,
220,
220,
3108,
10786,
16663,
14,
27,
600,
25,
16663,
62,
3... | 2.716667 | 60 |
#!/usr/bin/python
print('merging pdfs for filtered companies')
import os
import pandas as pd
import sys
from PyPDF2 import PdfFileMerger, PdfFileReader
from pathlib import Path
pd.options.mode.chained_assignment = None # default='warn'
pd.options.mode.use_inf_as_na = True
# set directories and files
cwd = os.getcwd... | [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
4798,
10786,
647,
2667,
37124,
82,
329,
29083,
2706,
11537,
198,
198,
11748,
28686,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
25064,
198,
6738,
9485,
20456,
17,
1330,
350,
7568,
8979,
... | 2.338235 | 1,088 |
"""
Tests of the transforms
"""
import pytest
from limnos.types import Route
from limnos.transforms import (bender,
flipper,
flattener,
Chirality)
two_point_routes = [[(1, 1), (3, 1)],
[(1, 1), (1, 3)],
... | [
37811,
198,
51,
3558,
286,
262,
31408,
198,
37811,
198,
11748,
12972,
9288,
198,
198,
6738,
1761,
39369,
13,
19199,
1330,
18956,
198,
6738,
1761,
39369,
13,
7645,
23914,
1330,
357,
45666,
11,
198,
220,
220,
220,
220,
220,
220,
220,
22... | 1.511111 | 720 |
import threading
from funcy import cached_property, wrap_prop
from dvc.scheme import Schemes
# pylint:disable=abstract-method
from .base import ObjectFileSystem
| [
11748,
4704,
278,
198,
198,
6738,
1257,
948,
1330,
39986,
62,
26745,
11,
14441,
62,
22930,
198,
198,
6738,
288,
28435,
13,
15952,
1326,
1330,
1446,
4411,
274,
198,
198,
2,
279,
2645,
600,
25,
40223,
28,
397,
8709,
12,
24396,
198,
67... | 3.3 | 50 |
# Copyright (c) 2017 Jonathan Bassen, Stanford University
import os
import tornado.escape as escape
import tornado.gen as gen
import tornado.httputil as httputil
import tornado.web as web
import urllib
from db import upsert_activity_data
@gen.coroutine
| [
2,
15069,
357,
66,
8,
2177,
11232,
19829,
268,
11,
13863,
2059,
198,
198,
11748,
28686,
198,
11748,
33718,
13,
41915,
355,
6654,
198,
11748,
33718,
13,
5235,
355,
2429,
198,
11748,
33718,
13,
2804,
1996,
346,
355,
1841,
1996,
346,
198... | 3.547945 | 73 |
import tensorflow as tf
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
from core.generator import Generator
from core.discriminator import Discriminator
from core.gan import GAN
import pickle
import argparse
parser = argparse.ArgumentParser(description='Testing')
parser.add_argument('--word_to_idx_dir... | [
11748,
11192,
273,
11125,
355,
48700,
198,
27110,
13,
5589,
265,
13,
85,
16,
13,
6404,
2667,
13,
2617,
62,
19011,
16579,
7,
27110,
13,
5589,
265,
13,
85,
16,
13,
6404,
2667,
13,
24908,
8,
198,
6738,
4755,
13,
8612,
1352,
1330,
359... | 2.955446 | 202 |
#!/usr/bin/env python3
#! -*-conding:utf-8 -*-
#!@Time :2018/4/11 17:14
#!@Author :@liuweqia
#!@File :class.py
import pygame,random
from pygame.locals import *
from pygame import Rect
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
0,
532,
9,
12,
17561,
278,
25,
40477,
12,
23,
532,
9,
12,
198,
198,
2,
0,
31,
7575,
220,
220,
1058,
7908,
14,
19,
14,
1157,
1596,
25,
1415,
198,
2,
0,
31,
13838,
1058,... | 2.181818 | 88 |
from rest_framework import serializers
from hyper_resource.serializers import BusinessSerializer
from scrum.models import *
from rest_framework_gis.serializers import GeoFeatureModelSerializer
from rest_framework.serializers import ModelSerializer, HyperlinkedRelatedField
| [
6738,
1334,
62,
30604,
1330,
11389,
11341,
201,
198,
201,
198,
6738,
8718,
62,
31092,
13,
46911,
11341,
1330,
7320,
32634,
7509,
201,
198,
6738,
6040,
388,
13,
27530,
1330,
1635,
201,
198,
6738,
1334,
62,
30604,
62,
70,
271,
13,
46911... | 3.542169 | 83 |
# used to change marker on players turn
# Sets up initital empty grid
grid = [
[" ", " ", " "],
[" ", " ", " "],
[" ", " ", " "]
]
valid = ["1", "2", "3"]
numbers = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
coordinates_states = {
0: "You should enter numbers!",
1: "Coordinates shoul... | [
628,
198,
198,
2,
973,
284,
1487,
18364,
319,
1938,
1210,
628,
198,
2,
21394,
510,
2315,
1287,
6565,
10706,
198,
25928,
796,
685,
198,
220,
220,
220,
14631,
33172,
366,
33172,
366,
366,
4357,
198,
220,
220,
220,
14631,
33172,
366,
3... | 1.982318 | 509 |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | [
2,
220,
220,
15069,
357,
66,
8,
2864,
350,
37382,
47,
37382,
46665,
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,
... | 3.582569 | 218 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
node.py
------
This file is part of NODE - the NORX Differential-Search Engine.
:copyright: (c) 2014 Philipp Jovanovic <philipp@jovanovic.io>
:license: BSD (3-Clause), see LICENSE
"""
__author__ = 'Philipp Jovanovic'
__email__ = 'philipp@jovanov... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
21004,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
220,
220,
220,
10139,
13,
9078,
198,
220,
220,
220,
40103,
628,
220,
220,
220,
770,
2393,
318,
636,
286,
... | 2.550661 | 227 |
import threading
import numpy as np
import ImageAnalyzer
import cv2
from PyQt5 import QtGui
import matplotlib.pyplot as plt
| [
11748,
4704,
278,
198,
11748,
299,
32152,
355,
45941,
198,
198,
11748,
7412,
37702,
9107,
198,
198,
11748,
269,
85,
17,
198,
6738,
9485,
48,
83,
20,
1330,
33734,
8205,
72,
198,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,... | 2.866667 | 45 |
__author__ = 'socialmoneydev'
from jsonBase import JsonBase
| [
834,
9800,
834,
796,
705,
14557,
26316,
7959,
6,
198,
6738,
33918,
14881,
1330,
449,
1559,
14881,
628
] | 3.388889 | 18 |
import tensorflow as tf
from sandbox.rocky.tf.policies.gaussian_mlp_policy import GaussianMLPPolicy
from sandbox.rocky.tf.envs.base import TfEnv
from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline
from rllab.envs.gym_env import GymEnv
from inverse_rl.algos.irl_trpo import IRLTRPO
from inverse_r... | [
11748,
11192,
273,
11125,
355,
48700,
198,
198,
6738,
35204,
13,
10823,
88,
13,
27110,
13,
79,
4160,
444,
13,
4908,
31562,
62,
4029,
79,
62,
30586,
1330,
12822,
31562,
5805,
10246,
21424,
198,
6738,
35204,
13,
10823,
88,
13,
27110,
13... | 2.523585 | 636 |
set_name(0x8014AFA0, "EA_cd_seek", SN_NOWARN)
set_name(0x8014AFA8, "MY_CdGetSector", SN_NOWARN)
set_name(0x8014AFDC, "init_cdstream", SN_NOWARN)
set_name(0x8014AFEC, "flush_cdstream", SN_NOWARN)
set_name(0x8014B010, "check_complete_frame", SN_NOWARN)
set_name(0x8014B090, "reset_cdstream", SN_NOWARN)
set_name(0x8014B0B8... | [
2617,
62,
3672,
7,
15,
87,
23,
28645,
32,
7708,
15,
11,
366,
16412,
62,
10210,
62,
36163,
1600,
11346,
62,
45669,
1503,
45,
8,
198,
2617,
62,
3672,
7,
15,
87,
23,
28645,
32,
7708,
23,
11,
366,
26708,
62,
34,
67,
3855,
50,
9250... | 1.93456 | 1,467 |
# Copyright 2018,2020 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from odoo import models
from odoo.http import request
| [
2,
15069,
2864,
11,
42334,
21798,
28876,
528,
283,
11203,
1279,
5450,
1378,
270,
12,
42068,
13,
10951,
14,
15097,
14,
88,
417,
528,
283,
11203,
29,
198,
2,
13789,
17370,
6489,
12,
18,
13,
15,
393,
1568,
357,
4023,
1378,
2503,
13,
... | 2.898551 | 69 |
import argparse
# model_name_or_path 'openai-gpt2' did not work, just gpt2 now
| [
11748,
1822,
29572,
198,
2,
2746,
62,
3672,
62,
273,
62,
6978,
705,
9654,
1872,
12,
70,
457,
17,
6,
750,
407,
670,
11,
655,
308,
457,
17,
783,
628,
198
] | 2.612903 | 31 |
from rapidsms.router.blocking import BlockingRouter
from celery_router.tasks import rapidsms_handle_message
class CeleryRouter(BlockingRouter):
"""Skeleton router only used to execute the Celery task."""
| [
6738,
4095,
2340,
907,
13,
472,
353,
13,
41938,
1330,
1086,
8629,
49,
39605,
198,
198,
6738,
18725,
1924,
62,
472,
353,
13,
83,
6791,
1330,
4095,
2340,
907,
62,
28144,
62,
20500,
628,
198,
4871,
15248,
1924,
49,
39605,
7,
3629,
8629... | 3.246154 | 65 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import rospy
import sys
from std_msgs.msg import String
rospy.init_node('boke') # ノード名「count」に設定
pub = rospy.Publisher('funny_boke', String, queue_size=10) # パブリッシャ「count_up」を作成
rate = rospy.Rate(10) # 10H... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
17,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
11748,
686,
2777,
88,
198,
11748,
25064,
198,
6738,
14367,
62,
907,
14542,
13,
19662,
1330,
10903,
198,
198,
... | 1.626866 | 335 |
#!/bin/false
# Copyright (c) 2022 Vít Labuda. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions an... | [
2,
48443,
8800,
14,
9562,
198,
198,
2,
15069,
357,
66,
8,
33160,
569,
8836,
83,
3498,
15339,
13,
1439,
2489,
10395,
13,
198,
2,
198,
2,
2297,
396,
3890,
290,
779,
287,
2723,
290,
13934,
5107,
11,
351,
393,
1231,
17613,
11,
389,
... | 3.587342 | 790 |
"""
IGWeight.py -
Compute IG Weights given a set of tokenized buckets and a feature set
Marco Lui, January 2013
Based on research by Marco Lui and Tim Baldwin.
Copyright 2013 Marco Lui <saffsd@gmail.com>. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permi... | [
37811,
198,
3528,
25844,
13,
9078,
532,
198,
7293,
1133,
35336,
775,
2337,
1813,
257,
900,
286,
11241,
1143,
38674,
290,
257,
3895,
900,
198,
198,
37179,
6026,
72,
11,
3269,
2211,
198,
198,
15001,
319,
2267,
416,
16556,
6026,
72,
290,... | 2.710065 | 3,080 |
import pandas as pd
from collections import defaultdict
from collections import OrderedDict
import matplotlib.pyplot as plt
import random
import re
import ast
from nltk.corpus import wordnet as wn
import spacy
from spacy import displacy
from collections import Counter
import en_core_web_sm
nlp = spacy.load("en")
pri... | [
11748,
19798,
292,
355,
279,
67,
198,
6738,
17268,
1330,
4277,
11600,
198,
6738,
17268,
1330,
14230,
1068,
35,
713,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
4738,
198,
11748,
302,
198,
11748,
6468,
198,
... | 1.944815 | 2,845 |
@Setup
@Token("T_STRING")
@Token("T_PRODUCER")
@Token("T_SPLIT")
@Pattern(["T_STRING", "T_PRODUCER", "T_STRING"])
@Pattern(["S_SUB"])
@Pattern(["S_SUB", "S_DEF"])
| [
31,
40786,
198,
198,
31,
30642,
7203,
51,
62,
18601,
2751,
4943,
198,
198,
31,
30642,
7203,
51,
62,
4805,
3727,
9598,
1137,
4943,
198,
198,
31,
30642,
7203,
51,
62,
4303,
43,
2043,
4943,
198,
198,
31,
47546,
7,
14692,
51,
62,
1860... | 1.857143 | 91 |
"""
Draw the maximum co-efficient value matrix
TODO: [Done]find the max RMD value, and get coefficient matrix for this value
"""
import numpy as np
import os
from scipy import signal
from scipy import stats
import matplotlib.pyplot as plt
# Global arrays
wav_out = []
def co_matrix(data):
"""
I will made the... | [
37811,
198,
25302,
262,
5415,
763,
12,
16814,
1988,
17593,
220,
198,
198,
51,
3727,
46,
25,
685,
45677,
60,
19796,
262,
3509,
371,
12740,
1988,
11,
290,
651,
35381,
17593,
329,
428,
1988,
198,
37811,
198,
198,
11748,
299,
32152,
355,
... | 2.137427 | 1,368 |
#print (text to write on the terminal)
print("ello world") | [
2,
4798,
357,
5239,
284,
3551,
319,
262,
12094,
8,
198,
4798,
7203,
11109,
995,
4943
] | 3.625 | 16 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# %% [markdown]
# # Process the raw mooring data
#
# Contents:
# * <a href=#raw>Raw data reprocessing.</a>
# * <a href=#corrected>Interpolated data processing.</a>
# * <a href=#ADCP>ADCP processing.</a>
# * <a href=#VMP>VMP processing.</a>
#
# Import the needed libraries.
... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
17,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
43313,
685,
4102,
2902,
60,
198,
2,
1303,
10854,
262,
8246,
285,
2675,
278,
1366,
198,
2,
198,
2,
26714,
25,... | 2.015024 | 23,563 |
"""add verification_roles table
Revision ID: 4fc3ae9ba717
Revises: 215e9036a3d7
Create Date: 2020-07-05 20:08:18.197783
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4fc3ae9ba717'
down_revision = '215e9036a3d7'
branch_labels = None
depends_on = None
| [
37811,
2860,
19637,
62,
305,
829,
3084,
198,
198,
18009,
1166,
4522,
25,
604,
16072,
18,
3609,
24,
7012,
22,
1558,
198,
18009,
2696,
25,
22951,
68,
3829,
2623,
64,
18,
67,
22,
198,
16447,
7536,
25,
12131,
12,
2998,
12,
2713,
1160,
... | 2.492063 | 126 |
# Copyright 2014-2017 Insight Software Consortium.
# Copyright 2004-2009 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
import os
import sys
import time
import hotshot
import hotshot.stats
this_module_dir_path = os.path.abspath(
os.path.dir... | [
2,
15069,
1946,
12,
5539,
39917,
10442,
42727,
13,
198,
2,
15069,
5472,
12,
10531,
7993,
30254,
16206,
7204,
13,
198,
2,
4307,
6169,
739,
262,
19835,
10442,
13789,
11,
10628,
352,
13,
15,
13,
198,
2,
4091,
2638,
1378,
2503,
13,
3952... | 2.752 | 625 |
import pytest
from matplotlib import pyplot as plt
from matplotlib.axes import Axes
from sklearn.linear_model import LinearRegression, LogisticRegression
from ml_tooling import Model
from ml_tooling.data import load_demo_dataset
from ml_tooling.plots.viz import RegressionVisualize, ClassificationVisualize
from ml_tool... | [
11748,
12972,
9288,
198,
6738,
2603,
29487,
8019,
1330,
12972,
29487,
355,
458,
83,
198,
6738,
2603,
29487,
8019,
13,
897,
274,
1330,
12176,
274,
198,
6738,
1341,
35720,
13,
29127,
62,
19849,
1330,
44800,
8081,
2234,
11,
5972,
2569,
808... | 3.46 | 100 |
from typing import Optional
from pydantic import Field, conint
from pystratis.api import Model
from pystratis.core.types import uint256
# noinspection PyUnresolvedReferences
class GetTxOutRequest(Model):
"""A request model for the node/gettxout endpoint.
Args:
trxid (uint256): The trxid to check.
... | [
6738,
19720,
1330,
32233,
198,
6738,
279,
5173,
5109,
1330,
7663,
11,
369,
600,
198,
6738,
12972,
2536,
37749,
13,
15042,
1330,
9104,
198,
6738,
12972,
2536,
37749,
13,
7295,
13,
19199,
1330,
20398,
11645,
628,
198,
2,
645,
1040,
14978,... | 2.747664 | 214 |
import sys
from pyteal import *
if __name__ == "__main__":
arg = int(sys.argv[1])
print(compileTeal(contract_account(arg), Mode.Signature, version=3))
| [
11748,
25064,
198,
6738,
12972,
660,
282,
1330,
1635,
628,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1822,
796,
493,
7,
17597,
13,
853,
85,
58,
16,
12962,
198,
220,
220,
220,
3601,
7,
5... | 2.53125 | 64 |
from typing import List, Pattern
import re
from matflow.exceptionpackage.MatFlowException import InternalException
class VersionNumber:
"""
This class represents string expressions that are valid version numbers
"""
__number: str
def __init__(self, number: str):
"""Translates correct str... | [
6738,
19720,
1330,
7343,
11,
23939,
198,
11748,
302,
198,
6738,
2603,
11125,
13,
1069,
4516,
26495,
13,
19044,
37535,
16922,
1330,
18628,
16922,
628,
198,
4871,
10628,
15057,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
770,
1398,... | 2.556465 | 1,222 |
import itertools
import copy
import logging
import datapackage
from dataflows.helpers.resource_matcher import ResourceMatcher
from datapackage_pipelines.wrapper import ingest, spew, get_dependency_datapackage_url
from datapackage_pipelines.utilities.resources import tabular, PROP_STREAMING, \
PROP_STREAMED_FROM
... | [
11748,
340,
861,
10141,
198,
11748,
4866,
198,
11748,
18931,
198,
198,
11748,
4818,
499,
441,
496,
198,
198,
6738,
1366,
44041,
13,
16794,
364,
13,
31092,
62,
6759,
2044,
1330,
20857,
19044,
2044,
198,
198,
6738,
4818,
499,
441,
496,
... | 2.992 | 125 |
from pathlib import Path
from setuptools import setup, find_packages
from alab_management import __version__
setup(
name="alab_management",
packages=find_packages(exclude=["tests", "tests.*"]),
package_data={"alab_management": ["py.typed"]},
version=__version__,
author="Alab Project Team",
py... | [
6738,
3108,
8019,
1330,
10644,
198,
198,
6738,
900,
37623,
10141,
1330,
9058,
11,
1064,
62,
43789,
198,
198,
6738,
435,
397,
62,
27604,
1330,
11593,
9641,
834,
198,
198,
40406,
7,
198,
220,
220,
220,
1438,
2625,
282,
397,
62,
27604,
... | 2.559441 | 286 |
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import tensorflow as tf
config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.compat.v1.Session(config=config)
import tensorflow_probability as tfp
tfd = tfp.distributions
from mpi4py import MP... | [
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
29487,
8019,
198,
6759,
29487,
8019,
13,
1904,
10786,
46384,
11537,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
11250,... | 2.255005 | 4,396 |
from asynctest import mock as async_mock, TestCase as AsyncTestCase
from ......messaging.request_context import RequestContext
from ......messaging.responder import MockResponder
from ......transport.inbound.receipt import MessageReceipt
from ...messages.cred_problem_report import V20CredProblemReport, ProblemReportR... | [
6738,
355,
2047,
310,
395,
1330,
15290,
355,
30351,
62,
76,
735,
11,
6208,
20448,
355,
1081,
13361,
14402,
20448,
198,
198,
6738,
47082,
37348,
3039,
13,
25927,
62,
22866,
1330,
19390,
21947,
198,
6738,
47082,
37348,
3039,
13,
5546,
263... | 3.747573 | 103 |
from .lmcut import tokenize
| [
6738,
764,
75,
76,
8968,
1330,
11241,
1096,
198
] | 3.111111 | 9 |
#!/usr/bin/env python
# coding: utf-8
# PyDrive activation Used for bypassing Google Drive download rate limit
# In[ ]:
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
download_with_pydrive = True #@param {typ... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
19617,
25,
3384,
69,
12,
23,
198,
198,
2,
9485,
24825,
14916,
16718,
329,
17286,
278,
3012,
9974,
4321,
2494,
4179,
198,
198,
2,
554,
58,
2361,
25,
628,
198,
6738,
279,
5173,
11... | 2.645228 | 3,887 |
import pyspark
from pyspark import SparkConf
from pyspark.sql import SparkSession
spark = SparkSession \
.builder \
.appName("Our first Python Spark SQL example") \
.getOrCreate()
spark.sparkContext.getConf().getAll()
spark
path = "./data/sparkify_log_small.json"
user_log = spark.read.json(path)
user_l... | [
11748,
279,
893,
20928,
198,
6738,
279,
893,
20928,
1330,
17732,
18546,
198,
6738,
279,
893,
20928,
13,
25410,
1330,
17732,
36044,
198,
198,
2777,
668,
796,
17732,
36044,
3467,
198,
220,
220,
220,
764,
38272,
3467,
198,
220,
220,
220,
... | 2.478764 | 259 |
from django.forms import ModelForm
from .models import Comment, Reply | [
6738,
42625,
14208,
13,
23914,
1330,
9104,
8479,
198,
6738,
764,
27530,
1330,
18957,
11,
14883
] | 4.3125 | 16 |
#! /usr/bin/env python
from flask.ext.script import Manager
from flask.ext.script.commands import ShowUrls, Clean
from <%= appName %> import create_app<% if (databaseMapper === 'sqlalchemy') { -%>, db<% } %>
app = create_app("development")
manager = Manager(app)
manager.add_command("show-urls", ShowUrls())
manager.... | [
2,
0,
1220,
14629,
14,
8800,
14,
24330,
21015,
198,
6738,
42903,
13,
2302,
13,
12048,
1330,
9142,
198,
6738,
42903,
13,
2302,
13,
12048,
13,
9503,
1746,
1330,
5438,
16692,
7278,
11,
5985,
198,
198,
6738,
1279,
4,
28,
598,
5376,
4064... | 2.749319 | 367 |
import numpy as np
from sklearn.utils.validation import check_X_y, check_is_fitted
| [
11748,
299,
32152,
355,
45941,
198,
6738,
1341,
35720,
13,
26791,
13,
12102,
341,
1330,
2198,
62,
55,
62,
88,
11,
2198,
62,
271,
62,
38631,
628
] | 3.111111 | 27 |
from django.urls import path
from . import views
app_name = 'network'
urlpatterns = [
path('', views.Index.as_view(), name='index'),
path('create-subscriber/', views.CreateSubscriber.as_view(), name='create-subscriber'),
]
| [
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
198,
6738,
764,
1330,
5009,
198,
198,
1324,
62,
3672,
796,
705,
27349,
6,
198,
198,
6371,
33279,
82,
796,
685,
198,
220,
220,
220,
3108,
10786,
3256,
5009,
13,
15732,
13,
292,
62,
1177,
... | 2.807229 | 83 |
"""PDF utilities
"""
import collections
import fpdf
import os
import pathlib
import PyPDF2 as pypdf
import tempfile
import time
import typing
import apsjournals
ArticleMeta = collections.namedtuple('ArticleMeta', 'article file pages')
LinkMeta = collections.namedtuple('LinkMeta', 'source_page target_page x y w h')
... | [
37811,
20456,
20081,
198,
37811,
628,
198,
11748,
17268,
198,
11748,
277,
12315,
198,
11748,
28686,
198,
11748,
3108,
8019,
198,
11748,
9485,
20456,
17,
355,
279,
4464,
7568,
198,
11748,
20218,
7753,
198,
11748,
640,
198,
11748,
19720,
19... | 2.088186 | 3,606 |
# -*- coding: utf-8 -*-
# Copyright 2020 The Matrix.org Foundation C.I.C.
#
# 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 require... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
15069,
12131,
383,
24936,
13,
2398,
5693,
327,
13,
40,
13,
34,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
... | 3.606299 | 254 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2017 Sebastian Golasch (plugin.video.netflix)
Copyright (C) 2018 Caphm (original implementation module)
MSL request building
SPDX-License-Identifier: MIT
See LICENSES/MIT.md for more information.
"""
from __future__ import absolute_import, division, unicode... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
220,
220,
220,
15069,
357,
34,
8,
2177,
26190,
402,
12456,
354,
357,
33803,
13,
15588,
13,
36977,
8,
198,
220,
220,
220,
15069,
357,
34,
8,
2864,
4476,
2... | 2.375811 | 1,695 |
# from https://github.com/jupyterhub/mybinder.org-deploy/blob/master/appendix/extra_notebook_config.py
import os
# if a user leaves a notebook with a running kernel,
# the effective idle timeout will typically be CULL_TIMEOUT + CULL_KERNEL_TIMEOUT
# as culling the kernel will register activity,
# resetting the no_activ... | [
2,
422,
3740,
1378,
12567,
13,
785,
14,
73,
929,
88,
353,
40140,
14,
1820,
65,
5540,
13,
2398,
12,
2934,
1420,
14,
2436,
672,
14,
9866,
14,
1324,
19573,
14,
26086,
62,
11295,
2070,
62,
11250,
13,
9078,
198,
11748,
28686,
198,
2,
... | 2.802521 | 476 |
# -*- coding: utf-8 -*-
""" 东方财富网:个股详情爬虫 """
import re
import scrapy
import json
import time
from crawl import db
from crawl import helper
from crawl.models.Stock import Stock
from crawl.models.StockDetail import StockDetail
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
37811,
220,
10310,
250,
43095,
164,
112,
95,
43380,
234,
163,
121,
239,
171,
120,
248,
10310,
103,
164,
224,
94,
46237,
99,
46349,
227,
163,
230,
105,
164,
247,
... | 2.414894 | 94 |
import torch
x = torch.randn(10, 5)
print(x)
labels = torch.LongTensor([1,2,3,3,0,0,0,0,0,0])
n_classes = x.shape[-1]
one_hot = torch.nn.functional.one_hot(labels, n_classes)
print(one_hot)
print(x * one_hot)
compare = (x * one_hot).sum(-1).unsqueeze(-1).repeat(1, n_classes)
print(compare)
compared_scores = x... | [
11748,
28034,
198,
198,
87,
796,
28034,
13,
25192,
77,
7,
940,
11,
642,
8,
198,
198,
4798,
7,
87,
8,
198,
198,
23912,
1424,
796,
28034,
13,
14617,
51,
22854,
26933,
16,
11,
17,
11,
18,
11,
18,
11,
15,
11,
15,
11,
15,
11,
15,... | 2.16 | 200 |
import sys
import h5py
import json
import numpy as np
import matplotlib.pyplot as plt
filename = sys.argv[1]
data = h5py.File(filename,'r')
attr = json.loads(data.attrs['jsonparam'])
#for k,v in attr['config'].items():
# print(k,v)
#print()
#
#for k,v in attr['param'].items():
# print(k,v)
#
#print()
#print()
... | [
11748,
25064,
198,
11748,
289,
20,
9078,
198,
11748,
33918,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
198,
34345,
796,
25064,
13,
853,
85,
58,
16,
60,
198,
7890,
796,
289,
... | 2.167006 | 491 |
from typing import NoReturn
from .StoryManager import StoryManager
| [
6738,
19720,
1330,
1400,
13615,
198,
6738,
764,
11605,
13511,
1330,
8362,
13511,
628
] | 4.857143 | 14 |
import numpy as np
import pylab as pl
from peri.test import init
crbs = []
rads = np.arange(1, 10, 1./5)
rads = np.linspace(1, 10, 39)
rads = np.logspace(0, 1, 50)
s = init.create_single_particle_state(imsize=64, radius=1, sigma=0.05)
blocks = s.blocks_particle(0)
for rad in rads:
print "Radius", rad
s.upda... | [
11748,
299,
32152,
355,
45941,
198,
11748,
279,
2645,
397,
355,
458,
198,
198,
6738,
583,
72,
13,
9288,
1330,
2315,
198,
198,
6098,
1443,
796,
17635,
198,
81,
5643,
796,
45941,
13,
283,
858,
7,
16,
11,
838,
11,
352,
19571,
20,
8,
... | 2.066327 | 392 |
#!/usr/bin/python
import simple_test
simple_test.test("test27", [])
| [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
198,
11748,
2829,
62,
9288,
198,
198,
36439,
62,
9288,
13,
9288,
7203,
9288,
1983,
1600,
685,
12962,
198
] | 2.592593 | 27 |
import calendar
import json
import os.path
import warnings
from pathlib import Path
from collections import OrderedDict
in_json = Path('/media/data/GDL_all_images/data_file.json')
out_json = Path('/media/data/GDL_all_images/data_file_dates.json')
root_cutoff = Path('/media/data/')
img_root_dir = '/media/data/GDL_all_... | [
11748,
11845,
198,
11748,
33918,
198,
11748,
28686,
13,
6978,
198,
11748,
14601,
198,
198,
6738,
3108,
8019,
1330,
10644,
198,
6738,
17268,
1330,
14230,
1068,
35,
713,
198,
198,
259,
62,
17752,
796,
10644,
10786,
14,
11431,
14,
7890,
14... | 2.744828 | 145 |
# Copyright © 2019 Province of British Columbia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | [
2,
15069,
10673,
13130,
22783,
286,
3517,
9309,
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,
... | 3.355263 | 380 |
######################################
# Django 模块
######################################
from django.db import models
from django.db.models import Q
######################################
# 系统模块
######################################
import datetime
######################################
# 自定义模块
####################... | [
29113,
4242,
2235,
198,
2,
37770,
10545,
101,
94,
161,
251,
245,
198,
29113,
4242,
2235,
198,
6738,
42625,
14208,
13,
9945,
1330,
4981,
198,
6738,
42625,
14208,
13,
9945,
13,
27530,
1330,
1195,
198,
198,
29113,
4242,
2235,
198,
2,
133... | 4.036496 | 137 |
"""
RHESSI LightCurve Tests
"""
from __future__ import absolute_import
import pytest
import sunpy.lightcurve
from sunpy.time import TimeRange
from numpy import all
| [
198,
37811,
198,
48587,
7597,
40,
4401,
26628,
303,
30307,
198,
37811,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
198,
11748,
12972,
9288,
198,
11748,
4252,
9078,
13,
2971,
22019,
303,
198,
6738,
4252,
9078,
13,
2435,
133... | 3.34 | 50 |
from .graph import graph
from .graph2 import graph2
| [
6738,
764,
34960,
1330,
4823,
198,
6738,
764,
34960,
17,
1330,
4823,
17,
198
] | 3.714286 | 14 |
from flask import Flask
from flask import render_template,request,redirect,url_for,abort
from ..models import User,Citizen
from . import main
from .forms import SearchForm,AdminForm
from .. import db,photos
from flask_login import login_required,current_user
import markdown2
@main.route('/',methods = ['GET','POST'])
d... | [
6738,
42903,
1330,
46947,
198,
6738,
42903,
1330,
8543,
62,
28243,
11,
25927,
11,
445,
1060,
11,
6371,
62,
1640,
11,
397,
419,
198,
6738,
11485,
27530,
1330,
11787,
11,
34,
36958,
198,
6738,
764,
1330,
1388,
198,
6738,
764,
23914,
133... | 3.185328 | 259 |
# Time: O(m * n)
# Space: O(m * n)
# Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell.
# The distance between two adjacent cells is 1.
#
# Example 1:
#
# Input:
# 0 0 0
# 0 1 0
# 0 0 0
#
# Output:
# 0 0 0
# 0 1 0
# 0 0 0
#
# Example 2:
#
# Input:
# 0 0 0
# 0 1 0
# 1 1 1
#
# Outpu... | [
2,
3862,
25,
220,
440,
7,
76,
1635,
299,
8,
198,
2,
4687,
25,
440,
7,
76,
1635,
299,
8,
198,
198,
2,
11259,
257,
17593,
10874,
286,
657,
290,
352,
11,
1064,
262,
5253,
286,
262,
16936,
657,
329,
1123,
2685,
13,
198,
2,
383,
... | 2.619048 | 210 |
__all__ = ['rvm']
import numpy as np
#import pdb
#from pyandres import cholInvert
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Initialization
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Pre-process basis
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... | [
834,
439,
834,
796,
37250,
81,
14761,
20520,
198,
11748,
299,
32152,
355,
45941,
198,
2,
11748,
279,
9945,
198,
2,
6738,
12972,
392,
411,
1330,
442,
349,
818,
1851,
198,
198,
2,
36917,
36917,
36917,
36917,
36917,
36917,
36917,
36917,
... | 2.593985 | 665 |