content stringlengths 1 1.05M | input_ids listlengths 1 883k | ratio_char_token float64 1 22.9 | token_count int64 1 883k |
|---|---|---|---|
import heapq
answer = solution([1,2,3,9,10,12], 1000)
print(answer) | [
11748,
24575,
80,
198,
41484,
796,
4610,
26933,
16,
11,
17,
11,
18,
11,
24,
11,
940,
11,
1065,
4357,
8576,
8,
198,
4798,
7,
41484,
8
] | 2.481481 | 27 |
from x_rebirth_station_calculator.station_data.station_base import Module
from x_rebirth_station_calculator.station_data.station_base import Production
from x_rebirth_station_calculator.station_data.station_base import Consumption
from x_rebirth_station_calculator.station_data import wares
names = {'L044': 'Valley For... | [
6738,
2124,
62,
260,
24280,
62,
17529,
62,
9948,
3129,
1352,
13,
17529,
62,
7890,
13,
17529,
62,
8692,
1330,
19937,
198,
6738,
2124,
62,
260,
24280,
62,
17529,
62,
9948,
3129,
1352,
13,
17529,
62,
7890,
13,
17529,
62,
8692,
1330,
19... | 2.705069 | 217 |
"""empty message
Revision ID: e424d03ba260
Revises: ace8d095a26b
Create Date: 2017-10-12 11:25:11.775853
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'e424d03ba260'
down_revision = 'ace8d095a26b'
branch_labels = None
depends_on = None
| [
37811,
28920,
3275,
198,
198,
18009,
1166,
4522,
25,
304,
40090,
67,
3070,
7012,
21719,
198,
18009,
2696,
25,
31506,
23,
67,
2931,
20,
64,
2075,
65,
198,
16447,
7536,
25,
2177,
12,
940,
12,
1065,
1367,
25,
1495,
25,
1157,
13,
34483,... | 2.512605 | 119 |
from setuptools import setup
setup(
name='smiegel',
version='0.0',
long_description=__doc__,
packages=['smiegel'],
include_package_data=True,
author='Erik Price',
description='Self hosted SMS mirroring service',
license='MIT',
install_requires=open('requirements.txt').readlines(),
... | [
6738,
900,
37623,
10141,
1330,
9058,
198,
198,
40406,
7,
198,
220,
220,
220,
1438,
11639,
5796,
28210,
3256,
198,
220,
220,
220,
2196,
11639,
15,
13,
15,
3256,
198,
220,
220,
220,
890,
62,
11213,
28,
834,
15390,
834,
11,
198,
220,
... | 2.45977 | 174 |
from buycoins.client import BuyCoinsClient
from buycoins.exceptions import AccountError, ClientError, ServerError
from buycoins.exceptions.utils import check_response
| [
6738,
2822,
14624,
13,
16366,
1330,
11763,
7222,
1040,
11792,
198,
6738,
2822,
14624,
13,
1069,
11755,
1330,
10781,
12331,
11,
20985,
12331,
11,
9652,
12331,
198,
6738,
2822,
14624,
13,
1069,
11755,
13,
26791,
1330,
2198,
62,
26209,
628
] | 4.2 | 40 |
"""App Signals
"""
import logging
from django.db.models.signals import post_save
from django.dispatch import receiver
from vision_on_edge.azure_training_status.models import TrainingStatus
from vision_on_edge.notifications.models import Notification
logger = logging.getLogger(__name__)
| [
37811,
4677,
5865,
874,
198,
37811,
198,
198,
11748,
18931,
198,
198,
6738,
42625,
14208,
13,
9945,
13,
27530,
13,
12683,
874,
1330,
1281,
62,
21928,
198,
6738,
42625,
14208,
13,
6381,
17147,
1330,
9733,
198,
198,
6738,
5761,
62,
261,
... | 3.435294 | 85 |
import json
import brilleaux_settings
import flask
from flask_caching import Cache
from flask_cors import CORS
import logging
import sys
from pyelucidate.pyelucidate import async_items_by_container, format_results, mirador_oa
app = flask.Flask(__name__)
CORS(app)
cache = Cache(
app, config={"CACHE_TYPE": "filesyst... | [
11748,
33918,
198,
11748,
865,
8270,
14644,
62,
33692,
198,
11748,
42903,
198,
6738,
42903,
62,
66,
8103,
1330,
34088,
198,
6738,
42903,
62,
66,
669,
1330,
327,
20673,
198,
11748,
18931,
198,
11748,
25064,
198,
6738,
12972,
417,
1229,
2... | 2.40613 | 261 |
from typing import Optional
from aiohttp.web import AppRunner
# TODO fix import
from aioros.graph_resource import get_local_address
from .master_api_server import start_server
from .param_cache import ParamCache
from .registration_manager import RegistrationManager
| [
6738,
19720,
1330,
32233,
198,
198,
6738,
257,
952,
4023,
13,
12384,
1330,
2034,
49493,
198,
198,
2,
16926,
46,
4259,
1330,
198,
6738,
257,
1504,
418,
13,
34960,
62,
31092,
1330,
651,
62,
12001,
62,
21975,
198,
198,
6738,
764,
9866,
... | 3.857143 | 70 |
from db import db
| [
6738,
20613,
1330,
20613,
628,
628
] | 3.5 | 6 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-10-23 09:47
from __future__ import unicode_literals
from django.db import migrations
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2980,
515,
416,
37770,
352,
13,
24,
13,
1485,
319,
2177,
12,
940,
12,
1954,
7769,
25,
2857,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
... | 2.690909 | 55 |
import time
import subprocess
import sys
import logging
if __name__ == "__main__":
try:
print(generate(**dict(arg.split("=") for arg in sys.argv[1:])))
except GitDirectoryError as e:
logging.error("%s %s", "[DateVersioning]", e)
| [
11748,
640,
198,
11748,
850,
14681,
198,
11748,
25064,
198,
11748,
18931,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
8612,
3... | 2.544554 | 101 |
MAX_CONSOLE_LINE_LENGTH = 79
| [
22921,
62,
10943,
15821,
2538,
62,
24027,
62,
43,
49494,
796,
9225,
628
] | 2.307692 | 13 |
# -*- coding: utf-8 -*-
import typing
import pandas as pd
import smart_open
import awswrangler as wr
from .helpers import (
check_enumeration_s3_key_string,
get_key_size_all_objects,
group_s3_objects_no_larger_than,
)
from .options import ZFILL
def merge_parquet(boto3_session,
source_u... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
11748,
19720,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
4451,
62,
9654,
198,
11748,
3253,
2032,
36985,
1754,
355,
1319,
198,
6738,
764,
16794,
364,
1330,
35... | 1.973913 | 1,265 |
# Supress warnings caused by tensorflow
import warnings
warnings.filterwarnings('ignore', category = DeprecationWarning)
warnings.filterwarnings('ignore', category = PendingDeprecationWarning)
import pytest
from .. import Marabou
import numpy as np
import os
# Global settings
TOL = 1e-4 ... | [
2,
5200,
601,
14601,
4073,
416,
11192,
273,
11125,
198,
11748,
14601,
198,
40539,
654,
13,
24455,
40539,
654,
10786,
46430,
3256,
6536,
796,
2129,
8344,
341,
20361,
8,
198,
40539,
654,
13,
24455,
40539,
654,
10786,
46430,
3256,
6536,
79... | 2.724757 | 1,951 |
# Generated by Django 3.2.12 on 2022-04-24 14:40
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_jalali.db.models
| [
2,
2980,
515,
416,
37770,
513,
13,
17,
13,
1065,
319,
33160,
12,
3023,
12,
1731,
1478,
25,
1821,
198,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
198,
11748,
42625,
... | 2.953125 | 64 |
import os
from dotenv import load_dotenv
import pandas as pd
import psycopg2
from psycopg2.extras import execute_values
import json
import numpy as np
load_dotenv()
DB_NAME = os.getenv("DB_NAME")
DB_USER = os.getenv("DB_USER")
DB_PASSWORD = os.getenv("DB_PASSWORD")
DB_HOST= os.getenv("DB_HOST")
conn = psycopg2.con... | [
11748,
28686,
198,
6738,
16605,
24330,
1330,
3440,
62,
26518,
24330,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
17331,
22163,
70,
17,
198,
6738,
17331,
22163,
70,
17,
13,
2302,
8847,
1330,
12260,
62,
27160,
198,
11748,
33918,
198... | 3.100863 | 2,201 |
import json
from flask import Flask, render_template, redirect, Response, jsonify,request
from flask_cors import CORS
from Kerberos import Server,Server_Error
app = Flask(__name__, static_folder='./static', static_url_path='/')
cors = CORS(app)
#! This server uses distinct routes for different type of requests
#? We ... | [
11748,
33918,
198,
6738,
42903,
1330,
46947,
11,
8543,
62,
28243,
11,
18941,
11,
18261,
11,
33918,
1958,
11,
25927,
198,
6738,
42903,
62,
66,
669,
1330,
327,
20673,
198,
6738,
17337,
527,
418,
1330,
9652,
11,
10697,
62,
12331,
198,
13... | 3.222798 | 193 |
import sys, glob
from os import listdir, remove
from os.path import dirname, join, isfile, abspath
from io import StringIO
import numpy as np
import utilsmodule as um
script_path = dirname(abspath(__file__))
datasetPath = join(script_path,"data/")
e = 'shrec'
### Compute the dice coefficient used in Table 1,
# E Mo... | [
11748,
25064,
11,
15095,
198,
6738,
28686,
1330,
1351,
15908,
11,
4781,
198,
6738,
28686,
13,
6978,
1330,
26672,
3672,
11,
4654,
11,
318,
7753,
11,
2352,
6978,
198,
6738,
33245,
1330,
10903,
9399,
198,
198,
11748,
299,
32152,
355,
45941... | 2.448193 | 1,245 |
from firebase import *
| [
6738,
2046,
8692,
1330,
1635,
198
] | 3.833333 | 6 |
import logging
from random import randint, random
from mlflow import (
active_run,
end_run,
get_tracking_uri,
log_metric,
log_param,
start_run,
)
from mlflow.tracking import MlflowClient
from dbnd import task
logger = logging.getLogger(__name__)
#
# from dbnd_task
# @task
# def mlflow_ex... | [
11748,
18931,
198,
198,
6738,
4738,
1330,
43720,
600,
11,
4738,
198,
198,
6738,
285,
1652,
9319,
1330,
357,
198,
220,
220,
220,
4075,
62,
5143,
11,
198,
220,
220,
220,
886,
62,
5143,
11,
198,
220,
220,
220,
651,
62,
36280,
62,
990... | 2.43125 | 160 |
from .channelpad import channelpad
from .conv2d_same import conv2d_same
from .padding import get_same_padding, pad_same
from .shakedrop import shakedrop
from .sigaug import signal_augment
from .sigmoid import h_sigmoid
from .stack import adjusted_concat, adjusted_stack
from .swish import h_swish, swish
| [
6738,
764,
17620,
15636,
1330,
6518,
15636,
201,
198,
6738,
764,
42946,
17,
67,
62,
31642,
1330,
3063,
17,
67,
62,
31642,
201,
198,
6738,
764,
39231,
1330,
651,
62,
31642,
62,
39231,
11,
14841,
62,
31642,
201,
198,
6738,
764,
1477,
... | 3.029126 | 103 |
#Conditional Tests HW - Due Monday
# 13 Tests --> 1 True and 1 False for each
#If Statements
#Simplest structure of an if statement:
# if conditional_test:
# do something <-- Instructions/commands
#my_age = 13
#if my_age >= 18:
# print("You are old enough to vote.")
# print("Are you registered to vote?... | [
2,
25559,
1859,
30307,
44884,
532,
14444,
3321,
198,
2,
1511,
30307,
14610,
352,
6407,
290,
352,
10352,
329,
1123,
198,
198,
2,
1532,
44936,
198,
198,
2,
8890,
489,
395,
4645,
286,
281,
611,
2643,
25,
198,
2,
220,
220,
611,
26340,
... | 3.228261 | 828 |
#!/usr/bin/env python
# BCET Workflow
__author__ = 'Sam Brooke'
__date__ = 'September 2017'
__copyright__ = '(C) 2017, Sam Brooke'
__email__ = "sbrooke@tuta.io"
import os
import georasters as gr
import matplotlib.pyplot as plt
import numpy as np
from optparse import OptionParser
import fnmatch
import re
from scipy.... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
2,
11843,
2767,
5521,
11125,
220,
198,
198,
834,
9800,
834,
796,
705,
16305,
46459,
6,
198,
834,
4475,
834,
796,
705,
17543,
2177,
6,
198,
834,
22163,
4766,
834,
796,
29513,
34,... | 2.382685 | 1,594 |
from pandas import DataFrame
import os
def frame_to_csv(frame:DataFrame,output_file:str,decimal_format=',',
float_format=None,date_format=None,quote_char='"',no_data_repr='',sep=';'):
"""
Converts a pandas dataframe to a csv file
Parameters
----------
output_file -> path to file to write to
d... | [
6738,
19798,
292,
1330,
6060,
19778,
198,
11748,
28686,
198,
198,
4299,
5739,
62,
1462,
62,
40664,
7,
14535,
25,
6601,
19778,
11,
22915,
62,
7753,
25,
2536,
11,
12501,
4402,
62,
18982,
28,
3256,
3256,
198,
22468,
62,
18982,
28,
14202,... | 2.809322 | 708 |
'''
Integration Test for HA mode with UI stop on one node.
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoo... | [
7061,
6,
201,
198,
201,
198,
34500,
1358,
6208,
329,
14558,
4235,
351,
12454,
2245,
319,
530,
10139,
13,
201,
198,
201,
198,
31,
9800,
25,
2264,
668,
38530,
201,
198,
7061,
6,
201,
198,
201,
198,
11748,
1976,
25558,
3822,
431,
15280... | 2.895706 | 163 |
# This code is licensed under the MIT License (see LICENSE file for details)
import ctypes
import atexit
# import all the autogenerated functions and definitions
# note: also pulls in common which provides AndorError and several other constants
from . import wrapper
from .wrapper import *
# Provided for reference pu... | [
2,
770,
2438,
318,
11971,
739,
262,
17168,
13789,
357,
3826,
38559,
24290,
2393,
329,
3307,
8,
198,
198,
11748,
269,
19199,
198,
11748,
379,
37023,
198,
198,
2,
1330,
477,
262,
1960,
519,
877,
515,
5499,
290,
17336,
198,
2,
3465,
25... | 2.64 | 975 |
from app.validation.error_messages import error_messages
from tests.integration.integration_test_case import IntegrationTestCase
| [
6738,
598,
13,
12102,
341,
13,
18224,
62,
37348,
1095,
1330,
4049,
62,
37348,
1095,
198,
6738,
5254,
13,
18908,
1358,
13,
18908,
1358,
62,
9288,
62,
7442,
1330,
38410,
14402,
20448,
628
] | 3.939394 | 33 |
import torch
import torch.nn as nn, torch.nn.functional as F
from torch.nn.parameter import Parameter
import math
from torch_scatter import scatter
from torch_geometric.utils import softmax
# NOTE: can not tell which implementation is better statistically
def normalize_l2(X):
"""Row-normalize matrix"""
... | [
11748,
28034,
198,
11748,
28034,
13,
20471,
355,
299,
77,
11,
28034,
13,
20471,
13,
45124,
355,
376,
198,
6738,
28034,
13,
20471,
13,
17143,
2357,
1330,
25139,
2357,
628,
198,
11748,
10688,
220,
198,
198,
6738,
28034,
62,
1416,
1436,
... | 2.314024 | 328 |
#!/bin/env python3
# import os
# os.environ['PYTHONASYNCIODEBUG'] = '1'
# import logging
# logging.getLogger('asyncio').setLevel(logging.DEBUG)
from datetime import datetime
import traceback
import atexit
import argparse
import os
from os import path
import sys
import logging
from struct import pack
import random
fro... | [
2,
48443,
8800,
14,
24330,
21015,
18,
198,
198,
2,
1330,
28686,
198,
2,
28686,
13,
268,
2268,
17816,
47,
56,
4221,
1340,
26483,
7792,
40,
16820,
12953,
20520,
796,
705,
16,
6,
198,
2,
1330,
18931,
198,
2,
18931,
13,
1136,
11187,
1... | 2.901499 | 1,401 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def main(options):
# test parameter handling
print options.infile, options.traml_in, options.outfile
def handle_args():
import argparse
usage = ""
usage += "\nOpenSwathFeatureXMLToTSV Converts a featureXML to a mProphet tsv."
parser ... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
201,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
201,
11748,
25064,
201,
201,
4299,
1388,
7,
25811,
2599,
201,
201,
220,
220,
220,
1303,
1332,
11507,
9041,
201,
220,
220,
... | 2.738832 | 291 |
import kanjigrid
gridder = kanjigrid.Gridder("Kanji", 40, "Header", 52)
grading = kanjigrid.Jouyou()
with open("test.txt", "r", encoding="utf-8") as f:
data = f.read()
gridder.feed_text(data)
grid = gridder.make_grid(grading, outside_of_grading=True, stats=True, bar_graph=True)
grid.save("test.png")
if "" in gra... | [
11748,
43998,
73,
3692,
312,
198,
198,
25928,
1082,
796,
43998,
73,
3692,
312,
13,
41339,
1082,
7203,
42,
272,
7285,
1600,
2319,
11,
366,
39681,
1600,
6740,
8,
198,
29247,
796,
43998,
73,
3692,
312,
13,
41,
280,
5832,
3419,
198,
198... | 2.572193 | 187 |
import torch
import numpy as np
import time
from spectrl.util.rl import get_rollout, test_policy
def ars(env, nn_policy, params):
'''
Run augmented random search.
Parameters:
env: gym.Env (state is expected to be a pair (np.array, int))
Also expected to provide cum_reward() funct... | [
11748,
28034,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
640,
198,
198,
6738,
5444,
45895,
13,
22602,
13,
45895,
1330,
651,
62,
2487,
448,
11,
1332,
62,
30586,
628,
628,
628,
198,
4299,
610,
82,
7,
24330,
11,
299,
77,
62,
30586... | 2.159542 | 2,971 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import subprocess
| [
2,
15069,
357,
66,
8,
5413,
10501,
13,
198,
2,
49962,
739,
262,
17168,
5964,
13,
198,
198,
11748,
850,
14681,
628
] | 4.227273 | 22 |
import sys
from pymod import index
from pymod.index import modules
from pymod.mappings import url
out = lambda s: sys.stdout.write(s)
out('{ ')
dom = index.domof('https://docs.python.org/2/library/exceptions.html')
for el in (el for el in dom.findAll('a', {'class': 'headerlink'})
if '-' not in el.attrs['... | [
11748,
25064,
198,
198,
6738,
12972,
4666,
1330,
6376,
198,
6738,
12972,
4666,
13,
9630,
1330,
13103,
198,
6738,
12972,
4666,
13,
76,
39242,
1330,
19016,
198,
198,
448,
796,
37456,
264,
25,
25064,
13,
19282,
448,
13,
13564,
7,
82,
8,
... | 2.518519 | 162 |
import sqlite3
from collections import namedtuple
from functional import seq
with sqlite3.connect(':memory:') as conn:
conn.execute('CREATE TABLE user (id INT, name TEXT)')
conn.commit()
User = namedtuple('User', 'id name')
seq([(1, 'pedro'), (2, 'fritz')]).to_sqlite3(
conn, 'INSERT INTO user... | [
11748,
44161,
578,
18,
198,
6738,
17268,
1330,
3706,
83,
29291,
198,
198,
6738,
10345,
1330,
33756,
198,
198,
4480,
44161,
578,
18,
13,
8443,
7,
10354,
31673,
25,
11537,
355,
48260,
25,
198,
220,
220,
220,
48260,
13,
41049,
10786,
433... | 2.251282 | 390 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Settings for launch_jobs.py
Test settings for automated tests.
To test run with job scheduler
@author: Matthias Gbel
"""
from run_wrf.configs.test.config_test import *
from copy import deepcopy
params = deepcopy(params)
params["vmem"] = 500
| [
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,
198,
26232,
329,
4219,
62,
43863,
13,
9078,
198,
14402,
6460,
329,
16359,
5254,
13,
198,
198,
2514,
1... | 2.883495 | 103 |
s1 = "I am a beginner in python \nI will study the concepts to be familiar with this language.\nIt is a very user friendly language"
print("The long string is: \n" + s1) # -- L1
s2 = """The long string is:
I am a beginner in python
I will study the concepts to be familiar with this language.
It is a very user ... | [
82,
16,
796,
366,
40,
716,
257,
31516,
287,
21015,
3467,
77,
40,
481,
2050,
262,
10838,
284,
307,
5385,
351,
428,
3303,
13,
59,
77,
1026,
318,
257,
845,
2836,
8030,
3303,
1,
201,
198,
4798,
7203,
464,
890,
4731,
318,
25,
3467,
7... | 3.147826 | 115 |
#!/usr/bin/env python
# $Id: setup.py 8864 2021-10-26 11:46:55Z grubert $
# Copyright: This file has been placed in the public domain.
from __future__ import print_function
import glob
import os
import sys
try:
from setuptools import setup
except ImportError:
print('Error: The "setuptools" module, which is r... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
720,
7390,
25,
9058,
13,
9078,
9193,
2414,
33448,
12,
940,
12,
2075,
1367,
25,
3510,
25,
2816,
57,
22848,
4835,
720,
198,
2,
15069,
25,
770,
2393,
468,
587,
4624,
287,
262,
1171... | 2.467671 | 2,057 |
"""Tests the ``remove`` plugin."""
from unittest.mock import patch
import pytest
import moe
class TestCommand:
"""Test the `remove` command."""
def test_track(self, mock_track, mock_query, mock_rm, tmp_rm_config):
"""Tracks are removed from the database with valid query."""
cli_args = ["... | [
37811,
51,
3558,
262,
7559,
28956,
15506,
13877,
526,
15931,
198,
198,
6738,
555,
715,
395,
13,
76,
735,
1330,
8529,
198,
198,
11748,
12972,
9288,
198,
198,
11748,
285,
2577,
628,
628,
198,
4871,
6208,
21575,
25,
198,
220,
220,
220,
... | 2.32356 | 955 |
#Tyler Sorensen
#February 15, 2012
#University of Utah
#PyBool_builder.py
#The interface to build recursive style boolean expressions
#See README.txt for more information
def mk_const_expr(val):
"""
returns a constant expression of value VAL
VAL should be of type boolean
"""
return {"type" : "con... | [
2,
46807,
311,
382,
5907,
268,
198,
2,
21816,
1315,
11,
2321,
198,
2,
21009,
286,
10202,
198,
198,
2,
20519,
33,
970,
62,
38272,
13,
9078,
198,
198,
2,
464,
7071,
284,
1382,
45115,
3918,
25131,
14700,
198,
2,
6214,
20832,
11682,
1... | 2.202198 | 910 |
#!/usr/bin/env python2
'''
A simple script to get the playback status of spotify.
This script needs ``dbus-python`` for spotify communication
To run simply::
./spotify-monitor.py <command>
Where command is one of the following::
``playback``
``playing``
'''
# pylint: disable=W0703
import dbus
from db... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
17,
198,
7061,
6,
198,
32,
2829,
4226,
284,
651,
262,
16388,
3722,
286,
4136,
1958,
13,
198,
198,
1212,
4226,
2476,
7559,
9945,
385,
12,
29412,
15506,
329,
4136,
1958,
6946,
198,
198,
251... | 2.04653 | 1,268 |
import sys
sys.path.insert(0, '../Pyro4-4.17')
import Pyro4
from time import clock
"""
log = open('pyro.log', 'w')
times = []
proxy = Pyro4.Proxy("PYRO:example.service@localhost:54642")
for i in range(100) :
local = []
begin = clock()
for files in proxy.getFiles(proxy.getcwd()) :
for file in file... | [
11748,
25064,
198,
198,
17597,
13,
6978,
13,
28463,
7,
15,
11,
705,
40720,
20519,
305,
19,
12,
19,
13,
1558,
11537,
198,
11748,
44954,
19,
198,
198,
6738,
640,
1330,
8801,
198,
198,
37811,
198,
6404,
796,
1280,
10786,
9078,
305,
13,... | 2.377644 | 331 |
from nose.tools import assert_equal
from tests.fixtures import WebTest
| [
6738,
9686,
13,
31391,
1330,
6818,
62,
40496,
198,
6738,
5254,
13,
69,
25506,
1330,
5313,
14402,
628
] | 4 | 18 |
import sys
import matplotlib
import numpy as np
# Avoid errors when running on headless servers.
matplotlib.use('Agg')
import matplotlib.pyplot as plt
if len(sys.argv) != 6:
print "Usage plot.py <data file port 1> <min size> <step size> <max size> <num packets sent>"
sys.exit(1)
width = 20
data_file = sys.ar... | [
11748,
25064,
198,
11748,
2603,
29487,
8019,
198,
11748,
299,
32152,
355,
45941,
198,
2,
24390,
8563,
618,
2491,
319,
1182,
1203,
9597,
13,
198,
6759,
29487,
8019,
13,
1904,
10786,
46384,
11537,
198,
11748,
2603,
29487,
8019,
13,
9078,
... | 2.325342 | 584 |
import os
import ssl
from six.moves import urllib
import torch
import numpy as np
import dgl
from torch.utils.data import Dataset, DataLoader
def PEMS_BAYGraphDataset():
if not os.path.exists('data/graph_bay.bin'):
if not os.path.exists('data'):
os.mkdir('data')
download_file('gr... | [
11748,
28686,
198,
11748,
264,
6649,
198,
6738,
2237,
13,
76,
5241,
1330,
2956,
297,
571,
198,
11748,
28034,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
288,
4743,
198,
6738,
28034,
13,
26791,
13,
7890,
1330,
16092,
292,
316,
11,
... | 2.323699 | 173 |
# -*- coding: utf-8 -*-
import string
import random
import logging
import urllib2
from os import path
from django.test import TestCase
from django.core.files.base import ContentFile
from s3 import upload
from s3.storage import S3Storage
from settings import BOTO_S3_BUCKET
logger = logging.getLogger(__name__)
local... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
11748,
4731,
198,
11748,
4738,
198,
11748,
18931,
198,
11748,
2956,
297,
571,
17,
198,
6738,
28686,
1330,
3108,
198,
198,
6738,
42625,
14208,
13,
9288,
1330,
6208,
... | 2.967742 | 124 |
# -*- coding: utf-8 -*-
# http://wiki.ros.org/Bags/Format/2.0
__all__ = ("BagPlayer",)
import subprocess
import threading
from types import TracebackType
from typing import Optional, Type
import dockerblade
from loguru import logger
from ... import exceptions
def finished(self) -> bool:
"""Checks wheth... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2638,
1378,
15466,
13,
4951,
13,
2398,
14,
33,
3775,
14,
26227,
14,
17,
13,
15,
198,
834,
439,
834,
796,
5855,
33,
363,
14140,
1600,
8,
198,
198,
11748,
850,
14... | 2.255127 | 1,219 |
from functools import wraps
from flask import request, make_response
from .exceptions import ApiError
from .schemas import create_schema, ma_version_lt_300b7
def response_headers(headers={}):
"""
This decorator adds the headers passed in to the response
"""
# http://flask.pocoo.org/snippets/100/
... | [
6738,
1257,
310,
10141,
1330,
27521,
198,
198,
6738,
42903,
1330,
2581,
11,
787,
62,
26209,
198,
198,
6738,
764,
1069,
11755,
1330,
5949,
72,
12331,
198,
6738,
764,
1416,
4411,
292,
1330,
2251,
62,
15952,
2611,
11,
17266,
62,
9641,
62... | 2.973913 | 115 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.urls import path
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from drf_yasg.views im... | [
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,
10414,
1330,
6460,
198,
6738,
42625,
14208,
13,
10414,
13,
6371,
82,
1330,
... | 2.597846 | 557 |
# -*- coding: utf-8 -*-
"""
datagator.rest.decorators
~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: 2015 by `University of Denver <http://pardee.du.edu/>`_
:license: Apache 2.0, see LICENSE for more details.
"""
import base64
from django.contrib.auth import authenticate, login
from django.core.exceptions imp... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
220,
220,
220,
4818,
363,
1352,
13,
2118,
13,
12501,
273,
2024,
198,
220,
220,
220,
220,
27156,
15116,
93,
628,
220,
220,
220,
1058,
22163,
4766,
25,
1853,... | 2.923664 | 131 |
from getpass import getpass
import socket
COLORS = {"green" : "\33[92m",
"red" : "\33[91m",
"yellow" : "\33[93m",
"endc" : "\33[0m" }
def print_green(msg):
"""Prints msg in green text."""
print("{0}{1}{2}".format(COLORS["green"], msg, COLORS["endc"]))
def print_yellow(ms... | [
6738,
651,
6603,
1330,
651,
6603,
198,
11748,
17802,
628,
198,
25154,
20673,
796,
19779,
14809,
1,
1058,
37082,
2091,
58,
5892,
76,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
445,
1,
220,
220,
1058,
37082,
2091,
58... | 2.489091 | 1,100 |
import pandas as pd
import numpy as np
from collections import Counter
data = pd.read_csv('out/negex_all.txt', sep="\t", header=None)
print(data.shape)
data.columns = ['PAT_DEID','NOTE_DEID','NOTE_DATE','ENCOUNTER_DATE','NOTE_CODE','TEXT_SNIPPET','lower_text','STATUS']
df = data.groupby(['PAT_DEID','NOTE_DEID','NOTE_... | [
11748,
19798,
292,
355,
279,
67,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
17268,
1330,
15034,
198,
198,
7890,
796,
279,
67,
13,
961,
62,
40664,
10786,
448,
14,
710,
25636,
62,
439,
13,
14116,
3256,
41767,
2625,
59,
83,
1600,
1... | 2.41573 | 356 |
from flask import Flask
from flask import request
from flask import jsonify
from os import environ
import query
app = Flask(__name__)
if 'MONGODB_HOST' in environ:
mongodb_host = environ['MONGODB_HOST']
else:
mongodb_host = "localhost"
if 'MONGODB_PORT' in environ:
mongodb_port = environ['MONGODB_PORT']... | [
6738,
42903,
1330,
46947,
198,
6738,
42903,
1330,
2581,
198,
6738,
42903,
1330,
33918,
1958,
198,
6738,
28686,
1330,
551,
2268,
198,
198,
11748,
12405,
198,
198,
1324,
796,
46947,
7,
834,
3672,
834,
8,
198,
198,
361,
705,
44,
18494,
3... | 2.343137 | 204 |
from stack.m_decoded_string import DecodeString
| [
6738,
8931,
13,
76,
62,
12501,
9043,
62,
8841,
1330,
4280,
1098,
10100,
628
] | 3.5 | 14 |
from pylab import plot, show, legend
from numpy import array
from h5py import File
data = File("data.h5")
iter = 2
R = array(data["/%04d/R" % iter])
rho = array(data["/%04d/rho" % iter])
Vtot = array(data["/%04d/V_tot" % iter])
Zeff = -Vtot * R
#for i in range(1, 19):
# P = array(data["/%04d/P%04d" % (iter, i)])... | [
6738,
279,
2645,
397,
1330,
7110,
11,
905,
11,
8177,
198,
6738,
299,
32152,
1330,
7177,
198,
6738,
289,
20,
9078,
1330,
9220,
628,
198,
7890,
796,
9220,
7203,
7890,
13,
71,
20,
4943,
198,
2676,
796,
362,
198,
49,
796,
7177,
7,
789... | 2.053846 | 260 |
# Generated by Django 3.1 on 2020-08-18 13:17
from django.db import migrations, models
| [
2,
2980,
515,
416,
37770,
513,
13,
16,
319,
12131,
12,
2919,
12,
1507,
1511,
25,
1558,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.966667 | 30 |
#!/usr/bin/python3
# Fabfile to delete out-of-date archives.
import os
from fabric.api import *
env.hosts = ['104.196.116.233', '54.165.130.77']
def do_clean(number=0):
"""Delete out-of-date archives.
"""
number = 1 if int(number) == 0 else int(number)
archives = sorted(os.listdir("versions"))
[... | [
2,
48443,
14629,
14,
8800,
14,
29412,
18,
198,
2,
14236,
7753,
284,
12233,
503,
12,
1659,
12,
4475,
22415,
13,
198,
11748,
28686,
198,
6738,
9664,
13,
15042,
1330,
1635,
198,
198,
24330,
13,
4774,
82,
796,
37250,
13464,
13,
25272,
1... | 2.462633 | 281 |
from tfrec.utils.model_utils import cross_validate
from tfrec.utils.model_utils import preprocess_and_split
__all__ = [
'cross_validate',
'preprocess_and_split',
]
| [
6738,
48700,
8344,
13,
26791,
13,
19849,
62,
26791,
1330,
3272,
62,
12102,
378,
198,
6738,
48700,
8344,
13,
26791,
13,
19849,
62,
26791,
1330,
662,
14681,
62,
392,
62,
35312,
198,
198,
834,
439,
834,
796,
685,
198,
220,
220,
220,
70... | 2.746032 | 63 |
"""
A threaded shared-memory scheduler for dask graphs.
This code is experimental and fairly ugly. It should probably be rewritten
before anyone really depends on it. It is very stateful and error-prone.
That being said, it is decently fast.
State
=====
Many functions pass around a ``state`` variable that holds t... | [
37811,
198,
32,
40945,
4888,
12,
31673,
6038,
18173,
329,
288,
2093,
28770,
13,
198,
198,
1212,
2438,
318,
11992,
290,
6547,
13400,
13,
220,
632,
815,
2192,
307,
30101,
198,
19052,
2687,
1107,
8338,
319,
340,
13,
220,
632,
318,
845,
... | 2.386819 | 6,843 |
# Generated by Django 3.1.1 on 2020-09-01 18:42
from django.db import migrations, models
import django.db.models.deletion
| [
2,
2980,
515,
416,
37770,
513,
13,
16,
13,
16,
319,
12131,
12,
2931,
12,
486,
1248,
25,
3682,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
198,
11748,
42625,
14208,
13,
9945,
13,
27530,
13,
2934,
1616,
295,
... | 2.818182 | 44 |
from django.core.management.base import LabelCommand
from yachter.courses.utils import export_static_html
| [
6738,
42625,
14208,
13,
7295,
13,
27604,
13,
8692,
1330,
36052,
21575,
198,
198,
6738,
331,
620,
353,
13,
66,
39975,
13,
26791,
1330,
10784,
62,
12708,
62,
6494,
198
] | 3.566667 | 30 |
###############################################################
# cms set host='juliet.futuresystems.org'
# cms set user=$USER
#
# pytest -v --capture=no tests/test_01_job_cli.py
# pytest -v tests/test_01_job_cli.py
# pytest -v --capture=no tests/test_01_job_cli.py::TestJob::<METHODNAME>
#############################... | [
29113,
14468,
7804,
4242,
21017,
198,
2,
269,
907,
900,
2583,
11639,
73,
377,
1155,
13,
69,
315,
942,
6781,
82,
13,
2398,
6,
198,
2,
269,
907,
900,
2836,
43641,
29904,
198,
2,
198,
2,
12972,
9288,
532,
85,
1377,
27144,
495,
28,
... | 3.257669 | 326 |
import argparse
import time
from pathlib import Path
from logger import get_logger
from csv_reader import CSVReader
from utils import infer_type, clear_console
from sql_generator import SQLGenerator
if __name__ == "__main__":
## Clear console
clear_console()
## get logger
logger = get_logger('pysql... | [
11748,
1822,
29572,
198,
11748,
640,
198,
198,
6738,
3108,
8019,
1330,
10644,
198,
6738,
49706,
1330,
651,
62,
6404,
1362,
198,
6738,
269,
21370,
62,
46862,
1330,
44189,
33634,
198,
6738,
3384,
4487,
1330,
13249,
62,
4906,
11,
1598,
62,... | 2.549168 | 1,322 |
# Definition for an interval.
solution = Solution()
ans = solution.merge([Interval(1, 4), Interval(2, 3)])
for i in ans:
print(i.start, i.end)
| [
2,
30396,
329,
281,
16654,
13,
628,
198,
198,
82,
2122,
796,
28186,
3419,
198,
504,
796,
4610,
13,
647,
469,
26933,
9492,
2100,
7,
16,
11,
604,
828,
4225,
2100,
7,
17,
11,
513,
8,
12962,
198,
1640,
1312,
287,
9093,
25,
198,
220,... | 2.586207 | 58 |
from tkinter import *
import mariadb
root = Tk()
root.title('SCHOOL MANAGEMENT')
root.geometry("900x700")
counter=2
for i in range(1,20):
label=Entry(root).grid(row=counter,column=0)
counter += 2
root.mainloop() | [
6738,
256,
74,
3849,
1330,
1635,
198,
11748,
1667,
72,
324,
65,
198,
15763,
796,
309,
74,
3419,
198,
15763,
13,
7839,
10786,
50,
3398,
31559,
17254,
4760,
12529,
11537,
198,
198,
15763,
13,
469,
15748,
7203,
12865,
87,
9879,
4943,
628... | 2.483146 | 89 |
import flopy.mt3d as mt
| [
11748,
781,
11081,
13,
16762,
18,
67,
355,
45079,
628
] | 2.5 | 10 |
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
from collections import namedtuple
from typing import Dict
from src.visualization import diminishing_reward_colors, PLOT_DPI
StateAction = namedtuple('StateAction', 'id state action')
| [
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
6738,
2603,
29487,
8019,
13,
83,
15799,
1330,
20401,
33711,
1352,
11,
18980,
13290,
8479,
1436,
198,
198,
6738,
17268,
1330,
3706,
83,
29291,
198,
6738,
19720,
1330,
360,
713... | 3.575 | 80 |
import time
import sys
import threading
import asyncio
# fly
from .ModelBootstrap import ModelBootstrap
from . import ModelManager
#runForEver = threading.Event()
# Expects a .conf for the model. It should be availble in config folder
#modelConf='calculator.conf' #sys.argv[1]
#bootstrap(modelConf)
# Th... | [
11748,
640,
201,
198,
11748,
25064,
201,
198,
11748,
4704,
278,
201,
198,
11748,
30351,
952,
201,
198,
201,
198,
2,
6129,
201,
198,
6738,
764,
17633,
36476,
26418,
1330,
9104,
36476,
26418,
201,
198,
6738,
764,
1330,
9104,
13511,
201,
... | 2.867188 | 128 |
import feedparser
allheadlines = []
newsurls={'googlenews': 'https://news.google.com/news/rss/?h1=ta&ned=us&gl=IN',}# I used IN in this line for indian news instead of that you can use your capital's
for key, url in newsurls.items():
allheadlines.extend(getHeadLines(url))
for h in allheadlines:
pr... | [
11748,
3745,
48610,
201,
198,
439,
2256,
6615,
796,
17635,
201,
198,
10827,
6371,
82,
34758,
6,
2188,
519,
11925,
15515,
10354,
705,
5450,
1378,
10827,
13,
13297,
13,
785,
14,
10827,
14,
42216,
20924,
71,
16,
28,
8326,
5,
696,
26,
2... | 2.624 | 125 |
from behave import when, then
from application.models import Member
| [
6738,
17438,
1330,
618,
11,
788,
198,
198,
6738,
3586,
13,
27530,
1330,
10239,
628,
628,
628
] | 4.352941 | 17 |
"""
Displaying the fields in an xy cross section of the sphere (x polarized light, z-propagating)
"""
import numpy as np
import matplotlib.pyplot as plt
import miepy
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.cm as cm
Ag = miepy.materials. Ag()
# calculate scattering coefficients, 800 nm illumination
... | [
37811,
198,
7279,
17916,
262,
7032,
287,
281,
2124,
88,
3272,
2665,
286,
262,
16558,
357,
87,
46469,
1657,
11,
1976,
12,
22930,
363,
803,
8,
198,
37811,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
29487,
8019,
13,
9078,... | 2.007107 | 1,407 |
import datetime
import dateutil.parser
import xml
import xml.etree.ElementTree
from pya2a.utils import parseRemark
| [
11748,
4818,
8079,
198,
11748,
3128,
22602,
13,
48610,
198,
198,
11748,
35555,
198,
11748,
35555,
13,
316,
631,
13,
20180,
27660,
198,
198,
6738,
279,
3972,
17,
64,
13,
26791,
1330,
21136,
8413,
668,
628,
628,
628,
628,
628,
628,
628,... | 3.045455 | 44 |
import numpy as np
min, max = -0.8777435, 0.57090986
M = np.asmatrix([
[0.02355068, -0.50542802, 0.16642167, -0.44872788, -0.05130898, 0.13320047, 0.41464597, -0.55703336, 0.52567458, 0.23784444, 0.15049535, 0.16599870, -0.28757980, 0.22277315, 0.56460077, -0.70838273, -0.61990398, -0.39724344, -0.09969769, 0.4583... | [
11748,
299,
32152,
355,
45941,
198,
1084,
11,
3509,
796,
532,
15,
13,
42802,
4524,
2327,
11,
657,
13,
20,
31495,
2931,
4521,
198,
198,
44,
796,
45941,
13,
292,
6759,
8609,
26933,
198,
220,
220,
220,
685,
15,
13,
15,
22370,
1120,
3... | 1.79443 | 2,262 |
# Aula 09 - Manipulando de cadeias de texto (Strings)
"""
Tcnica de Fatiamento
Frase = Curso em Video Python
Frase [9]: letra especfica
Frase [9:13]: Vai pegar do 9 ao 12 (menos um no final)
Frase [9:21:2]: Pula de 2 em 2
Frase [:5]: Ir comear no primeiro caracter e terminar no 4 (excluindo o nmero 5)
Frase [15:]: In... | [
2,
317,
4712,
7769,
532,
35045,
377,
25440,
390,
269,
671,
4448,
390,
2420,
78,
357,
13290,
654,
8,
198,
37811,
198,
51,
31522,
3970,
390,
12301,
1789,
50217,
198,
198,
6732,
589,
796,
4424,
568,
795,
7623,
11361,
198,
198,
6732,
58... | 2.618483 | 1,266 |
import optuna
from {{cookiecutter.repo_name}}.utils import check_args_num, \
read_config, set_random_seed, str_hash, file_hash
from {{cookiecutter.repo_name}}.settings import optuna_db_path
def get_objective(config):
"""
more on optuna objectives:
https://optuna.readthedocs.io/en/stable/faq.html
... | [
11748,
2172,
9613,
198,
6738,
22935,
44453,
8968,
353,
13,
260,
7501,
62,
3672,
11709,
13,
26791,
1330,
2198,
62,
22046,
62,
22510,
11,
3467,
198,
220,
220,
220,
1100,
62,
11250,
11,
900,
62,
25120,
62,
28826,
11,
965,
62,
17831,
11... | 2.521605 | 972 |
# - *- coding: utf- 8 - *-
""" Bot to suggest music from Spotify based on your mood.
"""
import spotipy, os
from spotipy.oauth2 import SpotifyClientCredentials
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
#from access_token import AUTH_TOKEN, CLIENT_ID, CLIENT_SECRET
# Intialise spotipy
cl... | [
2,
532,
1635,
12,
19617,
25,
3384,
69,
12,
807,
532,
1635,
12,
198,
37811,
18579,
284,
1950,
2647,
422,
26778,
1912,
319,
534,
10038,
13,
198,
37811,
198,
11748,
4136,
541,
88,
11,
28686,
198,
6738,
4136,
541,
88,
13,
12162,
1071,
... | 3.137045 | 467 |
# Copyright (c) 2019, Danish Technological Institute.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# -*- coding: utf-8 -*-
""" Utility code to locate tracker projects
"""
from tracker.tracker_file import Tra... | [
2,
15069,
357,
66,
8,
13130,
11,
20849,
5429,
2770,
5136,
13,
198,
2,
1439,
2489,
10395,
13,
198,
2,
198,
2,
770,
2723,
2438,
318,
11971,
739,
262,
347,
10305,
12,
7635,
5964,
1043,
287,
262,
198,
2,
38559,
24290,
2393,
287,
262,
... | 3.045113 | 266 |
"""
Python API for Hacker News.
@author Karan Goel
@email karan@goel.im
"""
__title__ = 'hackernews'
__author__ = 'Karan Goel'
__license__ = 'MIT'
__copyright__ = 'Copyright 2014 Karan Goel'
from .hn import HN, Story
| [
37811,
198,
37906,
7824,
329,
34399,
3000,
13,
198,
198,
31,
9800,
9375,
272,
1514,
417,
198,
31,
12888,
479,
19173,
31,
2188,
417,
13,
320,
198,
37811,
198,
198,
834,
7839,
834,
796,
705,
31153,
1142,
15515,
6,
198,
834,
9800,
834,... | 2.650602 | 83 |
ACCURACY = 0
MATTHEWS_CORRELATION_COEFFICIENT = 1
AUC = 2 | [
26861,
4261,
43300,
796,
657,
198,
41636,
4221,
6217,
50,
62,
44879,
16448,
6234,
62,
8220,
37267,
2149,
28495,
796,
352,
198,
32,
9598,
796,
362
] | 2.192308 | 26 |
'''
Advent of Code 2017
Day 6: Memory Reallocation
'''
import unittest
TEST_BANKS = ('0 2 7 0', 5, 4)
INPUT_BANKS = '0 5 10 0 11 14 13 4 11 8 8 7 1 4 12 11'
def findInfiniteLoop(memoryBanks):
'''
Finds the number of iterations required to detect an infinite loop with the given start condition.
memoryBa... | [
7061,
6,
198,
2782,
1151,
286,
6127,
2177,
198,
12393,
718,
25,
14059,
797,
439,
5040,
198,
198,
7061,
6,
198,
198,
11748,
555,
715,
395,
198,
198,
51,
6465,
62,
33,
15154,
50,
796,
19203,
15,
362,
767,
657,
3256,
642,
11,
604,
... | 2.664549 | 787 |
"""
Utility Methods for Authenticating against and using Indiana University CAS.
"""
import httplib2
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
def validate_cas_ticket(casticket, casurl):
"""
Takes a CAS Ticket and makes th... | [
37811,
198,
18274,
879,
25458,
329,
31885,
12364,
1028,
290,
1262,
10278,
2059,
35106,
13,
198,
37811,
198,
11748,
1841,
489,
571,
17,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
27530,
1330,
11787,
198,
6738,
42625,
14208,
1... | 2.663342 | 401 |
# -*- coding: utf-8 -*-
from django.http import JsonResponse
from decimal import Decimal
from datetime import datetime, timedelta
import re
import logging
from disqusapi import DisqusAPI
from django.contrib import messages
from django.apps import apps
from django.core.mail import mail_admins
from django.core.urlresolv... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
42625,
14208,
13,
4023,
1330,
449,
1559,
31077,
198,
6738,
32465,
1330,
4280,
4402,
198,
6738,
4818,
8079,
1330,
4818,
8079,
11,
28805,
12514,
198,
11748,
302,
198,
... | 2.955145 | 758 |
import serial
import string
import math
from itertools import chain
| [
11748,
11389,
198,
11748,
4731,
198,
11748,
10688,
198,
6738,
340,
861,
10141,
1330,
6333,
628
] | 4.3125 | 16 |
from discord import TextChannel, User
from discord.ext.commands import Bot
from .configuration import CONF0
from tqdm.asyncio import tqdm
# class LogMe:
# """This is a complicated logger I came up with.\n
# Feel free to insult me whilst readding it."""
# _std = {
# "LS": "|-----------------Log_ ST... | [
6738,
36446,
1330,
8255,
29239,
11,
11787,
198,
6738,
36446,
13,
2302,
13,
9503,
1746,
1330,
18579,
198,
6738,
764,
11250,
3924,
1330,
7102,
37,
15,
198,
6738,
256,
80,
36020,
13,
292,
13361,
952,
1330,
256,
80,
36020,
198,
2,
1398,
... | 1.699078 | 2,386 |
"""
test_django-oci api
-------------------
Tests for `django-oci` api.
"""
from django.urls import reverse
from django.contrib.auth.models import User
from django_oci import settings
from rest_framework import status
from rest_framework.test import APITestCase
from django.test.utils import override_settings
from tim... | [
37811,
198,
9288,
62,
28241,
14208,
12,
1733,
40391,
198,
1783,
6329,
198,
198,
51,
3558,
329,
4600,
28241,
14208,
12,
1733,
63,
40391,
13,
198,
37811,
198,
198,
6738,
42625,
14208,
13,
6371,
82,
1330,
9575,
198,
6738,
42625,
14208,
1... | 2.585635 | 1,267 |
#LCST Plotter
#Author: ESTC
import numpy
import streamlit
import matplotlib.pyplot as plt
import pandas
launch_app()
if datafile is not None:
load_data(datafile)
make_plot(x1a,x1b,T,cation,anion)
| [
2,
5639,
2257,
28114,
353,
201,
198,
2,
13838,
25,
17160,
34,
201,
198,
201,
198,
11748,
299,
32152,
201,
198,
11748,
4269,
18250,
201,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
201,
198,
11748,
19798,
292,
201,
... | 2.196078 | 102 |
#!/usr/bin/env python3
from flask import Flask, render_template, app, url_for,request
import tweepy # To consume Twitter's API
import pandas as pd # To handle data
import numpy as np # For number computing
from textblob import TextBlob
import re
import pandas as pa
from sklearn.tree import DecisionTr... | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
6738,
42903,
1330,
46947,
11,
8543,
62,
28243,
11,
598,
11,
19016,
62,
1640,
11,
25927,
198,
11748,
4184,
538,
88,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1675,
... | 3.029091 | 275 |
import torch
def save_param(model, pth_path):
'''
save the parameters of the model
Args:
model: the model to which the params belong
pth_path: the path where .pth file is saved
'''
torch.save(model.state_dict(), pth_path)
def load_param(model, pth_path):
'''
load t... | [
11748,
28034,
198,
198,
4299,
3613,
62,
17143,
7,
19849,
11,
279,
400,
62,
6978,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
3613,
262,
10007,
286,
262,
2746,
198,
220,
220,
220,
220,
198,
220,
220,
220,
943,
14542,
2... | 2.351111 | 225 |
#Project Euler Problem-77
#Author Tushar Gayan
#Multinomial Theorem
import math
import numpy as np
'''prime_list = []
i = 1
while len(prime_list)<200:
if prime_check(i) == True:
prime_list.append(i)
i +=1
print(prime_list)
m = 1
for i in prime_list:
m *= np.poly1d(mod_list(i,30))
#print(i)
... | [
2,
16775,
412,
18173,
20647,
12,
3324,
198,
2,
13838,
309,
1530,
283,
16013,
272,
198,
198,
2,
15205,
259,
49070,
383,
29625,
198,
11748,
10688,
198,
11748,
299,
32152,
355,
45941,
198,
198,
7061,
6,
35505,
62,
4868,
796,
17635,
198,
... | 2.133028 | 218 |
#! usr/bin/env python3
from os import times
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
import numpy... | [
2,
0,
514,
81,
14,
8800,
14,
24330,
21015,
18,
198,
6738,
28686,
1330,
1661,
198,
6738,
275,
82,
19,
1330,
23762,
50,
10486,
198,
198,
6738,
384,
11925,
1505,
1330,
3992,
26230,
198,
6738,
384,
11925,
1505,
13,
12384,
26230,
13,
466... | 3.253112 | 241 |
"""
64. Minimum Path Sum
Given a m x n grid filled with non-negative numbers,
find a path from top left to bottom right
which minimizes the sum of all numbers along its path.
Note: You can only move either down or right at any point in time.
http://www.tangjikai.com/algorithms/leetcode-64-minimum-path-sum
Dynamic P... | [
37811,
198,
2414,
13,
26265,
10644,
5060,
198,
198,
15056,
257,
285,
2124,
299,
10706,
5901,
351,
1729,
12,
31591,
3146,
11,
198,
19796,
257,
3108,
422,
1353,
1364,
284,
4220,
826,
198,
4758,
10356,
4340,
262,
2160,
286,
477,
3146,
18... | 3.572519 | 131 |
# coding=utf-8
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
import os
import re
import subprocess
import sys
from contextlib import contextmanager
from abc import abstractproperty
from pants.bin... | [
2,
19617,
28,
40477,
12,
23,
198,
198,
6738,
11593,
37443,
834,
1330,
357,
48546,
62,
11748,
11,
7297,
11,
27298,
11,
28376,
62,
1416,
13920,
11,
3601,
62,
8818,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,... | 2.716632 | 974 |
import torch
from torch import nn
import numpy as np
import torch
from torch import nn
if __name__=='__main__':
model = convmodel()
for m in model.parameters():
m.data.fill_(0.1)
# criterion = nn.CrossEntropyLoss()
criterion = nn.MSELoss()
optimizer = torch.optim.SGD(model.parameters(),... | [
198,
11748,
28034,
198,
6738,
28034,
1330,
299,
77,
198,
11748,
299,
32152,
355,
45941,
198,
198,
11748,
28034,
198,
6738,
28034,
1330,
299,
77,
198,
198,
361,
11593,
3672,
834,
855,
6,
834,
12417,
834,
10354,
198,
220,
220,
220,
2746... | 2.058278 | 755 |
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2019-12-06 15:32 | [
2,
532,
9,
12,
19617,
25,
40477,
12,
23,
532,
9,
12,
198,
2,
6434,
25,
289,
962,
6359,
198,
2,
7536,
25,
13130,
12,
1065,
12,
3312,
1315,
25,
2624
] | 2.064516 | 31 |
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/topics/items.html
from scrapy.item import Item, Field
| [
2,
2896,
500,
994,
262,
4981,
329,
534,
15881,
276,
3709,
198,
2,
198,
2,
4091,
10314,
287,
25,
198,
2,
2638,
1378,
15390,
13,
1416,
2416,
88,
13,
2398,
14,
4852,
873,
14,
23814,
13,
6494,
198,
198,
6738,
15881,
88,
13,
9186,
13... | 2.925926 | 54 |
import re
import copy
from mau.lexers.base_lexer import TokenTypes, Token
from mau.lexers.main_lexer import MainLexer
from mau.parsers.base_parser import (
BaseParser,
TokenError,
ConfigurationError,
parser,
)
from mau.parsers.text_parser import TextParser
from mau.parsers.arguments_parser import Argum... | [
11748,
302,
198,
11748,
4866,
198,
198,
6738,
285,
559,
13,
2588,
364,
13,
8692,
62,
2588,
263,
1330,
29130,
31431,
11,
29130,
198,
6738,
285,
559,
13,
2588,
364,
13,
12417,
62,
2588,
263,
1330,
8774,
45117,
263,
198,
6738,
285,
559... | 2.264889 | 1,125 |
#!/usr/bin/python
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
2,
198,
2,
15069,
2864,
3012,
11419,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
345,
743,
407,
779,
428,
2393,
2845,
287,... | 2.221927 | 1,505 |
from pathlib import Path
from unittest import mock
import pytest
from freedesktop_icons import Icon, Theme, lookup, lookup_fallback, theme_search_dirs
| [
6738,
3108,
8019,
1330,
10644,
198,
6738,
555,
715,
395,
1330,
15290,
198,
198,
11748,
12972,
9288,
198,
198,
6738,
13459,
274,
16201,
62,
34280,
1330,
26544,
11,
26729,
11,
35847,
11,
35847,
62,
7207,
1891,
11,
7505,
62,
12947,
62,
1... | 3.354167 | 48 |
# -*- coding: utf-8 -*-
__author__ = "Paul Schifferer <dm@sweetrpg.com>"
"""
"""
import os
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
from sentry_sdk.integrations.redis import RedisIntegration
from sweetrpg_library_api.application import constants
sentry_sdk.init(dsn=os.environ[con... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
834,
9800,
834,
796,
366,
12041,
41665,
11882,
1279,
36020,
31,
34751,
81,
6024,
13,
785,
24618,
198,
37811,
198,
37811,
198,
198,
11748,
28686,
198,
198,
11748,
1908,
5... | 2.231373 | 255 |
"""
Compiles stellar model isochrones into an easy-to-access format.
"""
from numpy import *
from scipy.interpolate import LinearNDInterpolator as interpnd
from consts import *
import os,sys,re
import scipy.optimize
#try:
# import pymc as pm
#except:
# print 'isochrones: pymc not loaded! MCMC will not work'
i... | [
37811,
198,
7293,
2915,
25041,
2746,
318,
5374,
9821,
656,
281,
2562,
12,
1462,
12,
15526,
5794,
13,
220,
220,
198,
198,
37811,
198,
6738,
299,
32152,
1330,
1635,
198,
6738,
629,
541,
88,
13,
3849,
16104,
378,
1330,
44800,
8575,
9492,... | 2.068862 | 334 |