code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""Kafka topic configuration for Templatebot's own topics."""
import structlog
from confluent_kafka.admin import AdminClient, NewTopic
__all__ = ["configure_topics"]
def configure_topics(app):
"""Create Kafka topics for templatebot.
This function is generally called at app startup.
Parameters
----... | [
"confluent_kafka.admin.NewTopic",
"confluent_kafka.admin.AdminClient",
"structlog.get_logger"
] | [((805, 867), 'structlog.get_logger', 'structlog.get_logger', (["app['root']['api.lsst.codes/loggerName']"], {}), "(app['root']['api.lsst.codes/loggerName'])\n", (825, 867), False, 'import structlog\n'), ((949, 1021), 'confluent_kafka.admin.AdminClient', 'AdminClient', (["{'bootstrap.servers': app['root']['templatebot/... |
# -*- coding: utf-8 -*-
"""
Tests for neural spline flows.
"""
import numpy as np
import pytest
import torch
from glasflow.flows import CouplingNSF
@pytest.mark.parametrize("num_bins", [4, 10])
def test_coupling_nsf_init(num_bins):
"""Test the initialise method"""
CouplingNSF(2, 2, num_bins=num_bins)
@pyte... | [
"torch.randn",
"glasflow.flows.CouplingNSF",
"pytest.mark.parametrize",
"numpy.testing.assert_array_almost_equal",
"torch.no_grad"
] | [((152, 196), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""num_bins"""', '[4, 10]'], {}), "('num_bins', [4, 10])\n", (175, 196), False, 'import pytest\n'), ((276, 312), 'glasflow.flows.CouplingNSF', 'CouplingNSF', (['(2)', '(2)'], {'num_bins': 'num_bins'}), '(2, 2, num_bins=num_bins)\n', (287, 312), Fals... |
import numpy as np
import pandas as pd
import pytest
from locan import LocData
from locan.dependencies import HAS_DEPENDENCY
if HAS_DEPENDENCY["trackpy"]:
from trackpy import quiet as tp_quiet
from locan.data.tracking import link_locdata, track
pytestmark = pytest.mark.skipif(
not HAS_DEPENDENCY["track... | [
"pandas.DataFrame.from_dict",
"trackpy.quiet",
"pytest.fixture",
"pytest.mark.skipif",
"numpy.arange",
"locan.data.tracking.link_locdata",
"locan.data.tracking.track"
] | [((271, 347), 'pytest.mark.skipif', 'pytest.mark.skipif', (["(not HAS_DEPENDENCY['trackpy'])"], {'reason': '"""requires trackpy"""'}), "(not HAS_DEPENDENCY['trackpy'], reason='requires trackpy')\n", (289, 347), False, 'import pytest\n'), ((453, 469), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (467, 469), Fal... |
import os
from atbr_updater.parse_control_files import *
directory = 'test_files'
file_parameters = {}
i = 0
for file in os.listdir(directory):
file_path = os.path.join(directory, file)
current_file = Amber_Data(file_path)
file_parameters[i] = current_file.get_parameters()
i += 1
for key in file_par... | [
"os.path.join",
"os.listdir"
] | [((124, 145), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (134, 145), False, 'import os\n'), ((163, 192), 'os.path.join', 'os.path.join', (['directory', 'file'], {}), '(directory, file)\n', (175, 192), False, 'import os\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-09 02:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('books', '0004_person_birth_date'),
]
operations = [
migrations.AddField(
... | [
"django.db.models.ImageField",
"django.db.models.DateTimeField"
] | [((398, 468), 'django.db.models.ImageField', 'models.ImageField', ([], {'blank': '(True)', 'null': '(True)', 'upload_to': '"""author_headshots"""'}), "(blank=True, null=True, upload_to='author_headshots')\n", (415, 468), False, 'from django.db import migrations, models\n'), ((595, 638), 'django.db.models.DateTimeField'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2019. <NAME>
#
# This program 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 2 of the License, or
# (at your optio... | [
"geofinder.ArgumentParserNoExit.ArgumentParserNoExit",
"geofinder.GeoKeys.admin2_normalize",
"geofinder.GeoKeys.search_normalize",
"geofinder.GeoKeys.capwords",
"geofinder.GeoKeys.country_normalize",
"geofinder.GeoKeys.admin1_normalize",
"re.sub",
"logging.getLogger"
] | [((1611, 1638), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1628, 1638), False, 'import logging\n'), ((3474, 3525), 'geofinder.ArgumentParserNoExit.ArgumentParserNoExit', 'ArgumentParserNoExit', ([], {'description': '"""Parses command."""'}), "(description='Parses command.')\n", (3494... |
import time
try:
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
is_watch_install = True
except ImportError:
is_watch_install = False
def watch(action, path):
if not is_watch_install:
raise Exception(
"requires watchdog library\n"
... | [
"time.sleep",
"watchdog.observers.Observer"
] | [((558, 568), 'watchdog.observers.Observer', 'Observer', ([], {}), '()\n', (566, 568), False, 'from watchdog.observers import Observer\n'), ((663, 678), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (673, 678), False, 'import time\n')] |
import os
import logging
import glob
import yaml
import joblib
import numpy as np
from mathtools import utils
from kinemparse import airplanecorpus
logger = logging.getLogger(__name__)
def makeBinLabels(action_labels, part_idxs_to_bins, num_samples):
no_bin = part_idxs_to_bins[0] # 0 is the index of the null... | [
"numpy.full",
"mathtools.utils.copyFile",
"kinemparse.airplanecorpus.loadHandDetections",
"os.path.join",
"os.makedirs",
"kinemparse.airplanecorpus.loadParts",
"yaml.dump",
"os.path.exists",
"mathtools.utils.plot_array",
"numpy.isnan",
"kinemparse.airplanecorpus.loadLabels",
"mathtools.utils.p... | [((161, 188), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (178, 188), False, 'import logging\n'), ((343, 382), 'numpy.full', 'np.full', (['num_samples', 'no_bin'], {'dtype': 'int'}), '(num_samples, no_bin, dtype=int)\n', (350, 382), True, 'import numpy as np\n'), ((749, 788), 'os.path.... |
from django.urls import path
from . import views
urlpatterns = [
path('stockdata', views.getStockData, name='stockdata'),
] | [
"django.urls.path"
] | [((72, 127), 'django.urls.path', 'path', (['"""stockdata"""', 'views.getStockData'], {'name': '"""stockdata"""'}), "('stockdata', views.getStockData, name='stockdata')\n", (76, 127), False, 'from django.urls import path\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import psutil
from datetime import datetime
print('CPU信息')
print('CPU使用时间: ', psutil.cpu_times())
print('逻辑CPU数量: ', psutil.cpu_count())
print('物理CPU核心数: ', psutil.cpu_count(logical=False))
print('每核CPU使用率: ', psutil.cpu_percent(percpu=True))
print('\n内存信息')
... | [
"psutil.virtual_memory",
"psutil.pids",
"psutil.sensors_battery",
"psutil.net_if_stats",
"psutil.cpu_count",
"psutil.users",
"psutil.swap_memory",
"psutil.net_io_counters",
"psutil.disk_usage",
"psutil.net_connections",
"psutil.win_service_get",
"psutil.disk_partitions",
"psutil.win_service_... | [((326, 349), 'psutil.virtual_memory', 'psutil.virtual_memory', ([], {}), '()\n', (347, 349), False, 'import psutil\n'), ((146, 164), 'psutil.cpu_times', 'psutil.cpu_times', ([], {}), '()\n', (162, 164), False, 'import psutil\n'), ((185, 203), 'psutil.cpu_count', 'psutil.cpu_count', ([], {}), '()\n', (201, 203), False,... |
# -*- coding: utf8 -*-
import logging
import os
import sys
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
import zeeguu.core.word_stats
logger = logging.getLogger(__name__)
print(f"zeeguu.core initialized logger with name: {logger.name}")
logging.basicConfig(
stream=sys.stdout, forma... | [
"os.environ.get",
"logging.basicConfig",
"sentry_sdk.integrations.flask.FlaskIntegration",
"logging.getLogger"
] | [((176, 203), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (193, 203), False, 'import logging\n'), ((271, 371), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'format': '"""%(asctime)s %(levelname)s %(name)s %(message)s"""'}), "(stream=sys.stdout, format=\n ... |
from lib.pipelines.pipeline_params import HsvThresholdParams
import cv2
def run_hsv_threshold(image, hsv_params: HsvThresholdParams):
img_hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
if hsv_params.hue_inverted:
bottom_min = (0, hsv_params.s[0], hsv_params.v[0])
bottom_max = (hsv_params.h[0], ... | [
"cv2.cvtColor",
"cv2.inRange"
] | [((150, 188), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2HSV'], {}), '(image, cv2.COLOR_BGR2HSV)\n', (162, 188), False, 'import cv2\n'), ((515, 559), 'cv2.inRange', 'cv2.inRange', (['img_hsv', 'bottom_min', 'bottom_max'], {}), '(img_hsv, bottom_min, bottom_max)\n', (526, 559), False, 'import cv2\n'), ((5... |
"""Basic operations on ntuple dicts and track property dicts."""
from random import shuffle
from random import seed as set_seed
from copy import deepcopy
from functools import reduce
from math import inf
from warnings import warn
from numpy import cumsum
from numpy import array
from numpy import delete
from numpy impo... | [
"copy.deepcopy",
"random.shuffle",
"random.seed",
"numpy.array",
"functools.reduce"
] | [((2434, 2484), 'functools.reduce', 'reduce', (['add_two_track_prop_dicts', 'track_prop_dicts'], {}), '(add_two_track_prop_dicts, track_prop_dicts)\n', (2440, 2484), False, 'from functools import reduce\n'), ((6406, 6420), 'random.seed', 'set_seed', (['seed'], {}), '(seed)\n', (6414, 6420), True, 'from random import se... |
from typing import Generator, Callable, Tuple, List, Deque
from collections import deque
from datetime import datetime, timedelta
DEBUG: bool = False
TEST_RUNS: Tuple[Tuple[str]] = (
(
"ROB-15;SS2-10;NX8000-3",
"8:00:00",
"detail",
"glass",
"wood",
"apple",
... | [
"datetime.datetime.strptime",
"datetime.timedelta",
"collections.deque"
] | [((1785, 1792), 'collections.deque', 'deque', ([], {}), '()\n', (1790, 1792), False, 'from collections import deque\n'), ((953, 988), 'datetime.datetime.strptime', 'datetime.strptime', (['"""00:00:00"""', 'STRP'], {}), "('00:00:00', STRP)\n", (970, 988), False, 'from datetime import datetime, timedelta\n'), ((1222, 125... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 16 17:03:00 2018
@author: jumtsai
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
'''Import this part for using Tensor Board to visualizing each nodes in CNN.
'''
#DCNN's TensorFlow(G... | [
"tensorflow.nn.batch_normalization",
"os.remove",
"tensorflow.train.AdadeltaOptimizer",
"numpy.floor",
"tensorflow.reshape",
"astropy.io.fits.PrimaryHDU",
"logging.Formatter",
"tensorflow.ConfigProto",
"os.path.isfile",
"tensorflow.Variable",
"tensorflow.assign",
"tensorflow.nn.conv2d",
"ten... | [((659, 671), 'manager.GPUManager', 'GPUManager', ([], {}), '()\n', (669, 671), False, 'from manager import GPUManager\n'), ((991, 1083), 'logging.handlers.RotatingFileHandler', 'logging.handlers.RotatingFileHandler', (['LOG_FILE'], {'maxBytes': '(10 * 1024 * 1024)', 'backupCount': '(5)'}), '(LOG_FILE, maxBytes=10 * 10... |
"""
Polynomials
"""
from functools import reduce
from petlib.bn import Bn
class Polynomial:
"""
Class to work with polynomials with big numbers from library petlib.
Implemented with a very restricted usage in mind, so incomplete polinomial class for general use. This allows simple
operations of poly... | [
"itertools.combinations",
"petlib.bn.Bn.from_num",
"doctest.testmod"
] | [((11177, 11194), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (11192, 11194), False, 'import doctest\n'), ((4725, 4739), 'petlib.bn.Bn.from_num', 'Bn.from_num', (['(0)'], {}), '(0)\n', (4736, 4739), False, 'from petlib.bn import Bn\n'), ((10822, 10836), 'petlib.bn.Bn.from_num', 'Bn.from_num', (['(0)'], {}),... |
"""Station module handling /station/ API calls."""
import math
from pyopensprinkler.const import (
STATION_STATUS_IDLE,
STATION_STATUS_MANUAL,
STATION_STATUS_MASTER_ENGAGED,
STATION_STATUS_ONCE_PROGRAM,
STATION_STATUS_PROGRAM,
STATION_STATUS_WAITING,
STATION_TYPE_STANDARD,
)
class Statio... | [
"math.floor"
] | [((1956, 1983), 'math.floor', 'math.floor', (['(self._index / 8)'], {}), '(self._index / 8)\n', (1966, 1983), False, 'import math\n'), ((2289, 2316), 'math.floor', 'math.floor', (['(self._index / 8)'], {}), '(self._index / 8)\n', (2299, 2316), False, 'import math\n')] |
from bs4 import BeautifulSoup
import re
from scraper.web_scraper import WebScraper
class GameScraper(WebScraper):
def __init__(self, url, html_parser="html.parser", get_html_with_appid=False):
"""
Used to scrape a Steam game store page and get the appid if the games is free.
:param url:
... | [
"bs4.BeautifulSoup",
"re.compile"
] | [((452, 502), 're.compile', 're.compile', (['"""game_area_purchase_game free_weekend"""'], {}), "('game_area_purchase_game free_weekend')\n", (462, 502), False, 'import re\n'), ((528, 551), 're.compile', 're.compile', (['"""[0-9]{5,}"""'], {}), "('[0-9]{5,}')\n", (538, 551), False, 'import re\n'), ((793, 835), 'bs4.Bea... |
import functools
import itertools
import logging
import operator
import numpy as np
from qecsim import graphtools as gt
from qecsim.model import Decoder, cli_description
logger = logging.getLogger(__name__)
@cli_description('Converging MWPM ([factor] FLOAT >=0, ...)')
class PlanarCMWPMDecoder(Decoder):
"""
... | [
"qecsim.model.cli_description",
"operator.index",
"numpy.sum",
"numpy.zeros",
"numpy.errstate",
"qecsim.graphtools.mwpm",
"itertools.combinations",
"qecsim.graphtools.SimpleGraph",
"functools.lru_cache",
"logging.getLogger"
] | [((182, 209), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (199, 209), False, 'import logging\n'), ((213, 273), 'qecsim.model.cli_description', 'cli_description', (['"""Converging MWPM ([factor] FLOAT >=0, ...)"""'], {}), "('Converging MWPM ([factor] FLOAT >=0, ...)')\n", (228, 273), Fa... |
from __future__ import absolute_import, unicode_literals
"""
Cache middleware. If enabled, each Django-powered page will be cached based on
URL. The canonical way to enable cache middleware is to set
``UpdateCacheMiddleware`` as your first piece of middleware, and
``FetchFromCacheMiddleware`` as the last::
MIDDLEW... | [
"django.utils.cache.get_max_age",
"django.utils.cache.get_cache_key"
] | [((6406, 6427), 'django.utils.cache.get_max_age', 'get_max_age', (['response'], {}), '(response)\n', (6417, 6427), False, 'from django.utils.cache import get_cache_key, get_max_age\n'), ((8894, 8958), 'django.utils.cache.get_cache_key', 'get_cache_key', (['request', 'self.key_prefix', '"""GET"""'], {'cache': 'self.cach... |
from django.db import models
class Poll(models.Model):
id = models.AutoField(primary_key=True)
title = models.CharField(blank=True, null=True, max_length=255)
message = models.TextField(blank=True, null=True)
select = models.IntegerField(blank=True, null=True)
type = models.IntegerField(blank=True... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.IntegerField",
"django.db.models.DateField"
] | [((66, 100), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)'}), '(primary_key=True)\n', (82, 100), False, 'from django.db import models\n'), ((113, 168), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'null': '(True)', 'max_length': '(255)'}), '(blank=True, nu... |
from django.shortcuts import render, redirect
from django.conf import settings
from django.views.generic import TemplateView, ListView, DetailView
from django.views.decorators.clickjacking import xframe_options_exempt
from django.db.models import Max, Min
from django.core.cache import cache
from django.utils.text impor... | [
"django.db.models.Max",
"django.utils.decorators.method_decorator",
"json.loads",
"django.shortcuts.render",
"urllib.parse.urlencode",
"django.shortcuts.redirect",
"django.db.models.Min",
"django.core.cache.cache.clear",
"django.conf.settings.COMMITTEE_DESCRIPTIONS.get",
"datetime.date.today",
"... | [((694, 727), 'pytz.timezone', 'pytz.timezone', (['settings.TIME_ZONE'], {}), '(settings.TIME_ZONE)\n', (707, 727), False, 'import pytz\n'), ((7145, 7201), 'django.utils.decorators.method_decorator', 'method_decorator', (['xframe_options_exempt'], {'name': '"""dispatch"""'}), "(xframe_options_exempt, name='dispatch')\n... |
# Validates the submission for a task
# Requires python 3 and numpy
# Usage:
#
# <Python3 executable> validate.py [dir]
# [dir] - path to the submission files directory
# Submission track is detected by file extension
import os
import sys
from dialent.task1.util import loadAllTest as loadTask1
from ... | [
"os.listdir"
] | [((571, 592), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (581, 592), False, 'import os\n')] |
import streamlit as st
import pages.projetos.projeto01 as PageProjetos01
import pages.projetos.projeto02 as PageProjetos02
import pages.projetos.papers as papers
import pages.projetos.sprints as sprints
def home():
text01 = "<h1 style='text-align: center; line-height: 1.15'> Potencial de uso de biocarvões como co... | [
"streamlit.markdown"
] | [((396, 439), 'streamlit.markdown', 'st.markdown', (['text01'], {'unsafe_allow_html': '(True)'}), '(text01, unsafe_allow_html=True)\n', (407, 439), True, 'import streamlit as st\n'), ((641, 684), 'streamlit.markdown', 'st.markdown', (['text02'], {'unsafe_allow_html': '(True)'}), '(text02, unsafe_allow_html=True)\n', (6... |
import matplotlib
matplotlib.use('Agg')
import torch.optim as optim
import torch.nn as nn
import torch
import matplotlib.pyplot as plt
from neural_nets_library import training
from tree_to_sequence.program_datasets import *
from tree_to_sequence.translating_trees import *
from functools import partial
import argparse... | [
"argparse.ArgumentParser",
"neural_nets_library.training.test_model_tree_to_tree",
"torch.load",
"matplotlib.use",
"torch.cuda.set_device"
] | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((1219, 1244), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1242, 1244), False, 'import argparse\n'), ((1761, 1801), 'torch.cuda.set_device', 'torch.cuda.set_device', ([... |
from distutils.sysconfig import get_python_lib, get_config_vars
from site import getusersitepackages, USER_SITE
from argparse import ArgumentParser
from os.path import dirname, abspath
parser = ArgumentParser(description='Determine Python specific paths and extensions.')
subparsers = parser.add_subparsers(dest='actio... | [
"argparse.ArgumentParser",
"site.getusersitepackages",
"distutils.sysconfig.get_config_vars",
"os.path.dirname",
"distutils.sysconfig.get_python_lib"
] | [((195, 272), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Determine Python specific paths and extensions."""'}), "(description='Determine Python specific paths and extensions.')\n", (209, 272), False, 'from argparse import ArgumentParser\n'), ((987, 1008), 'site.getusersitepackages', 'getusers... |
from modeldata import ModelData, netcdf_to_dimension, netcdf_to_quantity, from_local_file
from modeldata import Dimension
from utilities import get_dir, get_ncfiles_in_dir, get_ncfiles_in_time_range
from utilities import get_variable_name, get_variable_name_reverse
import log
from netCDF4 import Dataset
from datetime i... | [
"netCDF4.Dataset",
"modeldata.netcdf_to_dimension",
"utilities.get_ncfiles_in_dir",
"modeldata.from_local_file",
"os.path.exists",
"utilities.get_ncfiles_in_time_range",
"modeldata.netcdf_to_quantity",
"datetime.datetime",
"modeldata.ModelData",
"log.info",
"datetime.datetime.strptime",
"numpy... | [((496, 525), 'utilities.get_ncfiles_in_dir', 'get_ncfiles_in_dir', (['input_dir'], {}), '(input_dir)\n', (514, 525), False, 'from utilities import get_dir, get_ncfiles_in_dir, get_ncfiles_in_time_range\n'), ((530, 589), 'log.info', 'log.info', (['log_file', 'f"""Loading data {input_dir}{ncfiles[0]}"""'], {}), "(log_fi... |
#Copyright 2014 University Corporation for Atmospheric Research (UCAR)
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required b... | [
"copy.deepcopy",
"datapump.request_helper.RequestHelper",
"lxml.etree.parse",
"StringIO.StringIO",
"logging.getLogger"
] | [((837, 864), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (854, 864), False, 'import logging\n'), ((1560, 1615), 'copy.deepcopy', 'copy.deepcopy', (["settings.ASN_RESOLVER_SETTINGS['PARAMS']"], {}), "(settings.ASN_RESOLVER_SETTINGS['PARAMS'])\n", (1573, 1615), False, 'import copy\n'), ... |
import pandas as pd
import numpy as np
import warnings
from cassandra.cluster import Cluster
from cassandra.auth import PlainTextAuthProvider
warnings.filterwarnings(action='ignore')
cloud_config={
'secure_connect_bundle':'secure-connect-adult-census-income-prediction.zip'
}
client_id='eqGJcMRfbvJCggwzlZFrFuar'
cli... | [
"cassandra.auth.PlainTextAuthProvider",
"cassandra.cluster.Cluster",
"warnings.filterwarnings"
] | [((142, 182), 'warnings.filterwarnings', 'warnings.filterwarnings', ([], {'action': '"""ignore"""'}), "(action='ignore')\n", (165, 182), False, 'import warnings\n'), ((353, 400), 'cassandra.auth.PlainTextAuthProvider', 'PlainTextAuthProvider', (['client_id', 'client_secret'], {}), '(client_id, client_secret)\n', (374, ... |
# -*- coding: utf-8 -*-
"""Untitled1.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1E7m0EoAUNm8hn-rtemotVovsJVUjqLhS
"""
from torchvision.transforms import Normalize
import skimage.io
from skimage.transform import resize
import glob
from sklear... | [
"matplotlib.pyplot.title",
"torch.optim.lr_scheduler.StepLR",
"torch.cat",
"matplotlib.pyplot.figure",
"glob.glob",
"torch.device",
"torchvision.transforms.Normalize",
"torch.no_grad",
"torch.nn.BCELoss",
"torch.utils.data.DataLoader",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"mat... | [((1434, 1491), 'torchvision.datasets.ImageFolder', 'datasets.ImageFolder', (['data_train_dir'], {'transform': 'transform'}), '(data_train_dir, transform=transform)\n', (1454, 1491), False, 'from torchvision import datasets\n'), ((1508, 1565), 'torchvision.datasets.ImageFolder', 'datasets.ImageFolder', (['data_valid_di... |
from flask import current_app, jsonify, request, Response
from flask.views import View
from sqlalchemy.orm import joinedload
from zeus import auth
from zeus.api.resources.base import ApiHelpers
from zeus.config import nplusone
from zeus.constants import Permission
from zeus.exceptions import ApiError
from zeus.models ... | [
"flask.request.method.lower",
"flask.current_app.logger.warn",
"zeus.config.nplusone.ignore",
"sqlalchemy.orm.joinedload",
"flask.jsonify",
"zeus.auth.RepositoryTenant",
"zeus.models.Hook.query.unrestricted_unsafe",
"flask.current_app.logger.info"
] | [((530, 588), 'flask.current_app.logger.info', 'current_app.logger.info', (['"""received webhook id=%s"""', 'hook_id'], {}), "('received webhook id=%s', hook_id)\n", (553, 588), False, 'from flask import current_app, jsonify, request, Response\n'), ((1939, 1955), 'flask.jsonify', 'jsonify', (['context'], {}), '(context... |
import binascii
import struct
def unpack_half_float(float16):
# A function useful to read half-float (used in the uv coords), not supported by the struct module
# http://davidejones.com/blog/1413-python-precision-floating-point/
# TODO: check limitations on the input and raise exceptions
# http://rea... | [
"binascii.hexlify",
"struct.pack"
] | [((1410, 1436), 'struct.pack', 'struct.pack', (['""">f"""', 'float32'], {}), "('>f', float32)\n", (1421, 1436), False, 'import struct\n'), ((1445, 1464), 'binascii.hexlify', 'binascii.hexlify', (['a'], {}), '(a)\n', (1461, 1464), False, 'import binascii\n'), ((1109, 1136), 'struct.pack', 'struct.pack', (['"""I"""', 'sh... |
import configparser
config = configparser.ConfigParser()
config.read("./config.ini")
## Config helper
def configSectionMap(section):
dict1 = dict(config.items(section))
return dict1 | [
"configparser.ConfigParser"
] | [((30, 57), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (55, 57), False, 'import configparser\n')] |
import datetime
import random
from django.db import models
from django.conf import settings
from django.core.exceptions import ValidationError
from django.template.loader import render_to_string
from django.urls import reverse
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_... | [
"django.db.models.TextField",
"random.randint",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"register.models.Registration.objects.filter",
"django.template.loader.render_to_string",
"django.urls.reverse",
"django.db.models.IntegerField",
"polling_reports.models.StaffPhone.objects.va... | [((1598, 1630), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (1614, 1630), False, 'from django.db import models\n'), ((1649, 1677), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)'}), '(blank=True)\n', (1665, 1677), False, 'from django.d... |
import csv
import datetime
import io
import urllib.request, urllib.parse, urllib.error
import master_search_file
import pycurl
import configparser
from optparse import OptionParser
import traceback
def search_splunk_verbose(search_string):
results = search_splunk(search_string)
print("START======================... | [
"io.BytesIO",
"traceback.print_exc",
"optparse.OptionParser",
"datetime.datetime.utcnow",
"master_search_file.print_file_searches",
"pycurl.Curl",
"configparser.ConfigParser"
] | [((652, 679), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (677, 679), False, 'import configparser\n'), ((1728, 1742), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (1740, 1742), False, 'from optparse import OptionParser\n'), ((1145, 1157), 'io.BytesIO', 'io.BytesIO', ([], {}... |
import os
import unittest
from importlib import import_module
from elasticsearch import Elasticsearch, NotFoundError
from tests.module.blueprints.config import LOCAL_ELASTICSEARCH
from os_package_registry import PackageRegistry
module = import_module('conductor.blueprints.search.controllers')
PACKAGES_INDEX_NAME = ... | [
"os.environ.get",
"elasticsearch.Elasticsearch",
"os_package_registry.PackageRegistry",
"importlib.import_module"
] | [((240, 296), 'importlib.import_module', 'import_module', (['"""conductor.blueprints.search.controllers"""'], {}), "('conductor.blueprints.search.controllers')\n", (253, 296), False, 'from importlib import import_module\n'), ((320, 380), 'os.environ.get', 'os.environ.get', (['"""OS_ES_PACKAGES_INDEX_NAME"""', '"""test_... |
from cgl.data.collect_test_json import main
from typing import Optional
import torch
import torch.nn as nn
import torch.functional as F
from torch import Tensor
from torch_geometric.nn import MessagePassing
from torch_geometric.nn import SAGEConv
from torch_geometric.nn.pool import sag_pool
from torch_geometric.datas... | [
"pytorch_lightning.Trainer",
"torch_geometric.datasets.Planetoid",
"pytorch_lightning.seed_everything",
"torch.functional.normalize",
"torch.nn.CrossEntropyLoss",
"torch_geometric.data.dataloader.DataLoader",
"torch.nn.Linear",
"torch.nn.matmul"
] | [((4091, 4152), 'torch_geometric.datasets.Planetoid', 'Planetoid', ([], {'root': '"""/store/nosnap/datasets/gnn_tut"""', 'name': '"""Cora"""'}), "(root='/store/nosnap/datasets/gnn_tut', name='Cora')\n", (4100, 4152), False, 'from torch_geometric.datasets import Planetoid\n'), ((4190, 4209), 'torch_geometric.data.datalo... |
# -*- encoding: utf-8 -*-
# @File : mp4Book.py
# @Time : 2020/5/12 22:05
# @Author : 一叶星羽
# @Email : <EMAIL>
# @Software: PyCharm
import time
import requests
import re
from lxml import etree
from json.decoder import JSONDecodeError
def searchNovel(novelInfo):
novelInfo = str(novelInfo.encode("gb2312")).... | [
"re.findall",
"lxml.etree.HTML",
"requests.get",
"time.sleep"
] | [((617, 650), 'requests.get', 'requests.get', (['url'], {'headers': 'header'}), '(url, headers=header)\n', (629, 650), False, 'import requests\n'), ((696, 721), 'lxml.etree.HTML', 'etree.HTML', (['response.text'], {}), '(response.text)\n', (706, 721), False, 'from lxml import etree\n'), ((1615, 1637), 'requests.get', '... |
#By <NAME>
print("此程序由王浩龙制作\n\n")
import Modulars.Subject as su
import threading as th
import time
word = ''
catalog={}
catalog['语文'] = su.Sunject('语文')
catalog['数学'] = su.Sunject('数学')
catalog['英语'] = su.Sunject('英语')
catalog['物理'] = su.Sunject('物理')
catalog['化学'] = su.Sunject('化学')
catalog['生物'] = su.Sunject('生物')
ca... | [
"threading.Thread",
"Modulars.Subject.Sunject",
"time.sleep"
] | [((140, 156), 'Modulars.Subject.Sunject', 'su.Sunject', (['"""语文"""'], {}), "('语文')\n", (150, 156), True, 'import Modulars.Subject as su\n'), ((173, 189), 'Modulars.Subject.Sunject', 'su.Sunject', (['"""数学"""'], {}), "('数学')\n", (183, 189), True, 'import Modulars.Subject as su\n'), ((206, 222), 'Modulars.Subject.Sunjec... |
from functools import wraps
def val_checker(valid_func):
def _checker(func):
@wraps(func)
def valid(param):
if isinstance(param, valid_func) and param >= 0:
return func(param)
raise ValueError(f'wrong val {param}')
return valid
return _checker
... | [
"functools.wraps"
] | [((92, 103), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (97, 103), False, 'from functools import wraps\n')] |
#!/usr/bin/python
#
# CVEs: CVE-2016-6210 (Credits for this go to <NAME>)
#
# Author: 0_o -- null_null
# nu11.nu11 [at] yahoo.com
# Oh, and it is n-u-one-one.n-u-one-one, no l's...
# Wonder how the guys at packet... | [
"sys.stdout.write",
"paramiko.SSHClient",
"argparse.ArgumentParser",
"time.clock",
"numpy.array",
"sys.stdout.flush",
"paramiko.AutoAddPolicy",
"sys.exit"
] | [((1074, 1099), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1097, 1099), False, 'import argparse\n'), ((2395, 2415), 'paramiko.SSHClient', 'paramiko.SSHClient', ([], {}), '()\n', (2413, 2415), False, 'import paramiko\n'), ((2814, 2834), 'paramiko.SSHClient', 'paramiko.SSHClient', ([], {}), ... |
import Rate_calculation
#import constants as ct
from mpmath import mp
from mpmath import fp
import numpy as np
import scipy.integrate as spint
import time
methods=["mp-gl", "mp-ts", "fp-gl", "fp-ts", "sp-quad", "sp-gauss", "monte-carlo", "w-cumsum", "sp-simps", "romberg"];
#cumtrapz relative error tolerance
err_rel=... | [
"numpy.meshgrid",
"numpy.abs",
"mpmath.mp.quad",
"scipy.integrate.quad",
"mpmath.fp.quad",
"numpy.ndim",
"scipy.integrate.tplquad",
"time.time",
"numpy.max",
"numpy.min",
"numpy.arange",
"scipy.integrate.dblquad",
"numpy.random.rand",
"scipy.integrate.simps"
] | [((14219, 14230), 'time.time', 'time.time', ([], {}), '()\n', (14228, 14230), False, 'import time\n'), ((595, 648), 'mpmath.mp.quad', 'mp.quad', (['f', 'limx', 'limy', 'limz'], {'method': '"""gauss-legendre"""'}), "(f, limx, limy, limz, method='gauss-legendre')\n", (602, 648), False, 'from mpmath import mp\n'), ((711, ... |
# -*- coding: utf-8 -*-
from pyramid import session
from pyramid import view
from pyramid import httpexceptions
from elasticsearch import helpers as es_helpers
from h.api import nipsa
from h.api import storage
from h.i18n import TranslationString as _
from h import accounts
from h import models
from h import paginato... | [
"h.models.Feature.all",
"h.api.nipsa.index",
"h.models.Group.created_by",
"h.api.nipsa.remove_nipsa",
"h.models.Blocklist.get_by_uri",
"pyramid.view.view_config",
"h.models.User.get_by_username",
"h.accounts.make_staff",
"h.models.Group.created.desc",
"h.api.nipsa.add_nipsa",
"h.models.Blocklist... | [((391, 534), 'pyramid.view.view_config', 'view.view_config', ([], {'route_name': '"""admin_index"""', 'request_method': '"""GET"""', 'renderer': '"""h:templates/admin/index.html.jinja2"""', 'permission': '"""admin_index"""'}), "(route_name='admin_index', request_method='GET', renderer=\n 'h:templates/admin/index.ht... |
import torch
pthfile = r'/data1/master1/MSDNet-PyTorch/cifar100_anytime_result/flops.pth'
net = torch.load(pthfile)
print(net) | [
"torch.load"
] | [((98, 117), 'torch.load', 'torch.load', (['pthfile'], {}), '(pthfile)\n', (108, 117), False, 'import torch\n')] |
# audiotrackmanager -- generates audio tracks from midi file and provides
# several transformations on it (e.g. instrument
# postprocessing and mixdown
#
# author: Dr. <NAME>, 2006 - 2018
#====================
# IMPORTS
#====================
from numbers import Number
import ... | [
"basemodules.ttbase.iif2",
"wave.open",
"basemodules.stringutil.tokenize",
"basemodules.stringutil.splitAndStrip",
"basemodules.typesupport.isString",
"struct.unpack",
"basemodules.operatingsystem.OperatingSystem.showMessageOnConsole",
"struct.pack",
"re.escape",
"basemodules.operatingsystem.Opera... | [((2291, 2357), 'basemodules.simplelogging.Logging.trace', 'Logging.trace', (['""">>: file = %r, factor = %4.3f"""', 'file', 'volumeFactor'], {}), "('>>: file = %r, factor = %4.3f', file, volumeFactor)\n", (2304, 2357), False, 'from basemodules.simplelogging import Logging\n'), ((2653, 2672), 'basemodules.simplelogging... |
from operator import attrgetter
from math import sin, cos
class cached_property(object):
""" A property that is only computed once per instance and then replaces
itself with an ordinary attribute. Deleting the attribute resets the
property.
Source: https://github.com/bottlepy/bottle/commit... | [
"operator.attrgetter",
"math.cos",
"math.sin"
] | [((4999, 5009), 'math.sin', 'sin', (['theta'], {}), '(theta)\n', (5002, 5009), False, 'from math import sin, cos\n'), ((5022, 5032), 'math.cos', 'cos', (['theta'], {}), '(theta)\n', (5025, 5032), False, 'from math import sin, cos\n'), ((2603, 2637), 'operator.attrgetter', 'attrgetter', (["('dimensions.%s' % name)"], {}... |
from requests.exceptions import SSLError
responses = [SSLError('Certificate verification failed')]
| [
"requests.exceptions.SSLError"
] | [((55, 98), 'requests.exceptions.SSLError', 'SSLError', (['"""Certificate verification failed"""'], {}), "('Certificate verification failed')\n", (63, 98), False, 'from requests.exceptions import SSLError\n')] |
from os.path import dirname
from pathlib import Path
import warnings
from dataclasses import dataclass, asdict
from json import dump, load
from collections import defaultdict
from .util import tr_lower, normalize_tokenizer_name
from .token import Token
@dataclass
class Entry:
id: int
word: str
df: int
... | [
"json.load",
"os.path.dirname",
"collections.defaultdict",
"warnings.warn",
"dataclasses.asdict"
] | [((918, 934), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (929, 934), False, 'from collections import defaultdict\n'), ((977, 993), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (988, 993), False, 'from collections import defaultdict\n'), ((2516, 2645), 'warnings.warn', 'wa... |
from ugecko import uGecko
gecko = uGecko("192.168.1.57")
gecko.connect()
gecko.call(gecko.getSymbol("coreinit.rpl", "OSShutdown"), 1)
gecko.disconnect()
print("Done.") | [
"ugecko.uGecko"
] | [((35, 57), 'ugecko.uGecko', 'uGecko', (['"""192.168.1.57"""'], {}), "('192.168.1.57')\n", (41, 57), False, 'from ugecko import uGecko\n')] |
# https://leetcode.com/problems/longest-increasing-subsequence/discuss/667975/Python-3-Lines-dp-with-binary-search-explained
from bisect import bisect_left
class Solution:
def lengthOfLIS(self, nums):
dp = []
for elem in nums:
ind = bisect_left(dp, elem)
if ind == len(dp):
... | [
"bisect.bisect_left"
] | [((265, 286), 'bisect.bisect_left', 'bisect_left', (['dp', 'elem'], {}), '(dp, elem)\n', (276, 286), False, 'from bisect import bisect_left\n'), ((545, 566), 'bisect.bisect_left', 'bisect_left', (['dp', 'elem'], {}), '(dp, elem)\n', (556, 566), False, 'from bisect import bisect_left\n')] |
# coding: utf-8
"""
Mailchimp Marketing API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 3.0.74
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import... | [
"six.iteritems"
] | [((5734, 5767), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (5747, 5767), False, 'import six\n')] |
# code taken from http://scikit-learn.org/stable/auto_examples/model_selection/plot_confusion_matrix.html
import numpy as np
import matplotlib.pyplot as plt
import os
def plotConfusionMatrix(cm, lsGenres, path, title = 'Confusion matrix',
cmap = plt.cm.Blues):
""" Given a confusion matrix and the correspo... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.close",
"matplotlib.pyplot.yticks",
"os.path.dirname",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.... | [((463, 475), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (473, 475), True, 'import matplotlib.pyplot as plt\n'), ((481, 531), 'matplotlib.pyplot.imshow', 'plt.imshow', (['cm'], {'interpolation': '"""nearest"""', 'cmap': 'cmap'}), "(cm, interpolation='nearest', cmap=cmap)\n", (491, 531), True, 'import m... |
#
# This utility is to generate the bar chart of FLANNEL vs Patched FLANNEL Covid-19 scores
# Make sure results_home and measure_detail* file names are adjusted accordingly while running this util.
# results_home - line 12
# measure_detail* files in create_f1df function
#
import pandas as pd
import numpy... | [
"pandas.DataFrame",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"pandas.read_csv",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.Rectangle",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xticks"
] | [((1094, 1135), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'types', 'index': "['f1']"}), "(columns=types, index=['f1'])\n", (1106, 1135), True, 'import pandas as pd\n'), ((1583, 1626), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'types', 'index': 'cv_index'}), '(columns=types, index=cv_index)\n', (15... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"jax.experimental.stax.BatchNorm",
"jax.experimental.stax.GeneralConv",
"jax.random.PRNGKey",
"jax.lax.psum",
"jax.tree_util.tree_unflatten",
"jax.tree_util.tree_map",
"jax.experimental.stax.parallel",
"jax.numpy.argmax",
"jax.experimental.stax.FanOut",
"numpy.random.RandomState",
"jax.experimen... | [((1615, 1642), 'ctypes.CDLL', 'ctypes.CDLL', (['"""libcudart.so"""'], {}), "('libcudart.so')\n", (1626, 1642), False, 'import ctypes\n'), ((2767, 2798), 'jax.experimental.stax.shape_dependent', 'stax.shape_dependent', (['make_main'], {}), '(make_main)\n', (2787, 2798), False, 'from jax.experimental import stax\n'), ((... |
# Copyright (c) 2020 <NAME>
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
from bq_test_kit.interpolators.jinja_interpolator import JinjaInterpolator
def test_interpolate():
ji = JinjaInterpolator({"LOCAL_KEY": "VALUE"})
result = ji.interpolate("Local key has value... | [
"bq_test_kit.interpolators.jinja_interpolator.JinjaInterpolator"
] | [((230, 271), 'bq_test_kit.interpolators.jinja_interpolator.JinjaInterpolator', 'JinjaInterpolator', (["{'LOCAL_KEY': 'VALUE'}"], {}), "({'LOCAL_KEY': 'VALUE'})\n", (247, 271), False, 'from bq_test_kit.interpolators.jinja_interpolator import JinjaInterpolator\n'), ((581, 600), 'bq_test_kit.interpolators.jinja_interpola... |
import os
from math import *
import numpy as np
from scipy import misc
from scipy.ndimage import gaussian_filter
import cv2
def reviseImage():
img_names = [
"1.jpeg", "2.jpeg", "3.jpeg", "dark.jpeg", "overexposure.jpeg"
]
for filename in img_names:
fn = "./img_data/cutted/" + filename
... | [
"cv2.equalizeHist",
"cv2.imwrite",
"numpy.empty",
"numpy.zeros",
"numpy.clip",
"cv2.fastNlMeansDenoising",
"cv2.imread",
"cv2.LUT",
"numpy.random.normal",
"cv2.normalize",
"os.listdir",
"cv2.resize"
] | [((559, 580), 'os.listdir', 'os.listdir', (['"""./part1"""'], {}), "('./part1')\n", (569, 580), False, 'import os\n'), ((2020, 2041), 'os.listdir', 'os.listdir', (['"""./part3"""'], {}), "('./part3')\n", (2030, 2041), False, 'import os\n'), ((332, 368), 'cv2.imread', 'cv2.imread', (['fn', 'cv2.IMREAD_GRAYSCALE'], {}), ... |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import json
import sys
import re
from typing import Any
from watchdog.utils import BaseThread
from mypytools.config import config
from mypytools.server.mypy_file_cache import MypyFileCache
if sys.version_inf... | [
"BaseHTTPServer.HTTPServer",
"json.dumps",
"re.compile"
] | [((543, 588), 're.compile', 're.compile', (['"""^/file/([0-9a-f]+)/([0-9a-f]+)$"""'], {}), "('^/file/([0-9a-f]+)/([0-9a-f]+)$')\n", (553, 588), False, 'import re\n'), ((1372, 1402), 'json.dumps', 'json.dumps', (["{'output': output}"], {}), "({'output': output})\n", (1382, 1402), False, 'import json\n'), ((1937, 1987), ... |
# -*- coding: utf-8 -*-
import cv2
import os
def Edge_Extract():
img_root = '/home/src_unet/data_5fold_edge/test_96_4/label/'
edge_root = img_root
count = 0
for name in os.listdir(img_root):
image_name = name[0:-9]
image_path = img_root+name
img = cv2.imread(image_path,0)
... | [
"cv2.imread",
"cv2.Canny",
"os.listdir",
"cv2.imwrite"
] | [((189, 209), 'os.listdir', 'os.listdir', (['img_root'], {}), '(img_root)\n', (199, 209), False, 'import os\n'), ((292, 317), 'cv2.imread', 'cv2.imread', (['image_path', '(0)'], {}), '(image_path, 0)\n', (302, 317), False, 'import cv2\n'), ((360, 383), 'cv2.Canny', 'cv2.Canny', (['img', '(30)', '(100)'], {}), '(img, 30... |
'''
Author:
<NAME> <<EMAIL>>
<NAME> <<EMAIL>>
'''
import numpy as np
class Perceptron:
def __init__(self, datapoints, no_of_inputs, threshold=1000, learning_rate=0.0001, isPocket = False):
self.threshold = threshold
self.learning_rate = learning_rate
self.weights = np.random.... | [
"numpy.dot",
"numpy.genfromtxt",
"numpy.random.normal"
] | [((2356, 2394), 'numpy.genfromtxt', 'np.genfromtxt', (['filename'], {'delimiter': '""","""'}), "(filename, delimiter=',')\n", (2369, 2394), True, 'import numpy as np\n'), ((310, 352), 'numpy.random.normal', 'np.random.normal', (['(0)', '(0.1)', '(no_of_inputs + 1)'], {}), '(0, 0.1, no_of_inputs + 1)\n', (326, 352), Tru... |
# Generated by Django 3.1.3 on 2020-12-02 19:59
from django.conf import settings
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('forum', '0004_auto_20201201_... | [
"django.db.models.CharField",
"django.db.models.IntegerField",
"django.db.migrations.swappable_dependency",
"django.db.models.ManyToManyField"
] | [((223, 280), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (254, 280), False, 'from django.db import migrations, models\n'), ((470, 500), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(1)'}... |
from common.scripts.cleaning import map_priority
def test_map_priority():
raw_input_1 = "0"
output_1 = map_priority(raw_input_1)
assert output_1 == "routine"
raw_input_2 = 0
output_2 = map_priority(raw_input_2)
assert output_2 == "routine"
raw_input_3 = "1"
output_3 = map_priority(r... | [
"common.scripts.cleaning.map_priority"
] | [((114, 139), 'common.scripts.cleaning.map_priority', 'map_priority', (['raw_input_1'], {}), '(raw_input_1)\n', (126, 139), False, 'from common.scripts.cleaning import map_priority\n'), ((209, 234), 'common.scripts.cleaning.map_priority', 'map_priority', (['raw_input_2'], {}), '(raw_input_2)\n', (221, 234), False, 'fro... |
import numba
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
import strax
export, __all__ = strax.exporter(export_self=True)
def init_spe_scaling_factor_distributions(file):
# Extract the spe pdf from a csv file into a pandas dataframe
spe_shapes = pd.read_csv(file)
# Creat... | [
"numpy.zeros_like",
"numpy.sum",
"pandas.read_csv",
"numba.int32",
"numpy.cumsum",
"scipy.interpolate.interp1d",
"numpy.linspace",
"strax.exporter"
] | [((123, 155), 'strax.exporter', 'strax.exporter', ([], {'export_self': '(True)'}), '(export_self=True)\n', (137, 155), False, 'import strax\n'), ((290, 307), 'pandas.read_csv', 'pd.read_csv', (['file'], {}), '(file)\n', (301, 307), True, 'import pandas as pd\n'), ((1205, 1277), 'numba.int32', 'numba.int32', (['numba.in... |
import os
import sys
import threading
import time
def start_debugger(port: int):
host = os.getenv("PYTHON_DEBUG_HOST", default="localhost")
port = int(os.getenv("PYTHON_DEBUG_PORT", default=str(port)))
t = threading.Thread(target=__start_debugger, args=(host, port))
t.daemon = True
t.start()
def... | [
"threading.Thread",
"pydevd_pycharm.settrace",
"os.getenv",
"time.sleep"
] | [((94, 145), 'os.getenv', 'os.getenv', (['"""PYTHON_DEBUG_HOST"""'], {'default': '"""localhost"""'}), "('PYTHON_DEBUG_HOST', default='localhost')\n", (103, 145), False, 'import os\n'), ((220, 280), 'threading.Thread', 'threading.Thread', ([], {'target': '__start_debugger', 'args': '(host, port)'}), '(target=__start_deb... |
import os
import sys
import argparse
import urllib.request
import time
import shutil
from distutils.version import StrictVersion
from copy import deepcopy
from datetime import datetime
import yaml
DC_TEMPLATE = "./templates/docker-compose-template.yml"
DC_MAIN_FILE = "docker-compose.yml"
GC_BUCKET_API_URL = "https:/... | [
"copy.deepcopy",
"argparse.ArgumentParser",
"datetime.datetime.today",
"yaml.dump",
"os.path.isfile",
"yaml.safe_load",
"shutil.move",
"os.getenv",
"sys.exit"
] | [((636, 647), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (644, 647), False, 'import sys\n'), ((1191, 1289), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate docker complose for running spinnaker locally"""'}), "(description=\n 'Generate docker complose for running spinnake... |
import inspect
from django.core.management import BaseCommand
import inflection as inflection
from fedoralink.indexer import MULTI_LANG
from fedoralink.manager import FedoraManager
from fedoralink.models import FedoraObject
from fedoralink.type_manager import FedoraTypeManager
import logging
logging.basicConfig(level=... | [
"fedoralink.manager.FedoraManager.get_manager",
"importlib.import_module",
"logging.basicConfig",
"fedoralink.type_manager.FedoraTypeManager.populate",
"fedoralink.indexer.MULTI_LANG.issubset",
"fedoralink.type_manager.FedoraTypeManager.get_model_class",
"inspect.getmro",
"logging.getLogger"
] | [((294, 334), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (313, 334), False, 'import logging\n'), ((341, 385), 'logging.getLogger', 'logging.getLogger', (['"""config_repository_index"""'], {}), "('config_repository_index')\n", (358, 385), False, 'import log... |
import setuptools
# Build Author list
authors = {
"<NAME>": "<EMAIL>",
"<NAME>": "<EMAIL>",
"<NAME>": "<EMAIL>",
}
AUTHOR = ""
for i, (k, v) in enumerate(authors.items()):
if i > 0:
AUTHOR += ", "
AUTHOR += f"{k} <{v}>"
with open("README.md", "r", encoding="utf-8") as fh:
long_descrip... | [
"setuptools.find_packages"
] | [((930, 967), 'setuptools.find_packages', 'setuptools.find_packages', ([], {'where': '"""src"""'}), "(where='src')\n", (954, 967), False, 'import setuptools\n')] |
from discord.ext import commands
import discord
from resources import checks
from resources import colours
from discord.ext.commands import cooldown, BucketType
from resources import support
class command(commands.Cog, name="help"):
def __init__(self, client):
self.client = client
@checks.log... | [
"discord.ext.commands.command",
"discord.Embed",
"resources.checks.default",
"discord.ext.commands.cooldown",
"resources.checks.log"
] | [((310, 322), 'resources.checks.log', 'checks.log', ([], {}), '()\n', (320, 322), False, 'from resources import checks\n'), ((329, 345), 'resources.checks.default', 'checks.default', ([], {}), '()\n', (343, 345), False, 'from resources import checks\n'), ((352, 398), 'discord.ext.commands.cooldown', 'cooldown', (['(1)'... |
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
from sklearn.model_selection import GridSearchCV
from sklearn.neighbors import KNeighborsClassifier
class GlobalSurrogateTree:
def __init__(self, x, y, feature_names, task):
self.feature_names = feature_names
if task=='classific... | [
"sklearn.model_selection.GridSearchCV",
"sklearn.neighbors.KNeighborsClassifier",
"sklearn.tree.DecisionTreeRegressor",
"sklearn.tree.DecisionTreeClassifier"
] | [((2826, 2924), 'sklearn.neighbors.KNeighborsClassifier', 'KNeighborsClassifier', ([], {'n_neighbors': 'self.neighbours', 'weights': '"""distance"""', 'metric': '"""minkowski"""', 'p': '(2)'}), "(n_neighbors=self.neighbours, weights='distance',\n metric='minkowski', p=2)\n", (2846, 2924), False, 'from sklearn.neighb... |
"""Command line entrypoint for flatware."""
import sys
import argparse
from flatware.template_reading import make_argparse_from_template
from flatware.template_loading import load_template
from flatware.template_loading import get_avaliable_template_names
from flatware.template_rendering import render_template
def ... | [
"argparse.ArgumentParser",
"flatware.template_rendering.render_template",
"flatware.template_loading.load_template",
"flatware.template_reading.make_argparse_from_template",
"flatware.template_loading.get_avaliable_template_names",
"sys.exit"
] | [((398, 522), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Flatware is an application for reading and using single-file templates called \'plates\'."""'], {}), '(\n "Flatware is an application for reading and using single-file templates called \'plates\'."\n )\n', (421, 522), False, 'import argpars... |
# Task 1 - The greatest number
import random
number_list = [random.randint(1,100)]
list_length = len(number_list)
while list_length < 9:
list_length = len(number_list)
number_list.append(random.randint(1,100))
print(number_list)
print(f"The biggest number in the list are {max(number_list)}")
# Task 2 - Exclusi... | [
"random.randint"
] | [((60, 82), 'random.randint', 'random.randint', (['(1)', '(100)'], {}), '(1, 100)\n', (74, 82), False, 'import random\n'), ((349, 370), 'random.randint', 'random.randint', (['(1)', '(50)'], {}), '(1, 50)\n', (363, 370), False, 'import random\n'), ((381, 402), 'random.randint', 'random.randint', (['(1)', '(50)'], {}), '... |
import re
import os
import sys
import pandas as pd
import bibtexparser as btp
import argparse
PATTERN = "(?:(?P<name1>[^0-9\s\(\),]+)|(?P<name2>[^0-9\s\(\)]+)(?:\set\sal[.]*)|(?P<name3>[^0-9\s\(\)]+)(?:\s&\s[^\s\(\)]+))\s(?P<year>\d{4})"
def find_matches(text, pattern=PATTERN, bib=None):
"""Finds citations in te... | [
"pandas.DataFrame",
"argparse.ArgumentParser",
"re.finditer",
"bibtexparser.load",
"re.match",
"os.path.isfile",
"os.path.splitext"
] | [((1766, 1792), 're.finditer', 're.finditer', (['pattern', 'text'], {}), '(pattern, text)\n', (1777, 1792), False, 'import re\n'), ((2861, 2878), 'pandas.DataFrame', 'pd.DataFrame', (['out'], {}), '(out)\n', (2873, 2878), True, 'import pandas as pd\n'), ((3811, 3835), 're.finditer', 're.finditer', (['pat', 'in_str'], {... |
# Copyright (c) 2020 <NAME>. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This file is part of the "CPU-RAM usage monitor bar"
"""The main module. The module builds the GUI and application events."""
import tkinter as tk
from tkinter impo... | [
"tkinter.ttk.Label",
"tkinter.Tk.__init__",
"process.CpuBar",
"tkinter.ttk.Progressbar",
"tkinter.ttk.Combobox",
"tkinter.ttk.Button",
"sys.exit",
"tkinter.ttk.LabelFrame"
] | [((540, 560), 'tkinter.Tk.__init__', 'tk.Tk.__init__', (['self'], {}), '(self)\n', (554, 560), True, 'import tkinter as tk\n'), ((781, 789), 'process.CpuBar', 'CpuBar', ([], {}), '()\n', (787, 789), False, 'from process import CpuBar\n'), ((1058, 1110), 'tkinter.ttk.Button', 'ttk.Button', (['self'], {'text': '"""Exit""... |
import io
import json
import os
import sys
def save(path, data_str, mode='w'):
path = ensureAbsPath(path)
try:
with io.open(path, mode, encoding='utf-8') as f:
f.write(str(data_str))
except IOError:
directory = os.path.dirname(path)
if not os.path.isdir(directory):
... | [
"os.path.isabs",
"json.load",
"os.path.abspath",
"json.loads",
"os.makedirs",
"os.path.isdir",
"os.path.dirname",
"json.dumps",
"io.open"
] | [((1571, 1590), 'json.load', 'json.load', (['jsonFile'], {}), '(jsonFile)\n', (1580, 1590), False, 'import json\n'), ((1018, 1037), 'os.path.isabs', 'os.path.isabs', (['path'], {}), '(path)\n', (1031, 1037), False, 'import os\n'), ((1128, 1198), 'json.dumps', 'json.dumps', (['data'], {'ensure_ascii': '(False)', 'indent... |
# @file a script to compare to matrix market files.
from sys import argv, exit, stderr
from scipy.io import mmread
from scipy.linalg import norm
if __name__ == "__main__":
print("Comparing Matrices")
matrix1 = mmread(argv[1])
matrix2 = mmread(argv[2])
try:
matrix1 = matrix1.todense()
exce... | [
"scipy.io.mmread",
"sys.stderr.write",
"scipy.linalg.norm",
"sys.exit"
] | [((220, 235), 'scipy.io.mmread', 'mmread', (['argv[1]'], {}), '(argv[1])\n', (226, 235), False, 'from scipy.io import mmread\n'), ((250, 265), 'scipy.io.mmread', 'mmread', (['argv[2]'], {}), '(argv[2])\n', (256, 265), False, 'from scipy.io import mmread\n'), ((441, 464), 'scipy.linalg.norm', 'norm', (['(matrix1 - matri... |
import threading
import pytest
pytestmark = pytest.mark.asyncio
pytest_plugins = ("tests.test_middlewares.test_concurrency.fixtures",)
@pytest.mark.parametrize(
"order",
[("sync", "sync"), ("sync", "async"), ("async", "sync"), ("async", "async")],
)
async def test_that_both_async_and_sync_middlewares_will_w... | [
"pytest.mark.parametrize",
"threading.Event"
] | [((140, 255), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""order"""', "[('sync', 'sync'), ('sync', 'async'), ('async', 'sync'), ('async', 'async')]"], {}), "('order', [('sync', 'sync'), ('sync', 'async'), (\n 'async', 'sync'), ('async', 'async')])\n", (163, 255), False, 'import pytest\n'), ((468, 485)... |
import pandas as pd
pokemon = pd.read_csv('data/pokemon.csv', index_col=0)
# Create a plot by chaining the following actions
# Make a groupby object on the column type and name it pokemon_type
# Use .mean() on the new groupby object
# Use .loc[] to select the attack column
# Sort the pokemon mean attack values in de... | [
"pandas.read_csv"
] | [((31, 75), 'pandas.read_csv', 'pd.read_csv', (['"""data/pokemon.csv"""'], {'index_col': '(0)'}), "('data/pokemon.csv', index_col=0)\n", (42, 75), True, 'import pandas as pd\n')] |
from marshmallow import fields, Schema, validate
from marshmallow_enum import EnumField
from marshmallow_sqlalchemy import ModelSchema
from api.models.couriers import *
class CourierUpdateRequest(ModelSchema):
class Meta(ModelSchema.Meta):
model = Couriers
fields = ["courier_type", "working_hours"... | [
"marshmallow.fields.Integer",
"marshmallow.validate.Length",
"marshmallow.validate.OneOf",
"marshmallow.fields.String"
] | [((557, 572), 'marshmallow.fields.String', 'fields.String', ([], {}), '()\n', (570, 572), False, 'from marshmallow import fields, Schema, validate\n'), ((633, 649), 'marshmallow.fields.Integer', 'fields.Integer', ([], {}), '()\n', (647, 649), False, 'from marshmallow import fields, Schema, validate\n'), ((484, 523), 'm... |
import csv
import paho.mqtt.client as mqtt
import data_manager
def on_connect(client, userdata, flags, rc):
print("Connected with result code " + str(rc))
client.subscribe("tnt")
arquivo = open('dados.csv', 'w', newline='', encoding='utf-8')
arquivo.write("Tempo,Estação,LAT,LONG,Movimentação,Original_4... | [
"data_manager.confere_registros",
"paho.mqtt.client.Client",
"csv.writer"
] | [((1085, 1130), 'data_manager.confere_registros', 'data_manager.confere_registros', (['resultado[14]'], {}), '(resultado[14])\n', (1115, 1130), False, 'import data_manager\n'), ((1658, 1671), 'paho.mqtt.client.Client', 'mqtt.Client', ([], {}), '()\n', (1669, 1671), True, 'import paho.mqtt.client as mqtt\n'), ((1278, 13... |
# -----------------------------------------------------------------------------
# Copyright (c) 2009-2016 <NAME>. All rights reserved.
# Distributed under the (new) BSD License.
# -----------------------------------------------------------------------------
"""
Default argument parser for any glumpy program.
"""
import... | [
"argparse.ArgumentParser"
] | [((519, 544), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (542, 544), False, 'import argparse\n')] |
from typing import List
from PyInquirer import prompt, Separator
from shutil import copy, copytree
import os, errno, subprocess
from jinja2 import Template
scaffold_path = 'app/'
def resource_path(path: str) -> str:
"""
return the absolute path for a file
"""
return os.path.join(os.path.abspath(os.pat... | [
"os.makedirs",
"subprocess.check_output",
"os.path.dirname",
"PyInquirer.Separator",
"PyInquirer.prompt"
] | [((2407, 2424), 'PyInquirer.prompt', 'prompt', (['questions'], {}), '(questions)\n', (2413, 2424), False, 'from PyInquirer import prompt, Separator\n'), ((3005, 3022), 'PyInquirer.prompt', 'prompt', (['confirm_q'], {}), '(confirm_q)\n', (3011, 3022), False, 'from PyInquirer import prompt, Separator\n'), ((3131, 3163), ... |
import unittest
from calc import *
class TestCalc(unittest.TestCase):
def test_add(self):
result = add(10, 5)
self.assertEquals(result, 15)
self.assertEquals(add(12, 9), 21)
def test_subtrtact(self):
self.assertEquals(subtract(50, 25), 25)
self.assertEquals(subtract(-4... | [
"unittest.main"
] | [((680, 695), 'unittest.main', 'unittest.main', ([], {}), '()\n', (693, 695), False, 'import unittest\n')] |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.md') as f:
readme = f.read()
setup(
name='joint',
version='0.0.1',
description='JOINT for Large-scale Single-cell RNA-Sequencing Analysis via Soft-clustering and Parallel Computing.',
... | [
"distutils.core.setup"
] | [((150, 1208), 'distutils.core.setup', 'setup', ([], {'name': '"""joint"""', 'version': '"""0.0.1"""', 'description': '"""JOINT for Large-scale Single-cell RNA-Sequencing Analysis via Soft-clustering and Parallel Computing."""', 'long_description': 'readme', 'long_description_content_type': '"""text/markdown"""', 'auth... |
import json
import os.path
from mimetypes import guess_type
from stat import * # ST_SIZE etc
from ..util import set_param, get_param
import logging
logger = logging.getLogger('ao.task.output')
def get_columns(df):
logger.debug(df.columns)
class ResourceOutput:
def __init__(self,
resource=None,
item=None,
... | [
"json.dump",
"logging.getLogger",
"mimetypes.guess_type"
] | [((160, 195), 'logging.getLogger', 'logging.getLogger', (['"""ao.task.output"""'], {}), "('ao.task.output')\n", (177, 195), False, 'import logging\n'), ((2332, 2375), 'json.dump', 'json.dump', (['data', 'outfiledata'], {'indent': 'indent'}), '(data, outfiledata, indent=indent)\n', (2341, 2375), False, 'import json\n'),... |
"""
dataset preprocessing
"""
import argparse
import json
from pathlib import Path
from typing import List, Dict
import random
import logging
def preprocess_eval_dataset(subtopics: List[List], coref_pairs: Dict, doc_dict: Dict, out_path: Path):
"""
take raw dataset and create evaluation split
"""
all... | [
"json.dump",
"json.load",
"argparse.ArgumentParser",
"random.shuffle",
"logging.StreamHandler",
"random.seed"
] | [((6208, 6253), 'random.shuffle', 'random.shuffle', (['hard_candidate_negative_pairs'], {}), '(hard_candidate_negative_pairs)\n', (6222, 6253), False, 'import random\n'), ((6258, 6303), 'random.shuffle', 'random.shuffle', (['soft_candidate_negative_pairs'], {}), '(soft_candidate_negative_pairs)\n', (6272, 6303), False,... |
#
# (C) Copyright 2012 Enthought, Inc., Austin, TX
# All right reserved.
#
# This file is open source software distributed according to the terms in
# LICENSE.txt
#
"""
Dynamic URL Store
=================
This module contains the :py:class:`~DynamicURLStore` store that communicates
with a remote HTTP server which prov... | [
"json.loads",
"six.moves.urllib.parse.quote",
"json.dumps",
"email.utils.parsedate_tz",
"requests.__version__.split"
] | [((891, 922), 'requests.__version__.split', 'requests.__version__.split', (['"""."""'], {}), "('.')\n", (917, 922), False, 'import requests\n'), ((2844, 2869), 'json.loads', 'json.loads', (['response.text'], {}), '(response.text)\n', (2854, 2869), False, 'import json\n'), ((3129, 3154), 'json.loads', 'json.loads', (['r... |
import csv
import datetime
import os
import time
from collections import deque
import baselines.common.tf_util as U
from baselines import logger
from baselines.ddpg.noise import *
from gym import spaces
from mpi4py import MPI
from LASAgent.InternalEnvironment import InternalEnvironment
class LASGridSearchAgent:
... | [
"os.path.join",
"collections.deque",
"os.path.abspath",
"os.path.exists",
"baselines.logger.info",
"datetime.datetime.now",
"mpi4py.MPI.COMM_WORLD.Get_size",
"csv.writer",
"datetime.datetime.today",
"mpi4py.MPI.COMM_WORLD.Get_rank",
"baselines.logger.record_tabular",
"os.makedirs",
"baseline... | [((637, 702), 'LASAgent.InternalEnvironment.InternalEnvironment', 'InternalEnvironment', (['observation_dim', 'action_dim', 'num_observation'], {}), '(observation_dim, action_dim, num_observation)\n', (656, 702), False, 'from LASAgent.InternalEnvironment import InternalEnvironment\n'), ((2947, 2972), 'mpi4py.MPI.COMM_W... |
import os
import dotenv
class ApiConfig:
BASE_DIR = os.path.dirname(os.path.dirname((os.path.abspath(__file__))))
dotenv.load_dotenv(dotenv_path=os.path.join(BASE_DIR, ".env"), override=True)
MODE_PROD = True if os.environ.get("MODE") == "prod" else False
HOST = os.environ.get("HOST")
PORT = int(... | [
"os.environ.get",
"os.path.abspath",
"os.path.join"
] | [((282, 304), 'os.environ.get', 'os.environ.get', (['"""HOST"""'], {}), "('HOST')\n", (296, 304), False, 'import os\n'), ((626, 653), 'os.environ.get', 'os.environ.get', (['"""MOTOR_URI"""'], {}), "('MOTOR_URI')\n", (640, 653), False, 'import os\n'), ((670, 696), 'os.environ.get', 'os.environ.get', (['"""API_HOST"""'],... |
# controls.py
# <NAME> (https://github.com/alexstrandberg)
# December 28, 2016
""" controls module for Internet of Pi
This module provides the class Controls, which interfaces with the Pimoroni's Display-o-Tron HAT
It handles button presses, outputting information to the LCD display, and setting the backlight.... | [
"dothat.lcd.write",
"subprocess.Popen",
"time.time",
"dothat.lcd.set_cursor_position",
"dothat.backlight.rgb"
] | [((1761, 1790), 'dothat.lcd.set_cursor_position', 'lcd.set_cursor_position', (['(0)', '(0)'], {}), '(0, 0)\n', (1784, 1790), True, 'import dothat.lcd as lcd\n'), ((1799, 1823), 'dothat.backlight.rgb', 'backlight.rgb', (['(0)', '(255)', '(0)'], {}), '(0, 255, 0)\n', (1812, 1823), True, 'import dothat.backlight as backli... |
import numpy as np
import scipy.linalg as la
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.colors import rgb_to_hsv
from imageio import imread
from progress.bar import IncrementalBar
def grayscale_to_coords(image):
"""Sorts a grayscale image's pixels by saturation, and re... | [
"numpy.dstack",
"matplotlib.pyplot.ioff",
"matplotlib.pyplot.close",
"progress.bar.IncrementalBar",
"imageio.imread",
"numpy.unravel_index",
"matplotlib.pyplot.axis",
"matplotlib.animation.FuncAnimation",
"numpy.argsort",
"matplotlib.pyplot.ion",
"numpy.rot90",
"numpy.linspace",
"matplotlib.... | [((488, 509), 'numpy.rot90', 'np.rot90', (['image'], {'k': '(-1)'}), '(image, k=-1)\n', (496, 509), True, 'import numpy as np\n'), ((907, 928), 'numpy.rot90', 'np.rot90', (['image'], {'k': '(-1)'}), '(image, k=-1)\n', (915, 928), True, 'import numpy as np\n'), ((978, 1004), 'numpy.argsort', 'np.argsort', (['hue'], {'ax... |
import logging
from pprint import pprint # noqa
from aleph.authz import Authz
from aleph.core import db, cache
from aleph.model import Alert, Events, Entity
from aleph.index.indexes import entities_read_index
from aleph.index.util import search_safe, unpack_result, authz_query, MAX_PAGE
from aleph.logic.notifications... | [
"aleph.core.db.session.close",
"aleph.model.Alert.dedupe",
"aleph.index.indexes.entities_read_index",
"aleph.core.db.session.commit",
"aleph.model.Alert.by_id",
"aleph.authz.Authz.from_role",
"aleph.core.cache.get_complex",
"aleph.core.cache.object_key",
"aleph.model.Alert.all_ids",
"aleph.index.u... | [((343, 370), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (360, 370), False, 'import logging\n'), ((408, 441), 'aleph.core.cache.object_key', 'cache.object_key', (['Alert', 'alert_id'], {}), '(Alert, alert_id)\n', (424, 441), False, 'from aleph.core import db, cache\n'), ((453, 475), '... |
import numpy as np
from joblib import Parallel, delayed
from .affine import *
from .deformation import *
def select_image_samples(image, shape=(64,64,64), n=10, seed=None, with_augmentation=False):
"""
Select n samples from an image (z,x,y) with the given shape. Returns the sampled positions as (x,y,z) coordi... | [
"numpy.random.seed",
"numpy.power",
"numpy.expand_dims",
"numpy.max",
"numpy.random.randint",
"numpy.array",
"joblib.Parallel",
"numpy.squeeze",
"joblib.delayed"
] | [((3458, 3564), 'numpy.squeeze', 'np.squeeze', (['sample[padding:padding + shape[0], padding:padding + shape[1], padding:\n padding + shape[2]]'], {}), '(sample[padding:padding + shape[0], padding:padding + shape[1],\n padding:padding + shape[2]])\n', (3468, 3564), True, 'import numpy as np\n'), ((699, 719), 'num... |
import numpy as np
import tensorflow as tf
import math
LEARNING_RATE = 0.0001
BATCH_SIZE = 64
TAU = 0.001
class ActorNet:
""" Actor Network Model of DDPG Algorithm """
def __init__(self, num_states, num_actions):
self.g = tf.Graph()
with self.g.as_default():
self.sess = tf.Intera... | [
"tensorflow.random_uniform",
"math.sqrt",
"tensorflow.global_variables_initializer",
"tensorflow.placeholder",
"tensorflow.matmul",
"tensorflow.Graph",
"tensorflow.InteractiveSession",
"tensorflow.gradients",
"tensorflow.train.AdamOptimizer"
] | [((242, 252), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (250, 252), True, 'import tensorflow as tf\n'), ((2777, 2820), 'tensorflow.placeholder', 'tf.placeholder', (['"""float"""', '[None, num_states]'], {}), "('float', [None, num_states])\n", (2791, 2820), True, 'import tensorflow as tf\n'), ((311, 334), 'tenso... |
import unittest
import interface_time_management
class TimeManagementTest(unittest.TestCase):
# This method currently sits on the TimeManagement class, but it could eventually
# be re-factored to a helper/validator class.
def test_validates_id_works_as_expected(self):
ids = [1, 2, 3, 4]
i... | [
"interface_time_management.are_valid_tasks"
] | [((387, 443), 'interface_time_management.are_valid_tasks', 'interface_time_management.are_valid_tasks', (['invalid1', 'ids'], {}), '(invalid1, ids)\n', (428, 443), False, 'import interface_time_management\n'), ((470, 526), 'interface_time_management.are_valid_tasks', 'interface_time_management.are_valid_tasks', (['inva... |
# Copyright (c) 2015, Dataent Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import dataent
import unittest
test_records = dataent.get_test_records('Website Theme')
class TestWebsiteTheme(unittest.TestCase):
pass
| [
"dataent.get_test_records"
] | [((176, 217), 'dataent.get_test_records', 'dataent.get_test_records', (['"""Website Theme"""'], {}), "('Website Theme')\n", (200, 217), False, 'import dataent\n')] |
#!/usr/bin/env python3
'''
https://www.zhihu.com/question/48755767#answer-47628816
https://www.zhihu.com/question/23760468#answer-5661732
https://stackoverflow.com/questions/101268/hidden-features-of-python#101276
https://www.zhihu.com/question/57470958#answer-56901848
https://zhuanlan.zhihu.com/p/28008875
'''
... | [
"functools.reduce",
"random.random",
"copy.copy",
"random.randint"
] | [((5345, 5379), 'functools.reduce', 'reduce', (['(lambda x, y: x + y)', 'list_1'], {}), '(lambda x, y: x + y, list_1)\n', (5351, 5379), False, 'from functools import reduce\n'), ((5571, 5588), 'copy.copy', 'copy.copy', (['list_1'], {}), '(list_1)\n', (5580, 5588), False, 'import copy\n'), ((4787, 4807), 'random.randint... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
import time
import json
import random
import numpy as np
from jinja2 import Template
from PIL import Image, ImageDraw, ImageFont
class ConfigError(Exception):
pass
class ClickCaptcha(object):
def __init__(self):
# 根目录
self.basedir = os.getc... | [
"jinja2.Template",
"PIL.Image.new",
"json.load",
"random.randint",
"os.makedirs",
"os.getcwd",
"os.path.exists",
"random.choice",
"json.dumps",
"time.time",
"PIL.ImageFont.truetype",
"numpy.mean",
"PIL.ImageDraw.Draw",
"os.path.join"
] | [((313, 324), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (322, 324), False, 'import os\n'), ((1758, 1798), 'os.path.join', 'os.path.join', (['self.basedir', '"""JPEGImages"""'], {}), "(self.basedir, 'JPEGImages')\n", (1770, 1798), False, 'import os\n'), ((1829, 1870), 'os.path.join', 'os.path.join', (['self.basedir', ... |
from django.contrib import admin
from .models import Sample, Userdetails
admin.site.register(Userdetails)
admin.site.register(Sample)
# Register your models here.
| [
"django.contrib.admin.site.register"
] | [((74, 106), 'django.contrib.admin.site.register', 'admin.site.register', (['Userdetails'], {}), '(Userdetails)\n', (93, 106), False, 'from django.contrib import admin\n'), ((107, 134), 'django.contrib.admin.site.register', 'admin.site.register', (['Sample'], {}), '(Sample)\n', (126, 134), False, 'from django.contrib i... |
'''
@Descripttion: https://github.com/jesenzhang/UnityMisc.git
@version:
@Author: jesen.zhang
@Date: 2020-07-16 08:40:39
LastEditors: jesen.zhang
LastEditTime: 2020-09-08 10:07:01
'''
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
#适用于导入资源到unity前对图片命名进行检查 导入到unity的资源 使用AssetPostProcess处理
import re
import os
import ... | [
"sys.stdin.flush",
"os.listdir",
"argparse.ArgumentParser",
"os.getcwd",
"os.rename",
"re.match",
"os.path.isfile",
"os.path.splitext",
"os.path.split",
"re.sub",
"os.chdir"
] | [((365, 425), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""manual to this script"""'}), "(description='manual to this script')\n", (388, 425), False, 'import argparse\n'), ((547, 567), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (561, 567), False, 'import os\n'), ((... |
import os
import numpy as np
import tensorflow as tf
import tensorflow.keras as tfk
import tensorflow.keras.backend as K
import tensorflow.keras.models as tfkm
import tensorflow.keras.optimizers as tfko
import tensorflow.keras.layers as tfkl
import tensorflow.keras.activations as tfka
import tensorflow.keras.initialize... | [
"tensorflow.keras.layers.Dense",
"tensorflow.nn.tanh",
"tensorflow.keras.activations.linear",
"tensorflow.keras.Input",
"tensorflow.keras.initializers.HeNormal",
"tensorflow.keras.layers.LayerNormalization",
"tensorflow.concat",
"tensorflow.keras.initializers.GlorotNormal",
"tensorflow.keras.Model",... | [((412, 485), 'tensorflow.keras.initializers.VarianceScaling', 'tfki.VarianceScaling', ([], {'distribution': '"""uniform"""', 'mode': '"""fan_out"""', 'scale': '(0.333)'}), "(distribution='uniform', mode='fan_out', scale=0.333)\n", (432, 485), True, 'import tensorflow.keras.initializers as tfki\n'), ((522, 541), 'tenso... |
import copy
import requests
import inboxtracker
from .exceptions import InboxTrackerAPIException
class RequestsTransport(object):
def __init__(self):
import requests
self.sess = requests.Session()
def request(self, method, uri, params, **kwargs):
response = self.sess.request(method, u... | [
"copy.deepcopy",
"requests.Session",
"requests.get"
] | [((200, 218), 'requests.Session', 'requests.Session', ([], {}), '()\n', (216, 218), False, 'import requests\n'), ((1484, 1503), 'copy.deepcopy', 'copy.deepcopy', (['args'], {}), '(args)\n', (1497, 1503), False, 'import copy\n'), ((1796, 1815), 'copy.deepcopy', 'copy.deepcopy', (['args'], {}), '(args)\n', (1809, 1815), ... |