code stringlengths 10 805k | def_use_chains listlengths 0 667 |
|---|---|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('stocks', '0003_auto_20151129_1623'),
]
operations = [
migrations.Alter... | [
[
[
47,
63
]
],
[
[
87,
93
],
[
409,
415
],
[
601,
607
]
],
[
[
95,
105
],
[
178,
188
],
[
304,
314
],
[
495,
505
]
],
[
[
113,
... |
# Name: Breno Maurício de Freitas Viana
# NUSP: 11920060
# Course Code: SCC5830
# Year/Semester: 2021/1
# Assignment 5: Image Descriptors
import math
import numpy as np
import imageio
from scipy import ndimage
np.seterr(divide='ignore', invalid='ignore')
LEVELS = 256
# ----- (1) Read Parameters
# Get the locatio... | [
[
[
147,
151
],
[
1855,
1859
],
[
2005,
2009
],
[
2091,
2095
],
[
3630,
3634
]
],
[
[
159,
170
],
[
214,
216
],
[
3479,
3481
],
[
3821,
... |
"""Test trunk lock."""
import pytest
from tests.tesla_mock import TeslaMock
from teslajsonpy.controller import Controller
from teslajsonpy.trunk import TrunkLock
def test_has_battery(monkeypatch):
"""Test has_battery()."""
_mock = TeslaMock(monkeypatch)
_controller = Controller(None)
_data = _moc... | [
[
[
31,
37
],
[
736,
742
],
[
1138,
1144
],
[
1534,
1540
],
[
2047,
2053
],
[
2511,
2517
]
],
[
[
68,
77
],
[
245,
254
],
[
528,
537
... |
import sys
from cx_Freeze import setup, Executable
setup(
name='YtMusic-Lib-Tracker',
url='https://github.com/czifumasa/ytmusic-lib-tracker',
author='Łukasz Lenart',
author_email='[email protected]',
version='0.1',
license='MIT',
description='Useful tools for youtube music. Exporti... | [
[
[
7,
10
]
],
[
[
33,
38
],
[
52,
57
]
],
[
[
40,
50
],
[
679,
689
]
]
] |
#!/usr/bin/python
# -*- coding:utf-8 -*-
import RPi.GPIO as GPIO
import time
CS = 5
Clock = 25
Address = 24
DataOut = 23
Button = 7
class TRSensor(object):
def __init__(self,numSensors = 5):
self.numSensors = numSensors
self.calibratedMin = [0] * self.numSensors
self.calibratedMax = [1023] * self.numSensors
... | [
[
[
48,
64
],
[
342,
346
],
[
355,
359
],
[
367,
371
],
[
393,
397
],
[
410,
414
],
[
422,
426
],
[
441,
445
],
[
453,
457
],
[
... |
import connexion
from openapi_server.annotator.phi_types import PhiType
from openapi_server.get_annotations import get_annotations
from openapi_server.models.error import Error # noqa: E501
from openapi_server.models.text_date_annotation_request import \
TextDateAnnotationRequest # noqa: E501
from openapi_server.... | [
[
[
7,
16
],
[
656,
665
],
[
782,
791
]
],
[
[
64,
71
],
[
926,
933
]
],
[
[
115,
130
],
[
895,
910
]
],
[
[
171,
176
],
[
1102,
... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
import logging
from .lr_scheduler import WarmupMultiStepLR
def make_optimizer(cfg, model):
logger = logging.getLogger("fcos_core.trainer")
params = []
for key, value in model.named_parameters():
if not value.requi... | [
[
[
79,
84
],
[
932,
937
],
[
1034,
1039
]
],
[
[
92,
99
],
[
191,
198
]
],
[
[
126,
143
],
[
1132,
1149
]
],
[
[
150,
164
]
],
[
[
... |
# -*- coding: utf-8 -*-
"""Patched version of PyPi Kitchen's Python 3 getwriter function. Removes
extraneous newlines."""
import codecs
from kitchen.text.converters import to_bytes
def getwriter(encoding):
"""Return a :class:`codecs.StreamWriter` that resists tracing back.
:arg encoding: Encoding to use for... | [
[
[
129,
135
],
[
2442,
2448
],
[
2903,
2909
]
],
[
[
173,
181
],
[
3024,
3032
]
],
[
[
188,
197
]
]
] |
input = """
colored(2,g) :- not diff_col(2,g).
colored(2,y) :- not diff_col(2,y).
colored(3,g) :- not diff_col(3,g).
colored(3,y) :- not diff_col(3,y).
diff_col(2,g) :- colored(2,y).
diff_col(3,g) :- colored(3,y).
diff_col(2,y) :- colored(2,g).
diff_col(3,y) :- colored(3,g).
no_stable :- colored(2,2), color... | [
[
[
0,
5
]
],
[
[
520,
526
]
]
] |
import logging
from datetime import datetime
import botocore.loaders
import botocore.regions
from boto3 import Session as Boto3Session
from botocore.exceptions import ClientError
from .exceptions import CLIMisconfiguredError, DownstreamError
LOG = logging.getLogger(__name__)
BOTO_CRED_KEYS = ("aws_access_key_id", "... | [
[
[
7,
14
],
[
251,
258
]
],
[
[
36,
44
],
[
1320,
1328
]
],
[
[
53,
69
]
],
[
[
77,
93
],
[
2789,
2797
],
[
2878,
2886
]
],
[
[
1... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... | [
[
[
751,
755
]
],
[
[
763,
765
],
[
3076,
3078
]
],
[
[
773,
781
]
],
[
[
789,
800
]
],
[
[
825,
834
]
],
[
[
854,
862
]
],
[
[
864,
869... |
#!/usr/bin/env python3
# Very basic bitstream to SVF converter
# This file is Copyright (c) 2018 David Shah <[email protected]>
import sys
import textwrap
max_row_size = 100000
def bitreverse(x):
y = 0
for i in range(8):
if (x >> (7 - i)) & 1 == 1:
y |= (1 << i)
return y
def bit_to_svf(bi... | [
[
[
131,
134
],
[
2976,
2979
],
[
2989,
2992
],
[
878,
881
]
],
[
[
142,
150
],
[
2230,
2238
]
],
[
[
152,
164
],
[
1938,
1950
]
],
[
[
... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""Manages the details on the images used in the build and the run stage."""
import json
import os.path
#: Global variable... | [
[
[
281,
285
],
[
777,
781
]
],
[
[
293,
300
],
[
621,
623
],
[
637,
639
],
[
684,
686
]
],
[
[
372,
377
],
[
595,
600
]
],
[
[
391,
... |
# Name: VolumeExtractChannel
import inviwopy as ivw
import numpy as np
class VolumeExtractChannel(ivw.Processor):
def __init__(self, id, name):
ivw.Processor.__init__(self, id, name)
self.inport = ivw.data.VolumeInport("inport")
self.addInport(self.inport, owner=False)
self.outpor... | [
[
[
38,
53
],
[
101,
104
],
[
159,
162
],
[
220,
223
],
[
324,
327
],
[
433,
436
],
[
605,
608
],
[
785,
788
],
[
820,
823
],
[
... |
# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
# General Public License as public by the Free Software Foundation; version 2.0
# or (at your option) any later version. You can redistribute it and/or
# modify it under the terms of either of these two licenses.
#
# Unless required by applica... | [] |
# -*- test-case-name: twisted.web2.test.test_httpauth -*-
from twisted.cred import credentials, error
from twisted.web2.auth.interfaces import ICredentialFactory
from zope.interface import implements
class BasicCredentialFactory(object):
"""
Credential Factory for HTTP Basic Authentication
"""
imple... | [
[
[
84,
95
],
[
769,
780
]
],
[
[
97,
102
],
[
644,
649
],
[
838,
843
]
],
[
[
144,
162
],
[
326,
344
]
],
[
[
191,
201
],
[
315,
... |
from couchbase.management.admin import Admin
from couchbase_core.mapper import BijectiveMapping, \
StringEnum, Identity, Timedelta, Bijection, StringEnumLoose
from ..options import OptionBlockTimeOut, forward_args
from couchbase.management.generic import GenericManager
from typing import *
from couchbase_core impor... | [
[
[
39,
44
],
[
10792,
10797
]
],
[
[
79,
95
],
[
8037,
8053
]
],
[
[
103,
113
],
[
8691,
8701
]
],
[
[
115,
123
],
[
8193,
8201
],
[
... |
"""
This module implements the core class hierarchy for implementing EO tasks. An EO task is any class the inherits
from the abstract EOTask class. Each EO task has to implement the execute method; invoking __call__ on a EO task
instance invokes the execute method. EO tasks are meant primarily to operate on EO patches ... | [
[
[
1023,
1026
],
[
2938,
2941
]
],
[
[
1034,
1041
],
[
1206,
1213
]
],
[
[
1049,
1057
],
[
2667,
2675
],
[
2815,
2823
]
],
[
[
1065,
1072
],
... |
from kol.request.GenericRequest import GenericRequest
from kol.manager import PatternManager
import kol.Error as Error
from kol.util import Report
class RespondToTradeRequest(GenericRequest):
def __init__(self, session, tradeid, items=None, meat=0, message=""):
super(RespondToTradeRequest, self).__sup... | [
[
[
39,
53
],
[
176,
190
]
],
[
[
78,
92
],
[
882,
896
],
[
1134,
1148
],
[
1486,
1500
]
],
[
[
100,
118
],
[
1013,
1018
],
[
1077,
... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Caps(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "volume"
_path_str = "volume.caps"
_valid_props = {"x", "y", "z"}
# x
# -
@propert... | [
[
[
33,
82
],
[
117,
140
]
],
[
[
90,
103
],
[
5720,
5725
]
],
[
[
112,
116
],
[
5363,
5367
]
]
] |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
[
[
826,
836
],
[
925,
935
],
[
962,
972
]
],
[
[
871,
884
],
[
1134,
1147
],
[
1245,
1258
]
],
[
[
892,
924
]
]
] |
class Buffer:
def __init__(self):
self.lst = list()
def add(self, *a):
for value in a:
self.lst.append(value)
while len(self.lst) >= 5:
s = 0
for i in range(5):
s += self.lst.pop(0)
print(s)
def get_current_part(self)... | [
[
[
6,
12
]
]
] |
class GeometryObject(APIObject, IDisposable):
""" The common base class for all geometric primitives. """
def Dispose(self):
""" Dispose(self: APIObject,A_0: bool) """
pass
def Equals(self, obj):
"""
Equals(self: GeometryObject,obj: object) -> bool
Determines... | [
[
[
6,
20
]
]
] |
import os
import math
import argparse
import gym
from agents.q_agent import Q, Agent, Trainer
RECORD_PATH = os.path.join(os.path.dirname(__file__), "./upload")
def main(episodes, render, monitor):
env = gym.make("CartPole-v0")
q = Q(
env.action_space.n,
env.observation_space,
bin... | [
[
[
7,
9
],
[
110,
112
],
[
123,
125
],
[
1458,
1460
]
],
[
[
17,
21
]
],
[
[
29,
37
],
[
972,
980
]
],
[
[
45,
48
],
[
1498,
15... |
import os
import subprocess
import numpy as np
from tqdm import tqdm
from typing import Dict
MAX_FREQ = 7999
def to_str(v):
if isinstance(v, tuple):
s = " ".join(str(x) for x in v)
elif isinstance(v, float) or isinstance(v, int):
s = str(v)
else:
assert False
return s
def ... | [
[
[
7,
9
],
[
4813,
4815
]
],
[
[
17,
27
],
[
4834,
4844
],
[
4896,
4906
],
[
5751,
5761
]
],
[
[
36,
47
],
[
2341,
2343
],
[
2416,
... |
#!/usr/bin/env python
# Copyright 2014 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.
import logging
import os
import sys
import tempfile
import shutil
import unittest
import re
# Import this first before manipulatin... | [
[
[
196,
203
],
[
723,
730
],
[
742,
749
],
[
985,
992
],
[
1004,
1011
]
],
[
[
211,
213
],
[
392,
394
],
[
408,
410
],
[
424,
426
]... |
# -*- Python -*-
# This file is licensed under a pytorch-style license
# See frontends/pytorch/LICENSE for license information.
import torch
import npcomp.frontends.pytorch as torch_mlir
import npcomp.frontends.pytorch.test as test
# RUN: %PYTHON %s | FileCheck %s
dev = torch_mlir.mlir_device()
t0 = torch.randn((4,4... | [
[
[
136,
141
],
[
304,
309
],
[
340,
345
]
],
[
[
149,
187
],
[
274,
284
]
],
[
[
195,
232
],
[
573,
577
]
],
[
[
268,
271
],
[
330,
... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... | [
[
[
675,
686
],
[
1656,
1658
],
[
1705,
1707
],
[
1766,
1768
],
[
1829,
1831
],
[
1904,
1906
],
[
1948,
1950
],
[
1992,
1994
],
[
2361,
2363... |
from rest_framework.permissions import SAFE_METHODS, BasePermission
class IsAdminOrReadOnly(BasePermission):
"""
The request is authenticated as an Admin user or is Read Only
"""
def has_permission(self, request, view):
return bool(
request.method in SAFE_METHODS or
re... | [
[
[
39,
51
],
[
290,
302
]
],
[
[
53,
67
],
[
94,
108
]
],
[
[
76,
93
]
]
] |
#!/usr/bin/env python3
import argparse
import io
import sys
from urllib.request import urlopen
import urllib.error
import time
import datetime
from retrying import retry
URL = "http://unreliable.labs.crossref.org/error"
ONE_SECOND=1000
ONE_HOUR=((ONE_SECOND*60)*60)
ONE_DAY=(ONE_HOUR*24)
@retry(wait_exponential_mul... | [
[
[
30,
38
],
[
871,
879
]
],
[
[
46,
48
]
],
[
[
56,
59
]
],
[
[
87,
94
],
[
495,
502
]
],
[
[
102,
114
],
[
648,
654
]
],
[
[
... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 8
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_1
from i... | [
[
[
259,
274
]
],
[
[
283,
291
],
[
499,
507
],
[
972,
980
]
],
[
[
300,
313
]
],
[
[
377,
402
]
],
[
[
448,
460
]
],
[
[
469,
498
]
]... |
#
# Copyright (C) 2019 Databricks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | [
[
[
679,
681
],
[
2011,
2013
],
[
2107,
2109
]
],
[
[
689,
697
],
[
85077,
85085
]
],
[
[
720,
727
],
[
97012,
97019
]
],
[
[
729,
735
],
[
... |
import argparse, subprocess, os, re
from jinja2 import Environment, FileSystemLoader
def GetBaseName(full_path):
return os.path.basename(full_path)
class PlantUMLCodeGeneration():
class StateType():
def __init__(self):
self.entry = None
self.during = None
self.exit... | [
[
[
7,
15
],
[
9989,
9997
]
],
[
[
17,
27
],
[
1875,
1885
]
],
[
[
29,
31
],
[
125,
127
],
[
1670,
1672
],
[
9024,
9026
],
[
9103,
9... |
"""
====================
Build image pyramids
====================
The ``pyramid_gaussian`` function takes an image and yields successive images
shrunk by a constant scale factor. Image pyramids are often used, e.g., to
implement algorithms for denoising, texture discrimination, and scale-
invariant detection.
"""
im... | [
[
[
325,
336
],
[
572,
574
],
[
615,
617
]
],
[
[
344,
368
],
[
836,
839
],
[
878,
881
]
],
[
[
390,
394
],
[
452,
456
]
],
[
[
425,
... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 ... | [
[
[
605,
612
],
[
2164,
2171
],
[
2883,
2890
],
[
3715,
3722
],
[
3967,
3974
],
[
4597,
4604
]
],
[
[
620,
628
],
[
893,
901
]
],
[
[
669,... |
from flask_socketio import SocketIO
from flask import Flask, make_response, request, session
from flask import render_template, session, url_for, redirect
from threading import RLock
from threading import Thread
from utilslib import list_to_HTML_table
from time import sleep
from ClientStorage import Clients, User
fr... | [
[
[
27,
35
],
[
567,
575
]
],
[
[
54,
59
],
[
431,
436
]
],
[
[
61,
74
],
[
900,
913
],
[
3889,
3902
]
],
[
[
76,
83
],
[
863,
8... |
from torch.utils.data import Dataset, DataLoader
import glob
import os
import numpy as np
import cv2
import torch
from torchvision import transforms, utils
from skimage.transform import resize
class SegDataset(Dataset):
"""Segmentation Dataset"""
def __init__(self, root_dir, imageFolder, maskFolder, transfor... | [
[
[
29,
36
],
[
212,
219
]
],
[
[
38,
48
],
[
6147,
6157
]
],
[
[
56,
60
],
[
1734,
1738
],
[
1846,
1850
],
[
2065,
2069
],
[
2186,
... |
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import pytest
import vtk
import numpy as np
import sksurgeryvtk.utils.polydata_utils as pdu
import sksurgeryvtk.models.vtk_surface_model as vbs
def test_overlapping_bounds():
radius_0=10.0
radius_1=7.0
centre_1=5.0
radius_2=4.0
centre_2=15.0
rad... | [
[
[
57,
63
]
],
[
[
71,
74
],
[
362,
365
],
[
602,
605
],
[
851,
854
],
[
1096,
1099
],
[
1843,
1846
],
[
2083,
2086
],
[
3337,
3340
... |
import string
import random
# --- Defining Variables ---
LOWER_ALPHABET = list(string.ascii_lowercase)
DIGITS = list(string.digits)
UPPER_ALPHABET = list(string.ascii_uppercase)
SYMBOLS = list(string.punctuation)
SYMBOLS_DELETE = ['"', "'", "(", ")", ",", ".", ":", ";", "[", "]", "|", "`", "{", "}"]
for x in SYMBOLS... | [
[
[
7,
13
],
[
81,
87
],
[
119,
125
],
[
156,
162
],
[
196,
202
]
],
[
[
21,
27
],
[
2586,
2592
],
[
2767,
2773
],
[
2858,
2864
],
... |
# type: ignore
import json
import uuid
from json import JSONDecodeError
from typing import Tuple, Dict, List
import boto3
from melange.drivers.interfaces import Queue, Topic, MessagingDriver, Message
class AWSDriver(MessagingDriver):
def __init__(self, **kwargs):
super().__init__()
self.max_num... | [
[
[
23,
27
],
[
2273,
2277
],
[
2529,
2533
],
[
3141,
3145
],
[
4606,
4610
],
[
6413,
6417
]
],
[
[
35,
39
],
[
1357,
1361
]
],
[
[
57,
... |
'''
Created on 23.08.2017
@author: falensaa
'''
import logging
import sys
import imsnpars.nparser.features
import imsnpars.nparser.network
import imsnpars.nparser.graph.features as gfeatures
from imsnpars.nparser.graph import task, decoder
from imsnpars.nparser.graph.mst import cle
from imsnpars.nparser.labels impor... | [
[
[
57,
64
],
[
513,
520
],
[
591,
598
],
[
648,
655
],
[
1873,
1880
]
],
[
[
72,
75
],
[
571,
574
],
[
1930,
1933
]
],
[
[
84,
109
... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.22
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | [
[
[
279,
285
],
[
6356,
6362
]
],
[
[
293,
295
]
],
[
[
318,
321
],
[
5552,
5555
]
],
[
[
367,
380
],
[
1419,
1432
]
],
[
[
389,
405
],
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Bout (read bank-out) extracts transactions from pdf bank statements.
_ _
(_) (_)
(_) _ _ _ _ _ _ _ _ _ (_) _ _
(_)(_)(_)(_)_ _ (_)(_)(_) _ (_) (_)(_)(_)(... | [
[
[
552,
554
],
[
3228,
3230
]
],
[
[
562,
569
],
[
669,
676
],
[
4129,
4136
],
[
4155,
4162
]
],
[
[
577,
582
],
[
3617,
3622
],
[
3634,
... |
from colored import *
import staticconf
"""
You might find the colored documentation very useful:
https://pypi.python.org/pypi/colored
"""
ENABLE_COLORIZER = staticconf.read_string('enable_colorizer', default='false').lower() == 'true'
def colorizer_enabled(function):
"""do not colorize if it's not enabled"""
... | [
[
[
20,
21
],
[
543,
547
],
[
571,
573
],
[
593,
595
],
[
614,
616
],
[
623,
627
],
[
650,
652
],
[
671,
673
],
[
692,
694
],
[
... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | [
[
[
503,
521
]
],
[
[
522,
529
]
],
[
[
763,
772
],
[
773,
782
]
]
] |
from datetime import timedelta
from django.core.urlresolvers import reverse_lazy
from django.contrib.auth.models import User
from django.utils import timezone
from allauth.account.models import EmailAddress
from rest_framework import status
from rest_framework.test import APITestCase, APIClient
from challenges.model... | [
[
[
21,
30
],
[
14019,
14028
],
[
14076,
14085
],
[
21010,
21019
],
[
21067,
21076
],
[
21877,
21886
],
[
21934,
21943
],
[
25449,
25458
],
[
2918... |
# copyright 2022 @Ansaku
# Telegram @AnkiSatya
# Instagram @satya_ask
import telebot
import requests
from telebot.types import InlineKeyboardButton
# Fillout Here The BotToken it gets from botfather further queries @AnkiSatya 0n telegram
bot = telebot.TeleBot('**********************')
while True:
try:
... | [
[
[
80,
87
],
[
253,
260
],
[
342,
349
],
[
1402,
1409
],
[
3163,
3170
]
],
[
[
96,
104
],
[
1282,
1290
],
[
3438,
3446
],
[
5392,
5400
... |
#name_scan "d/yourdomain" 1
import sys, os
#sys.path.append('/home/khal/sources/nmcontrol/lib/')
import DNS
import rpcClient
import struct, listdns, base64, types, json, random
#from jsonrpc import ServiceProxy
from utils import *
from common import *
class Source(object):
#def __init__(self):
#self.server... | [
[
[
35,
38
]
],
[
[
40,
42
]
],
[
[
104,
107
]
],
[
[
115,
124
]
],
[
[
132,
138
],
[
4552,
4558
],
[
4948,
4954
],
[
5798,
5804
],
[
... |
"""Tests for the :mod:`~polymatheia.data.writer` package."""
import json
import os
from shutil import rmtree
from polymatheia.data import NavigableDict
from polymatheia.data.writer import JSONWriter
DOCUMENTS = [NavigableDict(r) for r in [
{
'id': '1',
'name': {
'first': 'A',
... | [
[
[
68,
72
],
[
1237,
1241
],
[
2314,
2318
]
],
[
[
80,
82
],
[
984,
986
],
[
1168,
1170
],
[
2061,
2063
],
[
2245,
2247
]
],
[
[
103,
... |
# -*- coding: utf-8; -*-
from __future__ import unicode_literals, absolute_import
import json
import requests
import six
from tests import unittest, mock
from freight_forwarder.registry import Registry, V1, V2
from freight_forwarder.registry.registry_base import RegistryBase, RegistryException
from ..fa... | [
[
[
48,
64
]
],
[
[
66,
81
]
],
[
[
89,
93
],
[
2973,
2977
],
[
4387,
4391
],
[
5762,
5766
],
[
7181,
7185
],
[
11173,
11177
]
],
[
[
... |
__all__ = ["loss_fn"]
from icevision.imports import *
def loss_fn(preds, targets) -> torch.Tensor:
return preds["loss"]
| [
[
[
0,
7
]
],
[
[
53,
54
],
[
88,
93
]
],
[
[
61,
68
]
]
] |
# Generated by Django 3.2.4 on 2021-09-11 12:44
import ckeditor_uploader.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0007_subscriber'),
]
operations = [
migrations.AlterField(
model_name='post',
name='... | [
[
[
56,
80
],
[
348,
365
]
],
[
[
103,
113
],
[
132,
142
],
[
248,
258
]
],
[
[
122,
131
]
]
] |
import unittest
from numpy.testing import assert_allclose
from qspectra import polarization
from qspectra.simulate import decorators
class TestGetCallArgs(unittest.TestCase):
def test(self):
self.assertEqual(
decorators._get_call_args(lambda a: None, 1),
{'a': 1})
self.ass... | [
[
[
7,
15
],
[
158,
166
],
[
810,
818
]
],
[
[
42,
57
],
[
1061,
1076
],
[
1102,
1117
],
[
1174,
1189
],
[
1251,
1266
],
[
1759,
1774
... |
# proxy module
from traitsui.editors.check_list_editor import *
| [
[
[
62,
63
]
]
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 29 16:16:57 2019
@author: rakshit
"""
import os
import cv2
import argparse
import matplotlib
import numpy as np
import deepdish as dd
import scipy.io as scio
print('Extracting Santini')
parser = argparse.ArgumentParser()
parser.add_argument('--noD... | [
[
[
116,
118
],
[
967,
969
],
[
1015,
1017
],
[
1063,
1065
],
[
2096,
2098
],
[
2107,
2109
],
[
2181,
2183
],
[
2265,
2267
],
[
2352,
2354
... |
from django.http import HttpResponse
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
from django.shortcuts import redirect
from django.core.validators import URLValidator # https://stackoverflow.com/questions/7160737/python-how-to-validate-a-url-in-python-malf... | [
[
[
25,
37
],
[
1964,
1976
],
[
2152,
2164
],
[
6536,
6548
],
[
7503,
7515
],
[
15715,
15727
]
],
[
[
78,
82
],
[
4359,
4363
],
[
11280,
... |
"""
The arraypad module contains a group of functions to pad values onto the edges
of an n-dimensional array.
"""
from __future__ import division, absolute_import, print_function
import numpy as np
__all__ = ['pad']
###############################################################################
# Private utility ... | [
[
[
138,
146
]
],
[
[
148,
163
]
],
[
[
165,
179
]
],
[
[
188,
199
],
[
1466,
1468
],
[
1523,
1525
],
[
1976,
1978
],
[
1997,
1999
],
[
... |
import copy
import json
import logging
import pytest
import burn_lock_functions
import test_utilities
from integration_env_credentials import sifchain_cli_credentials_for_test
from pytest_utilities import generate_minimal_test_account
from test_utilities import EthereumToSifchainTransferRequest, SifchaincliCredential... | [
[
[
7,
11
],
[
2053,
2057
],
[
4758,
4762
],
[
5322,
5326
]
],
[
[
19,
23
],
[
2279,
2283
],
[
3046,
3050
]
],
[
[
31,
38
],
[
1637,
... |
"""Build Environment used for isolation during sdist building
"""
import logging
import os
import sys
import textwrap
from distutils.sysconfig import get_python_lib
from sysconfig import get_paths
from pip._vendor.pkg_resources import Requirement, VersionConflict, WorkingSet
from pip import __file__ as pip_location
... | [
[
[
74,
81
],
[
486,
493
],
[
3683,
3690
]
],
[
[
89,
91
],
[
864,
866
],
[
924,
926
],
[
990,
992
],
[
1066,
1068
],
[
1349,
1351
]... |
import logging
from random import randint
import traceback
from typing import cast, Dict, List, Set, Collection
from geniusweb.actions.Accept import Accept
from geniusweb.actions.Action import Action
from geniusweb.actions.LearningDone import LearningDone
from geniusweb.actions.Offer import Offer
from geniusweb.action... | [
[
[
7,
14
],
[
1559,
1566
],
[
3197,
3204
],
[
3763,
3770
]
],
[
[
34,
41
],
[
4758,
4765
]
],
[
[
49,
58
]
],
[
[
78,
82
],
[
1878,
... |
METER_TO_KM = 1e-3
ONE_TO_KILO = 1e3
KM_TO_METER = 1e3
KILO_TO_ONE = 1e3
# Average earth radius, see https://en.wikipedia.org/wiki/Earth_radius
EARTH_RADIUS_KM = 6371.0088
# in reality air density varies between 1.14 and 1.42 in kg/m^3
AIR_DENSITY_RHO = 1.225
# of course this introduces a small mistake due to leap ... | [
[
[
0,
11
]
],
[
[
19,
30
]
],
[
[
38,
49
]
],
[
[
56,
67
]
],
[
[
146,
161
]
],
[
[
239,
254
]
],
[
[
446,
460
]
]
] |
# Time: O(n)
# Space: O(1)
class Solution(object):
# @param a, a string
# @param b, a string
# @return a string
def addBinary(self, a, b):
result, carry, val = "", 0, 0
for i in range(max(len(a), len(b))):
val = carry
if i < len(a):
val += int(a[... | [
[
[
35,
43
]
],
[
[
600,
611
],
[
814,
825
]
],
[
[
620,
629
]
]
] |
"""Test whether all elements of cls.args are instances of Basic. """
# NOTE: keep tests sorted by (module, class name) key. If a class can't
# be instantiated, add it here anyway with @SKIP("abstract class) (see
# e.g. Function).
import os
import re
import warnings
import io
from sympy import Basic, S, symbols, sqrt... | [
[
[
239,
241
],
[
574,
576
],
[
612,
614
],
[
631,
633
],
[
642,
644
],
[
670,
672
],
[
705,
707
],
[
736,
738
],
[
869,
871
],
[
... |
#ARC076e
def main():
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)
if __name__ == '__main__':
main() | [
[
[
13,
17
],
[
130,
134
]
]
] |
from django.core.management.base import BaseCommand
from django.utils.timezone import now
class Command(BaseCommand):
args = '[event_slug...]'
help = 'Create missing email aliases'
def handle(*args, **opts):
from access.models import InternalEmailAlias
InternalEmailAlias.ensure_internal_... | [
[
[
40,
51
],
[
106,
117
]
],
[
[
86,
89
]
],
[
[
98,
105
]
]
] |
from django.contrib.auth.models import User
from rest_framework.test import APITestCase
class FVHAPITestCase(APITestCase):
def assert_dict_contains(self, superset, subset, path=''):
for key, expected in subset.items():
full_path = path + key
received = superset.get(key, None)
... | [
[
[
39,
43
],
[
693,
697
]
],
[
[
76,
87
],
[
111,
122
]
],
[
[
96,
110
]
]
] |
"ts_project rule"
load("@build_bazel_rules_nodejs//:providers.bzl", "DeclarationInfo", "NpmPackageInfo", "declaration_info", "js_module_info", "run_node")
_DEFAULT_TSC = (
# BEGIN-INTERNAL
"@npm" +
# END-INTERNAL
"//typescript/bin:tsc"
)
_ATTRS = {
"args": attr.string_list(),
"declaration_dir... | [
[
[
157,
169
],
[
900,
912
]
],
[
[
257,
263
],
[
6752,
6758
]
],
[
[
1239,
1247
],
[
6762,
6770
]
],
[
[
1446,
1459
],
[
3196,
3209
],
[
... |
# encoding: utf-8
from __future__ import unicode_literals
class TranslationError(Exception):
"""Failure to translate source."""
pass
| [
[
[
42,
58
]
],
[
[
67,
83
]
]
] |
# Write a Python program to get execution time for a Python method.
import time
def sum_of_n_numbers(x):
start_time = time.time()
s = 0
for i in range(1, x + 1):
s = s + i
end_time = time.time()
return s, end_time - start_time
n = 5
print("\nTime to sum of 1 to ", n, " and required time... | [
[
[
76,
80
],
[
125,
129
],
[
210,
214
]
],
[
[
87,
103
],
[
341,
357
]
],
[
[
260,
261
],
[
298,
299
],
[
358,
359
]
]
] |
'''
Native support for Multitouch devices on Linux, using libmtdev.
===============================================================
The Mtdev project is a part of the Ubuntu Maverick multitouch architecture.
You can read more on http://wiki.ubuntu.com/Multitouch
To configure MTDev, it's preferable to use probesysfs p... | [
[
[
1234,
1241
]
],
[
[
1297,
1299
],
[
2279,
2281
]
],
[
[
1335,
1346
],
[
1409,
1420
]
],
[
[
1376,
1385
],
[
1777,
1786
]
],
[
[
1394,
1408
... |
import unittest
from unittest.mock import MagicMock
import pandas as pd
from pandas.testing import assert_frame_equal
from data_export.pipeline.dataset import Dataset
class TestDataset(unittest.TestCase):
def setUp(self):
example = MagicMock()
example.to_dict.return_value = {"data": "example"}
... | [
[
[
7,
15
],
[
189,
197
]
],
[
[
42,
51
],
[
248,
257
],
[
343,
352
],
[
427,
436
],
[
520,
529
]
],
[
[
60,
72
],
[
727,
729
]
... |
# Copyright 2018 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | [
[
[
682,
689
]
]
] |
from ..proto import *
from ..graph_io import *
import paddle.fluid as fluid
import numpy as np
from paddle.fluid.core import VarDesc, AttrType
def union(list_a, list_b):
return list(set(list_a).union(set(list_b)))
def difference(list_a, list_b):
return list(set(list_a).difference(set(list_b)))
class Edge_for_flu... | [
[
[
20,
21
]
],
[
[
45,
46
],
[
14341,
14347
],
[
14373,
14378
],
[
14403,
14410
],
[
14435,
14440
],
[
14465,
14471
],
[
14504,
14507
],
[
14... |
import logging
from django.core.mail import EmailMultiAlternatives, EmailMessage
from django.utils.encoding import smart_text
from django.core.urlresolvers import reverse
from django.conf import settings
from disturbance.components.emails.emails import TemplateEmailBase
from ledger.accounts.models import EmailUser
l... | [
[
[
7,
14
],
[
328,
335
]
],
[
[
45,
67
],
[
8077,
8099
],
[
9643,
9665
]
],
[
[
69,
81
],
[
8101,
8113
],
[
9667,
9679
]
],
[
[
116,
... |
# -*- coding: utf-8 -
from iso8601 import parse_date
from datetime import datetime, date, time, timedelta
import dateutil.parser
from pytz import timezone
import os
from decimal import Decimal
import re
TZ = timezone(os.environ['TZ'] if 'TZ' in os.environ else 'Europe/Kiev')
def get_all_etender_dates(initial_tender... | [
[
[
43,
53
],
[
4430,
4440
],
[
4578,
4588
],
[
4733,
4743
]
],
[
[
75,
83
],
[
3283,
3291
],
[
3479,
3487
],
[
4290,
4298
],
[
7292,
73... |
import os
import pytest
import sys
import random
import tempfile
import requests
from pathlib import Path
import ray
from ray.test_utils import (run_string_as_driver,
run_string_as_driver_nonblocking)
from ray._private.utils import (get_wheel_filename, get_master_wheel_url,
... | [
[
[
7,
9
],
[
2359,
2361
],
[
2379,
2381
],
[
2427,
2429
],
[
10230,
10232
],
[
23085,
23087
],
[
23105,
23107
],
[
23586,
23588
],
[
23785,
... |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///posts.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
# app.config['FLASK_RUN_PORT'] = 5002
db = SQLAlchemy(app)
| [
[
[
18,
23
],
[
72,
77
]
],
[
[
53,
63
],
[
246,
256
]
],
[
[
66,
69
],
[
88,
91
],
[
149,
152
],
[
257,
260
]
],
[
[
241,
243
... |
# coding: utf-8
"""
SendinBlue API
SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at h... | [
[
[
1029,
1044
]
],
[
[
1053,
1061
],
[
1237,
1245
],
[
1654,
1662
]
],
[
[
1070,
1084
]
],
[
[
1136,
1150
]
],
[
[
1197,
1209
]
],
[
[
1218,
... |
# coding: utf-8
import math
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
... | [
[
[
23,
27
],
[
2405,
2409
],
[
5014,
5018
],
[
5270,
5274
],
[
5507,
5511
]
],
[
[
35,
46
]
],
[
[
56,
61
]
],
[
[
69,
83
],
[
444,
... |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
"""
Tweepy Twitter API library
"""
__version__ = '3.2.0'
__author__ = 'Joshua Roesslein'
__license__ = 'MIT'
from tweepy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResults, ModelFactory, Category
from tweepy.erro... | [
[
[
111,
122
]
],
[
[
133,
143
]
],
[
[
165,
176
]
],
[
[
212,
218
]
],
[
[
220,
224
]
],
[
[
226,
239
]
],
[
[
241,
251
]
],
[
[
253,
... |
# Copyright (c) 2017 OpenStack Foundation
#
# 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 ... | [
[
[
596,
600
],
[
7286,
7290
]
],
[
[
608,
610
],
[
8146,
8148
],
[
8583,
8585
],
[
9849,
9851
],
[
9897,
9899
],
[
126061,
126063
],
[
126404... |
import unittest
from code.google_search import get_people_also_ask_links
class TestGoogleSearch(unittest.TestCase):
def setUp(self) -> None:
pass
def test_get_people_also_ask_links(self):
"""Test the get_people_also_ask_links method"""
test = "principal components"
result = get... | [
[
[
7,
15
],
[
97,
105
]
],
[
[
47,
72
],
[
317,
342
]
],
[
[
80,
96
]
]
] |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation
#
# 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... | [
[
[
657,
665
],
[
1202,
1210
]
],
[
[
673,
677
],
[
2709,
2713
],
[
2895,
2899
]
],
[
[
685,
689
],
[
2458,
2462
]
],
[
[
710,
717
],
[
... |
from datetime import datetime
from typing import List, Dict, Optional
from pydantic import BaseModel, validator, root_validator
class ItemModel(BaseModel):
cve: Dict
configurations: Optional[Dict]
impact: Optional[Dict]
publishedDate: datetime
lastModifiedDate: datetime
class ResultModel(BaseMod... | [
[
[
21,
29
],
[
253,
261
],
[
284,
292
],
[
349,
357
]
],
[
[
49,
53
],
[
396,
400
]
],
[
[
55,
59
],
[
167,
171
],
[
201,
205
]... |
import easygui as g
user_info=g.multenterbox(title='账号中心',msg='【*用户名】为必填项\t【*真实姓名】为必填项\t【*手机号码】为必填项\t【*E-mail】为必填项',
fields=['*用户名','*真实姓名','固定电话','*手机号码','QQ','*E-mail']
) | [
[
[
7,
19
],
[
31,
32
]
],
[
[
21,
30
]
]
] |
import re
import os
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
""" Holds all the custom exceptions raised by the api """
class OrderNotFound(StandardError):
"""Error raised when an order is not found"""
def __init__(self, orderid):
"""Create new OrderNotF... | [
[
[
7,
9
],
[
2063,
2065
]
],
[
[
17,
19
],
[
36,
38
],
[
53,
55
],
[
66,
68
],
[
79,
81
]
],
[
[
21,
33
]
],
[
[
173,
186
]... |
#Import modules and libraries
from random import randint
from string import ascii_uppercase, ascii_lowercase
from itertools import permutations
from copy import deepcopy
from tail_recursion import tail_recursive, recurse
#Define board mapping function
def mapBoard(col, row, value):
board = [[value for x in range(c... | [
[
[
49,
56
],
[
36390,
36397
],
[
36437,
36444
]
],
[
[
76,
91
],
[
603,
618
],
[
1022,
1037
],
[
35029,
35044
],
[
36552,
36567
],
[
37563,
... |
import os
import argparse
import json
import pandas as pd
import bilby
from bilby_pipe.create_injections import InjectionCreator
def main():
parser = argparse.ArgumentParser(description="Slurm files from nmma injection file")
parser.add_argument(
"--prior-file",
type=str,
required=Tr... | [
[
[
7,
9
],
[
2063,
2065
],
[
2116,
2118
],
[
2151,
2153
],
[
2301,
2303
],
[
2359,
2361
],
[
2638,
2640
]
],
[
[
17,
25
],
[
158,
166
... |
from functools import partial
from typing import NamedTuple, Union
from flake8_annotations import Argument, Function
from flake8_annotations.enums import AnnotationType
class FormatTestCase(NamedTuple):
"""Named tuple for representing our test cases."""
test_object: Union[Argument, Function]
str_output:... | [
[
[
22,
29
],
[
409,
416
],
[
495,
502
]
],
[
[
49,
59
],
[
193,
203
]
],
[
[
61,
66
],
[
279,
284
]
],
[
[
99,
107
],
[
285,
29... |
# coding: utf-8
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__),'../..'))
import suzu.matdb.srim_compounddb as compounddb
air = compounddb.Compound()
air.desc = 'Air, Dry near sea level (ICRU-104) 0.00120484 O-23.2, N-75.5, Ar-1.3'
air.name = '%Air, Dry (ICRU-104)'
air.density = 0.0... | [
[
[
23,
26
],
[
38,
41
]
],
[
[
34,
36
],
[
57,
59
],
[
70,
72
]
],
[
[
114,
154
],
[
162,
172
],
[
855,
865
]
],
[
[
156,
159
... |
import numpy as np
from sklearn import metrics
from PIL import Image
def get_metrics(pred, logits, gt):
if isinstance(logits, list):
logits = logits[-1]
result = {'confusion_matrix': metrics.confusion_matrix(gt.flatten(), pred.flatten(), labels=[1, 0]),
'auc': roc(gt, logits)}
return ... | [
[
[
7,
18
],
[
532,
534
],
[
1072,
1074
],
[
1688,
1690
],
[
1713,
1715
],
[
1839,
1841
],
[
1874,
1876
],
[
2814,
2816
],
[
2821,
2823
... |
from pysys.constants import *
from apama.basetest import ApamaBaseTest
from apama.correlator import CorrelatorHelper
from GAPDemoConnected import GAPDemoConnectedHelper
class PySysTest(ApamaBaseTest):
def __init__(self, descriptor, outsubdir, runner):
super(PySysTest, self).__init__(descriptor, outsubdir, ru... | [
[
[
28,
29
],
[
372,
379
]
],
[
[
58,
71
],
[
191,
204
]
],
[
[
102,
118
]
],
[
[
149,
171
],
[
343,
365
]
],
[
[
181,
190
],
[
26... |
"""youtubesearch URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.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... | [
[
[
664,
669
],
[
744,
749
]
],
[
[
694,
698
],
[
729,
733
],
[
766,
770
]
],
[
[
700,
707
],
[
775,
782
]
],
[
[
709,
720
]
]
] |
from cereal import car
from selfdrive.car import dbc_dict
Ecu = car.CarParams.Ecu
class CarControllerParams:
ACCEL_MAX = 2.0
ACCEL_MIN = -3.7
STEER_MAX = 384 # 409 is the max, 255 is stock
STEER_DELTA_UP = 3
STEER_DELTA_DOWN = 7
STEER_DRIVER_ALLOWANCE = 50
STEER_DRIVER_MULTIPLIER = 2
STEER_DRIVER_FA... | [
[
[
19,
22
],
[
64,
67
]
],
[
[
49,
57
],
[
88050,
88058
],
[
88106,
88114
],
[
88166,
88174
],
[
88219,
88227
],
[
88303,
88311
],
[
88386,
... |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# l... | [
[
[
1667,
1674
],
[
1928,
1935
],
[
2206,
2213
]
],
[
[
1728,
1742
],
[
6062,
6076
]
],
[
[
1794,
1802
],
[
6077,
6085
]
],
[
[
1847,
1853
],
... |
from __future__ import absolute_import, division, print_function
import numbers
import warnings
import torch
from torch.autograd import Variable
import pyro
import pyro.poutine as poutine
from pyro.distributions.util import is_identically_zero
from pyro.infer.elbo import ELBO
from pyro.infer.enum import iter_discret... | [
[
[
23,
38
]
],
[
[
40,
48
]
],
[
[
50,
64
]
],
[
[
73,
80
],
[
4854,
4861
],
[
7436,
7443
]
],
[
[
88,
96
],
[
5159,
5167
],
[
85... |
# -*- coding: utf-8 -*-
"""HydroMT workflows"""
from .basin_mask import *
from .forcing import *
from .rivers import *
| [
[
[
73,
74
]
],
[
[
96,
97
]
],
[
[
118,
119
]
]
] |
"""
To trace the falcon web framework, install the trace middleware::
import falcon
from ddtrace import tracer
from ddtrace.contrib.falcon import TraceMiddleware
mw = TraceMiddleware(tracer, 'my-falcon-app')
falcon.API(middleware=[mw])
You can also use the autopatching functionality::
import... | [
[
[
1192,
1207
],
[
1245,
1260
]
],
[
[
1209,
1225
],
[
1261,
1277
]
],
[
[
1282,
1297
],
[
1310,
1325
]
],
[
[
1359,
1374
]
],
[
[
1402,
1407
... |
# coding: utf-8
# @author octopoulo <[email protected]>
# @version 2020-05-01
"""
Sync
"""
import gzip
from logging import getLogger
import os
import re
import shutil
from subprocess import run
from time import time
from typing import Any
from PIL import Image, ImageFile
from common import makedirs_safe, read_text... | [
[
[
101,
105
],
[
3949,
3953
]
],
[
[
126,
135
],
[
2432,
2441
]
],
[
[
143,
145
],
[
422,
424
],
[
438,
440
],
[
476,
478
],
[
549,
... |
"""Tests for the main module."""
import unittest
from unittest.mock import Mock, patch
from yala.main import LinterRunner
class TestLinterRunner(unittest.TestCase):
"""Test the LinterRunner class."""
@patch('yala.main.Config')
def test_chosen_not_found(self, mock_config):
"""Should print an erro... | [
[
[
40,
48
],
[
148,
156
]
],
[
[
75,
79
],
[
1373,
1377
]
],
[
[
81,
86
],
[
213,
218
],
[
579,
584
],
[
1127,
1132
]
],
[
[
110,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.