code stringlengths 10 805k | def_use_chains sequencelengths 0 667 |
|---|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# #*** <License> ************************************************************#
# This module is part of the repository CNDB.
#
# This module is licensed under the terms of the BSD 3-Clause License
# <http://www.c-tanzer.at/license/bsd_3c.html>.
# #*** </License> ***************... | [
[
[
400,
403
],
[
1447,
1450
],
[
4508,
4511
],
[
5479,
5482
]
],
[
[
438,
441
],
[
1149,
1152
],
[
1925,
1928
],
[
2181,
2184
],
[
2581,
... |
# UCF Senior Design 2017-18
# Group 38
from PIL import Image
import cv2
import imagehash
import math
import numpy as np
DIFF_THRES = 20
LIMIT = 2
RESIZE = 1000
def calc_hash(img):
"""
Calculate the wavelet hash of the image
img: (ndarray) image file
"""
# resize image if height > 1000
im... | [
[
[
56,
61
],
[
363,
368
]
],
[
[
69,
72
],
[
1745,
1748
],
[
1812,
1815
]
],
[
[
80,
89
],
[
347,
356
]
],
[
[
97,
101
],
[
1783,
... |
# 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 agreed to in writing, ... | [
[
[
597,
601
],
[
750,
754
]
]
] |
import time
from PyQt5 import QtGui, QtCore
from ui.room_item import Ui_Form
from PyQt5.QtWidgets import QWidget
class Room_Item(QWidget,Ui_Form):
def __init__(self,parent=None,room_data=None):
super(Room_Item,self).__init__(parent)
self.setupUi(self)
self.data = room_data
self.se... | [
[
[
7,
11
],
[
636,
640
],
[
687,
691
]
],
[
[
31,
36
]
],
[
[
38,
44
]
],
[
[
71,
78
],
[
140,
147
]
],
[
[
107,
114
],
[
132,
... |
import asyncio
import re
import sys
import traceback
import toga
from toga import Key
from .keys import toga_to_winforms_key
from .libs import Threading, WinForms, shcore, user32, win_version
from .libs.proactor import WinformsProactorEventLoop
from .window import Window
class MainWindow(Window):
def winforms_F... | [
[
[
7,
14
],
[
1254,
1261
]
],
[
[
22,
24
],
[
6600,
6602
],
[
6697,
6699
],
[
6709,
6711
]
],
[
[
32,
35
],
[
3204,
3207
]
],
[
[
43,... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
SimplePhotogrammetryRoutePlanner
A QGIS plugin
A imple photogrammetry route planner.
Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
... | [
[
[
1304,
1315
]
],
[
[
1359,
1371
]
]
] |
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 24 14:38:20 2018
dimension reduction with VarianceThreshold using sklearn.
Feature selector that removes all low-variance features.
@author: lenovo
"""
from sklearn.feature_selection import VarianceThreshold
import numpy as np
#
np.random.seed(1)
X = np.random.randn(100, 1... | [
[
[
237,
254
],
[
605,
622
],
[
416,
433
]
],
[
[
262,
273
],
[
276,
278
],
[
298,
300
],
[
327,
329
],
[
341,
343
]
],
[
[
294,
295... |
#!/usr/bin/env python
# coding=utf-8
from my_multi_main3 import main
import numpy as np
import argparse
import time
parser = argparse.ArgumentParser(description='PyTorch MNIST Example')
parser.add_argument('--batch-size', type=int, default=64, metavar='N',
help='input batch size for training (defa... | [
[
[
65,
69
],
[
3317,
3321
]
],
[
[
77,
88
],
[
2405,
2407
],
[
2480,
2482
],
[
2529,
2531
],
[
2726,
2728
],
[
3017,
3019
],
[
3332,
33... |
"""HDF5 related files.
This file contains a set of functions that related to read and write
HDF5 files.
Author: Yuhuang Hu
Email : duguyue100@gmail.com
"""
from __future__ import print_function, absolute_import
import h5py
from spiker import log
logger = log.get_logger("data-hdf5", log.DEBUG)
def init_hdf5(file_... | [
[
[
181,
195
]
],
[
[
197,
212
]
],
[
[
221,
225
],
[
740,
744
],
[
998,
1002
]
],
[
[
246,
249
],
[
260,
263
],
[
288,
291
]
],
[
[
... |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: flatbuf
import flatbuffers
class FloatingPoint(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsFloatingPoint(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x ... | [
[
[
99,
110
],
[
246,
257
],
[
269,
280
],
[
458,
469
],
[
550,
561
],
[
670,
681
]
],
[
[
118,
131
],
[
322,
335
]
],
[
[
748,
766
... |
"""[Scynced Lights]
Class attributes are "shared"
Instance attributes are not shared.
"""
def sub(x, y):
f
class Light:
pass
a = Light()
b = Ligth()
| [
[
[
96,
99
]
],
[
[
121,
126
],
[
142,
147
]
],
[
[
138,
139
]
],
[
[
150,
151
]
]
] |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2012-11-14 17:09:50
from __future__ import unicode_literals, division, absolute_import
import time
import logging
from collections import deque
try:
f... | [
[
[
208,
224
]
],
[
[
226,
234
]
],
[
[
236,
251
]
],
[
[
260,
264
],
[
2554,
2558
],
[
3227,
3231
]
],
[
[
272,
279
],
[
8972,
8979
],
... |
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | [
[
[
685,
689
],
[
3487,
3491
],
[
3506,
3510
],
[
3524,
3528
]
],
[
[
691,
699
],
[
3588,
3596
]
],
[
[
701,
706
],
[
3427,
3432
],
[
3597... |
#!/usr/bin/env python3
UNKNOWN = -1
def read_val():
return int(input())
def read_row():
return list(map(int, input().split()))
def read_grid():
return [read_row() for _ in range(read_val())]
def make_blank_row(i):
return [UNKNOWN] * i
def make_blank_grid(n):
return [make_blank_row(i) for i in ... | [
[
[
24,
31
],
[
243,
250
],
[
514,
521
]
],
[
[
42,
50
],
[
676,
684
],
[
194,
202
]
],
[
[
83,
91
],
[
168,
176
]
],
[
[
143,
1... |
import platform
# print(platform.system())
operating_system = platform.system().lower()
if operating_system == 'darwin':
from .blender_utils_macos import get_installed_blender_versions
operating_system_name = 'macos'
elif operating_system == 'linux':
from .blender_utils_linux import get_installed_blender_... | [
[
[
7,
15
],
[
64,
72
]
],
[
[
45,
61
],
[
93,
109
],
[
232,
248
],
[
370,
386
],
[
568,
584
]
],
[
[
160,
190
],
[
1508,
1538
]... |
import functools
import random
from math import cos, pi
import cv2
import kornia
import numpy as np
import torch
from kornia.augmentation import ColorJitter
from data.util import read_img
from PIL import Image
from io import BytesIO
# Get a rough visualization of the above distribution. (Y-axis is meaningless, just... | [
[
[
7,
16
],
[
5932,
5941
]
],
[
[
24,
30
],
[
1805,
1811
],
[
1882,
1888
],
[
2559,
2565
],
[
4420,
4426
],
[
5500,
5506
]
],
[
[
48,
... |
# This test requires CPython3.5
print(b"%%" % ())
print(b"=%d=" % 1)
print(b"=%d=%d=" % (1, 2))
print(b"=%s=" % b"str")
print(b"=%r=" % b"str")
print("PASS") | [] |
#
# test_JpegCompression.py
#
import pytest
import albumentations as A
from .context import TfDataAugmentation as Tfda
from . import test_utils
from .test_utils import TestResult
@pytest.mark.parametrize(
"quality_lower, quality_upper, expected, message", [
# quality_lower
(-1, 100, TestResult.Er... | [
[
[
38,
44
],
[
183,
189
]
],
[
[
52,
71
],
[
1936,
1937
]
],
[
[
93,
119
],
[
1216,
1220
],
[
1528,
1532
]
],
[
[
134,
144
],
[
1669,... |
import os
from torch.utils.data import DataLoader
from continuum.datasets import CIFAR10, InMemoryDataset
from continuum.datasets import MNIST
import torchvision
from continuum.scenarios import TransformationIncremental
import pytest
import numpy as np
from continuum.transforms.bg_swap import BackgroundSwap
DATA_PAT... | [
[
[
7,
9
],
[
324,
326
],
[
2723,
2725
],
[
2755,
2757
]
],
[
[
40,
50
],
[
2949,
2959
]
],
[
[
82,
89
],
[
1059,
1066
],
[
1443,
14... |
# =========================================================================================
# Copyright 2015 Community Information Online Consortium (CIOC) and KCL Software Solutions
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.... | [
[
[
850,
852
],
[
1469,
1471
],
[
1486,
1488
],
[
1499,
1501
],
[
1565,
1567
],
[
1616,
1618
],
[
1709,
1711
],
[
1781,
1783
],
[
1860,
1862... |
# 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 ... | [
[
[
487,
490
],
[
1484,
1487
],
[
2190,
2193
]
],
[
[
492,
505
],
[
693,
706
]
],
[
[
544,
557
],
[
873,
886
]
],
[
[
590,
598
],
[
22... |
import django.http
import unittest.mock
from .. import middleware
def get_response(req):
# dummy get_response, just return an empty response
return django.http.HttpResponse()
def test_leaves_remote_addr_alone_if_no_real_ip():
remote_addr = object()
request = unittest.mock.MagicMock()
request.M... | [
[
[
7,
18
],
[
160,
166
]
],
[
[
27,
40
],
[
281,
289
],
[
584,
592
]
],
[
[
57,
67
],
[
360,
370
],
[
692,
702
]
],
[
[
74,
86
... |
#!/usr/bin/env python
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(21, GPIO.OUT)
GPIO.output(21, GPIO.LOW)
time.sleep(3.00)
GPIO.output(21, GPIO.HIGH)
GPIO.cleanup()
| [
[
[
30,
34
],
[
137,
141
]
],
[
[
43,
59
],
[
62,
66
],
[
75,
79
],
[
85,
89
],
[
100,
104
],
[
110,
114
],
[
126,
130
],
[
... |
from direct.directnotify.DirectNotifyGlobal import directNotify
class Notifier:
def __init__(self, name):
"""
@param name: The name of the notifier. Be sure to add it to your config/Config.prc!
@type name: str
"""
self.notify = directNotify.newCategory(name)
| [
[
[
51,
63
],
[
274,
286
]
],
[
[
72,
80
]
]
] |
import numpy as np
def train_ml_squarer() -> None:
print("Training!")
def square() -> int:
"""Square a number...maybe"""
return np.random.randint(1, 100)
if __name__ == '__main__':
train_ml_squarer() | [
[
[
7,
18
],
[
144,
146
]
],
[
[
25,
41
],
[
203,
219
]
],
[
[
82,
88
]
]
] |
"""
Platformer Game
"""
import arcade
# Constants
SCREEN_WIDTH = 1000
SCREEN_HEIGHT = 650
SCREEN_TITLE = "Platformer"
# Constants used to scale our sprites from their original size
CHARACTER_SCALING = 1
TILE_SCALING = 0.5
COIN_SCALING = 0.5
SPRITE_PIXEL_SIZE = 128
GRID_PIXEL_SIZE = SPRITE_PIXEL_SIZE * TILE_SCALING
#... | [
[
[
31,
37
],
[
444,
450
],
[
1215,
1221
],
[
1290,
1296
],
[
1348,
1354
],
[
1376,
1382
],
[
1558,
1564
],
[
1623,
1629
],
[
2125,
2131
... |
#!/usr/bin/env python3
'''
lib/ycmd/start.py
Server bootstrap logic. Includes a utility class for normalizing parameters and
calculating default ones. Also includes a helper to set up the temporary
options file.
'''
import logging
import os
import tempfile
from ..process import (
FileHandles,
Process,
)
from... | [
[
[
225,
232
],
[
674,
681
]
],
[
[
240,
242
],
[
3305,
3307
],
[
7231,
7233
]
],
[
[
250,
258
],
[
13763,
13771
],
[
16058,
16066
],
[
16... |
#!/usr/bin/env python
import serial
import sys
import struct
import pprint
import argparse
import code
pp = pprint.PrettyPrinter()
class ConsoleUI:
def opStart(self, name):
sys.stdout.write(name.ljust(40))
def opProgress(self, progress, total=-1):
if (total >= 0):
prstr = "0x%04x... | [
[
[
29,
35
],
[
693,
699
]
],
[
[
43,
46
],
[
7333,
7336
],
[
7347,
7350
],
[
188,
191
],
[
416,
419
],
[
458,
461
],
[
496,
499
],
... |
# Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... | [
[
[
1149,
1163
],
[
1187,
1201
]
],
[
[
1171,
1186
],
[
2305,
2320
]
]
] |
import logging
from django.db.models.query_utils import Q
from django.shortcuts import get_object_or_404
from django.utils.decorators import method_decorator
from django_filters.rest_framework import DjangoFilterBackend
from drf_yasg import openapi
from drf_yasg.openapi import Parameter
from drf_yasg.utils import no_b... | [
[
[
7,
14
],
[
1015,
1022
]
],
[
[
57,
58
],
[
5921,
5922
],
[
5958,
5959
],
[
5978,
5979
],
[
6028,
6029
],
[
6076,
6077
],
[
6113,
611... |
"""Mypy style test cases for SQLAlchemy stubs and plugin."""
import os
import os.path
import sys
import pytest # type: ignore # no pytest in typeshed
from mypy.test.config import test_temp_dir
from mypy.test.data import DataDrivenTestCase, DataSuite
from mypy.test.helpers import assert_string_arrays_equal
from myp... | [
[
[
69,
71
]
],
[
[
79,
86
],
[
401,
403
],
[
417,
419
],
[
454,
456
],
[
495,
497
],
[
511,
513
],
[
632,
634
],
[
1842,
1844
],
... |
#!/usr/bin/env python
# Copyright (C) 2017 The Android Open Source 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 b... | [
[
[
2044,
2058
]
],
[
[
2066,
2074
],
[
2601,
2609
],
[
2677,
2685
]
],
[
[
2082,
2089
],
[
3763,
3770
],
[
3788,
3795
],
[
3816,
3823
]
],
[
... |
# coding: utf-8
"""
An API to insert and retrieve metadata on cloud artifacts.
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1alpha1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
... | [
[
[
328,
334
],
[
6261,
6267
]
],
[
[
342,
344
]
],
[
[
367,
370
],
[
5335,
5338
]
],
[
[
379,
390
],
[
6039,
6050
],
[
6501,
6512
]
]
] |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals, print_function
import re
import os
import tempfile
import six
from .. import environment
from ..console import log
from .. import util
WIN = (os.name == "nt")... | [
[
[
112,
127
]
],
[
[
129,
137
]
],
[
[
139,
155
]
],
[
[
157,
171
]
],
[
[
180,
182
],
[
2443,
2445
]
],
[
[
190,
192
],
[
304,
306
],
... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 3