code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from cloudbio.galaxy.tools import _install_application
def install_tool(options):
version = options.get("galaxy_tool_version")
name = options.get("galaxy_tool_name")
install_dir = options.get("galaxy_tool_dir", None)
_install_application(name, version, tool_install_dir=install_dir)
configure_actions... | [
"cloudbio.galaxy.tools._install_application"
] | [((235, 300), 'cloudbio.galaxy.tools._install_application', '_install_application', (['name', 'version'], {'tool_install_dir': 'install_dir'}), '(name, version, tool_install_dir=install_dir)\n', (255, 300), False, 'from cloudbio.galaxy.tools import _install_application\n')] |
import os
def getRootPath():
return os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
def getProjectAbsPath(*path):
return os.path.join(getRootPath(), *path)
def getCachePath(*path):
return getProjectAbsPath(".cache", *path)
def getTemplatePath(*path):
return getProjectAbsPath... | [
"os.getcwd",
"os.path.isabs",
"os.path.abspath",
"os.path.dirname"
] | [((556, 575), 'os.path.isabs', 'os.path.isabs', (['path'], {}), '(path)\n', (569, 575), False, 'import os\n'), ((592, 613), 'os.path.abspath', 'os.path.abspath', (['path'], {}), '(path)\n', (607, 613), False, 'import os\n'), ((71, 96), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (86, 96), ... |
from importlib import reload, import_module
# Project imports
from patchy import patchy
default_app_config = 'django_cte.apps.DjangoCTEConfig'
def patch_cte():
""" Apply CTE monkey patches to Django.
At present these patches must be updated manually to conform with new CTE
implementations, but... | [
"patchy.patchy",
"importlib.import_module"
] | [((448, 488), 'patchy.patchy', 'patchy', (['"""django.db.models"""', '"""django_cte"""'], {}), "('django.db.models', 'django_cte')\n", (454, 488), False, 'from patchy import patchy\n'), ((697, 734), 'importlib.import_module', 'import_module', (['"""django.db.models.sql"""'], {}), "('django.db.models.sql')\n", (710, 734... |
# Imports pickle library used to store trained model
import pickle
# Open trained model and assigned to variable
with open('property_model_Bristle.pickle', 'rb') as file:
lr = pickle.load(file)
# Predict price based on console input, use for debugging
input_distance = float(input("Please enter the distance to the... | [
"pickle.load"
] | [((181, 198), 'pickle.load', 'pickle.load', (['file'], {}), '(file)\n', (192, 198), False, 'import pickle\n')] |
# scrapes AWS resource type and action mapping from AWS docs
import json
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options... | [
"selenium.webdriver.support.expected_conditions.presence_of_element_located",
"selenium.webdriver.Firefox",
"json.dumps",
"time.sleep",
"selenium.webdriver.firefox.options.Options",
"selenium.webdriver.support.ui.WebDriverWait"
] | [((455, 464), 'selenium.webdriver.firefox.options.Options', 'Options', ([], {}), '()\n', (462, 464), False, 'from selenium.webdriver.firefox.options import Options\n'), ((3025, 3092), 'selenium.webdriver.Firefox', 'webdriver.Firefox', ([], {'options': 'options', 'executable_path': '"""./geckodriver"""'}), "(options=opt... |
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring,unused-import,reimported
import pytest # type: ignore
import mc_flow_sim.mc_flow_sim as mc
def test_walk_ok_empty_string():
empty = ''
assert mc.walk(empty) is None
def test_walk_ok_empty_list():
seq = []
assert mc.walk(seq) is None
def... | [
"pytest.raises",
"mc_flow_sim.mc_flow_sim.walk"
] | [((617, 632), 'mc_flow_sim.mc_flow_sim.walk', 'mc.walk', (['string'], {}), '(string)\n', (624, 632), True, 'import mc_flow_sim.mc_flow_sim as mc\n'), ((878, 894), 'mc_flow_sim.mc_flow_sim.walk', 'mc.walk', (['a_range'], {}), '(a_range)\n', (885, 894), True, 'import mc_flow_sim.mc_flow_sim as mc\n'), ((214, 228), 'mc_fl... |
""" A test script to start Cassandra. """
import logging
import os
import sys
import cassandra_interface
sys.path.append(os.path.join(os.path.dirname(__file__), "../../lib"))
import monit_interface
def run():
""" Starts up cassandra. """
logging.warning("Starting Cassandra.")
monit_interface.start(cassandra... | [
"logging.warning",
"os.path.dirname",
"monit_interface.start"
] | [((248, 286), 'logging.warning', 'logging.warning', (['"""Starting Cassandra."""'], {}), "('Starting Cassandra.')\n", (263, 286), False, 'import logging\n'), ((289, 378), 'monit_interface.start', 'monit_interface.start', (['cassandra_interface.CASSANDRA_MONIT_WATCH_NAME'], {'is_group': '(False)'}), '(cassandra_interfac... |
from sqlalchemy import create_engine, Column, Integer, String, DATETIME
from sqlalchemy.ext.declarative import declarative_base
from datetime import datetime
# TODO: db_uri
# dialect+driver://username:password@host:port/database?charset=utf8
DB_URI = 'mysql+pymysql://root:root123@127.0.0.1:3300/alembic_demo?charset=ut... | [
"sqlalchemy.create_engine",
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.String",
"sqlalchemy.Column"
] | [((334, 355), 'sqlalchemy.create_engine', 'create_engine', (['DB_URI'], {}), '(DB_URI)\n', (347, 355), False, 'from sqlalchemy import create_engine, Column, Integer, String, DATETIME\n'), ((364, 393), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {'bind': 'engine'}), '(bind=engine)\n', (380, 3... |
import requests
import json
import ehp
# Page Scraper
# Have the programme connect to a site and pulls out all the links, or images, and save them to a list.
class PageScraper:
def __init__(self, url):
self.url = url
self.parser = ehp.Html()
self.dom = self.__dom()
def __dom(self):
req = request... | [
"ehp.Html",
"json.loads",
"requests.get",
"json.dumps"
] | [((244, 254), 'ehp.Html', 'ehp.Html', ([], {}), '()\n', (252, 254), False, 'import ehp\n'), ((313, 335), 'requests.get', 'requests.get', (['self.url'], {}), '(self.url)\n', (325, 335), False, 'import requests\n'), ((849, 868), 'json.loads', 'json.loads', (['encoded'], {}), '(encoded)\n', (859, 868), False, 'import json... |
"""Illustrates the asyncio engine / connection interface.
In this example, we have an async engine created by
:func:`_engine.create_async_engine`. We then use it using await
within a coroutine.
"""
import asyncio
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sq... | [
"sqlalchemy.MetaData",
"sqlalchemy.ext.asyncio.create_async_engine",
"sqlalchemy.Column"
] | [((436, 446), 'sqlalchemy.MetaData', 'MetaData', ([], {}), '()\n', (444, 446), False, 'from sqlalchemy import MetaData\n'), ((476, 515), 'sqlalchemy.Column', 'Column', (['"""id"""', 'Integer'], {'primary_key': '(True)'}), "('id', Integer, primary_key=True)\n", (482, 515), False, 'from sqlalchemy import Column\n'), ((51... |
# Root dir
import os
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
# Weather variable vocublary. This should match to the variable name used in the tahmoapi.
RAIN = "precipitation"
TEMP = "temperature"
REL = "humidity"
WINDR= "winddirection"
SRAD = "radiation"
| [
"os.path.abspath"
] | [((48, 73), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (63, 73), False, 'import os\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-07-23 19:11
from __future__ import unicode_literals
from django.db import migrations
import molo.core.blocks
import molo.core.models
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks
class Migration(migrations.Migration):
... | [
"django.db.migrations.RemoveField",
"django.db.migrations.DeleteModel"
] | [((597, 656), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""formfield"""', 'name': '"""page"""'}), "(model_name='formfield', name='page')\n", (619, 656), False, 'from django.db import migrations\n'), ((701, 763), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], ... |
# coding: utf-8
#
# Copyright (c) 2020-2021 Hopenly srl.
#
# This file is part of Ilyde.
#
# 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
#
#... | [
"unittest.main",
"flask.json.dumps"
] | [((7802, 7817), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7815, 7817), False, 'import unittest\n'), ((1328, 1356), 'flask.json.dumps', 'json.dumps', (['model_serializer'], {}), '(model_serializer)\n', (1338, 1356), False, 'from flask import json\n'), ((2061, 2097), 'flask.json.dumps', 'json.dumps', (['model_... |
import datetime as dt
import io
import logging
import os
import time
import PIL.Image
import requests
RADARS = {
'Adelaide': {'id': '643', 'delta': 360, 'frames': 6},
'Albany': {'id': '313', 'delta': 600, 'frames': 4},
'AliceSprings': {'id': '253', 'delta': 600, 'frames': 4},
'Bairn... | [
"io.BytesIO",
"os.makedirs",
"os.path.isdir",
"os.path.dirname",
"time.time",
"requests.get",
"datetime.datetime.fromtimestamp",
"logging.getLogger"
] | [((7594, 7611), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (7606, 7611), False, 'import requests\n'), ((8434, 8446), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (8444, 8446), False, 'import io\n'), ((3917, 3944), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (3934, 3944)... |
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 <NAME>, <NAME> <<EMAIL>>,
# <NAME> <<EMAIL>>, The University of Vermont
# <<EMAIL>>, github contributors
# Released under the MIT license, as given in the file LICENSE, which must
# accompany any distribution of this code.
import logging
from osgeo import ogr
from os... | [
"logging.warning",
"logging.debug"
] | [((10612, 10648), 'logging.debug', 'logging.debug', (['"""Splitting long ways"""'], {}), "('Splitting long ways')\n", (10625, 10648), False, 'import logging\n'), ((4136, 4177), 'logging.warning', 'logging.warning', (['"""Polygon with no rings?"""'], {}), "('Polygon with no rings?')\n", (4151, 4177), False, 'import logg... |
import json
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from ribo_api.models.usertypes import TinyIntegerField
from .usertypes import NormalTextField
class UserActivityLog(models.Model):
id = models.AutoFi... | [
"json.loads",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.GenericIPAddressField",
"ribo_api.models.usertypes.TinyIntegerField",
"django.db.models.DateTimeField",
"django.utils.translation.ugettext_lazy"
] | [((307, 341), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)'}), '(primary_key=True)\n', (323, 341), False, 'from django.db import models\n'), ((353, 396), 'django.db.models.ForeignKey', 'models.ForeignKey', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (370, 396), ... |
import os
import re
from collections import defaultdict
input_file = open(os.path.join(os.path.dirname(__file__), 'day6_input.txt'), 'r')
min_x = -1
min_y = -1
max_x = -1
max_y = -1
points = []
for line in input_file:
matcher = re.match("(\d+),\s(\d+)", line)
if matcher is not None:
y = int(matcher.gr... | [
"collections.defaultdict",
"os.path.dirname",
"re.match"
] | [((234, 268), 're.match', 're.match', (['"""(\\\\d+),\\\\s(\\\\d+)"""', 'line'], {}), "('(\\\\d+),\\\\s(\\\\d+)', line)\n", (242, 268), False, 'import re\n'), ((788, 811), 'collections.defaultdict', 'defaultdict', (['(lambda : 1)'], {}), '(lambda : 1)\n', (799, 811), False, 'from collections import defaultdict\n'), ((8... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.sparrows import sparrows
def test_sparrows():
"""Test module sparrows.py by downloading
sparrows.csv and testing shape of
extracted data h... | [
"observations.r.sparrows.sparrows",
"shutil.rmtree",
"tempfile.mkdtemp"
] | [((366, 384), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (382, 384), False, 'import tempfile\n'), ((407, 426), 'observations.r.sparrows.sparrows', 'sparrows', (['test_path'], {}), '(test_path)\n', (415, 426), False, 'from observations.r.sparrows import sparrows\n'), ((485, 509), 'shutil.rmtree', 'shutil.... |
#!/usr/bin/env python3
###################################
# Mastering ML Python Mini Course
#
# Inspired by the project here:
#
# https://s3.amazonaws.com/MLMastery/machine_learning_mastery_with_python_mini_course.pdf?__s=mxhvphowryg2sfmzus2q
#
# By <NAME>
#
# Project will soon be found at:
#
# https://www.inertia7... | [
"pandas.read_csv",
"numpy.empty",
"sklearn.model_selection.cross_val_score",
"sklearn.model_selection.KFold",
"sklearn.ensemble.GradientBoostingClassifier",
"sklearn.linear_model.LogisticRegression",
"numpy.array",
"sklearn.discriminant_analysis.LinearDiscriminantAnalysis"
] | [((963, 1049), 'numpy.array', 'np.array', (["['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']"], {}), "(['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age',\n 'class'])\n", (971, 1049), True, 'import numpy as np\n'), ((1069, 1097), 'pandas.read_csv', 'read_csv', (['url'], {'names':... |
# Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from coremltools.converters.mil.mil.types.symbolic import any_symbolic
from coremltools.converters.mi... | [
"coremltools.converters.mil.mil.get_new_variadic_symbol",
"coremltools.converters.mil.mil.types.symbolic.any_symbolic",
"coremltools.converters.mil.mil.get_new_symbol"
] | [((658, 688), 'coremltools.converters.mil.mil.types.symbolic.any_symbolic', 'any_symbolic', (['self.shape.shape'], {}), '(self.shape.shape)\n', (670, 688), False, 'from coremltools.converters.mil.mil.types.symbolic import any_symbolic\n'), ((804, 829), 'coremltools.converters.mil.mil.get_new_variadic_symbol', 'get_new_... |
from Ranking.src.Ranker import Ranker, add_player
def test_update(file, update_text, expected):
res = Ranker(file, update_text)
assert res == expected, "Update failed\ngot:\n" + str(res) + "\nexpected:\n" + expected
def test_add(file, player, expected):
res = add_player(file, player)
assert res == e... | [
"Ranking.src.Ranker.Ranker",
"Ranking.src.Ranker.add_player"
] | [((108, 133), 'Ranking.src.Ranker.Ranker', 'Ranker', (['file', 'update_text'], {}), '(file, update_text)\n', (114, 133), False, 'from Ranking.src.Ranker import Ranker, add_player\n'), ((276, 300), 'Ranking.src.Ranker.add_player', 'add_player', (['file', 'player'], {}), '(file, player)\n', (286, 300), False, 'from Ranki... |
import numpy as np
from kinematics import to_robot_velocities
from viz.env import Viz
class ControlSignalsViz(Viz):
def __init__(self, marxbot, time_window=10):
super().__init__()
self.marxbot = marxbot
self.marxbot_max_vel = 30
self.time_window = time_window
def _show(self... | [
"numpy.full",
"kinematics.to_robot_velocities",
"numpy.linspace",
"numpy.roll"
] | [((648, 697), 'numpy.linspace', 'np.linspace', (['(-self.time_window)', '(0)', 'self.n_samples'], {}), '(-self.time_window, 0, self.n_samples)\n', (659, 697), True, 'import numpy as np\n'), ((722, 768), 'numpy.full', 'np.full', (['(self.n_dims, self.n_samples)', 'np.nan'], {}), '((self.n_dims, self.n_samples), np.nan)\... |
import torch
import torchvision
import torchvision.transforms as transforms
import matplotlib.pyplot as plt
import numpy as np
classes = ('beaver','dolphin','otter','seal','whale','aquarium fish','flatfish','ray','shark','trout','orchids','poppies','roses','sunflowers','tulips','bottles','bowls','cans','cups','plates'... | [
"torch.utils.data.DataLoader",
"numpy.transpose",
"torchvision.datasets.CIFAR100",
"torchvision.transforms.Normalize",
"torchvision.transforms.ToTensor"
] | [((1293, 1389), 'torchvision.datasets.CIFAR100', 'torchvision.datasets.CIFAR100', ([], {'root': '"""./data"""', 'train': '(True)', 'download': '(True)', 'transform': 'transform'}), "(root='./data', train=True, download=True,\n transform=transform)\n", (1322, 1389), False, 'import torchvision\n'), ((1437, 1522), 'tor... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 19 12:14:06 2018
@author: Admin
"""
#from pandas import Series
#from statsmodels.graphics.tsaplots import plot_acf
#from statsmodels.graphics.tsaplots import plot_pacf
#from matplotlib import pyplot
#from pandas import DataFrame
#from pandas import read_csv
#from pandas ... | [
"statsmodels.tsa.arima_model.ARIMA",
"math.sqrt",
"warnings.filterwarnings",
"pandas.read_csv",
"pandas.datetime.strptime",
"sklearn.metrics.mean_squared_error"
] | [((2148, 2258), 'pandas.read_csv', 'read_csv', (['"""data/recom_train.csv"""'], {'header': '(0)', 'parse_dates': '[0]', 'index_col': '(0)', 'squeeze': '(True)', 'date_parser': 'parser'}), "('data/recom_train.csv', header=0, parse_dates=[0], index_col=0,\n squeeze=True, date_parser=parser)\n", (2156, 2258), False, 'f... |
import os
import sys
ROOT_DIR = os.path.dirname(os.path.dirname(os.getcwd()))
if ROOT_DIR not in sys.path: sys.path.append(ROOT_DIR)
import numpy as np
import tensorflow as tf
from DeepSparseCoding.tf1x.analysis.base_analyzer import Analyzer
"""
Test for activity triggered analysis
NOTE: Should be executed from th... | [
"sys.path.append",
"tensorflow.test.main",
"os.getcwd",
"numpy.random.RandomState",
"DeepSparseCoding.tf1x.analysis.base_analyzer.Analyzer",
"numpy.dot"
] | [((108, 133), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (123, 133), False, 'import sys\n'), ((1484, 1498), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (1496, 1498), True, 'import tensorflow as tf\n'), ((65, 76), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (74, 76), False, '... |
"""
Copyright 2021 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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
d... | [
"logging.warning",
"gym.envs.registration.register"
] | [((1224, 1282), 'gym.envs.registration.register', 'gym_reg.register', (['env_id'], {'entry_point': 'class_path'}), '(env_id, entry_point=class_path, **kwargs)\n', (1240, 1282), True, 'from gym.envs import registration as gym_reg\n'), ((1115, 1171), 'logging.warning', 'logging.warning', (['"""Re-registering environment ... |
# -*- coding: utf-8 -*-
# API - cs
# FileName: download.py
# Version: 1.0.0
# Create: 2018-10-27
# Modify: 2018-11-07
import mimetypes
from .auth import OSS
from .util import Check
from act import StoreData
from .upload import FolderFile, Source
from .exception import CSCommonErr, CSDownloadErr
class Do... | [
"mimetypes.guess_extension"
] | [((1055, 1094), 'mimetypes.guess_extension', 'mimetypes.guess_extension', (['content_type'], {}), '(content_type)\n', (1080, 1094), False, 'import mimetypes\n')] |
from twisted.internet.defer import Deferred, DeferredList
from twisted.web import server
from twisted.internet import reactor
from .base import BaseServer, LOGGER
from ..resources import DataResource
class DataServer(BaseServer):
def __init__(self,
aws_access_key_id,
aws_sec... | [
"twisted.internet.defer.DeferredList",
"twisted.web.server.Site"
] | [((818, 839), 'twisted.web.server.Site', 'server.Site', (['resource'], {}), '(resource)\n', (829, 839), False, 'from twisted.web import server\n'), ((2210, 2233), 'twisted.internet.defer.DeferredList', 'DeferredList', (['deferreds'], {}), '(deferreds)\n', (2222, 2233), False, 'from twisted.internet.defer import Deferre... |
"""Checking types and values."""
import os
from typing import Any, List, Type, Union
def raise_if_empty_str(*, val: str, val_name: str) -> None:
"""Raise if ``val`` is an empty :py:class:`str`.
Parameters
----------
val: str
Test target.
val_name: str
Test target name. Mainly used to create error... | [
"os.path.isdir",
"os.path.isfile",
"os.path.exists"
] | [((739, 759), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (753, 759), False, 'import os\n'), ((764, 783), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (777, 783), False, 'import os\n'), ((1071, 1091), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (1085, 1091), Fals... |
# encoding: utf-8
from leonardo.module.web.models import Widget
from leonardo.module.media.fields.image import ImageField
from django.db import models
from django.conf import settings
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
import datetime
from django.utils.encoding imp... | [
"django.db.models.FileField",
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"leonardo.module.web.widget.application.reverse.app_reverse",
"django.db.models.EmailField",
"django.db.models.DateTimeField"
] | [((486, 553), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'verbose_name': 'u"""Jméno"""', 'default': '""""""'}), "(max_length=255, verbose_name=u'Jméno', default='')\n", (502, 553), False, 'from django.db import models\n'), ((574, 653), 'django.db.models.CharField', 'models.CharField'... |
import sys
import binascii
import hashlib
from PyQt5.QtWidgets import QApplication,QMainWindow,QFileDialog
from xtui import Ui_Form
from xtoolsfunc import XToolsFunc
base64_method = ["encode","decode"]
hash_available = hashlib.algorithms_guaranteed
class MainUi(QMainWindow,QFileDialog,Ui_Form):
def __init__(self... | [
"PyQt5.QtWidgets.QApplication",
"xtoolsfunc.XToolsFunc.base64_method",
"xtoolsfunc.XToolsFunc.hash_method"
] | [((2346, 2368), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (2358, 2368), False, 'from PyQt5.QtWidgets import QApplication, QMainWindow, QFileDialog\n'), ((1861, 1900), 'xtoolsfunc.XToolsFunc.base64_method', 'XToolsFunc.base64_method', (['method', 'value'], {}), '(method, value)\... |
'''
Description: ip反查域名
Author: Senkita
Date: 2020-10-09 10:23:52
LastEditors: Senkita
LastEditTime: 2020-10-09 15:01:39
'''
import os
from utils.Query import batch_query
if __name__ == "__main__":
os.makedirs('./Log', exist_ok=True)
filename = 'public.txt'
save_filename = 'domain_name.txt'
... | [
"os.makedirs",
"utils.Query.batch_query"
] | [((214, 249), 'os.makedirs', 'os.makedirs', (['"""./Log"""'], {'exist_ok': '(True)'}), "('./Log', exist_ok=True)\n", (225, 249), False, 'import os\n'), ((325, 361), 'utils.Query.batch_query', 'batch_query', (['filename', 'save_filename'], {}), '(filename, save_filename)\n', (336, 361), False, 'from utils.Query import b... |
import numpy as np
import matplotlib.pyplot as plt
def spectrum(f, x):
# Discrete Fourier transform
A = np.fft.rfft(f(x))
A_amplitude = np.abs(A)
# Compute the corresponding frequencies
dx = x[1] - x[0]
freqs = np.linspace(0, np.pi/dx, A_amplitude.size)
plt.plot(freqs[:len(freqs)/2], A_am... | [
"numpy.zeros_like",
"numpy.abs",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"numpy.where",
"numpy.exp",
"numpy.linspace",
"matplotlib.pyplot.savefig",
"numpy.sqrt"
] | [((373, 398), 'numpy.linspace', 'np.linspace', (['(0)', 'L', '(Nx + 1)'], {}), '(0, L, Nx + 1)\n', (384, 398), True, 'import numpy as np\n'), ((707, 752), 'matplotlib.pyplot.legend', 'plt.legend', (["['step', '2sin', 'gauss', 'peak']"], {}), "(['step', '2sin', 'gauss', 'peak'])\n", (717, 752), True, 'import matplotlib.... |
# Copyright 2019-2020 Spotify AB
#
# 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 writin... | [
"logging.error",
"emoji.emojize",
"datetime.datetime.now",
"time.sleep",
"logging.info",
"datetime.timedelta",
"googleapiclient.discovery.build"
] | [((1007, 1047), 'googleapiclient.discovery.build', 'discovery.build', (['"""dataflow"""', 'api_version'], {}), "('dataflow', api_version)\n", (1022, 1047), False, 'from googleapiclient import discovery\n'), ((4693, 4711), 'logging.error', 'logging.error', (['msg'], {}), '(msg)\n', (4706, 4711), False, 'import logging\n... |
# -*- coding: utf-8 -*-
#VecMap0.1
#The first versio of VecMap
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
import matplotlib
matplotlib.use('Qt5Agg')
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.back... | [
"PyQt5.QtWidgets.QPushButton",
"os.path.isfile",
"matplotlib.backends.backend_qt5agg.NavigationToolbar2QT",
"atomap.tools.remove_atoms_from_image_using_2d_gaussian",
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QRadioButton",
"matplotlib.backe... | [((192, 216), 'matplotlib.use', 'matplotlib.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (206, 216), False, 'import matplotlib\n'), ((48135, 48145), 'hyperspy.io.load', 'load', (['file'], {}), '(file)\n', (48139, 48145), False, 'from hyperspy.io import load\n'), ((48725, 48789), 'atomap.sublattice.Sublattice', 'Sublat... |
import numpy as np
def count_subset_occurrences(array, subset_array):
occurrences = 0
for idx in range(len(array) - len(subset_array) + 1):
if np.array_equal(array[idx:(idx + len(subset_array))], subset_array):
occurrences += 1
return occurrences
def test_base_case():
assert count_... | [
"numpy.array"
] | [((348, 394), 'numpy.array', 'np.array', (['[0, 1, 1, 1, 2, 2, 2, 1, 1, 3, 3, 3]'], {}), '([0, 1, 1, 1, 2, 2, 2, 1, 1, 3, 3, 3])\n', (356, 394), True, 'import numpy as np\n'), ((405, 421), 'numpy.array', 'np.array', (['[1, 1]'], {}), '([1, 1])\n', (413, 421), True, 'import numpy as np\n')] |
from .. import db
from flask_login import UserMixin, login_manager, LoginManager
from werkzeug.security import generate_password_hash, check_password_hash
from .. import login_manager
from datetime import date, datetime
@login_manager.user_loader
def load_user(id):
return User.query.get(int(id))
class User(UserMi... | [
"werkzeug.security.check_password_hash",
"werkzeug.security.generate_password_hash"
] | [((1149, 1181), 'werkzeug.security.generate_password_hash', 'generate_password_hash', (['password'], {}), '(password)\n', (1171, 1181), False, 'from werkzeug.security import generate_password_hash, check_password_hash\n'), ((1239, 1291), 'werkzeug.security.check_password_hash', 'check_password_hash', (['self.secured_pa... |
# --------------------------------------------------------
# mcan-vqa (Deep Modular Co-Attention Networks)
# modify this to our VQA dataset
# --------------------------------------------------------
import os
from copy import copy
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Rectan... | [
"matplotlib.pyplot.savefig",
"numpy.meshgrid",
"yaml.load",
"argparse.ArgumentParser",
"numpy.ma.masked_where",
"matplotlib.colors.Normalize",
"os.getcwd",
"matplotlib.pyplot.close",
"matplotlib.colors.BoundaryNorm",
"copy.copy",
"numpy.exp",
"numpy.linspace",
"cfgs.base_cfgs.Cfgs",
"matpl... | [((516, 564), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""MCAN Args"""'}), "(description='MCAN Args')\n", (539, 564), False, 'import argparse, yaml\n'), ((4103, 4109), 'cfgs.base_cfgs.Cfgs', 'Cfgs', ([], {}), '()\n', (4107, 4109), False, 'from cfgs.base_cfgs import Cfgs\n'), ((4495, 4... |
r"""
===========
Transport laws
===========
Create a plot comparing the different transport laws.
"""
import matplotlib.pyplot as plt
import numpy as np
from PyDune.physics.sedtransport import transport_laws as TL
theta = np.linspace(0, 0.4, 1000)
theta_d = 0.035
omega = 8
plt.figure()
plt.plot(theta, TL.quadrati... | [
"PyDune.physics.sedtransport.transport_laws.quartic_transport_law",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"PyDune.physics.sedtransport.transport_laws.quadratic_transport_law",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matpl... | [((226, 251), 'numpy.linspace', 'np.linspace', (['(0)', '(0.4)', '(1000)'], {}), '(0, 0.4, 1000)\n', (237, 251), True, 'import numpy as np\n'), ((280, 292), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (290, 292), True, 'import matplotlib.pyplot as plt\n'), ((572, 610), 'matplotlib.pyplot.xlabel', 'plt.x... |
from office365.runtime.client_object import ClientObject
from office365.runtime.serviceOperationQuery import ServiceOperationQuery
from office365.runtime.http.http_method import HttpMethod
from office365.runtime.resource_path import ResourcePath
from office365.sharepoint.portal.SPSiteCreationResponse import SPSiteCreat... | [
"office365.runtime.resource_path.ResourcePath",
"office365.sharepoint.portal.SPSiteCreationResponse.SPSiteCreationResponse",
"office365.runtime.serviceOperationQuery.ServiceOperationQuery"
] | [((579, 603), 'office365.sharepoint.portal.SPSiteCreationResponse.SPSiteCreationResponse', 'SPSiteCreationResponse', ([], {}), '()\n', (601, 603), False, 'from office365.sharepoint.portal.SPSiteCreationResponse import SPSiteCreationResponse\n'), ((618, 691), 'office365.runtime.serviceOperationQuery.ServiceOperationQuer... |
import random
import numpy as np
import time
class Signalgenerator():
def __init__(self):
self.Fs = 8000
self.f = 2
self.sample = 8000
self.x = np.arange(1, self.sample+1)
self.y = np.empty(self.sample)
self.level = 0
self.filename = ''
def set_filename... | [
"random.randint",
"numpy.empty",
"time.time",
"numpy.arange",
"numpy.cos"
] | [((181, 210), 'numpy.arange', 'np.arange', (['(1)', '(self.sample + 1)'], {}), '(1, self.sample + 1)\n', (190, 210), True, 'import numpy as np\n'), ((226, 247), 'numpy.empty', 'np.empty', (['self.sample'], {}), '(self.sample)\n', (234, 247), True, 'import numpy as np\n'), ((523, 557), 'random.randint', 'random.randint'... |
from server.mod_auth.auth import load_user # , register, login
from server.tests.helpers import FlaskTestCase, fixtures
class TestAuth(FlaskTestCase):
@fixtures('single_user.json')
def test_load_existing_user(self):
"""Test loading a single valid user"""
with self.flaskapp.test_request_contex... | [
"server.mod_auth.auth.load_user",
"server.tests.helpers.fixtures"
] | [((159, 187), 'server.tests.helpers.fixtures', 'fixtures', (['"""single_user.json"""'], {}), "('single_user.json')\n", (167, 187), False, 'from server.tests.helpers import FlaskTestCase, fixtures\n'), ((446, 467), 'server.tests.helpers.fixtures', 'fixtures', (['"""base.json"""'], {}), "('base.json')\n", (454, 467), Fal... |
# Core functions for Vireo model
# Author: <NAME>
# Date: 30/08/2019
# http://edwardlib.org/tutorials/probabilistic-pca
# https://github.com/allentran/pca-magic
import sys
import itertools
import numpy as np
from scipy.stats import entropy
from scipy.special import digamma
from .vireo_base import normalize, loglik_am... | [
"numpy.sum",
"numpy.random.seed",
"numpy.log",
"scipy.stats.entropy",
"numpy.zeros",
"numpy.ones",
"numpy.expand_dims",
"numpy.append",
"scipy.special.digamma",
"numpy.array",
"numpy.exp",
"numpy.random.rand",
"sys.exit"
] | [((3246, 3264), 'numpy.zeros', 'np.zeros', (['max_iter'], {}), '(max_iter)\n', (3254, 3264), True, 'import numpy as np\n'), ((6889, 6930), 'numpy.zeros', 'np.zeros', (['(AD.shape[1], GT_prob.shape[1])'], {}), '((AD.shape[1], GT_prob.shape[1]))\n', (6897, 6930), True, 'import numpy as np\n'), ((7960, 7984), 'numpy.zeros... |
import numpy as np
import matplotlib.pyplot as plt
## preliminary tests
#inputs: A, P, Q, R
# A is the discrete representation of epsilon
#number of spatial harmonics (or orders)
P = 6;
Q = 6;
R = 6;
Nx = 20; Ny = 20; Nz = 1; #this is fundamentally 3D...not sure how to make general for 2D
N = np.array([Nx, Ny, Nz]);
... | [
"matplotlib.pyplot.show",
"numpy.abs",
"matplotlib.pyplot.imshow",
"numpy.floor",
"numpy.fft.fftn",
"numpy.zeros",
"numpy.ones",
"numpy.array",
"numpy.prod"
] | [((296, 318), 'numpy.array', 'np.array', (['[Nx, Ny, Nz]'], {}), '([Nx, Ny, Nz])\n', (304, 318), True, 'import numpy as np\n'), ((359, 373), 'numpy.ones', 'np.ones', (['(N + 1)'], {}), '(N + 1)\n', (366, 373), True, 'import numpy as np\n'), ((395, 417), 'matplotlib.pyplot.imshow', 'plt.imshow', (['A[:, :, 0]'], {}), '(... |
from fastapi import APIRouter
main_router = APIRouter()
from resources.db import session_dependency
session_dep = session_dependency()
@main_router.get("/", status_code=200)
async def root():
return {"msg": "Welcome to UMass Match!"}
from .user import user_router
from .match import match_router
# add indivi... | [
"resources.db.session_dependency",
"fastapi.APIRouter"
] | [((45, 56), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (54, 56), False, 'from fastapi import APIRouter\n'), ((117, 137), 'resources.db.session_dependency', 'session_dependency', ([], {}), '()\n', (135, 137), False, 'from resources.db import session_dependency\n')] |
import torch.nn as nn
from torch import cat, transpose
import torch
import torch.nn.functional as F
from Layers import EncoderLayer, DecoderLayer
from Sublayers import Norm, OutputFeedForward
import copy
import attention_setting
import numpy as np
import crispr_attn
import math
import OT_crispr_attn
import sys
import i... | [
"torch.nn.Dropout",
"copy.deepcopy",
"importlib.import_module",
"Layers.DecoderLayer",
"torch.nn.Embedding",
"torch.nn.Conv2d",
"Layers.EncoderLayer",
"torch.unsqueeze",
"torch.cat",
"torch.nn.init.xavier_uniform_",
"torch.nn.LayerNorm",
"Sublayers.OutputFeedForward",
"torch.nn.functional.re... | [((467, 514), 'importlib.import_module', 'importlib.import_module', (["(config_path + 'config')"], {}), "(config_path + 'config')\n", (490, 514), False, 'import importlib\n'), ((535, 593), 'importlib.import_module', 'importlib.import_module', (["(config_path + 'attention_setting')"], {}), "(config_path + 'attention_set... |
import random
from testcanarybot import objects
from testcanarybot import exceptions
# Copyright 2021 kensoi
class Main(objects.libraryModule):
@objects.priority(commands = ['quit']) # @testcanarybot quit
async def second(self, tools: objects.tools, package: objects.package):
await tools.api.messages.... | [
"testcanarybot.exceptions.Quit",
"testcanarybot.exceptions.LibraryReload",
"testcanarybot.objects.priority"
] | [((151, 186), 'testcanarybot.objects.priority', 'objects.priority', ([], {'commands': "['quit']"}), "(commands=['quit'])\n", (167, 186), False, 'from testcanarybot import objects\n'), ((592, 633), 'testcanarybot.objects.priority', 'objects.priority', ([], {'commands': "['lib_reload']"}), "(commands=['lib_reload'])\n", ... |
'''
<NAME> (<EMAIL>)
Department of Physics
University of Bath, UK
May 1st, 2020
Conductance model of an RVLM neuron for use with reservoir computing
using a modified Hodgkin-Huxley framework of ion channel gating.
Model parameters are chosen so as to replicate the behaviour of
the thalamocortical relay ne... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"scipy.integrate.odeint",
"scipy.tanh",
"numpy.arange",
"matplotlib.pyplot.ylabel"
] | [((1399, 1418), 'numpy.arange', 'np.arange', (['(0)', 'T', 'dt'], {}), '(0, T, dt)\n', (1408, 1418), True, 'import numpy as np\n'), ((6104, 6125), 'scipy.integrate.odeint', 'odeint', (['dXdt', 'init', 't'], {}), '(dXdt, init, t)\n', (6110, 6125), False, 'from scipy.integrate import odeint\n'), ((6691, 6711), 'matplotli... |
#!/usr/bin/env python
import sys
from pymccelib import *
import logging
logging.basicConfig(level=logging.DEBUG, format='%(levelname)-s: %(message)s')
if __name__ == "__main__":
env.init()
prot = Protein()
prot.load_nativepdb(env.prm["INPDB"])
# identify N and C terminal
if env.prm["TERMINALS"].... | [
"logging.basicConfig"
] | [((74, 152), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(levelname)-s: %(message)s"""'}), "(level=logging.DEBUG, format='%(levelname)-s: %(message)s')\n", (93, 152), False, 'import logging\n')] |
#!/usr/bin/env python
import lasagne
from lasagne.layers.conv import Conv2DLayer as Conv2DLayer
from lasagne.layers import MaxPool2DLayer, ConcatLayer, TransposedConv2DLayer
from lasagne.nonlinearities import elu, sigmoid, rectify
from lasagne.layers import batch_norm
from lasagne_wrapper.network import SegmentationN... | [
"lasagne_wrapper.learn_rate_shedules.get_stepwise",
"lasagne.layers.ConcatLayer",
"lasagne.layers.InputLayer",
"lasagne.layers.TransposedConv2DLayer",
"lasagne.layers.MaxPool2DLayer",
"lasagne.layers.conv.Conv2DLayer",
"lasagne_wrapper.batch_iterators.get_batch_iterator",
"lasagne_wrapper.parameter_up... | [((898, 1020), 'lasagne.layers.conv.Conv2DLayer', 'Conv2DLayer', (['in_layer'], {'num_filters': 'num_filters', 'filter_size': 'filter_size', 'nonlinearity': 'nonlinearity', 'pad': 'pad', 'name': 'name'}), '(in_layer, num_filters=num_filters, filter_size=filter_size,\n nonlinearity=nonlinearity, pad=pad, name=name)\n... |
#!/usr/bin/python
import sys
import os
import numpy as np
import pandas as pd
import argparse
import tensorflow as tf
from importlib.machinery import SourceFileLoader
import math
import psutil
import time
from scipy.sparse import csr_matrix
import gc
import matplotlib
matplotlib.use('Agg')
import scimpute
def learnin... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"tensorflow.reset_default_graph",
"scimpute.max_min_element_in_arrs",
"gc.collect",
"scimpute.read_data_into_cell_row",
"numpy.arange",
"scimpute.read_sparse_matrix_from_h5",
"pandas.DataFrame",
"scimpute.weight_bias_variable",
"scimpute.split__csr... | [((269, 290), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (283, 290), False, 'import matplotlib\n'), ((2503, 2567), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'Y_input_arr', 'columns': 'gene_ids', 'index': 'cell_ids'}), '(data=Y_input_arr, columns=gene_ids, index=cell_ids)\n', (2515, 25... |
"""IRC message."""
import re
from typing import Optional
from irc.messages.base import IRCBaseMessage
# Regex for matching the individual parts of an IRC message
private_message_regex = re.compile("^:([^!]+)!(.*?) (PRIVMSG|NOTICE) ([^ ]+) :(.*)")
class IRCMessage(IRCBaseMessage):
"""An IRC private message."""
... | [
"re.compile"
] | [((189, 249), 're.compile', 're.compile', (['"""^:([^!]+)!(.*?) (PRIVMSG|NOTICE) ([^ ]+) :(.*)"""'], {}), "('^:([^!]+)!(.*?) (PRIVMSG|NOTICE) ([^ ]+) :(.*)')\n", (199, 249), False, 'import re\n')] |
#!/usr/bin/env python3
from calendar import day_name, weekday
month, day, year = map(int, input().split())
print(day_name[weekday(year, month, day)].upper())
| [
"calendar.weekday"
] | [((124, 149), 'calendar.weekday', 'weekday', (['year', 'month', 'day'], {}), '(year, month, day)\n', (131, 149), False, 'from calendar import day_name, weekday\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2019/1/21 10:05 PM
# @Author : w8ay
# @File : nmap.py
import nmap
from lib.data import logger
def nmapscan(host, ports):
# 接受从masscan上扫描出来的结果
# 为了可以多线程使用,此函数支持多线程调用
nm = nmap.PortScanner()
argument = "-sV -sS -Pn --host-timeout 1m -p{}".f... | [
"nmap.PortScanner",
"lib.data.logger.debug"
] | [((248, 266), 'nmap.PortScanner', 'nmap.PortScanner', ([], {}), '()\n', (264, 266), False, 'import nmap\n'), ((667, 756), 'lib.data.logger.debug', 'logger.debug', (["('[nmap] successed,elapsed:%s command_line:%s' % (elapsed, command_line))"], {}), "('[nmap] successed,elapsed:%s command_line:%s' % (elapsed,\n command... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-08-11 12:46
from __future__ import unicode_literals
import ckeditor_uploader.fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
... | [
"django.db.migrations.swappable_dependency",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DateTimeField"
] | [((325, 382), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (356, 382), False, 'from django.db import migrations, models\n'), ((1523, 1671), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'djang... |
import tqdm
import networkx as nx
import argparse
import numpy as np
import multiprocessing
import graph_tool as gt
from graph_tool.centrality import betweenness
parser = argparse.ArgumentParser()
parser.add_argument("-g", "--graph", help='bundled graph')
parser.add_argument("-l","--length",help="contig length")
parse... | [
"tqdm.tqdm",
"argparse.ArgumentParser",
"networkx.set_node_attributes",
"numpy.std",
"numpy.mean",
"networkx.Graph",
"graph_tool.centrality.betweenness",
"networkx.connected_component_subgraphs",
"networkx.number_connected_components",
"multiprocessing.cpu_count"
] | [((172, 197), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (195, 197), False, 'import argparse\n'), ((402, 412), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (410, 412), True, 'import networkx as nx\n'), ((420, 447), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n... |
# Copyright (c) 2020 <NAME> <www.sean-graham.com>
#
# 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... | [
"os.path.expanduser",
"logging.getLogger"
] | [((1476, 1509), 'logging.getLogger', 'logging.getLogger', (['"""wiki updater"""'], {}), "('wiki updater')\n", (1493, 1509), False, 'import logging\n'), ((2461, 2494), 'os.path.expanduser', 'os.path.expanduser', (['self.filePath'], {}), '(self.filePath)\n', (2479, 2494), False, 'import os\n')] |
import json
import os
import threading
import grpc
from tiktorch.proto.inference_pb2 import Empty
from tiktorch.proto.inference_pb2_grpc import FlightControlStub
from tiktorch.server.grpc import serve
from tiktorch.utils import wait
def test_serving_on_random_port(tmpdir):
conn_file_path = str(tmpdir / "conn.js... | [
"threading.Thread",
"json.load",
"tiktorch.proto.inference_pb2.Empty",
"tiktorch.proto.inference_pb2_grpc.FlightControlStub",
"grpc.insecure_channel",
"os.path.exists",
"tiktorch.server.grpc.serve"
] | [((430, 462), 'threading.Thread', 'threading.Thread', ([], {'target': '_server'}), '(target=_server)\n', (446, 462), False, 'import threading\n'), ((772, 811), 'grpc.insecure_channel', 'grpc.insecure_channel', (['f"""{addr}:{port}"""'], {}), "(f'{addr}:{port}')\n", (793, 811), False, 'import grpc\n'), ((825, 848), 'tik... |
import os
import pymongo
DB_NAME = os.getenv("DB_NAME")
client = pymongo.MongoClient("mongodb://db:27017")
db = client[DB_NAME]
| [
"pymongo.MongoClient",
"os.getenv"
] | [((37, 57), 'os.getenv', 'os.getenv', (['"""DB_NAME"""'], {}), "('DB_NAME')\n", (46, 57), False, 'import os\n'), ((69, 110), 'pymongo.MongoClient', 'pymongo.MongoClient', (['"""mongodb://db:27017"""'], {}), "('mongodb://db:27017')\n", (88, 110), False, 'import pymongo\n')] |
import logging
import math
"""
1. Note
- Loop from 2 till Square Root of N and keep dividing N at every step.
2. Optimisation(s)
- Apart from 2, only ODD numbers are tested for divisiblity.
- Only numbers upto SquareRoot(n) are tested for divisibility.
3. Limitation(s)
- Do not try with numbers which h... | [
"math.sqrt"
] | [((739, 751), 'math.sqrt', 'math.sqrt', (['n'], {}), '(n)\n', (748, 751), False, 'import math\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 14 14:11:07 2019
@author: mimbres
"""
import pandas as pd
import numpy as np
from tqdm import trange
LASTFM_FILEPATH = './data/final_mapping.json'
OUTPUT_FILEPATH1 = './data/lastfm_top50_tagmtx.npy'
OUTPUT_FILEPATH2 = './data/lastfm_top50_featmtx.... | [
"numpy.save",
"tqdm.trange",
"numpy.asarray",
"numpy.zeros",
"pandas.read_json",
"numpy.max",
"numpy.where",
"numpy.ndarray"
] | [((1219, 1248), 'pandas.read_json', 'pd.read_json', (['LASTFM_FILEPATH'], {}), '(LASTFM_FILEPATH)\n', (1231, 1248), True, 'import pandas as pd\n'), ((1402, 1427), 'numpy.zeros', 'np.zeros', (['(num_items, 50)'], {}), '((num_items, 50))\n', (1410, 1427), True, 'import numpy as np\n'), ((1438, 1463), 'numpy.zeros', 'np.z... |
import pygame
class StartMenu:
def __init__(self, screen, font, text_colour, button_colour):
self.__screen = screen
self.__font = font
self.__text_colour = text_colour
self.__button_colour = button_colour
self.__click = False
self.__button_width = 150
self.__... | [
"pygame.quit",
"pygame.event.get",
"pygame.draw.rect",
"pygame.Rect",
"pygame.display.update",
"pygame.mouse.get_pos",
"pygame.display.set_caption"
] | [((671, 716), 'pygame.display.set_caption', 'pygame.display.set_caption', (['f"""{self.__title}"""'], {}), "(f'{self.__title}')\n", (697, 716), False, 'import pygame\n'), ((1517, 1539), 'pygame.mouse.get_pos', 'pygame.mouse.get_pos', ([], {}), '()\n', (1537, 1539), False, 'import pygame\n'), ((2765, 2788), 'pygame.disp... |
#Programmer: <NAME>
#This file contains a test step function for debugging the swept rule
import numpy, h5py, mpi4py.MPI as MPI
try:
import pycuda.driver as cuda
from pycuda.compiler import SourceModule
except Exception as e:
pass
def step(state,iidx,arrayTimeIndex,globalTimeStep):
"""This is the meth... | [
"numpy.float64",
"h5py.File",
"numpy.zeros"
] | [((1951, 1976), 'numpy.zeros', 'numpy.zeros', (['(nv, nx, ny)'], {}), '((nv, nx, ny))\n', (1962, 1976), False, 'import numpy, h5py, mpi4py.MPI as MPI\n'), ((2156, 2206), 'h5py.File', 'h5py.File', (['filename', '"""w"""'], {'driver': '"""mpio"""', 'comm': 'comm'}), "(filename, 'w', driver='mpio', comm=comm)\n", (2165, 2... |
import nose.tools as nt
import numpy as np
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
fX = theano.config.floatX
def test_aggregator_node_serialization():
tn.check_serialization(tn.AggregatorNode("a"))
def test_elementwise_cost_node_serialization():
tn.check_serializa... | [
"treeano.nodes.ConstantNode",
"treeano.nodes.MultiplyConstantNode",
"treeano.nodes.InputElementwiseSumNode",
"treeano.nodes.AddConstantNode",
"treeano.nodes.AggregatorNode",
"treeano.nodes.InputNode",
"numpy.random.rand",
"treeano.nodes.IdentityNode"
] | [((224, 246), 'treeano.nodes.AggregatorNode', 'tn.AggregatorNode', (['"""a"""'], {}), "('a')\n", (241, 246), True, 'import treeano.nodes as tn\n'), ((1102, 1125), 'numpy.random.rand', 'np.random.rand', (['(3)', '(4)', '(5)'], {}), '(3, 4, 5)\n', (1116, 1125), True, 'import numpy as np\n'), ((1145, 1168), 'numpy.random.... |
# NOTE WARNING NEVER CHANGE THIS FIRST LINE!!!! NEVER EVER
import cudf
from collections import OrderedDict
from enum import Enum
from urllib.parse import urlparse
from threading import Lock
from weakref import ref
from pyblazing.apiv2.filesystem import FileSystem
from pyblazing.apiv2 import DataType
from .hive imp... | [
"socket.socket",
"cudf.DataFrame.from_arrow",
"cudf.set_allocator",
"weakref.ref",
"urllib.parse.urlparse",
"random.randint",
"dask_cudf.from_cudf",
"dask.distributed.wait",
"dask.dataframe.from_delayed",
"pyarrow.Table.from_arrays",
"pyblazing.apiv2.filesystem.FileSystem",
"threading.Lock",
... | [((1027, 1062), 'jpype.JClass', 'jpype.JClass', (['"""java.util.ArrayList"""'], {}), "('java.util.ArrayList')\n", (1039, 1062), False, 'import jpype\n'), ((1081, 1155), 'jpype.JClass', 'jpype.JClass', (['"""com.blazingdb.calcite.catalog.domain.CatalogColumnDataType"""'], {}), "('com.blazingdb.calcite.catalog.domain.Cat... |
from __future__ import annotations
__copyright__ = """
Copyright (C) 2020 <NAME>
Copyright (C) 2020 <NAME>
Copyright (C) 2020 <NAME>
Copyright (C) 2021 <NAME>
"""
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "So... | [
"pytato.zeros",
"numpy.dtype",
"pymbolic.var",
"numpy.empty"
] | [((5205, 5223), 'numpy.dtype', 'np.dtype', (['np.int32'], {}), '(np.int32)\n', (5213, 5223), True, 'import numpy as np\n'), ((5632, 5664), 'pytato.zeros', 'pt.zeros', (['x.shape'], {'dtype': 'x.dtype'}), '(x.shape, dtype=x.dtype)\n', (5640, 5664), True, 'import pytato as pt\n'), ((3424, 3454), 'pymbolic.var', 'var', ([... |
import numpy as np
from io import TextIOWrapper
from typing import Iterable, Any, Union, TextIO, List, Optional
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
from plagiarism.sources import Source
class Output(object):
"""
Class that format n... | [
"sklearn.feature_extraction.text.TfidfVectorizer",
"sklearn.metrics.pairwise.cosine_similarity"
] | [((2982, 2999), 'sklearn.feature_extraction.text.TfidfVectorizer', 'TfidfVectorizer', ([], {}), '()\n', (2997, 2999), False, 'from sklearn.feature_extraction.text import TfidfVectorizer\n'), ((3241, 3264), 'sklearn.metrics.pairwise.cosine_similarity', 'cosine_similarity', (['x', 'y'], {}), '(x, y)\n', (3258, 3264), Fal... |
import cv2
import numpy as np
import random
import os
def imread(path):
# print(path)
img = cv2.imread(path, cv2.IMREAD_UNCHANGED)
# covert BRG to RGB
# img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
# convert BGR to RGB
img = img[:,:,[2, 1, 0]]
return img
def imsave(path, img):
# convert ... | [
"cv2.imread",
"os.path.join",
"os.listdir",
"cv2.imwrite"
] | [((101, 139), 'cv2.imread', 'cv2.imread', (['path', 'cv2.IMREAD_UNCHANGED'], {}), '(path, cv2.IMREAD_UNCHANGED)\n', (111, 139), False, 'import cv2\n'), ((375, 397), 'cv2.imwrite', 'cv2.imwrite', (['path', 'img'], {}), '(path, img)\n', (386, 397), False, 'import cv2\n'), ((560, 584), 'os.listdir', 'os.listdir', (['datas... |
import sentry_top
from collections import defaultdict
from nydus.db import create_cluster
from time import time
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from sentry.models import Project
from sentry.plugins.base import Plugin
if not getattr(settings, 'SENTRY_TOP', No... | [
"django.core.exceptions.ImproperlyConfigured",
"time.time",
"collections.defaultdict",
"sentry.models.Project.objects.filter",
"nydus.db.create_cluster",
"django.conf.settings.SENTRY_TOP.get"
] | [((767, 811), 'django.conf.settings.SENTRY_TOP.get', 'settings.SENTRY_TOP.get', (['"""total_minutes"""', '(15)'], {}), "('total_minutes', 15)\n", (790, 811), False, 'from django.conf import settings\n'), ((335, 391), 'django.core.exceptions.ImproperlyConfigured', 'ImproperlyConfigured', (['"""You need to configure SENT... |
import os
from aoc.utils.file_reader import read_file_line
from aoc.utils.file_reader import path_join
directory_path = os.path.dirname(os.path.realpath(__file__))
input_filename = "input.txt"
target_number = 2020
"""
"""
def problem_part1(lines):
seen = set()
answer = None
for number in lines:
i... | [
"aoc.utils.file_reader.read_file_line",
"os.path.realpath",
"aoc.utils.file_reader.path_join"
] | [((138, 164), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (154, 164), False, 'import os\n'), ((1163, 1204), 'aoc.utils.file_reader.path_join', 'path_join', (['directory_path', 'input_filename'], {}), '(directory_path, input_filename)\n', (1172, 1204), False, 'from aoc.utils.file_reader i... |
#!/usr/bin/env python3
import numpy as np
import math
import random
def compute_z(theta, x):
z = 0
for j in range(len(x)):
z += theta[j] * x[j]
z += theta[len(x)]
return z
def compute_g(z):
return (1)/(1 + math.exp(-z))
def compute_h(z):
return compute_g(z)
def binary_cross_entro... | [
"math.log",
"math.exp",
"numpy.random.randn"
] | [((1164, 1181), 'numpy.random.randn', 'np.random.randn', ([], {}), '()\n', (1179, 1181), True, 'import numpy as np\n'), ((238, 250), 'math.exp', 'math.exp', (['(-z)'], {}), '(-z)\n', (246, 250), False, 'import math\n'), ((429, 451), 'math.log', 'math.log', (['Y_predict[i]'], {}), '(Y_predict[i])\n', (437, 451), False, ... |
###
# Copyright 2008-2011 Diamond Light Source Ltd.
# This file is part of Diffcalc.
#
# Diffcalc is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | [
"math.radians",
"diffcalc.hkl.geometry.Position",
"math.asin",
"math.atan2"
] | [((1020, 1085), 'diffcalc.hkl.geometry.Position', 'Position', ([], {'mu': 'mu', 'delta': 'delta', 'nu': 'gamma', 'eta': 'eta', 'chi': 'chi', 'phi': 'phi'}), '(mu=mu, delta=delta, nu=gamma, eta=eta, chi=chi, phi=phi)\n', (1028, 1085), False, 'from diffcalc.hkl.geometry import Position\n'), ((2050, 2125), 'diffcalc.hkl.g... |
'''
Functions to compute fast distance covariance using mergesort.
'''
import warnings
from numba import float64, int64, boolean
import numba
import numpy as np
from ._utils import CompileMode, _transform_to_2d
def _compute_weight_sums(y, weights):
n_samples = len(y)
weight_sums = np.zeros((n_samples,) ... | [
"numpy.sum",
"numpy.ones_like",
"numpy.empty_like",
"numpy.zeros",
"numpy.cumsum",
"numpy.arange",
"numba.float64",
"warnings.warn"
] | [((298, 355), 'numpy.zeros', 'np.zeros', (['((n_samples,) + weights.shape[1:])'], {'dtype': 'y.dtype'}), '((n_samples,) + weights.shape[1:], dtype=y.dtype)\n', (306, 355), True, 'import numpy as np\n'), ((624, 691), 'numpy.zeros', 'np.zeros', (['((n_samples + 1,) + weights.shape[1:])'], {'dtype': 'weights.dtype'}), '((... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: <NAME>
# @Date: 2014-10-28 04:41:23
# @Last Modified by: marinheiro
# @Last Modified time: 2014-12-08 23:30:01
"""
Auxiliary functions to convert between different rotation representations.
"""
import numpy
import numpy.linalg
import scipy
import math
# Ax... | [
"numpy.trace",
"numpy.zeros",
"math.sin",
"numpy.linalg.norm",
"math.cos",
"numpy.array"
] | [((525, 545), 'numpy.linalg.norm', 'numpy.linalg.norm', (['w'], {}), '(w)\n', (542, 545), False, 'import numpy\n'), ((551, 568), 'numpy.zeros', 'numpy.zeros', (['(3,)'], {}), '((3,))\n', (562, 568), False, 'import numpy\n'), ((776, 795), 'numpy.zeros', 'numpy.zeros', (['(3, 1)'], {}), '((3, 1))\n', (787, 795), False, '... |
from abc import ABCMeta, abstractmethod
from typing import Optional, Dict, List, Tuple
import re
from .base import (
HTTPClient,
IParser,
APIResponseType,
ILoginFetcher,
ISemesterFetcher,
ResourceData,
ErrorData,
ParserPrecondition,
SemesterData,
)
from ..reqeust import Response
fro... | [
"re.search",
"re.match"
] | [((7462, 7486), 're.search', 're.search', (['"""\\\\d+"""', 'value'], {}), "('\\\\d+', value)\n", (7471, 7486), False, 'import re\n'), ((8979, 9050), 're.match', 're.match', (['"""(.+)?\\\\(([^(]*)?\\\\)(\\\\d{2}:\\\\d{2})\\\\s*~\\\\s*([0-9:]{,5})"""', 'td'], {}), "('(.+)?\\\\(([^(]*)?\\\\)(\\\\d{2}:\\\\d{2})\\\\s*~\\\... |
from django.db.models.signals import post_save
from django.contrib.auth.models import User
from .models import Profile
from django.dispatch import receiver
# Create your models here.
@receiver(post_save, sender=User)
def create_profile(sender,instance,created,**kwargs):
if created:
Profile.objects.create(p... | [
"django.db.models.signals.post_save.connect",
"django.dispatch.receiver"
] | [((185, 217), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'User'}), '(post_save, sender=User)\n', (193, 217), False, 'from django.dispatch import receiver\n'), ((372, 418), 'django.db.models.signals.post_save.connect', 'post_save.connect', (['create_profile'], {'sender': 'User'}), '(create_profil... |
from scipy.misc import imread,imresize,imsave
import os
path = '/home/zhang/tm/insightface_for_face_recognition-master/dataset/8631_align_train/'
out_path = '/home/zhang/tm/insightface_for_face_recognition-master/dataset/8631_112_align_train/'
img_lists = os.listdir(path)
for img_list in img_lists:
imgpaths = os... | [
"scipy.misc.imsave",
"os.mkdir",
"os.path.exists",
"scipy.misc.imresize",
"os.path.join",
"os.listdir",
"scipy.misc.imread"
] | [((257, 273), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (267, 273), False, 'import os\n'), ((318, 346), 'os.path.join', 'os.path.join', (['path', 'img_list'], {}), '(path, img_list)\n', (330, 346), False, 'import os\n'), ((365, 397), 'os.path.join', 'os.path.join', (['out_path', 'img_list'], {}), '(out_pa... |
import flappybird as fb
import random
import time
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import SGD
import numpy as np
import copy
SCALE_FACTOR = 200
class GeneticBrain(fb.Brain):
def __init__(self,n_input,n_hidden):
'''
self.model = Sequential()
... | [
"numpy.size",
"random.randint",
"flappybird.FlappyBirdGame",
"pygame.event.get",
"random.random",
"random.seed",
"simpleNeuralNetwork.NeuralNetwork"
] | [((5525, 5564), 'flappybird.FlappyBirdGame', 'fb.FlappyBirdGame', (['(30)', 'bird_num', 'brains'], {}), '(30, bird_num, brains)\n', (5542, 5564), True, 'import flappybird as fb\n'), ((6932, 6971), 'flappybird.FlappyBirdGame', 'fb.FlappyBirdGame', (['(30)', 'bird_num', 'brains'], {}), '(30, bird_num, brains)\n', (6949, ... |
import matplotlib.pyplot as plt
import pandas as pd
#Data from source
stockData = './stock_market_data-AAPL'
df = pd.read_csv (stockData+".csv")
# Sort DataFrame by date
df = df.sort_values('Date')
# Gets all of the rows
df.head()
#Plots figure
plt.figure(figsize = (18,9))
plt.plot(range(df.shape[0]),(df['Low']+df... | [
"matplotlib.pyplot.show",
"pandas.read_csv",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((116, 147), 'pandas.read_csv', 'pd.read_csv', (["(stockData + '.csv')"], {}), "(stockData + '.csv')\n", (127, 147), True, 'import pandas as pd\n'), ((250, 277), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(18, 9)'}), '(figsize=(18, 9))\n', (260, 277), True, 'import matplotlib.pyplot as plt\n'), ((475,... |
from ftplib import FTP
import time
import tarfile
import shutil
import os
def ftpconnect(host, username, password):
ftp = FTP()
ftp.set_pasv(0)
ftp.set_debuglevel(2)
ftp.connect(host, 21)
ftp.login(username, password)
ftp.encoding = "utf-8"
return ftp
def downloadfile(ftp, remotepath, lo... | [
"shutil.rmtree",
"time.time",
"shutil.copytree",
"ftplib.FTP"
] | [((128, 133), 'ftplib.FTP', 'FTP', ([], {}), '()\n', (131, 133), False, 'from ftplib import FTP\n'), ((2380, 2404), 'shutil.rmtree', 'shutil.rmtree', (['"""./rate/"""'], {}), "('./rate/')\n", (2393, 2404), False, 'import shutil\n'), ((2474, 2512), 'shutil.copytree', 'shutil.copytree', (['"""./sample"""', '"""./rate/"""... |
from os.path import join
import pandas as pd
import matplotlib.pyplot as plt
from util.plot import Plot, plotDataFrame, formatXAxisDate
class SubjectAlternateNamesPlot(Plot):
def __init__(self):
super(SubjectAlternateNamesPlot, self).__init__('Subject Alternate Names', 'SubjectAlternateNames.csv', 'subjec... | [
"util.plot.formatXAxisDate",
"util.plot.plotDataFrame",
"matplotlib.pyplot.tight_layout",
"os.path.join"
] | [((1157, 1215), 'util.plot.plotDataFrame', 'plotDataFrame', (['df', '"""Length of Subject Alternate Name List"""'], {}), "(df, 'Length of Subject Alternate Name List')\n", (1170, 1215), False, 'from util.plot import Plot, plotDataFrame, formatXAxisDate\n'), ((1287, 1307), 'util.plot.formatXAxisDate', 'formatXAxisDate',... |
import os
import os.path as osp
from PIL import Image
PATH='../Fewshot/Fewshot/'
classes= os.listdir(PATH)
trainp='../Fewshot/train/'
valp='../Fewshot/val/'
testp='../Fewshot/test/'
for classv in classes:
if classv[0]=='.':
continue
pathn=osp.join(PATH,classv)
pathn=pathn+'/'
folders=os.l... | [
"os.mkdir",
"os.path.join",
"os.listdir",
"PIL.Image.open"
] | [((96, 112), 'os.listdir', 'os.listdir', (['PATH'], {}), '(PATH)\n', (106, 112), False, 'import os\n'), ((262, 284), 'os.path.join', 'osp.join', (['PATH', 'classv'], {}), '(PATH, classv)\n', (270, 284), True, 'import os.path as osp\n'), ((316, 333), 'os.listdir', 'os.listdir', (['pathn'], {}), '(pathn)\n', (326, 333), ... |
import unittest
import code_helper
class Test0012(unittest.TestCase):
def test_problem(self):
primes = list(code_helper.range_prime(10000))
triangle_number = -1
for n in range(7000, 20000):
triangle_number = n * (n + 1) / 2
divisors = 1
s = triangle_numb... | [
"code_helper.range_prime"
] | [((122, 152), 'code_helper.range_prime', 'code_helper.range_prime', (['(10000)'], {}), '(10000)\n', (145, 152), False, 'import code_helper\n')] |
from twisted.internet import reactor, threads
import threading
import functools
import aux.protocol as protocol_module
class Backend(object):
def __init__(self):
self.thread = None
self.reactor = reactor
self.event = threading.Event()
self.protocols = protocols_module
def star... | [
"threading.Thread",
"twisted.internet.threads.blockingCallFromThread",
"threading.Event",
"functools.wraps"
] | [((247, 264), 'threading.Event', 'threading.Event', ([], {}), '()\n', (262, 264), False, 'import threading\n'), ((351, 416), 'threading.Thread', 'threading.Thread', ([], {'name': '"""BackendThread"""', 'target': 'self.start_reactor'}), "(name='BackendThread', target=self.start_reactor)\n", (367, 416), False, 'import th... |
# Author: <NAME>
# Python 3.9
import argparse
import nltk
import re
import os
import pathlib
def extract(filePath):
"""Extracts the textual information from a file.
Args:
filePath (str): The path to the file to extract text from.
Raises:
ValueError: If the information could not be extrac... | [
"argparse.ArgumentParser",
"os.getcwd",
"pdfminer.high_level.extract_text",
"pathlib.Path",
"bs4.BeautifulSoup",
"nltk.word_tokenize",
"re.compile"
] | [((7744, 7888), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Removes personally identifiable information (PII) like names and phone numbers from text strings and files."""'], {}), "(\n 'Removes personally identifiable information (PII) like names and phone numbers from text strings and files.'\n )\... |
import pyrebase
import time
from FaceRecognitionManager import *
firebaseConfig = {
"apiKey": "<KEY>",
"authDomain": "iaproject-29018.firebaseapp.com",
"projectId": "iaproject-29018",
"storageBucket": "iaproject-29018.appspot.com",
"messagingSenderId": "817053540910",
"appId": "1:817053540910:w... | [
"pyrebase.initialize_app"
] | [((428, 467), 'pyrebase.initialize_app', 'pyrebase.initialize_app', (['firebaseConfig'], {}), '(firebaseConfig)\n', (451, 467), False, 'import pyrebase\n')] |
"""Parallel backends"""
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
import os
import sys
import re
import multiprocessing
import shlex
import pickle
import base64
from warnings import warn
from subprocess import Popen, PIPE, TimeoutExpired
import binascii
from queue import Queue, Empty
from threading impo... | [
"sys.stdout.write",
"os.environ.copy",
"base64.b64decode",
"pytest.mark.skipif",
"psutil.cpu_count",
"multiprocessing.cpu_count",
"psutil.process_iter",
"os.path.dirname",
"shlex.split",
"threading.Event",
"re.search",
"pickle.dumps",
"pickle.loads",
"threading.Thread",
"subprocess.Popen... | [((2645, 2662), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (2660, 2662), False, 'import os\n'), ((4097, 4104), 'queue.Queue', 'Queue', ([], {}), '()\n', (4102, 4104), False, 'from queue import Queue, Empty\n'), ((4117, 4124), 'queue.Queue', 'Queue', ([], {}), '()\n', (4122, 4124), False, 'from queue import... |
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from Platforms.Discord.main_discord import PhaazebotDiscord
from Platforms.Web.index import WebIndex
from aiohttp.web import Response, Request
from .get import apiDiscordCommandsGet
from .create import apiDiscordCommandsCreate
from .list import apiDiscordCommandsLis... | [
"Platforms.Web.Processing.Api.errors.apiNotAllowed",
"Platforms.Web.Processing.Api.errors.apiMissingValidMethod"
] | [((713, 779), 'Platforms.Web.Processing.Api.errors.apiNotAllowed', 'apiNotAllowed', (['cls', 'WebRequest'], {'msg': '"""Discord module is not active"""'}), "(cls, WebRequest, msg='Discord module is not active')\n", (726, 779), False, 'from Platforms.Web.Processing.Api.errors import apiMissingValidMethod, apiNotAllowed\... |
from __future__ import annotations
import os
import math
import itertools
from io import BytesIO
from typing import Any, Dict, List, Tuple, Union, Iterator, Optional, Sequence
import PIL
from PIL import ImageDraw, ImageFont, ImageFilter
from pink_accents import Accent
from pink.context import Context
from pink.cog... | [
"PIL.ImageFilter.GaussianBlur",
"io.BytesIO",
"math.atan2",
"pink.cogs.utils.errorhandler.PINKError",
"PIL.ImageFont.truetype",
"PIL.ImageDraw.Draw",
"itertools.cycle"
] | [((790, 826), 'PIL.ImageFont.truetype', 'ImageFont.truetype', (['"""DejaVuSans.ttf"""'], {}), "('DejaVuSans.ttf')\n", (808, 826), False, 'from PIL import ImageDraw, ImageFont, ImageFilter\n'), ((13030, 13039), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (13037, 13039), False, 'from io import BytesIO\n'), ((5087, 5112), ... |
#!/usr/bin/python
import roslib
import rospy
import cv2
import numpy as np
import cv_bridge
import time
from sensor_msgs.msg import Image
from std_msgs.msg import String
from common import *
from jupiter.msg import BallPosition
class Detector:
current_camera = None
camera_subscription = None
bridge = None... | [
"cv2.GaussianBlur",
"rospy.Subscriber",
"cv2.bitwise_and",
"numpy.around",
"cv2.__version__.split",
"cv2.inRange",
"cv2.cvtColor",
"rospy.init_node",
"jupiter.msg.BallPosition",
"cv2.circle",
"rospy.loginfo",
"cv2.SimpleBlobDetector_create",
"cv2.SimpleBlobDetector",
"cv2.bitwise_or",
"c... | [((10179, 10206), 'rospy.init_node', 'rospy.init_node', (['"""detector"""'], {}), "('detector')\n", (10194, 10206), False, 'import rospy\n'), ((10237, 10249), 'rospy.spin', 'rospy.spin', ([], {}), '()\n', (10247, 10249), False, 'import rospy\n'), ((742, 827), 'rospy.Subscriber', 'rospy.Subscriber', (['"""/jupiter/detec... |
# Copyright 2020 <NAME>
#
# 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, distribute... | [
"AppImageBuilder.app_dir.runtimes.classic.DynamicLoader"
] | [((1647, 1690), 'AppImageBuilder.app_dir.runtimes.classic.DynamicLoader', 'DynamicLoader', (['"""AppDir"""', 'self.app_dir_files'], {}), "('AppDir', self.app_dir_files)\n", (1660, 1690), False, 'from AppImageBuilder.app_dir.runtimes.classic import DynamicLoader\n'), ((1818, 1916), 'AppImageBuilder.app_dir.runtimes.clas... |
import json
import matplotlib.pyplot as plt
import numpy as np
import pickle
import tensorflow as tf
import traceback
from support.data_model import TAG_CLASS_MAP, CLASSES
def load_raw_tracks(path):
tracks = []
with open(path, 'rb') as f:
try:
while True:
tracks.append(pi... | [
"matplotlib.pyplot.title",
"numpy.sum",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.callbacks.ModelCheckpoint",
"pickle.load",
"tensorflow.keras.callbacks.EarlyStopping",
"traceback.print_exc",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.callbacks.ReduceLROnPlateau",
"ma... | [((4864, 4908), 'matplotlib.pyplot.savefig', 'plt.savefig', (['f"""{save_directory}/history.png"""'], {}), "(f'{save_directory}/history.png')\n", (4875, 4908), True, 'import matplotlib.pyplot as plt\n'), ((4913, 4924), 'matplotlib.pyplot.close', 'plt.close', ([], {}), '()\n', (4922, 4924), True, 'import matplotlib.pypl... |
from PIL import Image
import os, pprint
old_directory = 'old'
new_directory = 'new'
new_origin = (36, 32)
for file in os.listdir(old_directory):
filename = "{}/{}".format(old_directory, file)
img = Image.open(filename)
width = img.size[0]
height = img.size[1]
if height != 1040:
print(file... | [
"os.listdir",
"PIL.Image.open"
] | [((121, 146), 'os.listdir', 'os.listdir', (['old_directory'], {}), '(old_directory)\n', (131, 146), False, 'import os, pprint\n'), ((209, 229), 'PIL.Image.open', 'Image.open', (['filename'], {}), '(filename)\n', (219, 229), False, 'from PIL import Image\n')] |
import unittest
from ..utils.inject import assign_injectables
from ..utils.immutabledict import ImmutableDict
from ..generator.exporter import Exporter
directory_values = ['title', 'images']
picture_values = ['alt_text', 'src', 'caption_data']
class MockJinja2Template(object):
def __init__(self, required_values):
... | [
"unittest.main"
] | [((2304, 2319), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2317, 2319), False, 'import unittest\n')] |
# Licensed under MIT License.
# See LICENSE in the project root for license information.
"""Longest common subsequence. The subsequence does not need to be continuous in the original sequence."""
from typing import Sequence, Tuple
from tests import jovian
import functools
##########################################
... | [
"tests.jovian.evaluate_test_cases",
"functools.wraps",
"tests.jovian.evaluate_test_cases_justyre"
] | [((7314, 7378), 'tests.jovian.evaluate_test_cases', 'jovian.evaluate_test_cases', ([], {'func': 'lcs_recursive', 'test_cases': 'tests'}), '(func=lcs_recursive, test_cases=tests)\n', (7340, 7378), False, 'from tests import jovian\n'), ((7493, 7560), 'tests.jovian.evaluate_test_cases_justyre', 'jovian.evaluate_test_cases... |
# This class manages the game's state
import pyglet
from pyglet import clock
from Entity import Asteroid, AsteroidDebris, Player
from Entity import ParticleSpawner, ParticleFactory, Bullet
from HUD import HUD
from pyglet.window import key
from Vect2 import Vect2
import math
# Target window size constant
WIDTH = 800
H... | [
"Vect2.Vect2",
"pyglet.text.Label",
"pyglet.window.key.KeyStateHandler",
"HUD.HUD",
"pyglet.graphics.Batch",
"Entity.ParticleFactory",
"pyglet.window.Window"
] | [((780, 815), 'pyglet.window.Window', 'pyglet.window.Window', (['WIDTH', 'HEIGHT'], {}), '(WIDTH, HEIGHT)\n', (800, 815), False, 'import pyglet\n'), ((910, 945), 'pyglet.window.key.KeyStateHandler', 'pyglet.window.key.KeyStateHandler', ([], {}), '()\n', (943, 945), False, 'import pyglet\n'), ((1093, 1098), 'HUD.HUD', '... |
from pyleecan.Classes.Segment import Segment
from pyleecan.Classes.SurfLine import SurfLine
import pytest
line_list = list()
line_list.append(Segment(begin=-1j, end=1j))
line_list.append(Segment(begin=1j, end=1j + 1))
line_list.append(Segment(begin=1j + 1, end=-1j + 1))
line_list.append(Segment(begin=-1j + 1, end=-1j)... | [
"pytest.mark.parametrize",
"pyleecan.Classes.SurfLine.SurfLine",
"pyleecan.Classes.Segment.Segment"
] | [((330, 388), 'pyleecan.Classes.SurfLine.SurfLine', 'SurfLine', ([], {'line_list': 'line_list', 'label': '"""test"""', 'point_ref': '(0.5)'}), "(line_list=line_list, label='test', point_ref=0.5)\n", (338, 388), False, 'from pyleecan.Classes.SurfLine import SurfLine\n'), ((641, 706), 'pyleecan.Classes.SurfLine.SurfLine'... |
from suitcase.nxsas.utils import _parse_bluesky_document_path
def test__build_bluesky_document_path():
parsed_path = _parse_bluesky_document_path("#bluesky/start@abc")
assert parsed_path["doc"] == "start"
assert parsed_path["attribute"] == "abc"
parsed_path = _parse_bluesky_document_path("#bluesky/st... | [
"suitcase.nxsas.utils._parse_bluesky_document_path"
] | [((123, 173), 'suitcase.nxsas.utils._parse_bluesky_document_path', '_parse_bluesky_document_path', (['"""#bluesky/start@abc"""'], {}), "('#bluesky/start@abc')\n", (151, 173), False, 'from suitcase.nxsas.utils import _parse_bluesky_document_path\n'), ((279, 329), 'suitcase.nxsas.utils._parse_bluesky_document_path', '_pa... |
# coding=utf-8
# Copyright 2022 Google LLC., LongT5 Authors and HuggingFace Inc. team.
#
# 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
#
# U... | [
"torch.nn.Dropout",
"torch.nn.Embedding",
"torch.empty",
"torch.cat",
"torch.nn.functional.dropout",
"torch.full",
"torch.arange",
"torch.nn.functional.pad",
"torch.ones",
"torch.nn.Linear",
"torch.zeros",
"math.log",
"torch.matmul",
"copy.deepcopy",
"torch.where",
"torch.nn.ModuleList... | [((2298, 2361), 'torch.nn.functional.pad', 'nn.functional.pad', (['x'], {'pad': 'pad', 'mode': '"""constant"""', 'value': 'pad_value'}), "(x, pad=pad, mode='constant', value=pad_value)\n", (2315, 2361), False, 'from torch import nn\n'), ((3668, 3731), 'torch.nn.functional.pad', 'nn.functional.pad', (['x'], {'pad': 'pad... |
"""
demo05_gridsearch.py 网格搜索
"""
import numpy as np
import sklearn.model_selection as ms
import sklearn.svm as svm
import sklearn.metrics as sm
import matplotlib.pyplot as mp
data = np.loadtxt('../ml_data/multiple2.txt',
delimiter=',', dtype='f8')
x = data[:, :-1]
y = data[:, -1]
# 选择svm做分类
train_x, test_x, train_... | [
"matplotlib.pyplot.title",
"sklearn.model_selection.GridSearchCV",
"matplotlib.pyplot.show",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.scatter",
"sklearn.metrics.classification_report",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.loadtxt",
"matplotlib.pyplot.pcolormesh",... | [((185, 250), 'numpy.loadtxt', 'np.loadtxt', (['"""../ml_data/multiple2.txt"""'], {'delimiter': '""","""', 'dtype': '"""f8"""'}), "('../ml_data/multiple2.txt', delimiter=',', dtype='f8')\n", (195, 250), True, 'import numpy as np\n'), ((338, 395), 'sklearn.model_selection.train_test_split', 'ms.train_test_split', (['x',... |