code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""Classifier package. Contains a general purpose class for HTML classification"""
from learnhtml.features import extract_features_from_html
from learnhtml.model_selection import HeightDepthSelector
class HTMLExtractor(object):
"""HTML extractor class, wraps a normal tag classifier so
it can receive html and ... | [
"learnhtml.features.extract_features_from_html"
] | [((1296, 1366), 'learnhtml.features.extract_features_from_html', 'extract_features_from_html', (['html'], {'height': 'self.height', 'depth': 'self.depth'}), '(html, height=self.height, depth=self.depth)\n', (1322, 1366), False, 'from learnhtml.features import extract_features_from_html\n')] |
# -*- coding: utf-8 -*-
import inspect
from typing import List
from zvt.utils.utils import marshal_object_for_ui
class ConstructorMeta(object):
def __init__(self) -> None:
self.args: List[str] = None
self.annotations: dict = None
self.defaults: List = None
self.metas: dict = None... | [
"inspect.getfullargspec",
"zvt.utils.utils.marshal_object_for_ui"
] | [((476, 503), 'inspect.getfullargspec', 'inspect.getfullargspec', (['cls'], {}), '(cls)\n', (498, 503), False, 'import inspect\n'), ((670, 700), 'zvt.utils.utils.marshal_object_for_ui', 'marshal_object_for_ui', (['default'], {}), '(default)\n', (691, 700), False, 'from zvt.utils.utils import marshal_object_for_ui\n')] |
import time
from ev3dev2 import get_current_platform
class Trace:
def __init__(self):
try:
if get_current_platform() == 'ev3':
fic=open('num','r')
else:
fic=open('numPC','r')
num = int(fic.read())
fic.close()
except:
... | [
"ev3dev2.get_current_platform"
] | [((365, 387), 'ev3dev2.get_current_platform', 'get_current_platform', ([], {}), '()\n', (385, 387), False, 'from ev3dev2 import get_current_platform\n'), ((541, 563), 'ev3dev2.get_current_platform', 'get_current_platform', ([], {}), '()\n', (561, 563), False, 'from ev3dev2 import get_current_platform\n'), ((119, 141), ... |
"""add fields for time and timezone
Revision ID: <KEY>
Revises: 3f137bef24e4
Create Date: 2020-07-06 19:19:01.413325
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "3f137bef24e4"
branch_labels = None
depends_on = ... | [
"sqlalchemy.Time",
"alembic.op.drop_column",
"sqlalchemy_utils.types.timezone.TimezoneType"
] | [((896, 967), 'alembic.op.drop_column', 'op.drop_column', (['"""github_summary_configuration"""', '"""summary_post_timezone"""'], {}), "('github_summary_configuration', 'summary_post_timezone')\n", (910, 967), False, 'from alembic import op\n'), ((972, 1039), 'alembic.op.drop_column', 'op.drop_column', (['"""github_sum... |
# https://adventofcode.com/2020/day/3
from functools import reduce
with open(file=r'd3input.txt') as file:
inputs = file.readlines()
inputs = [line.strip('\n') for line in inputs]
print('Starting Map:')
for line in inputs:
print(line)
slopes = [
{'x': 1, 'y': 1},
{'x': 3, 'y': 1},
{'x': 5, 'y': 1... | [
"functools.reduce"
] | [((1506, 1541), 'functools.reduce', 'reduce', (['(lambda x, y: x * y)', 'results'], {}), '(lambda x, y: x * y, results)\n', (1512, 1541), False, 'from functools import reduce\n')] |
import os
import pickle
import torch
import torchvision.datasets as dsets
import torchvision.transforms as transforms
import torch.utils.data as data
import torch.nn as nn
from utils.NonBayesianModels.LeNet import LeNet
from utils.NonBayesianModels.ELUN1 import ELUN1
from utils.NonBayesianModels.ExperimentalCNNModel ... | [
"torchvision.datasets.CIFAR100",
"torch.nn.CrossEntropyLoss",
"torchvision.datasets.FashionMNIST",
"os.path.join",
"torch.nn.DataParallel",
"torchvision.datasets.STL10",
"torchvision.datasets.ImageFolder",
"torchvision.datasets.CIFAR10",
"torch.cuda.is_available",
"torchvision.transforms.Normalize... | [((469, 494), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (492, 494), False, 'import torch\n'), ((3841, 3916), 'torch.utils.data.DataLoader', 'data.DataLoader', ([], {'dataset': 'train_dataset', 'batch_size': 'batch_size', 'shuffle': '(True)'}), '(dataset=train_dataset, batch_size=batch_size... |
#!/usr/bin/python
#
# File: plotEvolution.py
#
from ROOT import TCanvas, gROOT, TGraphErrors, TPaveText, TLatex, TFile, gStyle
from PerfHistoryTools import readPerformanceData
### these are the full series
commits = ["68c48276","4e5928c1","019d29a0","b356bad1","2c007289",
"298df455","a860eea3","e569cfb7","... | [
"ROOT.TCanvas",
"PerfHistoryTools.readPerformanceData"
] | [((1380, 1409), 'ROOT.TCanvas', 'TCanvas', (['"""c1"""', '"""c1"""', '(900)', '(600)'], {}), "('c1', 'c1', 900, 600)\n", (1387, 1409), False, 'from ROOT import TCanvas, gROOT, TGraphErrors, TPaveText, TLatex, TFile, gStyle\n'), ((1038, 1084), 'PerfHistoryTools.readPerformanceData', 'readPerformanceData', (['(i + 1)', '... |
#!/usr/bin/env python
import os
from setuptools import setup, find_packages
setup(
name='bdo',
version='0.1',
description='bdo utilities',
author='<NAME>',
author_email='<EMAIL>',
packages=find_packages(),
install_requires=open(
os.path.join(
os.path.dirname(__file__),
... | [
"os.path.dirname",
"setuptools.find_packages"
] | [((214, 229), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (227, 229), False, 'from setuptools import setup, find_packages\n'), ((292, 317), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (307, 317), False, 'import os\n')] |
#!/usr/bin/env python3
import sys, csv, re, os
try:
sam = open(sys.argv[1])
outfilename = sys.argv[2]
if len(sys.argv) > 3:
if sys.argv[3] == 'quick':
quick = True
chromsizefile = ''
else:
quick = False
chromsizefile = sys.argv[3]
else:
chromsizefile = ''
quick = False
except:... | [
"sys.stderr.write",
"re.findall",
"csv.writer",
"sys.exit"
] | [((662, 724), 'csv.writer', 'csv.writer', (['outfile'], {'delimiter': '"""\t"""', 'lineterminator': 'os.linesep'}), "(outfile, delimiter='\\t', lineterminator=os.linesep)\n", (672, 724), False, 'import sys, csv, re, os\n'), ((323, 400), 'sys.stderr.write', 'sys.stderr.write', (['"""usage: script.py samfile outpsl [chro... |
from pathlib import Path
import abc
import logging
import io
import importlib
import time
from _collections import OrderedDict
import traceback
import pandas as pd
import numpy as np
import shutil
from graphviz import Digraph
from ibllib.misc import version
import one.params
from one.alf.files import add_uuid_string
... | [
"logging.getLogger",
"logging.StreamHandler",
"ibllib.oneibl.patcher.FTPPatcher",
"ibllib.oneibl.patcher.SDSCPatcher",
"pathlib.Path",
"ibllib.oneibl.patcher.SDSC_PATCH_PATH.joinpath",
"_collections.OrderedDict",
"pandas.DataFrame",
"io.StringIO",
"one.util.filter_datasets",
"importlib.import_mo... | [((554, 581), 'logging.getLogger', 'logging.getLogger', (['"""ibllib"""'], {}), "('ibllib')\n", (571, 581), False, 'import logging\n'), ((931, 947), 'ibllib.misc.version.ibllib', 'version.ibllib', ([], {}), '()\n', (945, 947), False, 'from ibllib.misc import version\n'), ((10697, 10710), '_collections.OrderedDict', 'Or... |
from django.contrib.auth.models import User, Group
from tests.unit.chroma_api.tastypie_test import TestApiClient
from tests.unit.chroma_api.chroma_api_test_case import ChromaApiTestCase
from tests.unit.chroma_core.helpers import fake_log_message
class TestLogResource(ChromaApiTestCase):
def setUp(self):
... | [
"tests.unit.chroma_core.helpers.fake_log_message",
"django.contrib.auth.models.Group.objects.get",
"django.contrib.auth.models.User.objects.create_user",
"tests.unit.chroma_api.tastypie_test.TestApiClient"
] | [((433, 497), 'django.contrib.auth.models.User.objects.create_user', 'User.objects.create_user', (['"""test_filesystem_user"""', '""""""', '"""password"""'], {}), "('test_filesystem_user', '', 'password')\n", (457, 497), False, 'from django.contrib.auth.models import User, Group\n'), ((533, 575), 'django.contrib.auth.m... |
"""
Comparative Analysis | Cannabis Data Science Meetup Group
Author: <NAME>
Contact: <<EMAIL>>
Created: 11/17/2021
Updated: 11/24/2021
License: MIT License <https://opensource.org/licenses/MIT>
Data Sources:
Alaska
Arizona
California
Colorado
Illinois Department of Financ... | [
"matplotlib.pyplot.ylabel",
"pandas.read_excel",
"statsmodels.api.OLS",
"matplotlib.pyplot.margins",
"matplotlib.ticker.FuncFormatter",
"matplotlib.pyplot.figtext",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.savefig",
"matplotlib.pyp... | [((2320, 2363), 'pandas.read_excel', 'pd.read_excel', (['"""./data/retailer_stats.xlsx"""'], {}), "('./data/retailer_stats.xlsx')\n", (2333, 2363), True, 'import pandas as pd\n'), ((2641, 2659), 'statsmodels.api.add_constant', 'sm.add_constant', (['X'], {}), '(X)\n', (2656, 2659), True, 'import statsmodels.api as sm\n'... |
from odoo import fields, models
class Tag(models.Model):
_name = 'todo.task.tag'
_description = 'To-do Tag'
name = fields.Char('Name', translate=True)
# Many2many inverse relationship
task_ids = fields.Many2many(
'todo.task',
string='Tasks')
# Hierarchic relationships:
_... | [
"odoo.fields.Many2one",
"odoo.fields.Integer",
"odoo.fields.One2many",
"odoo.fields.Many2many",
"odoo.fields.Char"
] | [((130, 165), 'odoo.fields.Char', 'fields.Char', (['"""Name"""'], {'translate': '(True)'}), "('Name', translate=True)\n", (141, 165), False, 'from odoo import fields, models\n'), ((219, 264), 'odoo.fields.Many2many', 'fields.Many2many', (['"""todo.task"""'], {'string': '"""Tasks"""'}), "('todo.task', string='Tasks')\n"... |
"""
Simple DNS Server
"""
import threading
import traceback
import socketserver
import struct
import time
import sys
from helpers import *
from config import args
class DNSRequest():
def __init__(self, rawdata):
self.queries = []
self.id, self.flags, self.qdcount, self.ancount, self.nscount... | [
"sys.stderr.flush",
"time.sleep",
"threading.Thread",
"sys.stdout.flush",
"traceback.print_exc",
"struct.unpack_from"
] | [((337, 375), 'struct.unpack_from', 'struct.unpack_from', (['"""!HHHHHH"""', 'rawdata'], {}), "('!HHHHHH', rawdata)\n", (355, 375), False, 'import struct\n'), ((1979, 2019), 'threading.Thread', 'threading.Thread', ([], {'target': 's.serve_forever'}), '(target=s.serve_forever)\n', (1995, 2019), False, 'import threading\... |
from moviepy.editor import VideoFileClip
from PIL import Image
from .filetype import FileType
class CannotGenerateThumbnail(Exception):
"""Exception raised when a thumbnail cannot be created for the file"""
pass
def _resize_image(filepath, outfilepath, width):
"""Resize, optimize and make the image pro... | [
"PIL.Image.open",
"moviepy.editor.VideoFileClip"
] | [((344, 364), 'PIL.Image.open', 'Image.open', (['filepath'], {}), '(filepath)\n', (354, 364), False, 'from PIL import Image\n'), ((929, 952), 'moviepy.editor.VideoFileClip', 'VideoFileClip', (['filepath'], {}), '(filepath)\n', (942, 952), False, 'from moviepy.editor import VideoFileClip\n')] |
from typing import Optional, Any, Type, Iterable, Union
import os
import subprocess
from . import edgir, edgrpc
from .BufferSerializer import BufferSerializer, BufferDeserializer
from .Core import builder
from .HierarchyBlock import Block
from .DesignTop import DesignTop
from .Refinements import Refinements
class C... | [
"os.path.exists",
"subprocess.Popen"
] | [((1312, 1346), 'os.path.exists', 'os.path.exists', (['self.RELATIVE_PATH'], {}), '(self.RELATIVE_PATH)\n', (1326, 1346), False, 'import os\n'), ((1513, 1609), 'subprocess.Popen', 'subprocess.Popen', (["['java', '-jar', jar_path]"], {'stdin': 'subprocess.PIPE', 'stdout': 'subprocess.PIPE'}), "(['java', '-jar', jar_path... |
#!python
from __future__ import print_function
import sys
import ctypes
from ctypes import byref, sizeof
from ctypes.wintypes import BOOL, DWORD
import select
import socket
import struct
try:
import servicemanager
import win32api
import win32con
import win32security
import win32service
import ... | [
"ctypes.byref",
"select.select",
"ctypes.wintypes.DWORD",
"servicemanager.LogWarningMsg",
"socket.socket",
"servicemanager.LogInfoMsg",
"win32serviceutil.HandleCommandLine",
"win32security.OpenProcessToken",
"win32security.LookupAccountSid",
"win32serviceutil.ServiceFramework.__init__",
"service... | [((2387, 2395), 'ctypes.wintypes.DWORD', 'DWORD', (['(0)'], {}), '(0)\n', (2392, 2395), False, 'from ctypes.wintypes import BOOL, DWORD\n'), ((2425, 2438), 'ctypes.byref', 'byref', (['dwSize'], {}), '(dwSize)\n', (2430, 2438), False, 'from ctypes import byref, sizeof\n'), ((3829, 3847), 'socket.ntohs', 'socket.ntohs', ... |
#!/usr/bin/env python
"""
Extract histogram features
--------------------------
This example shows how to extract histogram features from tissue image.
Histogram features give a more detailed view than summary features
(:ref:`sphx_glr_auto_examples_image_compute_summary_features.py`)
by computing a histogram of each ... | [
"squidpy.pl.extract",
"squidpy.datasets.visium_fluo_adata_crop",
"squidpy.datasets.visium_fluo_image_crop",
"squidpy.im.calculate_image_features"
] | [((1078, 1114), 'squidpy.datasets.visium_fluo_image_crop', 'sq.datasets.visium_fluo_image_crop', ([], {}), '()\n', (1112, 1114), True, 'import squidpy as sq\n'), ((1123, 1159), 'squidpy.datasets.visium_fluo_adata_crop', 'sq.datasets.visium_fluo_adata_crop', ([], {}), '()\n', (1157, 1159), True, 'import squidpy as sq\n'... |
import numpy as np
from sklearn.exceptions import NotFittedError
from sklearn.neighbors import KNeighborsClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.neighbors._base import _get_weights
from .base import BaseDetector
# TODO: Support other distance metrics
class KDN(BaseDetector):
"... | [
"numpy.ones_like",
"numpy.average",
"sklearn.neighbors.KNeighborsClassifier",
"sklearn.ensemble.RandomForestClassifier",
"sklearn.neighbors._base._get_weights",
"numpy.zeros",
"numpy.zeros_like",
"numpy.arange"
] | [((1321, 1352), 'sklearn.neighbors._base._get_weights', '_get_weights', (['dist', 'self.weight'], {}), '(dist, self.weight)\n', (1333, 1352), False, 'from sklearn.neighbors._base import _get_weights\n'), ((1483, 1529), 'numpy.average', 'np.average', (['agreement'], {'axis': '(1)', 'weights': 'weights'}), '(agreement, a... |
"""Utils."""
# Copyright 2020-2022 Blue Brain Project / EPFL
# 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... | [
"os.chdir",
"os.path.join",
"subprocess.call",
"os.getcwd"
] | [((781, 792), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (790, 792), False, 'import os\n'), ((797, 811), 'os.chdir', 'os.chdir', (['path'], {}), '(path)\n', (805, 811), False, 'import os\n'), ((826, 843), 'os.chdir', 'os.chdir', (['old_dir'], {}), '(old_dir)\n', (834, 843), False, 'import os\n'), ((1005, 1049), 'subpr... |
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | [
"json.loads",
"perfkitbenchmarker.vm_util.IssueCommand",
"perfkitbenchmarker.rackspace.util.ParseNovaTable",
"os.environ.copy",
"time.sleep",
"perfkitbenchmarker.errors.Error",
"perfkitbenchmarker.rackspace.util.GetDefaultRackspaceNovaEnv",
"perfkitbenchmarker.errors.Resource.RetryableCreationError",
... | [((1284, 1390), 'perfkitbenchmarker.flags.DEFINE_string', 'flags.DEFINE_string', (['"""image_id"""', 'None', '"""The ID of the image from which you want to create the volume."""'], {}), "('image_id', None,\n 'The ID of the image from which you want to create the volume.')\n", (1303, 1390), False, 'from perfkitbenchm... |
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the ... | [
"pandas.DataFrame",
"logging.info",
"sklearn.ensemble.RandomForestClassifier",
"pandas.read_csv"
] | [((695, 721), 'pandas.read_csv', 'pd.read_csv', (['affinity_file'], {}), '(affinity_file)\n', (706, 721), True, 'import pandas as pd\n'), ((785, 833), 'sklearn.ensemble.RandomForestClassifier', 'ensemble.RandomForestClassifier', ([], {'n_estimators': '(20)'}), '(n_estimators=20)\n', (816, 833), False, 'from sklearn imp... |
"""
raven.transport.eventlet
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import sys
from raven.transport.http import HTTPTransport
try:
import eventlet
try:
... | [
"eventlet.green.urllib.request.Request",
"eventlet.green.urllib.request.urlopen",
"eventlet.spawn"
] | [((1043, 1098), 'eventlet.green.urllib.request.Request', 'eventlet_urllib2.Request', (['self._url'], {'headers': 'payload[1]'}), '(self._url, headers=payload[1])\n', (1067, 1098), True, 'from eventlet.green.urllib import request as eventlet_urllib2\n'), ((1596, 1647), 'eventlet.spawn', 'eventlet.spawn', (['self._send_p... |
from enum import Enum, auto, unique
class Suit(Enum):
HEARTS = "♥"
DIAMONDS = "♦"
CLUBS = "♣"
SPADES = "♠"
class CardRank(Enum):
TWO = auto()
THREE = auto()
FOUR = auto()
FIVE = auto()
SIX = auto()
SEVEN = auto()
EIGHT = auto()
NINE = auto(... | [
"enum.auto"
] | [((175, 181), 'enum.auto', 'auto', ([], {}), '()\n', (179, 181), False, 'from enum import Enum, auto, unique\n'), ((195, 201), 'enum.auto', 'auto', ([], {}), '()\n', (199, 201), False, 'from enum import Enum, auto, unique\n'), ((215, 221), 'enum.auto', 'auto', ([], {}), '()\n', (219, 221), False, 'from enum import Enum... |
import urllib
from fake_useragent import UserAgent
import requests
import re
from bs4 import BeautifulSoup
keyword = "<NAME>"
html_keyword = urllib.parse.quote_plus(keyword)
print(html_keyword)
google_url = "https://www.google.com/search?q=" + html_keyword
print(google_url)
ua = UserAgent()
response = requests.get(... | [
"bs4.BeautifulSoup",
"requests.get",
"urllib.parse.quote_plus",
"fake_useragent.UserAgent"
] | [((142, 174), 'urllib.parse.quote_plus', 'urllib.parse.quote_plus', (['keyword'], {}), '(keyword)\n', (165, 174), False, 'import urllib\n'), ((284, 295), 'fake_useragent.UserAgent', 'UserAgent', ([], {}), '()\n', (293, 295), False, 'from fake_useragent import UserAgent\n'), ((307, 358), 'requests.get', 'requests.get', ... |
"""Test numpy array to matrix conversion function."""
import numpy as np
import libs.test_carma as carma
test_flags = {
1: 'Number of elements between array and matrix are not the same',
2: 'Number of rows between array and matrix are not the same',
3: 'Number of columns between array and matrix are not t... | [
"numpy.random.normal",
"libs.test_carma.to_arma_mat",
"libs.test_carma.arr_to_col",
"libs.test_carma.arr_to_cube",
"libs.test_carma.to_arma_row",
"libs.test_carma.arr_to_mat_long",
"libs.test_carma.to_arma_cube",
"libs.test_carma.arr_to_mat_double_copy",
"libs.test_carma.to_arma_col",
"libs.test_c... | [((625, 670), 'libs.test_carma.arr_to_mat_double', 'carma.arr_to_mat_double', (['sample', '(False)', '(False)'], {}), '(sample, False, False)\n', (648, 670), True, 'import libs.test_carma as carma\n'), ((875, 918), 'libs.test_carma.arr_to_mat_long', 'carma.arr_to_mat_long', (['sample', '(False)', '(False)'], {}), '(sam... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-24 15:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('secrets', '0002_userkey_add_session_key'),
]
operations = [
migrations.AlterField(
model_name='userkey',
... | [
"django.db.models.TextField"
] | [((368, 415), 'django.db.models.TextField', 'models.TextField', ([], {'verbose_name': '"""RSA public key"""'}), "(verbose_name='RSA public key')\n", (384, 415), False, 'from django.db import migrations, models\n')] |
import socket
import sys
from netguardmitm import NetGuardMITM
file_data = b""
file_upload_started = False
obfuscated_file_name = None
original_file_name = None
string_needle = b'b\0e\0n\0i\0g\0n\0'
string_replacement = b'm\0o\0d\0d\0e\0d\0'
def my_login_request_callback(raw_packet, packet, username, password):
... | [
"socket.socket",
"socket.gethostname",
"netguardmitm.NetGuardMITM"
] | [((4635, 4662), 'netguardmitm.NetGuardMITM', 'NetGuardMITM', (['ip', 'queue_num'], {}), '(ip, queue_num)\n', (4647, 4662), False, 'from netguardmitm import NetGuardMITM\n'), ((3234, 3254), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (3252, 3254), False, 'import socket\n'), ((3510, 3558), 'socket.socke... |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is govered by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""Message classes for use by template_helpers_test."""
from protorpc import messages
class P... | [
"protorpc.messages.StringField",
"protorpc.messages.BooleanField",
"protorpc.messages.MessageField"
] | [((428, 451), 'protorpc.messages.StringField', 'messages.StringField', (['(1)'], {}), '(1)\n', (448, 451), False, 'from protorpc import messages\n'), ((460, 499), 'protorpc.messages.BooleanField', 'messages.BooleanField', (['(2)'], {'default': '(False)'}), '(2, default=False)\n', (481, 499), False, 'from protorpc impor... |
import unittest
from orderbook.src.common.order import Order
from orderbook.src.common.priceTree import PriceTree
from orderbook.src.common.ptreeIterator import ComplexIterator
class TestPriceTree(unittest.TestCase):
def test_PriceTreeInsert(self):
num_elements = 5
price_tree = TestPriceTree.pop... | [
"orderbook.src.common.order.Order",
"orderbook.src.common.priceTree.PriceTree"
] | [((570, 587), 'orderbook.src.common.priceTree.PriceTree', 'PriceTree', (['"""test"""'], {}), "('test')\n", (579, 587), False, 'from orderbook.src.common.priceTree import PriceTree\n'), ((1322, 1339), 'orderbook.src.common.priceTree.PriceTree', 'PriceTree', (['"""test"""'], {}), "('test')\n", (1331, 1339), False, 'from ... |
#!/usr/bin/python
# coding=utf-8
##########################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import Mock
from mock import patch
from diamond.collector import Collector
from solr import SolrColl... | [
"mock.patch.object",
"solr.SolrCollector",
"test.unittest.main",
"test.get_collector_config"
] | [((655, 689), 'mock.patch.object', 'patch.object', (['Collector', '"""publish"""'], {}), "(Collector, 'publish')\n", (667, 689), False, 'from mock import patch\n'), ((5477, 5511), 'mock.patch.object', 'patch.object', (['Collector', '"""publish"""'], {}), "(Collector, 'publish')\n", (5489, 5511), False, 'from mock impor... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pathlib import Path
import reusables
from box import __version__ as box_version
from qtpy import API, QtCore, QtGui, QtWidgets
from fastflix.language import t
from fastflix.shared import base_path, link, pyinstaller
from fastflix.version import __version__
__all__ =... | [
"pathlib.Path",
"qtpy.QtWidgets.QGridLayout",
"qtpy.QtWidgets.QLabel",
"fastflix.shared.link",
"qtpy.QtCore.QSize",
"qtpy.QtGui.QFont",
"fastflix.language.t"
] | [((463, 486), 'qtpy.QtWidgets.QGridLayout', 'QtWidgets.QGridLayout', ([], {}), '()\n', (484, 486), False, 'from qtpy import API, QtCore, QtGui, QtWidgets\n'), ((562, 594), 'pathlib.Path', 'Path', (['base_path', '"""build_version"""'], {}), "(base_path, 'build_version')\n", (566, 594), False, 'from pathlib import Path\n... |
from __future__ import print_function
"""
Markov based methods for spatial dynamics.
"""
__author__ = "<NAME> <<EMAIL>"
__all__ = ["Markov", "LISA_Markov", "Spatial_Markov", "kullback",
"prais", "shorrock", "homogeneity"]
import numpy as np
from pysal.spatial_dynamics.ergodic import fmpt
from pysal.spati... | [
"numpy.trace",
"numpy.asmatrix",
"numpy.log",
"pysal.Quantiles",
"numpy.array",
"numpy.arange",
"numpy.multiply",
"scipy.stats.chi2.cdf",
"numpy.asarray",
"pysal.region.components.Graph",
"pysal.spatial_dynamics.ergodic.steady_state",
"pysal.spatial_dynamics.markov.chi2",
"numpy.kron",
"nu... | [((631, 652), 'numpy.zeros', 'np.zeros', (['(5, 5)', 'int'], {}), '((5, 5), int)\n', (639, 652), True, 'import numpy as np\n'), ((25202, 25223), 'numpy.multiply', 'np.multiply', (['num', 'num'], {}), '(num, num)\n', (25213, 25223), True, 'import numpy as np\n'), ((48485, 48499), 'numpy.trace', 'np.trace', (['pmat'], {}... |
# Generated by Django 3.0.3 on 2020-02-21 10:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('payroll_management', '0002_auto_20200221_1221'),
]
operations = [
migrations.AlterField(
model_name='payslip',
... | [
"django.db.models.DateTimeField"
] | [((369, 400), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'null': '(True)'}), '(null=True)\n', (389, 400), False, 'from django.db import migrations, models\n')] |
from scout_api import *
import struct
import socket
SCOUT_HEADER_FORMAT = "!LL"
SCOUT_HEADER_SIZE = struct.Struct(SCOUT_HEADER_FORMAT).size
def sendInstr(sock, instr, logger):
"""Sends an instruction to the (debuggee) server.
Args:
sock (socket): (TCP) socket to the server
instr... | [
"struct.Struct",
"struct.unpack",
"socket.socket",
"socket.create_connection"
] | [((108, 142), 'struct.Struct', 'struct.Struct', (['SCOUT_HEADER_FORMAT'], {}), '(SCOUT_HEADER_FORMAT)\n', (121, 142), False, 'import struct\n'), ((828, 870), 'struct.unpack', 'struct.unpack', (['SCOUT_HEADER_FORMAT', 'header'], {}), '(SCOUT_HEADER_FORMAT, header)\n', (841, 870), False, 'import struct\n'), ((2258, 2294)... |
import traceback
from sklearn.neural_network import MLPClassifier
from submissions.Hess import cars
class DataFrame:
data = []
feature_names = []
target = []
target_names = []
guzzle = DataFrame()
guzzle.target = []
guzzle.data = []
guzzle = cars.get_cars()
def guzzleTarget(string):
if (info['Fu... | [
"submissions.Hess.cars.get_cars",
"traceback.print_exc",
"sklearn.neural_network.MLPClassifier"
] | [((261, 276), 'submissions.Hess.cars.get_cars', 'cars.get_cars', ([], {}), '()\n', (274, 276), False, 'from submissions.Hess import cars\n'), ((863, 916), 'sklearn.neural_network.MLPClassifier', 'MLPClassifier', ([], {'solver': '"""sgd"""', 'learning_rate': '"""adaptive"""'}), "(solver='sgd', learning_rate='adaptive')\... |
# -*- coding: utf-8 -*-
# Copyright 2014 OpenMarket 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 la... | [
"logging.getLogger",
"synapse.http.server.respond_with_json_bytes",
"OpenSSL.crypto.dump_certificate",
"syutil.crypto.jsonsign.verify_signed_json",
"synapse.crypto.keyclient.fetch_server_key",
"twisted.web.resource.Resource.__init__",
"syutil.jsonutil.encode_canonical_json",
"syutil.base64util.encode_... | [((1097, 1124), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1114, 1124), False, 'import logging\n'), ((1914, 1937), 'twisted.web.resource.Resource.__init__', 'Resource.__init__', (['self'], {}), '(self)\n', (1931, 1937), False, 'from twisted.web.resource import Resource\n'), ((2102, 2... |
import os
import urllib
from telethon.errors.rpcerrorlist import UsernameOccupiedError
from telethon.tl import functions
from telethon.tl.functions.account import UpdateUsernameRequest
from telethon.tl.functions.channels import GetAdminedPublicChannelsRequest
from telethon.tl.functions.photos import (DeletePhotosReque... | [
"telethon.tl.functions.photos.UploadProfilePhotoRequest",
"os.makedirs",
"urllib.request.urlretrieve",
"telethon.tl.functions.photos.DeletePhotosRequest",
"telethon.tl.functions.photos.GetUserPhotosRequest",
"telethon.tl.functions.account.UpdateProfileRequest",
"telethon.tl.types.InputPhoto",
"os.path... | [((1677, 1778), 'urllib.request.urlretrieve', 'urllib.request.urlretrieve', (['"""https://telegra.ph/file/249f27d5b52a87babcb3f.jpg"""', '"""donottouch.jpg"""'], {}), "('https://telegra.ph/file/249f27d5b52a87babcb3f.jpg',\n 'donottouch.jpg')\n", (1703, 1778), False, 'import urllib\n'), ((3096, 3155), 'urllib.request... |
"""Specialized version of xes_histograms.
1) no support for background region of interest
2) photon_counting method only; uses integrated area under 1-photon Gaussian
3) no support for >1 photon
4) no multiprocessing
5) no output of gain map; no input gain correction
6) Fixed constraints for ratio of peak widths 1-phot... | [
"xfel.command_line.view_pixel_histograms.hist_outline",
"scitbx.math.curve_fitting.gaussian",
"math.sqrt",
"scitbx.array_family.flex.max",
"xfel.cxi.cspad_ana.cspad_tbx.dpack",
"scitbx.array_family.flex.mean",
"xfel.cxi.cspad_ana.cspad_tbx.getOptROI",
"xfel.cxi.cspad_ana.cspad_tbx.dwritef",
"matplot... | [((2316, 2352), 'xfel.cxi.cspad_ana.cspad_tbx.getOptROI', 'cspad_tbx.getOptROI', (['work_params.roi'], {}), '(work_params.roi)\n', (2335, 2352), False, 'from xfel.cxi.cspad_ana import cspad_tbx\n'), ((2364, 2403), 'xfel.cxi.cspad_ana.cspad_tbx.getOptROI', 'cspad_tbx.getOptROI', (['work_params.bg_roi'], {}), '(work_para... |
import functools
import statistics
# 3.8 新版功能.
# 将一个类方法转换为特征属性,一次性计算该特征属性的值,然后将其缓存为实例生命周期内的普通属性。 类似于 property() 但增加了缓存功能。
# class DataSet:
# def __init__(self, sequence_of_numbers):
# self._data = sequence_of_numbers
#
# @functools.cached_property
# def stdev(self):
# return statistics.stde... | [
"functools.reduce",
"functools.partialmethod",
"functools.wraps",
"functools.partial",
"functools.lru_cache",
"functools.update_wrapper"
] | [((1088, 1121), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': 'None'}), '(maxsize=None)\n', (1107, 1121), False, 'import functools\n'), ((2383, 2403), 'functools.partial', 'partial', (['int'], {'base': '(2)'}), '(int, base=2)\n', (2390, 2403), False, 'from functools import partial\n'), ((2742, 2782), '... |
import numpy as np
x = np.linspace(0, 2*np.pi, 100)
y = np.sin(x)
| [
"numpy.sin",
"numpy.linspace"
] | [((24, 54), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(100)'], {}), '(0, 2 * np.pi, 100)\n', (35, 54), True, 'import numpy as np\n'), ((57, 66), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (63, 66), True, 'import numpy as np\n')] |
import math
import os
import re
import numpy as np
from BluPrintTriboSys import TriboSys
from Constants import PltOpts, SubDir, TexTempl, UnitTex, Unit, PrintOpts, \
PreSol
from cartesian_plot_functions import plt_profile, plt_contact, plt_3d, \
plt_2d_scatt_line, \
plt_energy_ring_on_ring, plt... | [
"math.floor",
"generate_latex_output.get_calc_specific_latex_template",
"cartesian_plot_functions.plt_energy_ring_on_ring",
"system_functions.exit_program",
"system_functions.print_it",
"system_functions.to_preci",
"influ_matrix_management.load_influ_mat",
"hertz_equations.hertz_displ",
"numpy.divid... | [((1803, 1844), 'system_functions.print_it', 'print_it', (['"""calculating load distribution"""'], {}), "('calculating load distribution')\n", (1811, 1844), False, 'from system_functions import print_it, to_preci, exit_program, save_to_matlab\n'), ((2202, 2257), 'system_functions.print_it', 'print_it', (['"""determinin... |
from lumicks.pylake.detail.utilities import *
import pytest
import matplotlib as mpl
import numpy as np
def test_first():
assert(first((1, 2, 3), condition=lambda x: x % 2 == 0) == 2)
assert(first(range(3, 100)) == 3)
with pytest.raises(StopIteration):
first((1, 2, 3), condition=lambda x: x % 5 =... | [
"numpy.array",
"numpy.equal",
"pytest.raises",
"numpy.arange"
] | [((823, 866), 'numpy.array', 'np.array', (['[0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0]'], {}), '([0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0])\n', (831, 866), True, 'import numpy as np\n'), ((1673, 1686), 'numpy.arange', 'np.arange', (['(10)'], {}), '(10)\n', (1682, 1686), True, 'import numpy as np\n'), ((238, 266), 'pytest.raises', 'pyte... |
from granger_causality import granger_causality
import pandas as pd
import numpy as np
our_data = pd.read_csv("natural_data2.csv")
our_data = our_data[np.where(our_data['Year'] == 1880)[0][0]:]
print(granger_causality(our_data, ['Ozone', 'WMGHG'], 'Temperature', lags=3, our_type='trend'))
| [
"numpy.where",
"granger_causality.granger_causality",
"pandas.read_csv"
] | [((99, 131), 'pandas.read_csv', 'pd.read_csv', (['"""natural_data2.csv"""'], {}), "('natural_data2.csv')\n", (110, 131), True, 'import pandas as pd\n'), ((202, 294), 'granger_causality.granger_causality', 'granger_causality', (['our_data', "['Ozone', 'WMGHG']", '"""Temperature"""'], {'lags': '(3)', 'our_type': '"""tren... |
from pathlib import Path
from typing import Dict, Mapping, Any
#
import opentelemetry as otel
from opentelemetry.trace import StatusCode, Status # type: ignore
#
from pynb_dag_runner.core.dag_runner import task_from_python_function
#
from pynb_dag_runner.notebooks_helpers import JupytextNotebook, JupyterIpynbNotebo... | [
"opentelemetry.trace.get_tracer",
"opentelemetry.trace.Status",
"pynb_dag_runner.notebooks_helpers.JupyterIpynbNotebook",
"opentelemetry.baggage.get_all"
] | [((540, 571), 'opentelemetry.trace.get_tracer', 'otel.trace.get_tracer', (['__name__'], {}), '(__name__)\n', (561, 571), True, 'import opentelemetry as otel\n'), ((1145, 1179), 'pynb_dag_runner.notebooks_helpers.JupyterIpynbNotebook', 'JupyterIpynbNotebook', (['tmp_filepath'], {}), '(tmp_filepath)\n', (1165, 1179), Fal... |
from collections import defaultdict
class FixtureCreator:
CATEGORY = 'jobMatchingApi.JobCategory'
USER = 'accounts.User'
RECRUITER = 'accounts.Recruiter'
JOB_POST = 'jobMatchingApi.JobPost'
def __init__(self, data, recruiter_name=None):
"""Initialize fixtures.
Fixtures for each m... | [
"collections.defaultdict"
] | [((471, 488), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (482, 488), False, 'from collections import defaultdict\n'), ((514, 530), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (525, 530), False, 'from collections import defaultdict\n')] |
import re
from django.template.defaultfilters import slugify
def unique_slugify(instance, value, slug_field_name='slug', queryset=None,
slug_separator='-'):
"""
Calculates a unique slug of ``value`` for an instance.
``slug_field_name`` should be a string matching the name of... | [
"re.sub",
"django.template.defaultfilters.slugify",
"re.escape"
] | [((816, 830), 'django.template.defaultfilters.slugify', 'slugify', (['value'], {}), '(value)\n', (823, 830), False, 'from django.template.defaultfilters import slugify\n'), ((2207, 2256), 're.sub', 're.sub', (["('^%s+|%s+$' % (re_sep, re_sep))", '""""""', 'value'], {}), "('^%s+|%s+$' % (re_sep, re_sep), '', value)\n", ... |
################################################################################
# CLASS FOR GEOMETRY VISUALIZATION USING PYTHONOCC #
################################################################################
# This file provides the class definition for the geometry visualization of t... | [
"logging.getLogger",
"tempfile.TemporaryDirectory",
"OCC.Core.Quantity.Quantity_Color",
"OCC.Extend.TopologyUtils.TopologyExplorer",
"OCC.Display.SimpleGui.init_display",
"OCC.Extend.DataExchange.read_step_file"
] | [((895, 922), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (912, 922), False, 'import logging\n'), ((6460, 6483), 'OCC.Core.Quantity.Quantity_Color', 'color', (['(1)', '(1)', '(1)', 'typeRGB'], {}), '(1, 1, 1, typeRGB)\n', (6465, 6483), True, 'from OCC.Core.Quantity import Quantity_Colo... |
import locale
locale.setlocale( locale.LC_ALL, 'en_US.UTF-8' )
import re
import dateparser
try:
from local_extractor.utils import common_utils
from local_extractor.utils.table_concatenation import concatenate_tables
except ImportError:
import sys, os, pathlib
path = pathlib.Path(__file__).absolute().p... | [
"sys.path.insert",
"locale.setlocale",
"pathlib.Path",
"utils.common_utils.find_table_by_keywords",
"os.path.join",
"utils.common_utils.convert_df_to_dict",
"utils.table_concatenation.concatenate_tables.concatenate_tables",
"utils.common_utils.find_all_tables_by_keywords",
"utils.common_utils.extrac... | [((14, 60), 'locale.setlocale', 'locale.setlocale', (['locale.LC_ALL', '"""en_US.UTF-8"""'], {}), "(locale.LC_ALL, 'en_US.UTF-8')\n", (30, 60), False, 'import locale\n'), ((341, 378), 'os.path.join', 'os.path.join', (['path', '"""local_extractor"""'], {}), "(path, 'local_extractor')\n", (353, 378), False, 'import sys, ... |
from collections import defaultdict
import numpy as np
from pyNastran.bdf.bdf_interface.assign_type import (
integer, integer_or_blank, double_or_blank)
from pyNastran.bdf.field_writer_8 import print_card_8, set_blank_if_default
from pyNastran.bdf.cards.base_card import _format_comment
class Rods:
"""intiali... | [
"numpy.unique",
"pyNastran.bdf.cards.base_card._format_comment",
"numpy.hstack",
"pyNastran.bdf.field_writer_8.set_blank_if_default",
"numpy.array",
"pyNastran.bdf.bdf_interface.assign_type.integer_or_blank",
"collections.defaultdict",
"numpy.vstack",
"pyNastran.bdf.bdf_interface.assign_type.integer... | [((4213, 4240), 'numpy.array', 'np.array', (['[]'], {'dtype': '"""int32"""'}), "([], dtype='int32')\n", (4221, 4240), True, 'import numpy as np\n'), ((4261, 4288), 'numpy.array', 'np.array', (['[]'], {'dtype': '"""int32"""'}), "([], dtype='int32')\n", (4269, 4288), True, 'import numpy as np\n'), ((4308, 4335), 'numpy.a... |
"""Test the Shark IQ vacuum entity."""
from copy import deepcopy
import enum
from typing import Dict, List
from sharkiqpy import AylaApi, Properties, SharkIqAuthError, SharkIqVacuum, get_ayla_api
from homeassistant.components.sharkiq import SharkIqUpdateCoordinator
from homeassistant.components.sharkiq.vacuum import ... | [
"sharkiqpy.SharkIqVacuum",
"tests.async_mock.MagicMock",
"sharkiqpy.get_ayla_api",
"tests.async_mock.patch.object",
"json.dumps",
"homeassistant.components.sharkiq.SharkIqUpdateCoordinator",
"copy.deepcopy",
"homeassistant.components.sharkiq.vacuum.SharkVacuumEntity"
] | [((1245, 1268), 'tests.async_mock.MagicMock', 'MagicMock', ([], {'spec': 'AylaApi'}), '(spec=AylaApi)\n', (1254, 1268), False, 'from tests.async_mock import MagicMock, patch\n'), ((2184, 2252), 'tests.async_mock.patch.object', 'patch.object', (['SharkIqVacuum', '"""set_property_value"""'], {'new': '_set_property'}), "(... |
from flipdigit import *
from time import sleep
#---------------------------------------------------------
#
# We start with basic config: addr = 0xff and speed 9600
#
#---------------------------------------------------------
# myDigit = FlipDigit('/dev/tty0') #Linux com port
myDigit = FlipDigit('COM6')
myDigit.se... | [
"time.sleep"
] | [((436, 446), 'time.sleep', 'sleep', (['(0.5)'], {}), '(0.5)\n', (441, 446), False, 'from time import sleep\n')] |
from src import socket_plus
import traceback
headers_socket = [{"name": "id_type", "type": int, "len": 4}]
format_socket = {
0: [
{"name": "len_msg", "type": int, "len": 12},
{"name": "fl", "type": float, "len": "len_msg"},
]
}
def update(self):
msg = "test message"
self.add_to_send(... | [
"traceback.format_exc",
"src.socket_plus.Server_connection",
"src.socket_plus.Client_connection"
] | [((615, 713), 'src.socket_plus.Server_connection', 'socket_plus.Server_connection', (['"""localhost"""', '(6000)', 'headers_socket', 'format_socket'], {'update': 'update'}), "('localhost', 6000, headers_socket,\n format_socket, update=update)\n", (644, 713), False, 'from src import socket_plus\n'), ((730, 809), 'src... |
# -*- coding: utf-8 -*-
import os
from hamcrest import *
from amplify.agent.context import context
from amplify.agent.nginx.config.config import NginxConfig
from test.base import BaseTestCase
__author__ = "<NAME>"
__copyright__ = "Copyright (C) Nginx, Inc. All rights reserved."
__credits__ = ["<NAME>", "<NAME>", "<N... | [
"amplify.agent.nginx.config.config.NginxConfig",
"amplify.agent.context.context.log.info",
"os.getcwd"
] | [((440, 451), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (449, 451), False, 'import os\n'), ((512, 523), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (521, 523), False, 'import os\n'), ((582, 593), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (591, 593), False, 'import os\n'), ((651, 662), 'os.getcwd', 'os.getcwd', ([],... |
# Copyright 2015 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for gclient.py."""
from __future__ import print_function
import os
from chromite.lib import cros_build_lib
from chromite.lib import cros_b... | [
"chromite.lib.gclient.WriteConfigFile",
"chromite.lib.osutils.WriteFile",
"chromite.lib.gclient.BuildspecUsesDepsGit",
"os.path.join",
"chromite.lib.cros_build_lib.HostIsCIBuilder"
] | [((999, 1045), 'os.path.join', 'os.path.join', (['self.tempdir', '"""gclient_template"""'], {}), "(self.tempdir, 'gclient_template')\n", (1011, 1045), False, 'import os\n'), ((1050, 1100), 'chromite.lib.osutils.WriteFile', 'osutils.WriteFile', (['template_path', 'template_content'], {}), '(template_path, template_conte... |
import pandas as pd
import numpy as np
import os
import tensorflow as tf
####### STUDENTS FILL THIS OUT ######
#Question 3
def reduce_dimension_ndc(df, ndc_df):
'''
df: pandas dataframe, input dataset
ndc_df: pandas dataframe, drug code dataset used for mapping in generic names
return:
df: pand... | [
"numpy.where",
"tensorflow.feature_column.categorical_column_with_vocabulary_file",
"os.path.join",
"tensorflow.feature_column.indicator_column",
"numpy.random.seed",
"tensorflow.cast",
"numpy.random.permutation"
] | [((1268, 1291), 'numpy.random.seed', 'np.random.seed', ([], {'seed': '(13)'}), '(seed=13)\n', (1282, 1291), True, 'import numpy as np\n'), ((1324, 1351), 'numpy.random.permutation', 'np.random.permutation', (['keys'], {}), '(keys)\n', (1345, 1351), True, 'import numpy as np\n'), ((3004, 3028), 'tensorflow.cast', 'tf.ca... |
import unittest
from vvrest.services.document_service import DocumentService
from vvrest.services.file_service import FileService
from .settings import test_file_path
from .utilities import get_vault_object, generate_random_uuid, get_parameters_json
class DocumentServiceTest(unittest.TestCase):
vault = None
... | [
"vvrest.services.document_service.DocumentService",
"vvrest.services.file_service.FileService"
] | [((1030, 1057), 'vvrest.services.document_service.DocumentService', 'DocumentService', (['self.vault'], {}), '(self.vault)\n', (1045, 1057), False, 'from vvrest.services.document_service import DocumentService\n'), ((1490, 1517), 'vvrest.services.document_service.DocumentService', 'DocumentService', (['self.vault'], {}... |
#!/usr/bin/env python
import os
import shutil
import copy
import csv
import json
import math as m
import traceback
import cv2
import numpy as np
from .util_video import FrameStamps
from .util_video import FrameCache
class FrameStamps:
def __init__(self, Nfrm, runTime_s):
self.Nfrm = Nfrm
self.runTim... | [
"cv2.rectangle",
"os.path.exists",
"traceback.format_exc",
"numpy.where",
"os.path.join",
"os.path.splitext",
"os.path.split",
"json.load",
"numpy.sum",
"numpy.zeros",
"shutil.copyfile",
"numpy.empty",
"cv2.VideoCapture",
"numpy.nonzero",
"copy.deepcopy",
"numpy.isnan",
"json.dump",
... | [((1950, 1978), 'os.path.split', 'os.path.split', (['videoFilePath'], {}), '(videoFilePath)\n', (1963, 1978), False, 'import os\n'), ((2013, 2040), 'os.path.splitext', 'os.path.splitext', (['videoFile'], {}), '(videoFile)\n', (2029, 2040), False, 'import os\n'), ((2159, 2221), 'os.path.join', 'os.path.join', (['self.ou... |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
Remove control_id column from assessments table
Create Date: 2016-11-23 12:48:48.942528
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
# pylint: disable=invalid-name... | [
"alembic.op.get_bind",
"alembic.op.create_foreign_key",
"alembic.op.drop_constraint",
"alembic.op.drop_column",
"sqlalchemy.sql.column",
"datetime.datetime.now",
"alembic.op.bulk_insert",
"sqlalchemy.Column"
] | [((942, 955), 'alembic.op.get_bind', 'op.get_bind', ([], {}), '()\n', (953, 955), False, 'from alembic import op\n'), ((1653, 1667), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1665, 1667), False, 'from datetime import datetime\n'), ((1670, 1916), 'alembic.op.bulk_insert', 'op.bulk_insert', (['relations... |
from hubcheck.pageobjects.basepagewidget import BasePageWidget
from hubcheck.pageobjects.basepageelement import Link
class ResourcesNew(BasePageWidget):
def __init__(self, owner, locatordict={}):
super(ResourcesNew,self).__init__(owner,locatordict)
# load hub's classes
ResourcesNew_Locator... | [
"hubcheck.pageobjects.basepageelement.Link"
] | [((716, 746), 'hubcheck.pageobjects.basepageelement.Link', 'Link', (['self', "{'base': 'create'}"], {}), "(self, {'base': 'create'})\n", (720, 746), False, 'from hubcheck.pageobjects.basepageelement import Link\n'), ((775, 807), 'hubcheck.pageobjects.basepageelement.Link', 'Link', (['self', "{'base': 'legal_cc'}"], {})... |
"""Rules to whitelist or blacklist IPs"""
# Built-in
from datetime import date, timedelta
# Django
from django.db.models import (
DateField,
GenericIPAddressField,
Index,
IntegerChoices,
IntegerField,
)
# Personal
from jklib.django.db.fields import ActiveField, RequiredField, TrimCharField
from j... | [
"django.db.models.Index",
"jklib.django.utils.network.get_client_ip",
"django.db.models.DateField",
"jklib.django.db.queries.get_object_or_none",
"jklib.django.db.fields.TrimCharField",
"jklib.django.db.fields.RequiredField",
"jklib.django.db.fields.ActiveField",
"jklib.django.utils.settings.get_confi... | [((1315, 1412), 'jklib.django.db.fields.RequiredField', 'RequiredField', (['GenericIPAddressField'], {'protocol': '"""IPv4"""', 'unique': '(True)', 'verbose_name': '"""IP Address"""'}), "(GenericIPAddressField, protocol='IPv4', unique=True,\n verbose_name='IP Address')\n", (1328, 1412), False, 'from jklib.django.db.... |
"""
Tidy Scenario: A robot uses its hand to tidy up the table, pushing the objects into a bin/cart etc.
EE = 'End Effector', which is the gripper / suction cup
"""
import torch
import random
import stillleben as sl
from sl_cutscenes.constants import SCENARIO_DEFAULTS
import sl_cutscenes.constants as CONSTANTS
from sl_... | [
"torch.linalg.norm",
"random.uniform",
"stillleben.ManipulationSim",
"random.choices",
"random.random"
] | [((2144, 2181), 'random.choices', 'random.choices', (['ycbv_info_meshes'], {'k': '(3)'}), '(ycbv_info_meshes, k=3)\n', (2158, 2181), False, 'import random\n'), ((3146, 3247), 'random.uniform', 'random.uniform', (["self.config['endeffector_pos']['z_min']", "self.config['endeffector_pos']['z_max']"], {}), "(self.config['... |
import sys, unittest
from django.utils.importlib import import_module
def geo_suite():
"""
Builds a test suite for the GIS package. This is not named
`suite` so it will not interfere with the Django test suite (since
spatial database tables are required to execute these tests on
some backends).
... | [
"unittest.TestSuite",
"django.db.models.get_app",
"unittest.TextTestRunner",
"django.db.connection.creation.destroy_test_db",
"django.test.simple.reorder_suite",
"django.db.models.get_apps",
"django.contrib.gis.gdal.tests.suite",
"django.test.simple.build_test",
"django.test.simple.build_suite",
"... | [((609, 629), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (627, 629), False, 'import sys, unittest\n'), ((4965, 4989), 'django.test.utils.setup_test_environment', 'setup_test_environment', ([], {}), '()\n', (4987, 4989), False, 'from django.test.utils import setup_test_environment, teardown_test_envir... |
from typing import List, Optional, Union
from quart import request, views
from quart import current_app as app
from .response import APIResponse
from tsundoku.feeds.entry import Entry
class EntriesAPI(views.MethodView):
def _doc_get_0(self):
"""
Retrieves all entries for a specified show.
... | [
"quart.request.get_data",
"quart.current_app.db_pool.acquire",
"tsundoku.feeds.entry.Entry",
"quart.current_app.downloader.begin_handling"
] | [((4411, 4432), 'tsundoku.feeds.entry.Entry', 'Entry', (['app', 'new_entry'], {}), '(app, new_entry)\n', (4416, 4432), False, 'from tsundoku.feeds.entry import Entry\n'), ((2978, 2996), 'quart.request.get_data', 'request.get_data', ([], {}), '()\n', (2994, 2996), False, 'from quart import request, views\n'), ((4005, 40... |
#!/usr/bin/env python3
import logging
import os
import re
from typing import List, Set
from obfuscapk import obfuscator_category
from obfuscapk import util
from obfuscapk.obfuscation import Obfuscation
class AdvancedReflection(obfuscator_category.ICodeObfuscator):
def __init__(self):
self.logger = loggi... | [
"re.compile",
"obfuscapk.util.get_dangerous_api",
"obfuscapk.util.invoke_pattern.match",
"os.path.join",
"obfuscapk.util.method_pattern.match",
"obfuscapk.util.get_advanced_api_reflection_smali_code",
"obfuscapk.util.locals_pattern.match"
] | [((13048, 13105), 're.compile', 're.compile', (['"""\\\\s+move-result.*?\\\\s(?P<register>[vp0-9]+)"""'], {}), "('\\\\s+move-result.*?\\\\s(?P<register>[vp0-9]+)')\n", (13058, 13105), False, 'import re\n'), ((25271, 25331), 'os.path.join', 'os.path.join', (['destination_dir', '"""AdvancedApiReflection.smali"""'], {}), ... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# __author__ = Lyon
from base.auth import login_required
from api.status import Code, Message
from utils.fundutil import FundData
from apps.users.trade import TradeRecord
from docs import RequestHandler, define_api, Param
class FundSurvey(RequestHandler):
@define_api(... | [
"docs.Param",
"utils.fundutil.FundData.get_last_day_net_worth",
"utils.fundutil.FundData.get_fund_name",
"utils.fundutil.FundData.get_current_net_worth",
"apps.users.trade.TradeRecord.async_get",
"apps.users.trade.TradeRecord.async_select",
"docs.define_api"
] | [((309, 352), 'docs.define_api', 'define_api', (['"""/fund/survey"""', '[]'], {'desc': '"""基金概况"""'}), "('/fund/survey', [], desc='基金概况')\n", (319, 352), False, 'from docs import RequestHandler, define_api, Param\n'), ((2207, 2248), 'docs.define_api', 'define_api', (['"""/fund/list"""', '[]'], {'desc': '"""我的基金"""'}), ... |
from typing import Dict
import numpy as np
from gym import spaces
from stable_baselines3.common.vec_env import VecEnv, VecEnvWrapper
class ObsDictWrapper(VecEnvWrapper):
"""
Wrapper for a VecEnv which overrides the observation space for Hindsight Experience Replay to support dict observations.
:param e... | [
"gym.spaces.MultiDiscrete",
"gym.spaces.MultiBinary",
"numpy.concatenate",
"gym.spaces.Box"
] | [((2733, 2826), 'numpy.concatenate', 'np.concatenate', (['[observation_dict[observation_key], observation_dict[goal_key]]'], {'axis': '(-1)'}), '([observation_dict[observation_key], observation_dict[\n goal_key]], axis=-1)\n', (2747, 2826), True, 'import numpy as np\n'), ((1141, 1263), 'numpy.concatenate', 'np.conca... |
from __future__ import absolute_import
import sys, os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
sys.path.append(BASE_DIR)
import numpy as np
import PMML43Ext as pml
from skl import pre_process as pp
from datetime import datetime
import math
import metadata
import inspect
from nyoka.keras.keras_model_to_pmm... | [
"PMML43Ext.KNNInputs",
"PMML43Ext.TargetValueCounts",
"PMML43Ext.InstanceFields",
"PMML43Ext.OutputField",
"numpy.hstack",
"PMML43Ext.NeuralOutputs",
"PMML43Ext.minkowski",
"numpy.asanyarray",
"PMML43Ext.LinearKernelType",
"numpy.array",
"PMML43Ext.MiningModel",
"PMML43Ext.ComparisonMeasure",
... | [((109, 134), 'sys.path.append', 'sys.path.append', (['BASE_DIR'], {}), '(BASE_DIR)\n', (124, 134), False, 'import sys, os\n'), ((82, 107), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (97, 107), False, 'import sys, os\n'), ((11628, 11668), 'PMML43Ext.MiningBuildTask', 'pml.MiningBuildTask'... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | [
"logging.getLogger",
"qiskit.circuit.tools.pi_check.pi_check",
"re.compile",
"matplotlib.patches.Arc",
"pylatexenc.latex2text.LatexNodes2Text",
"numpy.sin",
"matplotlib.get_backend",
"qiskit.visualization.qcstyle.DefaultStyle",
"matplotlib.pyplot.close",
"matplotlib.patches.Circle",
"os.path.exp... | [((1274, 1301), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1291, 1301), False, 'import logging\n'), ((4154, 4179), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (4177, 4179), False, 'import collections\n'), ((4206, 4231), 'collections.OrderedDict', 'collecti... |
"""__main__.py
This file is part of keras2c
Copyright 2020 <NAME>
Licensed under MIT License
https://github.com/f0uriest/keras2c
Runs keras2c
"""
import argparse
import sys
from keras2c.keras2c_main import k2c
__author__ = "<NAME>"
__copyright__ = "Copyright 2020, <NAME>"
__license__ = "MIT"
__maintainer__ = "<NAME>... | [
"keras2c.keras2c_main.k2c",
"argparse.ArgumentParser"
] | [((464, 620), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""keras2c"""', 'description': '"""A library for converting the forward pass (inference) part of a keras model to a C function"""'}), "(prog='keras2c', description=\n 'A library for converting the forward pass (inference) part of a ke... |
# 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... | [
"tvm.autotvm.register_topi_schedule",
"tvm.autotvm.register_topi_compute",
"topi.util.get_const_int",
"topi.tag.is_broadcast",
"tvm.te.thread_axis",
"tvm.te.create_schedule",
"topi.nn.pad",
"topi.util.get_const_tuple",
"topi.InvalidShapeError",
"tvm.te.reduce_axis"
] | [((1013, 1063), 'tvm.autotvm.register_topi_compute', 'autotvm.register_topi_compute', (['"""conv2d_packed.vta"""'], {}), "('conv2d_packed.vta')\n", (1042, 1063), False, 'from tvm import autotvm\n'), ((2611, 2662), 'tvm.autotvm.register_topi_schedule', 'autotvm.register_topi_schedule', (['"""conv2d_packed.vta"""'], {}),... |
import discord
from discord.ext import tasks, commands
import asyncio
from datetime import datetime
import pytz
import json
import aiohttp
import os
import vimm_config as config
botver = "vimm-vault-bot v1.0"
class Vault(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.vault_updates.sta... | [
"os.path.exists",
"pytz.timezone",
"aiohttp.ClientSession",
"json.loads",
"datetime.datetime.now",
"discord.ext.tasks.loop",
"discord.ext.commands.command"
] | [((335, 371), 'discord.ext.commands.command', 'commands.command', ([], {'aliases': "['search']"}), "(aliases=['search'])\n", (351, 371), False, 'from discord.ext import tasks, commands\n'), ((672, 690), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (688, 690), False, 'from discord.ext import tas... |
import numpy as np
import pytest
import tensorflow as tf
from autokeras.adapters import output_adapter
from tests import utils
def test_y_is_pd_series():
(x, y), (val_x, val_y) = utils.dataframe_series()
head = output_adapter.ClassificationHeadAdapter(name='a')
head.fit_transform(y)
assert isinstance... | [
"tests.utils.generate_one_hot_labels",
"numpy.array",
"tests.utils.dataframe_series",
"pytest.raises",
"autokeras.adapters.output_adapter.ClassificationHeadAdapter"
] | [((186, 210), 'tests.utils.dataframe_series', 'utils.dataframe_series', ([], {}), '()\n', (208, 210), False, 'from tests import utils\n'), ((222, 272), 'autokeras.adapters.output_adapter.ClassificationHeadAdapter', 'output_adapter.ClassificationHeadAdapter', ([], {'name': '"""a"""'}), "(name='a')\n", (262, 272), False,... |
# --- built in ---
import os
# --- 3rd party ---
import numpy as np
import torch
from torch import nn
# --- my module ---
__all__ = [
'langevin_dynamics',
'anneal_langevin_dynamics',
'sample_score_field',
'sample_energy_field'
]
# --- dynamics ---
def langevin_dynamics(
score_fn,
x,
eps... | [
"numpy.sqrt",
"numpy.log",
"numpy.asarray",
"torch.from_numpy",
"numpy.stack",
"numpy.linspace",
"torch.randn_like"
] | [((2245, 2290), 'numpy.linspace', 'np.linspace', (['(-range_lim)', 'range_lim', 'grid_size'], {}), '(-range_lim, range_lim, grid_size)\n', (2256, 2290), True, 'import numpy as np\n'), ((2299, 2344), 'numpy.linspace', 'np.linspace', (['(-range_lim)', 'range_lim', 'grid_size'], {}), '(-range_lim, range_lim, grid_size)\n'... |
"""Fecha especiales
Revision ID: 041
Revises: 040
Create Date: 2015-01-02 09:04:09.990585
"""
# revision identifiers, used by Alembic.
revision = '041'
down_revision = '040'
from alembic import op
import sqlalchemy as db
def upgrade():
op.create_table('fecha_especial',
db.Column('id', db.Integer, prim... | [
"alembic.op.drop_table",
"sqlalchemy.ForeignKey",
"sqlalchemy.Column"
] | [((547, 578), 'alembic.op.drop_table', 'op.drop_table', (['"""fecha_especial"""'], {}), "('fecha_especial')\n", (560, 578), False, 'from alembic import op\n'), ((288, 333), 'sqlalchemy.Column', 'db.Column', (['"""id"""', 'db.Integer'], {'primary_key': '(True)'}), "('id', db.Integer, primary_key=True)\n", (297, 333), Tr... |
import time
import sys
import board
import busio
import digitalio
from adafruit_mcp9600 import MCP9600
SENSOR_ADDR = 0X67
i2c = busio.I2C(board.SCL, board.SDA,frequency=200000)
try:
sensor = MCP9600(i2c,SENSOR_ADDR,"K")
except ValueError as e:
print(e)
print("Unable to connect to the thermocouple sensor."... | [
"adafruit_mcp9600.MCP9600",
"busio.I2C",
"time.monotonic",
"time.sleep",
"sys.exit",
"digitalio.DigitalInOut"
] | [((130, 179), 'busio.I2C', 'busio.I2C', (['board.SCL', 'board.SDA'], {'frequency': '(200000)'}), '(board.SCL, board.SDA, frequency=200000)\n', (139, 179), False, 'import busio\n'), ((346, 378), 'digitalio.DigitalInOut', 'digitalio.DigitalInOut', (['board.D4'], {}), '(board.D4)\n', (368, 378), False, 'import digitalio\n... |
from os import get_terminal_size, name, system
def clear() -> None:
"""Clears screen for most operating systems: Windows, Linux & Mac (Posix) """
if name == 'nt':
_ = system('cls')
else:
_ = system('clear')
def terminal_width() -> int:
return get_terminal_size()[0] | [
"os.system",
"os.get_terminal_size"
] | [((189, 202), 'os.system', 'system', (['"""cls"""'], {}), "('cls')\n", (195, 202), False, 'from os import get_terminal_size, name, system\n'), ((228, 243), 'os.system', 'system', (['"""clear"""'], {}), "('clear')\n", (234, 243), False, 'from os import get_terminal_size, name, system\n'), ((286, 305), 'os.get_terminal_s... |
from threading import Thread
from time import sleep
from .subscriber import Subscriber
class MetronomeEvents():
TICK = 1
BEAT = 2
BAR = 3
class Metronome(Thread):
_dispatcher = {
MetronomeEvents.TICK: [],
MetronomeEvents.BEAT: [],
MetronomeEvents.BAR: []
}
def __ini... | [
"threading.Thread.__init__",
"time.sleep"
] | [((639, 660), 'threading.Thread.__init__', 'Thread.__init__', (['self'], {}), '(self)\n', (654, 660), False, 'from threading import Thread\n'), ((863, 881), 'time.sleep', 'sleep', (['self._delay'], {}), '(self._delay)\n', (868, 881), False, 'from time import sleep\n')] |
import collections
import hashlib
from django_prbac.utils import has_privilege
from corehq import privileges, toggles
from corehq.apps.hqwebapp.templatetags.hq_shared_tags import toggle_enabled
from corehq.apps.linked_domain.util import is_linked_report
from corehq.apps.userreports.adapter import IndicatorAdapterLoad... | [
"corehq.apps.userreports.models.StaticReportConfiguration.by_domain",
"django_prbac.utils.has_privilege",
"hashlib.sha1",
"corehq.apps.hqwebapp.templatetags.hq_shared_tags.toggle_enabled",
"corehq.util.metrics.load_counters.ucr_load_counter",
"corehq.apps.userreports.adapter.IndicatorAdapterLoadTracker",
... | [((1435, 1482), 'corehq.apps.hqwebapp.templatetags.hq_shared_tags.toggle_enabled', 'toggle_enabled', (['request', 'toggles.REPORT_BUILDER'], {}), '(request, toggles.REPORT_BUILDER)\n', (1449, 1482), False, 'from corehq.apps.hqwebapp.templatetags.hq_shared_tags import toggle_enabled\n'), ((1509, 1558), 'django_prbac.uti... |
import time
print("OwO What's This!!!")
print("Here's my favorite activity in Japoneeese: プログラミング (yes google translate is good)")
furry = "Rawr x3 nuzzles how are you pounces on you you're so warm o3o notices you have a bulge o: someone's happy ;) nuzzles your necky wecky~ murr~ hehehe rubbies your bulgy wolgy you're... | [
"time.sleep"
] | [((465, 480), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (475, 480), False, 'import time\n')] |
# how to run this script: python setup.py bdist_wheel
# hot to test install: python -m pip install ~/dnnc/master/dnnCompiler/dist/dnnc-0.1-py3-none-any.whl --root pip_install_test
# reference: https://dzone.com/articles/executable-package-pip-install
import os
import shutil, errno
import setuptools
NAME='deepC'
VERSI... | [
"os.path.dirname",
"setuptools.find_packages",
"setuptools.setup"
] | [((713, 739), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (737, 739), False, 'import setuptools\n'), ((870, 1825), 'setuptools.setup', 'setuptools.setup', ([], {'name': 'NAME', 'version': 'VERSION', 'description': '"""DeepC: Deep Neural Network Compiler"""', 'long_description_content_type'... |
"""Data models for the Forecast.Solar API."""
from __future__ import annotations
from dataclasses import dataclass
from datetime import datetime, timedelta, date
from enum import Enum
from typing import Any
import sys
if sys.version_info[:2] >= (3, 9):
import zoneinfo
else:
from backports import zoneinfo
fro... | [
"datetime.timedelta",
"backports.zoneinfo.ZoneInfo",
"datetime.datetime.fromisoformat",
"datetime.date.date"
] | [((4080, 4109), 'datetime.timedelta', 'timedelta', ([], {'hours': 'period_hours'}), '(hours=period_hours)\n', (4089, 4109), False, 'from datetime import datetime, timedelta, date\n'), ((4928, 4961), 'datetime.datetime.fromisoformat', 'datetime.fromisoformat', (['timestamp'], {}), '(timestamp)\n', (4950, 4961), False, '... |
import re
from .types import Module, ResultCode, UNKNOWN_MODULE, NO_RESULTS_FOUND
"""
This file contains all currently known Wii U result and error codes.
There may be inaccuracies here; we'll do our best to correct them
when we find out more about them.
A result code is a 32-bit integer returned when calling variou... | [
"re.compile"
] | [((22178, 22206), 're.compile', 're.compile', (['"""1\\\\d{2}-\\\\d{4}"""'], {}), "('1\\\\d{2}-\\\\d{4}')\n", (22188, 22206), False, 'import re\n')] |
import context
import unittest
from data_structures.linked_list import LinkedList
class TestLinkedList(unittest.TestCase):
def _checkEqual(self, ll, expected):
print('Expected: {}, Got: {}'.format(expected, ll))
n = ll.head
for v in expected:
self.assertEqual(v, n.data, 'expec... | [
"data_structures.linked_list.LinkedList",
"random.shuffle"
] | [((547, 559), 'data_structures.linked_list.LinkedList', 'LinkedList', ([], {}), '()\n', (557, 559), False, 'from data_structures.linked_list import LinkedList\n'), ((760, 772), 'data_structures.linked_list.LinkedList', 'LinkedList', ([], {}), '()\n', (770, 772), False, 'from data_structures.linked_list import LinkedLis... |
import os
import xml.etree.ElementTree as ET
from os import mkdir
from os.path import isdir
from configparser import ConfigParser, ExtendedInterpolation
def main():
"""
converts annotations into the format used for csv paraser in retinanet.
the annotations should already been in pascal voc format, otherwi... | [
"os.listdir",
"xml.etree.ElementTree.parse",
"os.path.join",
"os.path.isdir",
"os.mkdir",
"configparser.ExtendedInterpolation"
] | [((675, 712), 'os.path.join', 'os.path.join', (['"""dataset"""', 'dataset_name'], {}), "('dataset', dataset_name)\n", (687, 712), False, 'import os\n'), ((735, 775), 'os.path.join', 'os.path.join', (['dataset_dir', '"""Annotations"""'], {}), "(dataset_dir, 'Annotations')\n", (747, 775), False, 'import os\n'), ((792, 83... |
"""
Nose2 Unit Tests for the clusters module.
"""
from pprint import pprint
from os import environ, getenv
from atlasapi.atlas import Atlas
from atlasapi.organizations import Organization
from atlasapi.teams import TeamRoles
from atlasapi.atlas_users import AtlasUser
from json import dumps
from tests import BaseTests... | [
"logging.getLogger"
] | [((369, 394), 'logging.getLogger', 'logging.getLogger', (['"""test"""'], {}), "('test')\n", (386, 394), False, 'import logging\n')] |
import uuid
import time
import hashlib
import json
def get_event_metadata():
return {
"run_id": str(uuid.uuid1()),
"event_id": str(uuid.uuid4())
}
# python does some pretty pretting to json objects, we have to change the
# separators to have a bare bone stringifying/dumping function, which wi... | [
"uuid.uuid1",
"json.dumps",
"time.time",
"uuid.uuid4"
] | [((1166, 1177), 'time.time', 'time.time', ([], {}), '()\n', (1175, 1177), False, 'import time\n'), ((113, 125), 'uuid.uuid1', 'uuid.uuid1', ([], {}), '()\n', (123, 125), False, 'import uuid\n'), ((152, 164), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (162, 164), False, 'import uuid\n'), ((434, 476), 'json.dumps', 'j... |
from collections import namedtuple
import pytest
import tornado.testing
import rw.scope
import rw.http
import rw.routing
import rw.template
from .common import generate_handler_func
## TODO
# def test_duplicated_functions():
# m = rw.http.Module('test')
#
# @m.get('/')
# def foo():
# pass
#
# ... | [
"collections.namedtuple"
] | [((1739, 1772), 'collections.namedtuple', 'namedtuple', (['"""Application"""', '"""root"""'], {}), "('Application', 'root')\n", (1749, 1772), False, 'from collections import namedtuple\n')] |
from dg_ai_platform.dg_platform import ITaskProcess
from PIL import Image, ImageOps
from dg_ai_platform.utils import get_dynamic_outputs
class TaskProcess1toN(ITaskProcess):
def __init__(self):
super().__init__()
def inference(self, input_list, output_list, options=None):
print(options)
... | [
"dg_ai_platform.utils.get_dynamic_outputs",
"PIL.Image.open",
"PIL.ImageOps.posterize",
"PIL.ImageOps.grayscale"
] | [((388, 412), 'PIL.ImageOps.grayscale', 'ImageOps.grayscale', (['img1'], {}), '(img1)\n', (406, 412), False, 'from PIL import Image, ImageOps\n'), ((329, 354), 'PIL.Image.open', 'Image.open', (['input_list[0]'], {}), '(input_list[0])\n', (339, 354), False, 'from PIL import Image, ImageOps\n'), ((601, 645), 'dg_ai_platf... |
"""
change all linking keys from chars to id's.
Revision ID: 20671b28c538
Revises: <PASSWORD>
Create Date: 2012-07-07 21:49:21.906150
"""
from __future__ import unicode_literals
import sqlalchemy as sa
from alembic import op
from alembic.context import get_context # noqa: F401
from sqlalchemy.dialects.mysql.base imp... | [
"alembic.op.create_foreign_key",
"alembic.op.drop_constraint",
"alembic.op.alter_column",
"alembic.op.drop_column",
"sqlalchemy.engine.reflection.Inspector.from_engine",
"alembic.op.create_primary_key",
"alembic.op.execute",
"sqlalchemy.Integer",
"sqlalchemy.ForeignKey",
"alembic.context.get_conte... | [((503, 516), 'alembic.context.get_context', 'get_context', ([], {}), '()\n', (514, 516), False, 'from alembic.context import get_context\n'), ((528, 570), 'sqlalchemy.engine.reflection.Inspector.from_engine', 'Inspector.from_engine', (['c.connection.engine'], {}), '(c.connection.engine)\n', (549, 570), False, 'from sq... |
import re
import json
import asyncio
import numpy as np
import pandas as pd
from config import config
from lbry import filtered_outpoints
from utils import load_df_cache, get_outpoints, now_timestamp
from vocabulary import MULTILINGUAL
from status import main_status
from analysis.music import is_artist
# Load block li... | [
"json.load",
"analysis.music.is_artist",
"utils.load_df_cache"
] | [((383, 395), 'json.load', 'json.load', (['f'], {}), '(f)\n', (392, 395), False, 'import json\n'), ((805, 834), 'utils.load_df_cache', 'load_df_cache', (['"""stream_seeds"""'], {}), "('stream_seeds')\n", (818, 834), False, 'from utils import load_df_cache, get_outpoints, now_timestamp\n'), ((1263, 1293), 'utils.load_df... |
# coding: utf-8
from django.conf.urls import patterns, include, url
urlpatterns = patterns('parsifal.reviews.metaanalysis.views',
url(r'^save_metaanalysis/$', 'save_metaanalysis', name='save_metaanalysis'),
)
| [
"django.conf.urls.url"
] | [((136, 210), 'django.conf.urls.url', 'url', (['"""^save_metaanalysis/$"""', '"""save_metaanalysis"""'], {'name': '"""save_metaanalysis"""'}), "('^save_metaanalysis/$', 'save_metaanalysis', name='save_metaanalysis')\n", (139, 210), False, 'from django.conf.urls import patterns, include, url\n')] |
# -*- coding: utf-8 -*-
import re
import logging
import torch
import numpy as np
logger = logging.getLogger(__name__)
class DocText:
"""
define one sample text, like one context or one question
"""
def __init__(self, nlp, text, config):
doc = nlp(text)
self.config = config
... | [
"logging.getLogger",
"torch.tensor",
"re.sub",
"logging.warning"
] | [((93, 120), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (110, 120), False, 'import logging\n'), ((3868, 3906), 'torch.tensor', 'torch.tensor', (['sen_id'], {'dtype': 'torch.long'}), '(sen_id, dtype=torch.long)\n', (3880, 3906), False, 'import torch\n'), ((4281, 4325), 're.sub', 're.su... |
from django.urls import path
from django.conf.urls.static import static
from django.conf import settings
from . import views
app_name = 'djangoapp'
urlpatterns = [
path(route='', view=views.get_dealerships, name='Index'),
path(route='about', view=views.about, name='About Us'),
path(route='contact', view=vi... | [
"django.conf.urls.static.static",
"django.urls.path"
] | [((1005, 1066), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n', (1011, 1066), False, 'from django.conf.urls.static import static\n'), ((169, 225), 'django.urls.path', 'path', ([], {'route': '""""... |
import cv2
import numpy as np
import pytesseract
import requests
from PIL import Image
def ocr(img) -> str:
"""
识别验证码,由于可以绕过验证码,该方法不再需要
"""
img = np.array(img)
img = img[:, :, ::-1].copy()
img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
mask = cv2.inRange(img, (45, 100, 40), (90, 255, 255))
... | [
"PIL.Image.fromarray",
"PIL.Image.open",
"cv2.inRange",
"requests.get",
"numpy.array",
"cv2.cvtColor",
"pytesseract.image_to_string",
"numpy.zeros_like"
] | [((164, 177), 'numpy.array', 'np.array', (['img'], {}), '(img)\n', (172, 177), True, 'import numpy as np\n'), ((221, 257), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2HSV'], {}), '(img, cv2.COLOR_BGR2HSV)\n', (233, 257), False, 'import cv2\n'), ((270, 317), 'cv2.inRange', 'cv2.inRange', (['img', '(45, 100, ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com <EMAIL>
import argparse
import sys
from importlib import import_module
from shutil import whi... | [
"colorful.cyan",
"importlib.import_module",
"argparse.ArgumentParser",
"colorful.bold_red",
"shutil.which",
"colorful.disable",
"colorful.use_style",
"colorful.bold_green",
"sys.exit"
] | [((518, 571), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""thumbor doctor"""'}), "(description='thumbor doctor')\n", (541, 571), False, 'import argparse\n'), ((3891, 3916), 'colorful.use_style', 'cf.use_style', (['"""solarized"""'], {}), "('solarized')\n", (3903, 3916), True, 'import c... |
import os
from time import sleep
import gdbremote_testcase
import lldbgdbserverutils
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestGdbRemoteAttachWait(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__... | [
"lldbgdbserverutils.gdbremote_hex_encode_string",
"os.getpid",
"lldbgdbserverutils.process_is_running",
"time.sleep"
] | [((1609, 1617), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (1614, 1617), False, 'from time import sleep\n'), ((413, 424), 'os.getpid', 'os.getpid', ([], {}), '()\n', (422, 424), False, 'import os\n'), ((744, 801), 'lldbgdbserverutils.process_is_running', 'lldbgdbserverutils.process_is_running', (['inferior.pid', '(... |
import socket
from datetime import datetime as datestamp
port = 50000
s = socket.socket()
host = ""
s.bind((host, port))
s.listen(100)
print ('Server listening....')
while True:
conn, addr = s.accept()
print ('Got con... | [
"datetime.datetime.now",
"socket.socket"
] | [((114, 129), 'socket.socket', 'socket.socket', ([], {}), '()\n', (127, 129), False, 'import socket\n'), ((828, 843), 'datetime.datetime.now', 'datestamp.now', ([], {}), '()\n', (841, 843), True, 'from datetime import datetime as datestamp\n')] |
# 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 ... | [
"azure.core.exceptions.map_error",
"azure.core.exceptions.HttpResponseError",
"azure.core.async_paging.AsyncList",
"azure.core.async_paging.AsyncItemPaged",
"typing.TypeVar"
] | [((1362, 1374), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (1369, 1374), False, 'from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar\n'), ((14588, 14626), 'azure.core.async_paging.AsyncItemPaged', 'AsyncItemPaged', (['get_next', 'extract_data'], {}), '(get_next, extract_dat... |
import json, os, time, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from src.query_wrapper import QueryWrapper
from log.querytime import log_querytime
# endpoint = "http://kg2018a.isi.edu:3030/test/sparql"
# endpoint = "http://localhost:3030/ds/query"
endpoint = "http://gaiadev01.isi.edu:3030/eff... | [
"log.querytime.log_querytime",
"os.listdir",
"os.path.dirname",
"src.query_wrapper.QueryWrapper",
"json.load"
] | [((340, 362), 'src.query_wrapper.QueryWrapper', 'QueryWrapper', (['endpoint'], {}), '(endpoint)\n', (352, 362), False, 'from src.query_wrapper import QueryWrapper\n'), ((523, 566), 'os.listdir', 'os.listdir', (['"""../resources/prod_query/query"""'], {}), "('../resources/prod_query/query')\n", (533, 566), False, 'impor... |