code stringlengths 10 805k | def_use_chains listlengths 0 667 |
|---|---|
# Created by Thomas Jones on 06/11/15 - thomas@tomtecsolutions.com
# branding.py, a plugin for minqlx to brand your server.
# This plugin is released to everyone, for any purpose. It comes with no warranty, no guarantee it works, it's released AS IS.
# You can modify everything, except for lines 1-4 and the !tomtec_ver... | [
[
[
2136,
2142
],
[
2159,
2165
],
[
3301,
3307
],
[
3390,
3396
],
[
3592,
3598
],
[
3835,
3841
],
[
4233,
4239
],
[
4432,
4438
]
],
[
[
2150,
... |
import os
from django.utils.translation import gettext_lazy as _
######################
# CARTRIDGE SETTINGS #
######################
# The following settings are already defined in cartridge.shop.defaults
# with default values, but are common enough to be put here, commented
# out, for conveniently overriding. Plea... | [
[
[
7,
9
],
[
8265,
8267
],
[
8281,
8283
],
[
8322,
8324
],
[
8383,
8385
],
[
8997,
8999
],
[
9381,
9383
],
[
9653,
9655
],
[
13337,
13339
... |
# HitObject class
class HitObject:
def __init__(self, start_x, start_y, end_x, end_y, time, object_type):
self.start_x = start_x
self.start_y = start_y
self.end_x = end_x
self.end_y = end_y
self.time = time
self.object_type = object_type # hit_circle, eve... | [
[
[
29,
38
],
[
1349,
1358
]
],
[
[
434,
444
]
],
[
[
653,
671
]
],
[
[
1495,
1518
]
],
[
[
2589,
2608
]
],
[
[
3475,
3502
]
]
] |
r"""
Isomorphisms between Weierstrass models of elliptic curves
AUTHORS:
- Robert Bradshaw (2007): initial version
- John Cremona (Jan 2008): isomorphisms, automorphisms and twists
in all characteristics
"""
#*****************************************************************************
# Copyright (C) 2007 Rober... | [
[
[
903,
911
],
[
11452,
11460
],
[
14589,
14597
],
[
14959,
14967
],
[
15353,
15361
],
[
15792,
15800
],
[
20713,
20721
]
],
[
[
936,
949
],
[
... |
"""
Settings specific to prod-like deployable code, reading values from system environment variables.
"""
import os
from conf.configs import common
from conf.settings import PROJECT_ID
__author__ = "Alex Laird"
__copyright__ = "Copyright 2018, Helium Edu"
__version__ = "1.1.15"
# Define the base working directory o... | [
[
[
114,
116
],
[
349,
351
],
[
366,
368
],
[
379,
381
],
[
395,
397
],
[
967,
969
],
[
1052,
1054
],
[
2818,
2820
],
[
3034,
3036
],
... |
import operator
from functools import reduce
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required
from django.db.models import Q, Sum
from django.shortcuts import HttpResponse, get_object_or_404, redirect, render
from django.views.generic import View
from django.view... | [
[
[
7,
15
],
[
735,
743
],
[
1815,
1823
],
[
3097,
3105
]
],
[
[
38,
44
],
[
728,
734
],
[
1808,
1814
],
[
3090,
3096
]
],
[
[
78,
9... |
import pandas as pd
import numpy as np
import torch
from sklearn.model_selection import train_test_split
from backend.services.toxic_comment_jigsaw.application.ai.model import BERTClassifier
from backend.services.toxic_comment_jigsaw.application.ai.training.src.dataset import BERTDataset
from backend.services.toxic_co... | [
[
[
7,
19
],
[
1977,
1979
]
],
[
[
27,
38
],
[
2192,
2194
]
],
[
[
46,
51
],
[
4092,
4097
]
],
[
[
89,
105
],
[
2270,
2286
]
],
[
[
... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [
[
[
1052,
1061
],
[
3265,
3274
]
],
[
[
1069,
1071
],
[
1131,
1133
],
[
1231,
1233
],
[
1304,
1306
],
[
1430,
1432
],
[
1560,
1562
],
[
1637,
... |
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
setup(
name='carafe_layer_cuda',
ext_modules=[
CUDAExtension('carafe_layer_cuda', [
'src/carafe_layer_cuda.cpp',
'src/carafe_layer_kernel.cu',
])
],
cmdclass={
... | [
[
[
23,
28
],
[
98,
103
]
],
[
[
67,
81
],
[
335,
349
]
],
[
[
83,
96
],
[
161,
174
]
]
] |
from numpy import *
import numpy as np
# from numba import jit
# @jit
def detrending_coeff(win_len , order):
#win_len = 51
#order = 2
n = (win_len-1)/2
A = mat(ones((win_len,order+1)))
x = np.arange(-n , n+1)
for j in range(0 , order + 1):
A[:,j] = mat(x ** j).T
coeff_output = (A.T * A).I * A... | [
[
[
18,
19
],
[
172,
175
],
[
176,
180
],
[
272,
275
]
],
[
[
28,
39
],
[
207,
209
]
],
[
[
82,
98
]
]
] |
# Author: Javad Amirian
# Email: amiryan.j@gmail.com
import xml.etree.ElementTree as et
import numpy as np
import pandas as pd
from opentraj.toolkit.core.trajdataset import TrajDataset
from opentraj.toolkit.utils.calibration.camera_calibration_tsai import *
def load_pets(path, **kwargs):
"""
:param path: a... | [
[
[
61,
88
],
[
515,
517
],
[
812,
814
]
],
[
[
97,
108
],
[
2931,
2933
],
[
2939,
2941
],
[
3180,
3182
]
],
[
[
116,
128
],
[
3167,
... |
"""
Production settings for Estatisticas Facebook project.
- Use WhiteNoise for serving static files
- Use Amazon's S3 for storing uploaded media
- Use mailgun to send emails
- Use Redis for cache
- Use sentry for error logging
"""
import logging
from .base import * # noqa
# SECRET CONFIGURATION
# -----------... | [
[
[
245,
252
],
[
7208,
7215
],
[
7297,
7304
]
],
[
[
273,
274
],
[
550,
553
],
[
818,
832
],
[
1068,
1078
],
[
1654,
1657
],
[
1753,
17... |
# coding: utf-8
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.
import os
import posixpath
import numpy as np
import pandas
import tables
import warnings
from pyiron_base import Gener... | [
[
[
207,
209
],
[
3925,
3927
],
[
4031,
4033
],
[
9296,
9298
],
[
15938,
15940
],
[
16181,
16183
],
[
16825,
16827
]
],
[
[
217,
226
],
[
1797... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... | [
[
[
277,
284
],
[
17959,
17966
]
],
[
[
301,
310
],
[
17141,
17150
]
],
[
[
318,
320
]
],
[
[
329,
341
],
[
18228,
18240
]
]
] |
#task 1
nyaam = float (input('enter a length in cm: '))
if nyaam < 0:
print ('entry is invalid')
else:
res = nyaam / 2.54
print (res, 'inch')
#task 2
whoosh = int (input ('how many credits have you taken? '))
if whoosh > 0 and whoosh < 24:
print ('congrats, you a freshman!')
elif whoosh > 23 and wh... | [
[
[
9,
14
],
[
60,
65
],
[
118,
123
]
],
[
[
112,
115
],
[
143,
146
]
],
[
[
167,
173
],
[
229,
235
],
[
244,
250
],
[
302,
308
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from mp.models.segmentation.unet_fepegar import UNet2D
### UNet Wrapper ###
class UNet2D_dis(UNet2D):
r"""Wrapper for UNet2D to access encoder and decoder seperately.
"""
def __init__(self, *args, **kwargs):
super(UNet2D_dis, self).... | [
[
[
7,
12
],
[
8399,
8404
],
[
8453,
8458
],
[
8680,
8685
],
[
12611,
12616
],
[
12665,
12670
],
[
12892,
12897
],
[
14097,
14102
],
[
14278,
... |
"""Tornado handlers for nbgrader assignment list web service."""
import os
import json
import contextlib
import traceback
from tornado import web
from notebook.utils import url_path_join as ujoin
from nbgrader.exchange import ExchangeFactory
from nbgrader.coursedir import CourseDirectory
from nbgrader.auth import A... | [
[
[
73,
75
],
[
481,
483
],
[
494,
496
],
[
594,
596
],
[
610,
612
],
[
642,
644
]
],
[
[
83,
87
],
[
2320,
2324
],
[
2871,
2875
],
... |
# Copyright 2016 Citrix Systems
#
# 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... | [
[
[
641,
642
],
[
913,
914
],
[
1635,
1636
],
[
1758,
1759
]
],
[
[
651,
668
],
[
1601,
1618
],
[
1724,
1741
],
[
1317,
1334
]
],
[
[
1579... |
import os
import shutil
from multiprocessing.pool import Pool
import cv2
import numpy as np
from functools import partial
from path import Path
def process_scene(input_directory, output_folder):
K = np.array([[525.0, 0.0, 320.0],
[0.0, 525.0, 240.0],
[0.0, 0.0, 1.0]])
prin... | [
[
[
7,
9
],
[
759,
761
],
[
805,
807
],
[
867,
869
],
[
1012,
1014
],
[
1045,
1047
],
[
1054,
1056
]
],
[
[
17,
23
],
[
973,
979
]
... |
import pygame
import math
import glob
import os
tilesize = 128 # pixels per tile
def tiletosurface(tile):
pass
def maptosurface(sx,sy,ex,ey,oholmap):
pass
def main(windowsize,tilepipe,OHOLMap):
wt = math.floor(windowsize/tilesize)
cx,cy,first = 0,0,True
if OHOLMap.data != {}:
for x in OHOL... | [
[
[
7,
13
],
[
770,
776
]
],
[
[
21,
25
],
[
214,
218
]
],
[
[
33,
37
],
[
524,
528
]
],
[
[
45,
47
],
[
697,
699
]
],
[
[
48,
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.http import Http404
from core.models import (Category, Article, Source, BaseUserProfile,
BookmarkArticle, ArticleLike, HashTag, Menu, Notification, Devices,
SocialAccount, Category, CategoryAss... | [
[
[
47,
63
]
],
[
[
88,
95
],
[
7006,
7013
],
[
7558,
7565
],
[
13151,
13158
],
[
49002,
49009
],
[
49326,
49333
],
[
57366,
57373
]
],
[
[
... |
import json
import os
import sys
import disnake
from disnake.ext import commands
from disnake.ext.commands import Context
from helpers import json_manager, checks
import logging
if not os.path.isfile("../config.json"):
sys.exit("'config.json' not found by general-normal! Please add it and try again.")
else:
... | [
[
[
7,
11
],
[
374,
378
],
[
2412,
2416
],
[
3070,
3074
],
[
3754,
3758
],
[
4948,
4952
]
],
[
[
19,
21
],
[
188,
190
]
],
[
[
29,
3... |
from django.apps import AppConfig
class MarkersConfig(AppConfig):
name = 'markers'
| [
[
[
24,
33
],
[
56,
65
]
],
[
[
42,
55
]
]
] |
from os import (
startfile,
getcwd
)
from os.path import join
from io import BytesIO
from csv import (
writer,
excel
)
from openpyxl import (
Workbook,
load_workbook
)
from statistics import (
mean,
variance,
stdev
)
from treetopper.plot import Plot
from treetopper.timber import (
... | [
[
[
21,
30
],
[
4287,
4296
]
],
[
[
36,
42
],
[
4149,
4155
],
[
6367,
6373
],
[
7018,
7024
]
],
[
[
65,
69
],
[
4088,
4092
],
[
4144,
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def example1():
"""Slice operator.
seq[::stride] # [seq[0], seq[stride], ..., seq[-1] ]
seq[low::stride] # [seq[low], seq[low+stride], ..., seq[-1] ]
seq[:high:stride] # [seq[0], seq[stride], ..., seq[high-1]]
seq[lo... | [
[
[
52,
60
],
[
670,
678
]
],
[
[
687,
695
],
[
981,
989
]
]
] |
"""
Common logic used by the docker state and execution module
This module contains logic to accommodate docker/salt CLI usage, as well as
input as formatted by states.
"""
import copy
import logging
import salt.utils.args
import salt.utils.data
import salt.utils.dockermod.translate
from salt.exceptions import Comm... | [
[
[
183,
187
],
[
5991,
5995
]
],
[
[
195,
202
],
[
1080,
1087
]
],
[
[
211,
226
]
],
[
[
234,
249
]
],
[
[
257,
287
],
[
1344,
1348
],
... |
# Copyright (c) 2019 UniMoRe, Matteo Spallanzani
import torch
from ..utils.utils import xywh2xyxy, bbox_iou
def clip_boxes(boxes):
boxes[:, [0, 2]] = boxes[:, [0, 2]].clamp(min=0, max=1)
boxes[:, [1, 3]] = boxes[:, [1, 3]].clamp(min=0, max=1)
def postprocess_pr(pr_outs, conf_thres=0.001, overlap_thres=0.5... | [
[
[
57,
62
],
[
973,
978
],
[
1254,
1259
],
[
1490,
1495
],
[
2468,
2473
],
[
2729,
2734
]
],
[
[
90,
99
],
[
1456,
1465
]
],
[
[
101,
... |
"""
This is an implementation of Function Secret Sharing
Useful papers are:
- Function Secret Sharing- Improvements and Extensions, Boyle 2017
Link: https://eprint.iacr.org/2018/707.pdf
- Secure Computation with Preprocessing via Function Secret Sharing, Boyle 2019
Link: https://eprint.iacr.org/2019/1095
Note tha... | [
[
[
395,
402
],
[
10227,
10234
],
[
10639,
10646
]
],
[
[
411,
422
],
[
534,
536
],
[
11127,
11129
],
[
11140,
11142
],
[
3069,
3071
],
[
3919... |
#!/usr/bin/env python3
"""
Test for local-subnet identifier
"""
import unittest
import netifaces
from base_test import PschedTestBase
from pscheduler.limitprocessor.identifier.localsubnet import *
DATA = {
}
class TestLimitprocessorIdentifierLocalSubnet(PschedTestBase):
"""
Test the Identifier
"""
... | [
[
[
72,
80
],
[
1726,
1734
]
],
[
[
88,
97
],
[
782,
791
],
[
925,
934
]
],
[
[
121,
135
],
[
262,
276
]
],
[
[
198,
199
],
[
454,
... |
from PuzzleLib.Cuda.Kernels.RadixSort import backendTest
def unittest():
from PuzzleLib.Hip import Backend
backendTest(Backend)
if __name__ == "__main__":
unittest()
| [
[
[
45,
56
],
[
111,
122
]
],
[
[
63,
71
],
[
162,
170
]
]
] |
import os
from setuptools import setup
README = """
See the README on `GitHub
<https://github.com/uw-it-aca/app_name>`_.
"""
# The VERSION file is created by travis-ci, based on the tag name
version_path = "app_name/VERSION"
print(os.path.join(os.path.dirname(__file__), version_path))
VERSION = open(os.path.join(os.p... | [
[
[
7,
9
],
[
233,
235
],
[
246,
248
],
[
303,
305
],
[
316,
318
],
[
443,
445
],
[
452,
454
],
[
469,
471
],
[
482,
484
],
[
... |
from abc import abstractmethod
from ml import LabelStudioMLBase
class LabelStudioMLBaseHelper(LabelStudioMLBase):
@abstractmethod
def prepare_tasks(self, tasks, workdir=None, **kwargs):
pass
@abstractmethod
def convert_predictions(self, predictions, **kwargs):
pass
@abstractmeth... | [
[
[
16,
30
],
[
122,
136
],
[
216,
230
],
[
308,
322
],
[
387,
401
]
],
[
[
46,
63
],
[
96,
113
]
],
[
[
72,
95
],
[
958,
981
]
... |
import requests
import urllib
import time
import hashlib
import hmac
import itertools
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
from .api import Base
from .errors import ApiError, ArgumentError
def check_values(value, arg, arg_value):
if type(value) == type... | [
[
[
7,
15
],
[
5928,
5936
]
],
[
[
23,
29
]
],
[
[
37,
41
],
[
5676,
5680
]
],
[
[
49,
56
],
[
6139,
6146
]
],
[
[
64,
68
],
[
610... |
from umonitor import __version__
def test_version():
assert __version__ == '0.1.5'
| [
[
[
21,
32
],
[
66,
77
]
],
[
[
39,
51
]
]
] |
#!/usr/bin/env python3
import sys, utils, random # import the modules we will need
utils.check_version((3,7)) # make sure we are running at least Python 3.7
utils.clear() # clear the screen
print('Greetings!') # prints out "Greetings!" in the terminal.
colors = ['red','orang... | [
[
[
31,
34
],
[
534,
537
]
],
[
[
36,
41
],
[
95,
100
],
[
178,
183
]
],
[
[
43,
49
],
[
837,
843
]
],
[
[
298,
304
],
[
851,
85... |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Class for bitcoinexodusd node under test"""
import contextlib
import decimal
import errno
from enum im... | [
[
[
269,
279
],
[
10099,
10109
]
],
[
[
287,
294
],
[
17520,
17527
]
],
[
[
302,
307
],
[
7611,
7616
]
],
[
[
325,
329
],
[
877,
881
]
],
[
... |
import warnings
import numpy as np
from skimage import img_as_float
from skimage.util.dtype import dtype_range, dtype_limits
from skimage._shared.utils import deprecated
__all__ = ['histogram', 'cumulative_distribution', 'equalize',
'rescale_intensity', 'adjust_gamma',
'adjust_log', 'adjust_sig... | [
[
[
7,
15
],
[
1521,
1529
]
],
[
[
23,
34
],
[
1811,
1813
],
[
1838,
1840
],
[
1881,
1883
],
[
1921,
1923
],
[
1950,
1952
],
[
2008,
201... |
# Copyright 2020-2022 OpenDR European Project
#
# 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 agree... | [
[
[
600,
603
],
[
1097,
1100
],
[
2373,
2376
],
[
2579,
2582
],
[
3439,
3442
],
[
4566,
4569
]
],
[
[
611,
619
],
[
1432,
1440
],
[
8452,
... |
# coding: utf-8
"""Python data types for IB Flex format XML data.
These class definitions are introspected by ibflex.parser to type-convert
IB data. They're dataclasses, made immutable by passing `Frozen=True` to the
class decorator. Class attributes are annotated with PEP 484 type hints.
Except for the top-level ... | [
[
[
1983,
1994
]
],
[
[
1996,
2003
]
],
[
[
2965,
2973
],
[
3920,
3928
],
[
3946,
3954
],
[
3995,
4003
],
[
8214,
8222
],
[
8261,
8269
],
[
... |
import os
import aiofiles
import webbrowser
import json as stdlib_json
from sanic import Sanic, response
from sanic.exceptions import abort
from sanic.response import json
from pyfy import AsyncSpotify, ClientCreds, AuthError
try:
from spt_keys import KEYS
except: # noqa: E722
from spt_keys_template import ... | [
[
[
7,
9
],
[
1502,
1504
],
[
1814,
1816
],
[
1866,
1868
],
[
3112,
3114
]
],
[
[
17,
25
],
[
1488,
1496
]
],
[
[
33,
43
],
[
3206,
... |
"""
This test will initialize the display using displayio and draw a solid green
background, a smaller purple rectangle, and some yellow text. All drawing is done
using native displayio modules.
Pinouts are for the 2.4" TFT FeatherWing or Breakout with a Feather M4 or M0.
"""
import board
import terminalio
im... | [
[
[
292,
297
],
[
501,
506
],
[
523,
528
],
[
542,
547
],
[
641,
646
]
],
[
[
306,
316
],
[
1496,
1506
]
],
[
[
325,
334
],
[
463,
4... |
###############################################################################
##
## Copyright (c) Crossbar.io Technologies GmbH
##
## 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... | [
[
[
817,
821
],
[
841,
845
],
[
1116,
1120
]
],
[
[
831,
840
]
]
] |
a = int(input())
for i in range(1,11):
total = i*a
print('{} x {} = {}'.format(i, a,total))
| [
[
[
0,
1
],
[
54,
55
],
[
91,
92
]
],
[
[
22,
23
],
[
52,
53
],
[
88,
89
]
],
[
[
44,
49
],
[
93,
98
]
]
] |
import copy
import torch.nn as nn
from rlkit.launchers.launcher_util import setup_logger
import rlkit.torch.pytorch_util as ptu
from rlkit.core.ma_eval_util import get_generic_ma_path_information
def experiment(variant):
num_agent = variant['num_agent']
from differential_game import DifferentialGame
expl_e... | [
[
[
7,
11
],
[
1224,
1228
],
[
1945,
1949
]
],
[
[
19,
33
],
[
1104,
1106
],
[
1149,
1151
],
[
1825,
1827
],
[
1870,
1872
],
[
2128,
213... |
from django.urls import NoReverseMatch
from django.utils import html
from django.utils.translation import ugettext as _
from couchdbkit import ResourceNotFound
from casexml.apps.case.models import CommCareCaseAction
from corehq.apps.case_search.const import (
CASE_COMPUTED_METADATA,
SPECIAL_CASE_PROPERTIES,
... | [
[
[
24,
38
],
[
3297,
3311
]
],
[
[
64,
68
]
],
[
[
106,
119
],
[
2095,
2096
],
[
2722,
2723
],
[
5896,
5897
]
],
[
[
144,
160
],
[
44... |
# LICENSE: Simplified BSD https://github.com/mmp2/megaman/blob/master/LICENSE
from nose import SkipTest
import numpy as np
from numpy.testing import assert_allclose, assert_raises, assert_equal
from scipy.sparse import isspmatrix
from scipy.spatial.distance import cdist, pdist, squareform
from megaman.geometry impor... | [
[
[
96,
104
],
[
1333,
1341
],
[
1767,
1775
],
[
3094,
3102
]
],
[
[
113,
124
],
[
741,
743
],
[
1052,
1054
],
[
2647,
2649
],
[
2787,
2... |
"""
This compat modules is a wrapper of the core os module that forbids usage of specific operations
(e.g. chown, chmod, getuid) that would be harmful to the Windows file security model of Certbot.
This module is intended to replace standard os module throughout certbot projects (except acme).
"""
# pylint: disable=fun... | [
[
[
359,
374
]
],
[
[
612,
613
],
[
1640,
1644
]
],
[
[
1059,
1071
],
[
1192,
1198
],
[
1508,
1514
],
[
1733,
1739
]
],
[
[
1118,
1132
],
[
... |
from commons import *
import os
def pgp_check():
init_directory('./temp')
# gpg must exist on your system
status = os.system('gpg --version')
if status==0:
print_up('gpg is found')
else:
print_err('can\'t find gpg')
def verify_publickey_message(pk, msg):
# obtain a temp filena... | [
[
[
20,
21
],
[
54,
68
],
[
182,
190
],
[
225,
234
],
[
332,
353
],
[
502,
511
],
[
554,
563
],
[
799,
805
],
[
1088,
1094
],
[
... |
import unittest
import math
from Include.Tuple import *
#
# Tuple Unit tests
#
class TestTuplePointVector(unittest.TestCase):
def test_Tuple_ifWArgumentIsOneTupleIsPoint(self):
self.a = Tuple(4.3, -4.2, 3.1, 1.0)
self.assertEqual(self.a.x, 4.3)
self.assertEqual(self.a.y, -4.2)
self... | [
[
[
7,
15
],
[
108,
116
],
[
934,
942
],
[
2772,
2780
],
[
3770,
3778
],
[
4490,
4498
],
[
4739,
4747
],
[
5133,
5141
],
[
6731,
6739
],... |
from collections.abc import Mapping
import numpy as np
from pickydict import PickyDict
from .utils import load_known_key_conversions
_key_regex_replacements = {r"\s": "_",
r"[!?.,;:]": ""}
_key_replacements = load_known_key_conversions()
class Metadata:
"""Class to handle spectrum met... | [
[
[
28,
35
],
[
1839,
1846
],
[
4250,
4257
]
],
[
[
43,
54
],
[
2327,
2329
],
[
2363,
2365
]
],
[
[
77,
86
],
[
1791,
1800
],
[
1874,
... |
"""
Base settings to build other settings files upon.
"""
import environ
ROOT_DIR = (
environ.Path(__file__) - 3
) # (webscrape/config/settings/base.py - 3 = webscrape/)
APPS_DIR = ROOT_DIR.path("webscrape")
env = environ.Env()
READ_DOT_ENV_FILE = env.bool("DJANGO_READ_DOT_ENV_FILE", default=False)
if READ_DOT... | [
[
[
66,
73
],
[
92,
99
],
[
222,
229
]
],
[
[
75,
83
],
[
188,
196
],
[
424,
432
],
[
1341,
1349
],
[
5529,
5537
]
],
[
[
177,
185
... |
"This creates an HDF5 file with a potentially large number of objects"
import sys
import numpy
import tables
filename = sys.argv[1]
# Open a new empty HDF5 file
fileh = tables.open_file(filename, mode="w")
# nlevels -- Number of levels in hierarchy
# ngroups -- Number of groups on each level
# ndatasets -- Number o... | [
[
[
79,
82
],
[
122,
125
]
],
[
[
90,
95
],
[
655,
660
],
[
679,
684
]
],
[
[
103,
109
],
[
172,
178
]
],
[
[
111,
119
],
[
189,
... |
import logging
import os
import unittest
import pypesto
import pypesto.logging
class LoggingTest(unittest.TestCase):
def test_optimize(self):
# logging
pypesto.logging.log_to_console(logging.WARN)
filename = ".test_logging.tmp"
pypesto.logging.log_to_file(logging.DEBUG, filename)
... | [
[
[
7,
14
],
[
206,
213
],
[
295,
302
],
[
337,
344
],
[
448,
455
],
[
498,
505
]
],
[
[
22,
24
],
[
377,
379
],
[
415,
417
],
[... |
from django.urls import path
from .views import audit_view
urlpatterns = [
path('', audit_view, name="audit")
] | [
[
[
24,
28
],
[
80,
84
]
],
[
[
48,
58
],
[
89,
99
]
],
[
[
60,
71
]
]
] |
from cashbook.models import CashBookTransaction
from controls.models import ModuleSettings, Period
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db.models import F, OuterRef, Subquery, Sum
from django.db.models.functions import Coalesce
from django.views.generic import TemplateView
from purchase... | [
[
[
28,
47
],
[
4923,
4942
]
],
[
[
76,
90
],
[
4783,
4797
]
],
[
[
92,
98
],
[
1507,
1513
],
[
2414,
2420
]
],
[
[
138,
156
],
[
4582... |
import os
import errno
import certifi
import requests
from deriva.core import urlsplit, get_new_requests_session, stob, make_dirs, DEFAULT_SESSION_CONFIG
from deriva.transfer.download import DerivaDownloadError, DerivaDownloadConfigurationError, \
DerivaDownloadAuthenticationError, DerivaDownloadAuthorizationError
... | [
[
[
7,
9
],
[
2051,
2053
],
[
2896,
2898
],
[
3269,
3271
],
[
4119,
4121
],
[
4295,
4297
]
],
[
[
17,
22
]
],
[
[
30,
37
],
[
7149,
... |
from app.routers.audio import router
AUDIO_SETTINGS_URL = router.url_path_for("audio_settings")
GET_CHOICES_URL = router.url_path_for("get_choices")
START_AUDIO_URL = router.url_path_for("start_audio")
def test_get_settings(audio_test_client):
response = audio_test_client.get(url=AUDIO_SETTINGS_URL)
assert r... | [
[
[
30,
36
],
[
59,
65
],
[
115,
121
],
[
168,
174
]
],
[
[
38,
56
],
[
288,
306
]
],
[
[
97,
112
],
[
641,
656
],
[
977,
992
],... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Enrique Fernandez
# Released under the BSD License.
#
# Authors:
# * Enrique Fernandez
import Tkinter
import rospy
from geometry_msgs.msg import Twist, Vector3
import numpy
class MouseTeleop():
def __init__(self):
# Retrieve params... | [
[
[
167,
174
],
[
1004,
1011
],
[
1180,
1187
],
[
1355,
1362
],
[
1667,
1674
],
[
1744,
1751
],
[
1789,
1796
],
[
1836,
1843
],
[
1885,
1892... |
from typing import Tuple, Union, Callable, Optional, Sequence
from pytest_mock import MockerFixture
import pytest
import numpy as np
import dask.array as da
from squidpy.im import (
segment,
ImageContainer,
SegmentationCustom,
SegmentationWatershed,
)
from squidpy.im._segment import _SEG_DTYPE
from sq... | [
[
[
19,
24
],
[
5651,
5656
]
],
[
[
26,
31
],
[
2753,
2758
],
[
3337,
3342
],
[
3370,
3375
],
[
5640,
5645
],
[
9804,
9809
]
],
[
[
33,
... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import argparse
import contextlib
import os
import subprocess
from pathlib import Path
RESTLER_TEMP_DIR = 'restler_working_dir'
@contextlib.contextmanager
def usedir(dir):
""" Helper for 'with' statements that changes the current directory t... | [
[
[
80,
88
],
[
3926,
3934
]
],
[
[
96,
106
],
[
204,
214
]
],
[
[
114,
116
],
[
5626,
5628
],
[
6093,
6095
],
[
6331,
6333
],
[
504,
... |
import urllib
from contextlib import suppress
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import login
from django.core.exceptions import PermissionDenied, SuspiciousOperation
from django.http import FileResponse, Http404, HttpResponseServerError
from django.shortcuts ... | [
[
[
7,
13
],
[
2668,
2674
],
[
4583,
4589
]
],
[
[
37,
45
],
[
1214,
1222
]
],
[
[
71,
79
],
[
2018,
2026
],
[
4819,
4827
]
],
[
[
107... |
# Generated by Django 2.1 on 2019-10-12 09:44
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Stock',
fields=[
('id', models.AutoField(auto... | [
[
[
69,
79
],
[
106,
116
],
[
205,
215
]
],
[
[
81,
87
],
[
299,
305
],
[
418,
424
],
[
477,
483
],
[
525,
531
],
[
574,
580
]
],
... |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | [
[
[
616,
621
],
[
18014,
18019
],
[
18728,
18733
]
],
[
[
629,
633
],
[
62672,
62676
]
],
[
[
642,
654
],
[
19601,
19613
]
],
[
[
662,
665
],
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class MyAwesomeModel(nn.Module):
def __init__(self, n_classes):
super(MyAwesomeModel, self).__init__()
self.feature_extractor = nn.Sequential(
nn.Conv2d(in_channels=1, out_channels=6, kernel_size=4, stride=1),
... | [
[
[
7,
12
],
[
930,
935
]
],
[
[
20,
34
],
[
90,
92
],
[
218,
220
],
[
245,
247
],
[
324,
326
],
[
347,
349
],
[
388,
390
],
[
... |
from adventofcode.year_2021.day_2021_01 import readable, short
def test_readable_part_one():
answer = readable.part1()
assert answer == 1616
def test_readable_part_two():
answer = readable.part2()
assert answer == 1645
def test_short_part_one():
answer = short.part1()
assert answer == 1616... | [
[
[
47,
55
],
[
108,
116
],
[
196,
204
]
],
[
[
57,
62
],
[
281,
286
],
[
363,
368
]
],
[
[
69,
91
]
],
[
[
157,
179
]
],
[
[
245,... |
"""djangoecommerce URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Cla... | [
[
[
666,
671
],
[
788,
793
]
],
[
[
696,
700
],
[
752,
756
],
[
773,
777
]
],
[
[
725,
730
],
[
761,
766
]
],
[
[
732,
743
]
]
] |
from stable_baselines.ppo2.run_mujoco import eval_return
import cma
import numpy as np
from stable_baselines.low_dim_analysis.eval_util import *
from stable_baselines.low_dim_analysis.common import do_pca, plot_2d, \
dump_rows_write_csv, generate_run_dir, do_proj_on_first_n_IPCA, get_allinone_concat_df
from sklear... | [
[
[
45,
56
],
[
2185,
2196
]
],
[
[
64,
67
],
[
1537,
1540
],
[
6205,
6208
]
],
[
[
76,
87
],
[
815,
817
],
[
1916,
1918
],
[
2334,
... |
import tublatexmaker.latex_creater as convert
dict_of_entries = {
"(Bahth fī) uṣūl al-fiqh": {
"displaytitle": "",
"exists": "1",
"fulltext": "(Bahth fī) uṣūl al-fiqh",
"fullurl": "http://144.173.140.108:8080/tub/index.php/(Bahth_f%C4%AB)_u%E1%B9%A3%C5%ABl_al-fiqh",
"namespa... | [
[
[
7,
45
],
[
4249,
4256
],
[
4360,
4367
]
],
[
[
47,
62
]
],
[
[
804,
811
],
[
4391,
4398
]
],
[
[
3082,
3103
]
],
[
[
3986,
4003
]
],
... |
from typing import Sequence
import numpy as np
import xarray
from xarray import DataArray
from xclim.indices.run_length import rle_1d
def get_longest_run_start_index(
arr: DataArray,
window: int = 1,
dim: str = "time",
) -> DataArray:
return xarray.apply_ufunc(
get_index_of_longest_run,
... | [
[
[
19,
27
],
[
522,
530
]
],
[
[
36,
47
],
[
608,
610
],
[
626,
628
],
[
707,
709
],
[
729,
731
],
[
765,
767
]
],
[
[
55,
61
]... |
# Generated by Django 2.2.7 on 2019-11-20 17:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('notes', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='note',
name='media',
field=... | [
[
[
71,
81
],
[
108,
118
],
[
222,
232
]
],
[
[
83,
89
],
[
320,
326
]
],
[
[
98,
107
]
]
] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 Intel Corporation
#
# 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
#
# Unl... | [
[
[
648,
662
],
[
1179,
1193
]
],
[
[
671,
678
],
[
1276,
1283
],
[
1702,
1709
],
[
2109,
2116
]
],
[
[
1260,
1275
],
[
1529,
1544
]
],
[
[
... |
from __future__ import annotations
import shutil
from betfairlightweight.resources.streamingresources import MarketDefinition
from betfairlightweight.resources.bettingresources import MarketCatalogue, MarketBook
from betfairlightweight.streaming.listener import StreamListener
import sqlalchemy
from sqlalchemy.sql.expr... | [
[
[
23,
34
]
],
[
[
43,
49
],
[
14911,
14917
]
],
[
[
110,
126
],
[
17076,
17092
]
],
[
[
185,
200
],
[
16634,
16649
],
[
19363,
19378
]
],
... |
"""rest_vk_api URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-b... | [
[
[
664,
667
],
[
712,
715
],
[
789,
792
]
],
[
[
685,
690
],
[
750,
755
],
[
806,
811
]
],
[
[
692,
703
]
]
] |
#!/usr/bin/env python
from testWrt import testsetup
from testWrt.lib import SSHOpenWrt
if __name__ == "__main__":
ts = testsetup.create_generic()
device = SSHOpenWrt(hostname="192.168.1.1", password="test")
ret = device.portscan(22)
print(ret)
| [
[
[
43,
52
],
[
125,
134
]
],
[
[
77,
87
],
[
165,
175
]
],
[
[
120,
122
]
],
[
[
156,
162
],
[
227,
233
]
],
[
[
221,
224
],
[
25... |
import csv
import logging
from datetime import datetime, timedelta
from typing import Any, Dict, Optional
from scrapy import Spider
from sqlalchemy.dialects.postgresql import insert
from opennem.core.normalizers import normalize_duid
from opennem.db import SessionLocal, get_database_engine
from opennem.db.models.open... | [
[
[
7,
10
],
[
941,
944
],
[
1822,
1825
],
[
2614,
2617
]
],
[
[
18,
25
],
[
579,
586
]
],
[
[
47,
55
],
[
3022,
3030
]
],
[
[
57,
... |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from w... | [
[
[
237,
253
]
],
[
[
297,
313
],
[
1357,
1373
]
],
[
[
341,
353
],
[
1292,
1304
],
[
4244,
4256
],
[
4880,
4892
],
[
5415,
5427
]
],
[
[
... |
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 6 20:55:32 2020
@author: arosso
"""
from recipe_scrapers import scrape_me
# give the url as a string, it can be url from any site listed below
# scraper = scrape_me('http://allrecipes.com/Recipe/Apple-Cake-Iv/Detail.aspx')
scraper = scrape_me('https://www.101cookbooks.... | [
[
[
114,
123
],
[
284,
293
]
],
[
[
274,
281
],
[
411,
418
],
[
457,
464
],
[
508,
515
],
[
555,
562
],
[
607,
614
]
],
[
[
360,
371... |
import numpy as np
import pandas as pd
from sklearn.cluster import KMeans
import itertools
import findspark
import pyspark
from pyspark.sql.functions import pandas_udf, PandasUDFType
from pyspark.sql.types import *
import time
def simulate_sbm_dc_data(sbm_matrix, sample_size=1000, partition_num=10, cluster_num=3):
... | [
[
[
7,
18
],
[
8576,
8578
],
[
8706,
8708
],
[
8830,
8832
],
[
8960,
8962
],
[
780,
782
],
[
908,
910
],
[
954,
956
],
[
976,
978
],
... |
from __future__ import absolute_import
import six
from string import Formatter
class dontexplodedict(object):
"""
A dictionary that won't throw a KeyError and will
return back a sensible default value to be used in
string formatting.
"""
def __init__(self, d=None):
self.data = d or {... | [
[
[
23,
38
]
],
[
[
47,
50
],
[
5416,
5419
]
],
[
[
70,
79
],
[
5236,
5245
]
],
[
[
88,
103
],
[
5326,
5341
]
],
[
[
401,
411
]
]
] |
import os.path as pt
import numpy as np
import torchvision.transforms as transforms
import torch
from torch.utils.data import DataLoader
from torchvision.datasets import EMNIST
def ceil(x: float):
return int(np.ceil(x))
class MyEMNIST(EMNIST):
""" Reimplements get_item to transform tensor input to pil imag... | [
[
[
7,
20
],
[
1951,
1953
]
],
[
[
29,
40
],
[
215,
217
],
[
2412,
2414
],
[
2429,
2431
]
],
[
[
48,
84
],
[
569,
579
],
[
1997,
200... |
import numpy as np
import torch
import torch.nn as nn
from rgb_stacking.utils.utils import init
class Flatten(nn.Module):
def forward(self, x):
return x.view(x.size(0), -1)
class Sum(nn.Module):
def __init__(self, dim):
super().__init__()
self.dim = dim
def forward(self, x):
... | [
[
[
7,
18
],
[
853,
855
]
],
[
[
26,
31
],
[
332,
337
],
[
501,
506
]
],
[
[
39,
53
],
[
112,
114
],
[
199,
201
],
[
368,
370
],... |
#!/usr/bin/env python
# coding=utf-8
# Stan 2018-08-04
import sys
if sys.version_info >= (3,):
class aStr():
def __str__(self):
return self.__unicode__()
def cmp(a, b):
return (a > b) - (a < b)
# range = range
def b(s):
return s.encode('utf-8')
def u(s):
... | [
[
[
64,
67
],
[
73,
76
]
],
[
[
109,
113
]
],
[
[
191,
194
]
],
[
[
263,
264
]
],
[
[
311,
312
]
],
[
[
373,
380
]
],
[
[
392,
404
]... |
# A four-digit integer is given. Find the sum of even digits in it.
# Create a variable "var_int" and assign it a four-digit integer value.
# Create a variable "sum_even" and assign it 0.
# Find the sum of the even digits in the variable "var_int".
var_int = 1184
sum_even = 0
x1 = var_int % 10
var_int //= 10
sum_ev... | [
[
[
253,
260
],
[
286,
293
],
[
299,
306
]
],
[
[
268,
276
],
[
314,
322
]
],
[
[
281,
283
],
[
327,
329
],
[
341,
343
]
],
[
[
345,
... |
# Permafrost Forms
from django.conf import settings
from django.contrib.auth.models import Permission
from django.contrib.sites.models import Site
from django.core.exceptions import ValidationError
from django.forms import ModelForm
from django.forms.fields import CharField, ChoiceField, BooleanField
from django.forms.... | [
[
[
43,
51
]
],
[
[
91,
101
],
[
2021,
2031
],
[
2886,
2896
],
[
3351,
3361
]
],
[
[
142,
146
],
[
2283,
2287
]
],
[
[
182,
197
],
[
4... |
import os
import numpy as np
import pandas as pd
from qlib.data.dataset.processor import Processor
from qlib.data.dataset.utils import fetch_df_by_index
from typing import Dict
class HighFreqTrans(Processor):
def __init__(self, dtype: str = "bool"):
self.dtype = dtype
def fit(self, df_features):
... | [
[
[
7,
9
],
[
953,
955
],
[
999,
1001
],
[
1067,
1069
]
],
[
[
18,
29
],
[
439,
441
],
[
500,
502
],
[
1582,
1584
],
[
1634,
1636
],... |
import torch
import torch.nn as nn
use_cuda = torch.cuda.is_available()
class CNNClassifier(nn.Module):
def __init__(self, channel, SHHS=False):
super(CNNClassifier, self).__init__()
conv1 = nn.Conv2d(1, 10, (1, 200))
pool1 = nn.MaxPool2d((1, 2))
if channel == 1:
conv2 =... | [
[
[
7,
12
],
[
47,
52
]
],
[
[
20,
34
],
[
93,
95
],
[
212,
214
],
[
255,
257
],
[
321,
323
],
[
368,
370
],
[
416,
418
],
[
... |
from math import sqrt
# function with int parameter
def my_function(a: str):
print(a)
my_function(3)
# function with type annotation
def my_function2(a: str) -> str:
return a
print(my_function2(3))
# import sqrt from math and use it
print(sqrt(9.4323))
# import alias from math
# from math import sqrt as square_... | [
[
[
17,
21
],
[
246,
250
]
],
[
[
57,
68
],
[
89,
100
]
],
[
[
141,
153
],
[
187,
199
]
],
[
[
361,
373
],
[
409,
421
]
],
[
[
481... |
import cv_datetime_utils
import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
import scipy.optimize
import json
import os
def compose_transformations(
rotation_vector_1,
translation_vector_1,
rotation_vector_2,
translation_vector_2):
rotation_vector_1 = np.asarray(rot... | [
[
[
7,
24
]
],
[
[
32,
41
],
[
614,
616
],
[
2561,
2563
],
[
3212,
3214
],
[
6424,
6426
],
[
7884,
7886
],
[
10553,
10555
],
[
10787,
10... |
"""
Client
Run by the evaluator, sends a TLS Client Hello with the ESNI extension, followed by two test packets.
"""
import argparse
import binascii as bi
import os
import socket
import time
socket.setdefaulttimeout(1)
from plugins.plugin_client import ClientPlugin
class ESNIClient(ClientPlugin):
"""
Defi... | [
[
[
126,
134
],
[
705,
713
]
],
[
[
142,
156
],
[
3340,
3342
]
],
[
[
164,
166
]
],
[
[
174,
180
],
[
194,
200
],
[
3187,
3193
],
[
32... |
"""
Dump/export our own data to a local file.
Script is installed as `location_dump`.
"""
import argparse
import os
import os.path
import sys
from sqlalchemy import text
from ichnaea.db import (
configure_db,
db_worker_session,
)
from ichnaea.geocalc import bbox
from ichnaea.log import (
configure_loggi... | [
[
[
99,
107
],
[
2153,
2161
]
],
[
[
115,
117
]
],
[
[
125,
132
],
[
2979,
2981
],
[
2995,
2997
],
[
3037,
3039
]
],
[
[
140,
143
],
[
... |
#!/usr/bin/python
import serial
import time
ser = serial.Serial(
port = '/dev/ttyACM1',
baudrate = 9600,
parity = serial.PARITY_NONE,
stopbits = serial.STOPBITS_ONE,
bytesize = serial.EIGHTBITS
)
while 1:
ser.flush()
line = ser.readline().decode().strip()
gas... | [
[
[
26,
32
],
[
53,
59
],
[
142,
148
],
[
181,
187
],
[
221,
227
]
],
[
[
40,
44
],
[
411,
415
]
],
[
[
47,
50
],
[
258,
261
],
... |
"""
Convert an RDF graph into an image for displaying in the notebook, via GraphViz
It has two parts:
- conversion from rdf into dot language. Code based in rdflib.utils.rdf2dot
- rendering of the dot graph into an image. Code based on
ipython-hierarchymagic, which in turn bases it from Sphinx
See https://... | [
[
[
4998,
5003
],
[
9334,
9339
],
[
9370,
9375
]
],
[
[
5011,
5017
],
[
11778,
11784
]
],
[
[
5025,
5027
],
[
6929,
6931
]
],
[
[
5043,
5051
],
... |
"""
LUME-Genesis primary class
"""
from genesis import archive, lattice, parsers, tools, writers
import h5py
import tempfile
from time import time
import shutil
import os
def find_genesis2_executable(genesis_exe=None, verbose=False):
"""
Searches for the genesis2 executable.
"""
if ge... | [
[
[
59,
66
],
[
12820,
12827
],
[
12909,
12916
],
[
12991,
12998
],
[
13412,
13419
],
[
13950,
13957
],
[
14006,
14013
]
],
[
[
68,
75
],
[
68... |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import absolute_import
from telemetry.core import util
util.AddDirToPythonPath(
util.GetTelemetryDir(), 'third_party', 'websocket-client... | [
[
[
185,
200
]
],
[
[
229,
233
],
[
235,
239
],
[
264,
268
]
],
[
[
345,
362
]
],
[
[
410,
428
]
],
[
[
476,
501
]
]
] |
# -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
BaseExceptionViolation,
)
from wemake_python_styleguide.visitors.ast.keywords import (
WrongExceptionTypeVisitor,
)
use_base_exception = """
try:
execute()
except BaseException:
raise
"""
use_excep... | [
[
[
32,
38
],
[
448,
454
],
[
837,
843
]
],
[
[
109,
131
],
[
809,
831
]
],
[
[
200,
225
],
[
708,
733
],
[
1123,
1148
]
],
[
[
230,
... |
from .functional import *
| [
[
[
24,
25
]
]
] |
from . import ac
from . import q_learning
from . import rnnq_learning
AC = ac.ActorCritic
MFAC = ac.MFAC
IL = q_learning.DQN
MFQ = q_learning.MFQ
POMFQ = q_learning.POMFQ
rnnIL = rnnq_learning.DQN
rnnMFQ = rnnq_learning.MFQ
def spawn_ai(algo_name, sess, env, handle, human_name, max_steps):
if algo_name == 'mfq':
... | [
[
[
14,
16
],
[
75,
77
],
[
97,
99
]
],
[
[
31,
41
],
[
110,
120
],
[
131,
141
],
[
154,
164
]
],
[
[
56,
69
],
[
179,
192
],
... |
from lib.types import IStdin, IStdout
def main(stdin: IStdin, stdout: IStdout):
stdout.write('*** You are a student at PWN_University and you are all set to graduate at the end of the semester. Unfortunately the night before graduation you learned you were going to fail your last class and now you’re afraid the sc... | [
[
[
22,
28
],
[
55,
61
]
],
[
[
30,
37
],
[
71,
78
]
],
[
[
43,
47
]
]
] |
"""Constants for the ISY994 Platform."""
import logging
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_COLD,
DEVICE_CLASS_DOOR,
DEVICE_CLASS_GAS,
DEVICE_CLASS_HEAT,
DEVICE_CLASS_MOISTURE,
DEVICE_CLASS_MOTION,
DEVICE_CLASS_OPENING,
DEVICE_CLAS... | [
[
[
48,
55
],
[
2122,
2129
]
],
[
[
114,
134
],
[
18189,
18209
]
],
[
[
140,
157
],
[
18029,
18046
]
],
[
[
163,
180
],
[
18157,
18174
]
],
... |
from scfmsp.controlflowanalysis.StatusRegister import StatusRegister
from scfmsp.controlflowanalysis.instructions.AbstractInstructionBranching import AbstractInstructionBranching
class InstructionJz(AbstractInstructionBranching):
name = 'jz'
def get_execution_time(self):
return 2
def get_branchi... | [
[
[
54,
68
],
[
377,
391
]
],
[
[
150,
178
],
[
201,
229
]
],
[
[
187,
200
]
]
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.