code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from dash import Dash, html, dcc, Input, Output
import altair as alt
import pandas as pd
# Read in global data
#cars = data.cars()
penguins = pd.read_csv('penguins.csv')
# Setup app and layout/frontend
app = Dash(__name__, external_stylesheets=['https://codepen.io/chriddyp/pen/bWLwgP.css'])
server = app.server
app... | [
"dash.Output",
"dash.Dash",
"altair.Y",
"pandas.read_csv",
"altair.Chart",
"dash.html.Iframe",
"dash.dcc.Dropdown",
"altair.X",
"dash.Input"
] | [((143, 170), 'pandas.read_csv', 'pd.read_csv', (['"""penguins.csv"""'], {}), "('penguins.csv')\n", (154, 170), True, 'import pandas as pd\n'), ((211, 299), 'dash.Dash', 'Dash', (['__name__'], {'external_stylesheets': "['https://codepen.io/chriddyp/pen/bWLwgP.css']"}), "(__name__, external_stylesheets=[\n 'https://c... |
import sys
import matplotlib.pyplot as plt
# coords should be (row,col)
def plot_2D_rmaj(coords, annotate=False):
# plot origin
plt.scatter(coords[0][1], coords[0][0], zorder=10, color='green', marker='X', s=85)
plt.plot(coords[0][1], coords[0][0], zorder=0, linewidth=4, color='grey')
# plot the rest
... | [
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.gca"
] | [((137, 225), 'matplotlib.pyplot.scatter', 'plt.scatter', (['coords[0][1]', 'coords[0][0]'], {'zorder': '(10)', 'color': '"""green"""', 'marker': '"""X"""', 's': '(85)'}), "(coords[0][1], coords[0][0], zorder=10, color='green', marker=\n 'X', s=85)\n", (148, 225), True, 'import matplotlib.pyplot as plt\n'), ((225, 2... |
# MIT License
#
# Copyright (c) 2021 GGggg-sp
#
# 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, pub... | [
"pickle.dump",
"openpyxl.Workbook",
"openpyxl.styles.Alignment",
"numpy.random.choice",
"openpyxl.styles.Border",
"openpyxl.styles.PatternFill",
"openpyxl.styles.Side"
] | [((5618, 5628), 'openpyxl.Workbook', 'Workbook', ([], {}), '()\n', (5626, 5628), False, 'from openpyxl import Workbook\n'), ((6412, 6476), 'openpyxl.styles.Alignment', 'Alignment', ([], {'horizontal': '"""center"""', 'wrapText': '(True)', 'vertical': '"""center"""'}), "(horizontal='center', wrapText=True, vertical='cen... |
import kfp.dsl as dsl
import kfp.gcp as gcp
import kfp.onprem as onprem
platform = 'GCP'
@dsl.pipeline(
name='MNIST',
description='A pipeline to train and serve the MNIST example.'
)
def mnist_pipeline(model_export_dir='gs://kf-test1234/export',
train_steps='200',
learning_ra... | [
"kfp.compiler.Compiler",
"kfp.dsl.ContainerOp",
"kfp.gcp.use_gcp_secret",
"kfp.dsl.pipeline",
"kfp.onprem.mount_pvc"
] | [((92, 187), 'kfp.dsl.pipeline', 'dsl.pipeline', ([], {'name': '"""MNIST"""', 'description': '"""A pipeline to train and serve the MNIST example."""'}), "(name='MNIST', description=\n 'A pipeline to train and serve the MNIST example.')\n", (104, 187), True, 'import kfp.dsl as dsl\n'), ((580, 867), 'kfp.dsl.Container... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models
from odoo.exceptions import AccessError
from odoo.tools.translate import _
class MailNotification(models.Model):
_name = 'mail.... | [
"odoo.fields.Selection",
"odoo.fields.Datetime",
"odoo.fields.Many2one",
"odoo.tools.translate._",
"odoo.fields.Text",
"dateutil.relativedelta.relativedelta",
"odoo.fields.Datetime.now",
"odoo.fields.Boolean"
] | [((525, 618), 'odoo.fields.Many2one', 'fields.Many2one', (['"""mail.message"""', '"""Message"""'], {'index': '(True)', 'ondelete': '"""cascade"""', 'required': '(True)'}), "('mail.message', 'Message', index=True, ondelete='cascade',\n required=True)\n", (540, 618), False, 'from odoo import api, fields, models\n'), (... |
# =====================================================
# Imports - these are external bits of code that we use to make the model run properly.
# =====================================================
# Custom modules
from network import Network
from participant import Participant, CSV_Participant
from battery import B... | [
"energy_sim.simulate",
"network.Network",
"datetime.datetime",
"financial_sim.simulate",
"util.generate_dates_in_range",
"os.path.join"
] | [((838, 854), 'network.Network', 'Network', (['"""Byron"""'], {}), "('Byron')\n", (845, 854), False, 'from network import Network\n'), ((1665, 1718), 'datetime.datetime', 'datetime.datetime', ([], {'year': '(2017)', 'month': '(2)', 'day': '(26)', 'hour': '(4)'}), '(year=2017, month=2, day=26, hour=4)\n', (1682, 1718), ... |
# -*- coding: utf-8 -*-
"""
Description
-----------
This module defines the :obj:`ParaMol.Objective_function.Tasks.task.TorsionsParametrization` class used to perform parametrization of rotatable (soft) dihedrals.
"""
import simtk.unit as unit
import logging
# ParaMol modules
from .task import *
from .torsions_scan i... | [
"logging.info"
] | [((8673, 8784), 'logging.info', 'logging.info', (['"""Performing QM optimization before starting soft dihedrals\' scans and parametrization."""'], {}), '(\n "Performing QM optimization before starting soft dihedrals\' scans and parametrization."\n )\n', (8685, 8784), False, 'import logging\n')] |
from flask import Blueprint
chat = Blueprint('chat', __name__)
from . import views
| [
"flask.Blueprint"
] | [((36, 63), 'flask.Blueprint', 'Blueprint', (['"""chat"""', '__name__'], {}), "('chat', __name__)\n", (45, 63), False, 'from flask import Blueprint\n')] |
#170401011 <NAME>
import socket
import sys
import os
def list():
try:
data, address = client.recvfrom(4096)
File=data.decode('utf-8')
print("Dosyalar:")
print(File)
except:
print("Baglanti hatasi")
sys.exit()
def GET(dosya):
try:
data, address = clie... | [
"socket.socket",
"os.listdir",
"sys.exit"
] | [((1053, 1101), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (1066, 1101), False, 'import socket\n'), ((1375, 1385), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1383, 1385), False, 'import sys\n'), ((255, 265), 'sys.exit', 'sys.exit', ([], {}),... |
import numpy as np
class Parabola:
coefficients: np.ndarray # Python 3.5 doesn't like this
a: float
b: float
c: float
extreme_point: list
vertex_point: list
def __init__(self, p: list, q: list, r: list):
"""Define a parabolic curve from 3 points.
Given points are x1,y1 .... | [
"numpy.linalg.solve",
"numpy.array"
] | [((997, 1061), 'numpy.array', 'np.array', (['[[x1 ** 2, x1, 1], [x2 ** 2, x2, 1], [x3 ** 2, x3, 1]]'], {}), '([[x1 ** 2, x1, 1], [x2 ** 2, x2, 1], [x3 ** 2, x3, 1]])\n', (1005, 1061), True, 'import numpy as np\n'), ((1118, 1140), 'numpy.array', 'np.array', (['[y1, y2, y3]'], {}), '([y1, y2, y3])\n', (1126, 1140), True,... |
import json
import requests_mock
from mock import MagicMock, create_autospec
from nose.tools import assert_raises, eq_
from parameterized import parameterized
from requests import HTTPError
from api.proquest.client import (
ProQuestAPIClient,
ProQuestAPIClientConfiguration,
ProQuestAPIInvalidJSONResponseE... | [
"core.model.configuration.ConfigurationFactory",
"requests_mock.Mocker",
"api.proquest.client.ProQuestAPIClient",
"json.dumps",
"parameterized.parameterized.expand",
"api.util.url.URLUtility.build_url",
"mock.create_autospec",
"nose.tools.eq_",
"nose.tools.assert_raises",
"mock.MagicMock",
"core... | [((1697, 2311), 'parameterized.parameterized.expand', 'parameterized.expand', (["[('in_the_case_of_http_error_status_code', {'status_code': 401}, HTTPError),\n ('in_the_case_of_non_json_response', {'text': 'garbage'},\n ProQuestAPIInvalidJSONResponseError), (\n 'when_json_document_does_not_contain_status_code'... |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""General editor panel utilities."""
# Standard library imports
import bisect
import uuid
# Third-party imports
from intervaltree import IntervalTree
import textdi... | [
"uuid.uuid4",
"intervaltree.IntervalTree",
"intervaltree.IntervalTree.from_tuples",
"textdistance.jaccard.normalized_similarity",
"bisect.bisect_left"
] | [((4049, 4089), 'intervaltree.IntervalTree.from_tuples', 'IntervalTree.from_tuples', (['folding_ranges'], {}), '(folding_ranges)\n', (4073, 4089), False, 'from intervaltree import IntervalTree\n'), ((1218, 1265), 'bisect.bisect_left', 'bisect.bisect_left', (['children_ranges', 'node_range'], {}), '(children_ranges, nod... |
from typing import List, Optional
import random
import queue
import pygame
from . import helpers
from .. import binds
from .. import constants as c
from .. import gameinfo
from .. import phys
from .. import setup
from .. import tools
class Player(pygame.sprite.Sprite):
def __init__(self, x: int, y: int) -> No... | [
"pygame.rect.Rect"
] | [((8747, 8841), 'pygame.rect.Rect', 'pygame.rect.Rect', (['(grid_x * 64 + i * ts, grid_y * 64 + j * ts)', '(c.TILE_SIZE, c.TILE_SIZE)'], {}), '((grid_x * 64 + i * ts, grid_y * 64 + j * ts), (c.TILE_SIZE,\n c.TILE_SIZE))\n', (8763, 8841), False, 'import pygame\n')] |
from time import sleep
from plexapi.server import PlexServer
from plex_trakt_sync.logging import logging
PLAYING = "playing"
class WebSocketListener:
def __init__(self, plex: PlexServer, interval=1):
self.plex = plex
self.interval = interval
self.event_handlers = {}
self.logger =... | [
"plex_trakt_sync.logging.logging.getLogger",
"time.sleep"
] | [((321, 373), 'plex_trakt_sync.logging.logging.getLogger', 'logging.getLogger', (['"""PlexTraktSync.WebSocketListener"""'], {}), "('PlexTraktSync.WebSocketListener')\n", (338, 373), False, 'from plex_trakt_sync.logging import logging\n'), ((1125, 1145), 'time.sleep', 'sleep', (['self.interval'], {}), '(self.interval)\n... |
from src import main
main()
| [
"src.main"
] | [((22, 28), 'src.main', 'main', ([], {}), '()\n', (26, 28), False, 'from src import main\n')] |
from skimage.io import imsave
import numpy as np
from skimage.transform import resize
from model import bce_dice_loss, iou, dice_coef
from read_one_image import read_one_image
from post_process_image import post_processing, colorize_image
from tensorflow.keras.models import load_model
import tensorflow as tf
class pre... | [
"tensorflow.keras.models.load_model",
"read_one_image.read_one_image",
"skimage.io.imsave",
"tensorflow.config.set_visible_devices",
"tensorflow.config.list_physical_devices",
"tensorflow.config.experimental.set_memory_growth",
"numpy.array",
"skimage.transform.resize",
"tensorflow.config.get_visibl... | [((2259, 2325), 'tensorflow.keras.models.load_model', 'load_model', (['"""models/unet"""'], {'custom_objects': "{'dice_coef': dice_coef}"}), "('models/unet', custom_objects={'dice_coef': dice_coef})\n", (2269, 2325), False, 'from tensorflow.keras.models import load_model\n'), ((2354, 2446), 'tensorflow.keras.models.loa... |
import logging
import requests
import socket
import json
from time import sleep
from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
import config
prohibit_remove = ('phone_home','broadcast_location')
# Scheduler
class Config:
JOBS = [
{'id': 'default_clean',
'func': 'sch:custom_cycle'... | [
"logging.error",
"logging.debug",
"json.loads",
"logging.warning",
"socket.socket",
"time.sleep",
"socket.gethostname",
"requests.delete",
"apscheduler.jobstores.sqlalchemy.SQLAlchemyJobStore",
"requests.get",
"requests.put",
"requests.post"
] | [((817, 874), 'apscheduler.jobstores.sqlalchemy.SQLAlchemyJobStore', 'SQLAlchemyJobStore', ([], {'url': '"""sqlite:////database/database.db"""'}), "(url='sqlite:////database/database.db')\n", (835, 874), False, 'from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore\n'), ((1605, 1638), 'time.sleep', 'sleep', (... |
import boto3
CODE_BUILD_NAME = "S3BenchmarksDeploy"
def benchmarkManager(event, context):
'''
Lambda handler.
Action in event determing how manager runs benchmark stack.
delete: Delete a stack.
- stack_name (string): the name of stack to delete.
test: Deploy the stack via code build.
... | [
"boto3.client"
] | [((341, 371), 'boto3.client', 'boto3.client', (['"""cloudformation"""'], {}), "('cloudformation')\n", (353, 371), False, 'import boto3\n'), ((1865, 1890), 'boto3.client', 'boto3.client', (['"""codebuild"""'], {}), "('codebuild')\n", (1877, 1890), False, 'import boto3\n')] |
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams.update({'font.size': 10})
import json
import os, sys
import numpy as np
if __name__ == "__main__":
fname = sys.argv[1]
data = np.loadtxt(fname)
fig, ax = plt.subplots(1, figsize=(7,2.5))
# output profile and set po... | [
"matplotlib.pyplot.show",
"numpy.abs",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.rcParams.update",
"numpy.loadtxt",
"matplotlib.pyplot.tight_layout"
] | [((74, 112), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 10}"], {}), "({'font.size': 10})\n", (93, 112), True, 'import matplotlib.pyplot as plt\n'), ((222, 239), 'numpy.loadtxt', 'np.loadtxt', (['fname'], {}), '(fname)\n', (232, 239), True, 'import numpy as np\n'), ((255, 288), 'matplot... |
#!/usr/bin/env python3
"""
Scripts to drive a donkey 2 car and train a model for it.
Usage:
car.py (drive) [--model=<model>]
car.py (train) (--tub=<tub>) (--model=<model>)
car.py (calibrate)
"""
import os
from docopt import docopt
import donkeycar as dk
CAR_PATH = PACKAGE_PATH = os.path.dirname(os.pa... | [
"donkeycar.parts.KerasCategorical",
"donkeycar.parts.TubHandler",
"donkeycar.parts.PWMThrottle",
"donkeycar.parts.Lambda",
"donkeycar.parts.Tub",
"docopt.docopt",
"os.path.realpath",
"donkeycar.parts.PiCamera",
"donkeycar.parts.LocalWebController",
"donkeycar.parts.PCA9685",
"donkeycar.parts.PWM... | [((355, 385), 'os.path.join', 'os.path.join', (['CAR_PATH', '"""data"""'], {}), "(CAR_PATH, 'data')\n", (367, 385), False, 'import os\n'), ((400, 432), 'os.path.join', 'os.path.join', (['CAR_PATH', '"""models"""'], {}), "(CAR_PATH, 'models')\n", (412, 432), False, 'import os\n'), ((315, 341), 'os.path.realpath', 'os.pa... |
# coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"pathlib.Path",
"setuptools.find_packages"
] | [((1613, 1639), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (1637, 1639), False, 'import setuptools\n'), ((1693, 1725), 'pathlib.Path', 'pathlib.Path', (['"""requirements.txt"""'], {}), "('requirements.txt')\n", (1705, 1725), False, 'import pathlib\n')] |
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
# Create your models here.
from django.contrib.auth.models import AbstractUser
from django.contrib.auth import get_user_model
from django.db import models
from PIL import Image
from django.contrib.auth.mode... | [
"django.db.models.CharField",
"django.db.models.PositiveIntegerField",
"PIL.Image.open",
"django.db.models.ImageField",
"django.db.models.DateField"
] | [((540, 595), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'null': '(True)', 'blank': '(True)'}), '(max_length=100, null=True, blank=True)\n', (556, 595), False, 'from django.db import models\n'), ((603, 653), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([],... |
"""effectful functions for streamlit io"""
from typing import Optional
from datetime import date
import altair as alt
import numpy as np
import os
import json
import pandas as pd
import penn_chime.spreadsheet as sp
from .constants import (
CHANGE_DATE,
DOCS_URL,
EPSILON,
FLOAT_INPUT_MIN,
FLOAT_INP... | [
"penn_chime.spreadsheet.spreadsheet",
"os.getenv",
"json.dumps"
] | [((25123, 25148), 'json.dumps', 'json.dumps', (['client_secret'], {}), '(client_secret)\n', (25133, 25148), False, 'import json\n'), ((25236, 25263), 'os.getenv', 'os.getenv', (['"""GAPI_CRED_TYPE"""'], {}), "('GAPI_CRED_TYPE')\n", (25245, 25263), False, 'import os\n'), ((25282, 25315), 'os.getenv', 'os.getenv', (['"""... |
import librosa
import librosa.display
import numpy as np
from pydub import AudioSegment
import torch
from matplotlib import pyplot as plt
SAMPLE = 44100
TOP = 32767
def load_wave_file_to_numpy(file_path, sample_rate=SAMPLE, *args, **kwargs):
return librosa.load(file_path, sr=sample_rate, *args, **kwargs)
def... | [
"matplotlib.pyplot.title",
"numpy.abs",
"torch.stft",
"matplotlib.pyplot.margins",
"numpy.angle",
"librosa.istft",
"matplotlib.pyplot.figure",
"numpy.sin",
"pydub.AudioSegment.from_file",
"librosa.feature.melspectrogram",
"librosa.feature.mfcc",
"numpy.zeros_like",
"matplotlib.pyplot.close",... | [((258, 314), 'librosa.load', 'librosa.load', (['file_path', '*args'], {'sr': 'sample_rate'}), '(file_path, *args, sr=sample_rate, **kwargs)\n', (270, 314), False, 'import librosa\n'), ((440, 451), 'numpy.angle', 'np.angle', (['D'], {}), '(D)\n', (448, 451), True, 'import numpy as np\n'), ((462, 471), 'numpy.abs', 'np.... |
import random, os
import numpy as np
from torch.utils.data import Dataset
from sentence_transformers import InputExample
import csv
from typing import List, Tuple, Optional, Union
import copy
class IMDB62AvDataset(Dataset):
"""Dataset for Author Verification on the IMDB62 Dataset."""
def __init__(self,
... | [
"numpy.random.uniform",
"copy.deepcopy",
"csv.reader",
"argparse.ArgumentParser",
"csv.writer",
"random.sample",
"sentence_transformers.InputExample",
"random.choice",
"os.path.join"
] | [((7360, 7459), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Get args for building train/test splits of IMDB dataset"""'}), "(description=\n 'Get args for building train/test splits of IMDB dataset')\n", (7383, 7459), False, 'import argparse\n'), ((8634, 8662), 'copy.deepcopy', 'cop... |
# -*- coding: utf-8 -*-
import pandas as pd
# Scikit-learn
from sklearn.model_selection import train_test_split
# Matplotlib
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
# Seaborn
import seaborn as sns
def top_n_famous_genus_names(df_genus, n):
genusNames = \
df_genus.groupby('taxon_nam... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"sklearn.model_selection.train_test_split",
"seaborn.barplot",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((1692, 1812), 'sklearn.model_selection.train_test_split', 'train_test_split', (['df_genus'], {'test_size': 'test_ratio', 'shuffle': '(True)', 'random_state': 'seed1', 'stratify': "df_genus['taxon_name']"}), "(df_genus, test_size=test_ratio, shuffle=True, random_state\n =seed1, stratify=df_genus['taxon_name'])\n", ... |
from tests.util import pick_ray
from pyrosetta import Pose
from pyrosetta.rosetta.core.import_pose import pose_from_pdbstring
name = "OH_OH"
# NOTE(onalant): serines substituted for hydroxyls since we need real carbons
contents = """
ATOM 1 N SER A 1 7.975 -0.175 -0.127 1.00 0.00 N
ATOM... | [
"pyrosetta.Pose",
"pyrosetta.rosetta.core.import_pose.pose_from_pdbstring"
] | [((1991, 1997), 'pyrosetta.Pose', 'Pose', ([], {}), '()\n', (1995, 1997), False, 'from pyrosetta import Pose\n'), ((1998, 2033), 'pyrosetta.rosetta.core.import_pose.pose_from_pdbstring', 'pose_from_pdbstring', (['pose', 'contents'], {}), '(pose, contents)\n', (2017, 2033), False, 'from pyrosetta.rosetta.core.import_pos... |
from abc import abstractmethod, ABC
from py_wake.site._site import Site, LocalWind
from py_wake.wind_turbines import WindTurbines
import numpy as np
from py_wake.flow_map import FlowMap, HorizontalGrid
class WindFarmModel(ABC):
"""Base class for RANS and engineering flow models"""
def __init__(self, site, wi... | [
"numpy.isin",
"numpy.atleast_1d",
"matplotlib.pyplot.show",
"py_wake.flow_map.HorizontalGrid",
"py_wake.flow_map.FlowMap",
"numpy.argwhere",
"matplotlib.pyplot.figure",
"py_wake.site._site.LocalWind",
"py_wake.IEA37SimpleBastankhahGaussian",
"py_wake.examples.data.iea37.IEA37Site",
"py_wake.exam... | [((8723, 8797), 'py_wake.flow_map.FlowMap', 'FlowMap', (['self', 'X', 'Y', 'lw_j', 'WS_eff_jlk', 'TI_eff_jlk', 'wd', 'ws'], {'yaw_ilk': 'yaw_ilk'}), '(self, X, Y, lw_j, WS_eff_jlk, TI_eff_jlk, wd, ws, yaw_ilk=yaw_ilk)\n', (8730, 8797), False, 'from py_wake.flow_map import FlowMap, HorizontalGrid\n'), ((9059, 9072), 'py... |
#
# Copyright (c) 2016-2020 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import mock
import uuid
from nfv_common import strategy as common_strategy
from nfv_vim import nfvi
from nfv_vim.objects import HOST_PERSONALITY
from nfv_vim.objects import SW_UPDATE_ALARM_RESTRICTION
from nfv_vim.objects i... | [
"nfv_vim.nfvi.objects.v1.SwPatch",
"uuid.uuid4",
"nfv_vim.objects.SwPatch",
"mock.patch",
"nfv_vim.nfvi.objects.v1.HostSwPatch"
] | [((1547, 1636), 'mock.patch', 'mock.patch', (['"""nfv_vim.objects._sw_update.SwUpdate.save"""', 'sw_update_testcase.fake_save'], {}), "('nfv_vim.objects._sw_update.SwUpdate.save', sw_update_testcase.\n fake_save)\n", (1557, 1636), False, 'import mock\n'), ((1633, 1735), 'mock.patch', 'mock.patch', (['"""nfv_vim.obje... |
import schedule, time, sys, os, traceback
sys.path.append(os.getcwd())
from material_sync.sync_to_baidu_cloud import Sync2Cloud
p = Sync2Cloud().main
schedule.every(1).days.at("03:00").do(p)
# schedule.every(1).minutes.do(p)
print("脚本已启动")
while True:
try:
schedule.run_pending()
time.sleep(1)
... | [
"schedule.run_pending",
"traceback.print_exc",
"os.getcwd",
"material_sync.sync_to_baidu_cloud.Sync2Cloud",
"time.sleep",
"schedule.every"
] | [((58, 69), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (67, 69), False, 'import schedule, time, sys, os, traceback\n'), ((133, 145), 'material_sync.sync_to_baidu_cloud.Sync2Cloud', 'Sync2Cloud', ([], {}), '()\n', (143, 145), False, 'from material_sync.sync_to_baidu_cloud import Sync2Cloud\n'), ((272, 294), 'schedule.r... |
#!/usr/bin/env python3
# coding=utf-8
"""
Simple trigger to run a successful run on the program.
"""
__author__ = "<NAME>, <EMAIL>"
from contextlib import suppress
import logging
import os
from lib.constants import PLUGIN_ERROR
from lib.plugins import MainPlugin
from lib.trigger import RawTrigger
class Success(M... | [
"logging.error",
"contextlib.suppress"
] | [((989, 1013), 'contextlib.suppress', 'suppress', (['AttributeError'], {}), '(AttributeError)\n', (997, 1013), False, 'from contextlib import suppress\n'), ((1974, 2032), 'logging.error', 'logging.error', (['"""The bug failed with an unknown error code"""'], {}), "('The bug failed with an unknown error code')\n", (1987... |
import tkinter as tk
from tkinter import ttk
class Tooltip:
'''
It creates a tooltip for a given widget as the mouse goes on it.
http://www.daniweb.com/programming/software-development/
code/484591/a-tooltip-class-for-tkinter
- Originally written by vegaseat on 2014.09.09.
- Modified... | [
"tkinter.ttk.Label",
"tkinter.Toplevel",
"tkinter.ttk.Frame"
] | [((3164, 3183), 'tkinter.Toplevel', 'tk.Toplevel', (['widget'], {}), '(widget)\n', (3175, 3183), True, 'import tkinter as tk\n'), ((3301, 3319), 'tkinter.ttk.Frame', 'ttk.Frame', (['self.tw'], {}), '(self.tw)\n', (3310, 3319), False, 'from tkinter import ttk\n'), ((3337, 3424), 'tkinter.ttk.Label', 'ttk.Label', (['win'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import graphene
from graphene import Schema
import sorgente
class Esempio(graphene.ObjectType):
esempio = graphene.String()
class Risultato(graphene.ObjectType):
buongiorno = graphene.String(
nome=graphene.String(default_value="Mario"),
)
cia... | [
"sorgente.buongiorno",
"graphene.String",
"sorgente.ciao"
] | [((159, 176), 'graphene.String', 'graphene.String', ([], {}), '()\n', (174, 176), False, 'import graphene\n'), ((572, 597), 'sorgente.buongiorno', 'sorgente.buongiorno', (['nome'], {}), '(nome)\n', (591, 597), False, 'import sorgente\n'), ((263, 301), 'graphene.String', 'graphene.String', ([], {'default_value': '"""Mar... |
import os
import prometheus_client
import skyscraper.settings
NUMBER_OF_FILES = prometheus_client.Gauge(
'skyscraper_num_files',
'Number of files stored in Skyscraper',
['project', 'spider'])
def instrument_num_files():
directory = skyscraper.settings.SKYSCRAPER_STORAGE_FOLDER_PATH
for project... | [
"os.path.isdir",
"prometheus_client.Gauge",
"os.path.join",
"os.listdir"
] | [((83, 197), 'prometheus_client.Gauge', 'prometheus_client.Gauge', (['"""skyscraper_num_files"""', '"""Number of files stored in Skyscraper"""', "['project', 'spider']"], {}), "('skyscraper_num_files',\n 'Number of files stored in Skyscraper', ['project', 'spider'])\n", (106, 197), False, 'import prometheus_client\n... |
import pygame as pg
from pygame.locals import *
from math import sqrt
SIZE = 750
G = 6.67 * 10**-11
class Particle():
def __init__(self, pos, m):
self.x = pos[0]
self.y = pos[1]
self.v = 0 #Particle's velocity, starts at 0
self.d = SIZE-pos[1]/3... | [
"pygame.draw.circle",
"pygame.font.SysFont",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.init",
"pygame.display.update",
"pygame.mouse.get_pos",
"pygame.display.set_caption",
"pygame.time.Clock"
] | [((2841, 2850), 'pygame.init', 'pg.init', ([], {}), '()\n', (2848, 2850), True, 'import pygame as pg\n'), ((2869, 2897), 'pygame.font.SysFont', 'pg.font.SysFont', (['"""Arial"""', '(20)'], {}), "('Arial', 20)\n", (2884, 2897), True, 'import pygame as pg\n'), ((2910, 2925), 'pygame.time.Clock', 'pg.time.Clock', ([], {})... |
from collections import OrderedDict
from dataclasses import dataclass, InitVar
from pathlib import Path
from typing import List, Dict
import tensorflow as tf
from tensorflow.keras.preprocessing import image
from config import Config, ModelConfig
from model import load_model
from utils.collections import sort_by_value... | [
"tensorflow.nn.softmax",
"utils.collections.sort_by_values",
"model.load_model",
"tensorflow.keras.preprocessing.image.load_img",
"pathlib.Path",
"collections.OrderedDict"
] | [((1142, 1171), 'model.load_model', 'load_model', (['config.model_path'], {}), '(config.model_path)\n', (1152, 1171), False, 'from model import load_model\n'), ((1185, 1198), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1196, 1198), False, 'from collections import OrderedDict\n'), ((1411, 1436), 'tensor... |
# -*- coding: utf-8 -*-
"""SerialInput -- Serialized input using pickle. This class will load all global data (all RDFObjects) as well as a pointer to a specific device."""
# builtin modules
import pickle
import logging
# local modules
import pynt.xmlns
import pynt.input
class SerialInput(pynt.input.BaseFetcher):
... | [
"pickle.load"
] | [((1180, 1200), 'pickle.load', 'pickle.load', (['self.io'], {}), '(self.io)\n', (1191, 1200), False, 'import pickle\n')] |
import os
import random
from torch.utils.data import Dataset as TorchDataset
import json
import numpy as np
from ml4vision.ml.utils.image_utils import load_image
from PIL import Image
class ML4visionDataset(TorchDataset):
def __init__(
self,
client=None,
name='',
owner=None,
... | [
"ml4vision.ml.utils.image_utils.load_image",
"json.load",
"random.randint",
"PIL.Image.open",
"os.path.splitext",
"os.path.join"
] | [((1533, 1589), 'os.path.join', 'os.path.join', (['self.dataset_loc', '"""images"""', 'image_filename'], {}), "(self.dataset_loc, 'images', image_filename)\n", (1545, 1589), False, 'import os\n'), ((1606, 1628), 'ml4vision.ml.utils.image_utils.load_image', 'load_image', (['image_path'], {}), '(image_path)\n', (1616, 16... |
#!/usr/bin/env python3
"""A github org client
"""
from typing import (
List,
Dict,
)
from utils import (
get_json,
access_nested_map,
memoize,
)
class GithubOrgClient:
"""A Githib org client
"""
ORG_URL = "https://api.github.com/orgs/{org}"
def __init__(self, org_name: str) -> No... | [
"utils.get_json",
"utils.access_nested_map"
] | [((760, 792), 'utils.get_json', 'get_json', (['self._public_repos_url'], {}), '(self._public_repos_url)\n', (768, 792), False, 'from utils import get_json, access_nested_map, memoize\n'), ((1336, 1379), 'utils.access_nested_map', 'access_nested_map', (['repo', "('license', 'key')"], {}), "(repo, ('license', 'key'))\n",... |
import pytest
from hallo.inc.commons import Commons
@pytest.mark.parametrize(
"calculation",
[
"23",
"2.123",
"cos(12.2)",
"tan(sin(atan(cosh(1))))",
"pie",
"1+2*3/4^5%6",
"gamma(17)",
],
)
def test_check_calculation__valid(calculation):
assert ... | [
"hallo.inc.commons.Commons.get_random_choice",
"hallo.inc.commons.Commons.get_domain_name",
"hallo.inc.commons.Commons.load_url_string",
"hallo.inc.commons.Commons.get_random_int",
"hallo.inc.commons.Commons.get_digits_from_start_or_end",
"pytest.mark.parametrize",
"hallo.inc.commons.Commons.read_file_t... | [((56, 190), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""calculation"""', "['23', '2.123', 'cos(12.2)', 'tan(sin(atan(cosh(1))))', 'pie',\n '1+2*3/4^5%6', 'gamma(17)']"], {}), "('calculation', ['23', '2.123', 'cos(12.2)',\n 'tan(sin(atan(cosh(1))))', 'pie', '1+2*3/4^5%6', 'gamma(17)'])\n", (79, 19... |
import random
from plugin import plugin
from colorama import Fore
def delay(): # method to pause after a series of actions have been completed.
n = input("Press enter to continue")
def wiped_slate(player): # resets all hands and bets
player['hands'] = []
player['suits'] = []
player['bets'] = []
... | [
"random.choice",
"plugin.plugin"
] | [((6025, 6044), 'plugin.plugin', 'plugin', (['"""blackjack"""'], {}), "('blackjack')\n", (6031, 6044), False, 'from plugin import plugin\n'), ((2457, 2477), 'random.choice', 'random.choice', (['cards'], {}), '(cards)\n', (2470, 2477), False, 'import random\n'), ((2500, 2520), 'random.choice', 'random.choice', (['suits'... |
import numpy as np
import pytest
import tensorflow as tf
from fv3fit.emulation.thermobasis.loss import QVLossSingleLevel, RHLossSingleLevel
from fv3fit.emulation.thermobasis.models import (
RHScalarMLP,
ScalarMLP,
UVTQSimple,
UVTRHSimple,
V1QCModel,
)
from fv3fit.emulation.thermobasis.thermo import ... | [
"fv3fit.emulation.thermobasis.models.V1QCModel",
"tensorflow.ones",
"fv3fit.emulation.thermobasis.models.UVTQSimple",
"tensorflow.random.set_seed",
"fv3fit.emulation.thermobasis.loss.RHLossSingleLevel",
"tensorflow.random.uniform",
"fv3fit.emulation.thermobasis.thermo.RelativeHumidityBasis",
"tensorfl... | [((481, 535), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""with_scalars"""', '[True, False]'], {}), "('with_scalars', [True, False])\n", (504, 535), False, 'import pytest\n'), ((1553, 1608), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""num_hidden_layers"""', '[0, 1, 4]'], {}), "('num_hidde... |
## Copyright 2020 ROS Industrial Consortium Asia Pacific
##
## 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 appl... | [
"yaml.load",
"launch_ros.actions.Node",
"os.path.basename",
"xacro.process_file",
"launch.LaunchDescription",
"ament_index_python.packages.get_package_share_directory",
"os.path.join",
"xacro.open_output"
] | [((1296, 1326), 'xacro.process_file', 'xacro.process_file', (['xacro_path'], {}), '(xacro_path)\n', (1314, 1326), False, 'import xacro\n'), ((1364, 1392), 'xacro.open_output', 'xacro.open_output', (['urdf_path'], {}), '(urdf_path)\n', (1381, 1392), False, 'import xacro\n'), ((1551, 1592), 'ament_index_python.packages.g... |
import pandas as pd
import numpy as np
import scipy
import os, sys
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import pylab
import matplotlib as mpl
import seaborn as sns
import analysis_utils
from multiprocessing import Pool
sys.path.append('../utils/')
from game_utils import *
in_d... | [
"sys.path.append",
"pandas.DataFrame",
"pandas.io.parsers.read_csv",
"analysis_utils.get_while_value",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"seaborn.despine",
"analysis_utils.get_value",
"matplotlib.use",
"numpy.mean",
"pdb.set_trace",
"multiprocessing.Pool",
"matplotlib.py... | [((88, 109), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (102, 109), False, 'import matplotlib\n'), ((261, 289), 'sys.path.append', 'sys.path.append', (['"""../utils/"""'], {}), "('../utils/')\n", (276, 289), False, 'import os, sys\n'), ((9004, 9011), 'multiprocessing.Pool', 'Pool', (['(8)'], ... |
import pandas as pd
s1 = pd.Series([10, 20, 30], name="Total")
s2 = pd.Series(["Jonathan", "Maikao", "Ronald"], name="Clientes")
df = pd.DataFrame({s2.name: s2, s1.name: s1})
print(df)
print()
df = df.rename(columns = {"Total": "Conta"}) #Renomeia colunas do dataframe e retorna outro dataFrame
print(df)
print()
pri... | [
"pandas.DataFrame",
"pandas.Series"
] | [((26, 63), 'pandas.Series', 'pd.Series', (['[10, 20, 30]'], {'name': '"""Total"""'}), "([10, 20, 30], name='Total')\n", (35, 63), True, 'import pandas as pd\n'), ((69, 129), 'pandas.Series', 'pd.Series', (["['Jonathan', 'Maikao', 'Ronald']"], {'name': '"""Clientes"""'}), "(['Jonathan', 'Maikao', 'Ronald'], name='Clien... |
import pickle
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import cassie
import time
from tempfile import TemporaryFile
FILE_PATH = "./hardware_logs/aslip_unified_no_delta_80_TS_only_sim/"
FILE_NAME = "2020-01-27_10:26_logfinal"
logs = pickle.load(open(FILE_PATH + ... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"numpy.asarray",
"numpy.zeros",
"numpy.array",
"numpy.savez"
] | [((593, 616), 'numpy.array', 'np.array', (["logs['input']"], {}), "(logs['input'])\n", (601, 616), True, 'import numpy as np\n'), ((767, 791), 'numpy.zeros', 'np.zeros', (['(numStates, 3)'], {}), '((numStates, 3))\n', (775, 791), True, 'import numpy as np\n'), ((808, 832), 'numpy.zeros', 'np.zeros', (['(numStates, 6)']... |
#!/usr/bin/env python
# coding: utf-8
from jinja2 import Environment, FileSystemLoader
import re
import yaml
regex = re.compile(r'^9GAG ')
with open('feeds.yml', 'r') as f_feeds:
feeds = yaml.load(f_feeds)
feed_list_unsort = [{
'categ_name': regex.sub('', f['name']).replace(' - Fresh', '').replace(' - Hot', '... | [
"jinja2.FileSystemLoader",
"yaml.load",
"re.compile"
] | [((119, 139), 're.compile', 're.compile', (['"""^9GAG """'], {}), "('^9GAG ')\n", (129, 139), False, 'import re\n'), ((193, 211), 'yaml.load', 'yaml.load', (['f_feeds'], {}), '(f_feeds)\n', (202, 211), False, 'import yaml\n'), ((671, 700), 'jinja2.FileSystemLoader', 'FileSystemLoader', (['"""templates"""'], {}), "('tem... |
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.express as px
import pandas as pd
from datetime import datetime, timedelta
from app import app
from settings import *
# https://stackoverflow.com/questions/60172150/dash-python-... | [
"dash_html_components.H2",
"pandas.read_csv",
"dash_core_components.Link",
"plotly.express.line",
"pandas.read_json",
"dash.dependencies.Input",
"dash_html_components.H4",
"datetime.timedelta",
"dash_core_components.Dropdown",
"dash_core_components.Graph",
"dash.dependencies.Output",
"datetime... | [((917, 955), 'pandas.read_json', 'pd.read_json', (['addresses_json_file_path'], {}), '(addresses_json_file_path)\n', (929, 955), True, 'import pandas as pd\n'), ((685, 699), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (697, 699), False, 'from datetime import datetime, timedelta\n'), ((2607, 2642), 'pand... |
import numpy as np
import os
from PIL import Image
def convert_to_10class(d):
d_mod = np.zeros((len(d), 10), dtype=np.float32)
for num, contents in enumerate(d):
d_mod[num][int(contents)] = 1.0
# debug
# print("d_mod[100] =", d_mod[100])
# print("d_mod[200] =", d_mod[200])
return d_mo... | [
"PIL.Image.fromarray",
"numpy.zeros",
"numpy.tile"
] | [((1018, 1087), 'numpy.zeros', 'np.zeros', (['(28 * sample_num_h, 28 * sample_num_h, 1)'], {'dtype': 'np.float32'}), '((28 * sample_num_h, 28 * sample_num_h, 1), dtype=np.float32)\n', (1026, 1087), True, 'import numpy as np\n'), ((1786, 1813), 'PIL.Image.fromarray', 'Image.fromarray', (['wide_image'], {}), '(wide_image... |
from django.conf import settings
from django.contrib.sites.models import Site
from django.utils import timezone
import pytz
def core_context(self):
"""Context processor for elements appearing on every page."""
context = {}
context["conference_title"] = Site.objects.get_current().name
context["google_... | [
"django.contrib.sites.models.Site.objects.get_current",
"django.utils.timezone.get_current_timezone_name"
] | [((751, 787), 'django.utils.timezone.get_current_timezone_name', 'timezone.get_current_timezone_name', ([], {}), '()\n', (785, 787), False, 'from django.utils import timezone\n'), ((268, 294), 'django.contrib.sites.models.Site.objects.get_current', 'Site.objects.get_current', ([], {}), '()\n', (292, 294), False, 'from ... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"os.path.abspath",
"logging.error",
"logging.debug",
"os.environ.copy",
"subprocess.check_output",
"time.sleep",
"logging.info",
"os.path.join",
"subprocess.check_call",
"re.compile"
] | [((1086, 1118), 'os.path.abspath', 'os.path.abspath', (['cluster.workdir'], {}), '(cluster.workdir)\n', (1101, 1118), False, 'import os\n'), ((1146, 1182), 'os.path.abspath', 'os.path.abspath', (['cluster.hadoop_home'], {}), '(cluster.hadoop_home)\n', (1161, 1182), False, 'import os\n'), ((1207, 1247), 'os.path.join', ... |
import math
import random
import cv2
import mmcv
import numpy as np
from mmhuman3d.core.conventions.keypoints_mapping import get_flip_pairs
from mmhuman3d.utils.demo_utils import box2cs
from ..builder import PIPELINES
from .transforms import (
_rotate_smpl_pose,
affine_transform,
get_affine_transform,
)
... | [
"numpy.abs",
"numpy.maximum",
"numpy.ones",
"numpy.sin",
"numpy.linalg.norm",
"numpy.random.normal",
"numpy.zeros_like",
"numpy.empty_like",
"mmhuman3d.core.conventions.keypoints_mapping.get_flip_pairs",
"math.sqrt",
"mmcv.imflip",
"numpy.hstack",
"random.random",
"numpy.linalg.inv",
"nu... | [((842, 876), 'numpy.array', 'np.array', (['[xmin, ymin, xmax, ymax]'], {}), '([xmin, ymin, xmax, ymax])\n', (850, 876), True, 'import numpy as np\n'), ((1679, 1700), 'numpy.zeros_like', 'np.zeros_like', (['coords'], {}), '(coords)\n', (1692, 1700), True, 'import numpy as np\n'), ((1818, 1860), 'numpy.array', 'np.array... |
# --------------
# Import packages
import numpy as np
import pandas as pd
from scipy.stats import mode
# code starts here
bank = pd.read_csv(path)
print(bank.head(5))
categorical_var = bank.select_dtypes(include = 'object')
print(categorical_var)
numerical_var = bank.select_dtypes(include = 'number')
print(nume... | [
"pandas.read_csv",
"pandas.pivot_table"
] | [((135, 152), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (146, 152), True, 'import pandas as pd\n'), ((649, 759), 'pandas.pivot_table', 'pd.pivot_table', (['banks'], {'index': "['Gender', 'Married', 'Self_Employed']", 'values': '"""LoanAmount"""', 'aggfunc': 'np.mean'}), "(banks, index=['Gender', 'Ma... |
##
# Copyright (c) 2014-2017 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | [
"twext.who.expression.MatchExpression",
"twext.who.opendirectory.DirectoryService",
"twisted.internet.defer.returnValue",
"uuid.UUID",
"itertools.chain"
] | [((2343, 2361), 'twext.who.opendirectory.DirectoryService', 'DirectoryService', ([], {}), '()\n', (2359, 2361), False, 'from twext.who.opendirectory import DirectoryService\n'), ((2006, 2025), 'twisted.internet.defer.returnValue', 'returnValue', (['result'], {}), '(result)\n', (2017, 2025), False, 'from twisted.interne... |
#!/usr/bin/python3
"""
Usage: tlpakinfo [OPTION] [-f FILE | -p PATH]
-f FILE Extract information about the given APK file
-p PATH Extract information about all "*.apk" files in the given path
Other options
-t Just show some summary information about the files in the APK e.g.
size of 'ass... | [
"zipfile.ZipFile",
"getopt.getopt",
"os.path.isdir",
"os.walk",
"collections.namedtuple",
"os.path.join",
"fnmatch.fnmatch",
"sys.exit"
] | [((778, 901), 'collections.namedtuple', 'namedtuple', (['"""ApkData"""', "('storedsize uctotalsize assetsize metainfsize xmlsize ' +\n 'miscsize cassetsize ucassetsize')"], {}), "('ApkData', \n 'storedsize uctotalsize assetsize metainfsize xmlsize ' +\n 'miscsize cassetsize ucassetsize')\n", (788, 901), False,... |
import statistics
import sys
sys.path.append(
"scripts"
) # Hackfix but results in a more readable scripts folder structure
from shared import *
import json
# check cohort frequencies on
meanPileups = {}
for f in snakemake.input:
print("processing pileups: {}".format(f))
fp = parsePileupStrandAware(f)
... | [
"sys.path.append",
"statistics.median"
] | [((30, 56), 'sys.path.append', 'sys.path.append', (['"""scripts"""'], {}), "('scripts')\n", (45, 56), False, 'import sys\n'), ((747, 783), 'statistics.median', 'statistics.median', (['meanPileups[p][k]'], {}), '(meanPileups[p][k])\n', (764, 783), False, 'import statistics\n')] |
from nose.tools import eq_, ok_, raises
from pullsbury.handlers.github_handler import GithubHandler
from pullsbury.config import load_config
from tests import load_fixture
from unittest import TestCase
import httpretty
import github as pygithub
class TestGithubHandler(TestCase):
def test_get_oauth_client(self):
... | [
"tests.load_fixture",
"httpretty.register_uri",
"httpretty.last_request",
"pullsbury.config.load_config",
"pullsbury.handlers.github_handler.GithubHandler",
"nose.tools.raises"
] | [((957, 974), 'nose.tools.raises', 'raises', (['Exception'], {}), '(Exception)\n', (963, 974), False, 'from nose.tools import eq_, ok_, raises\n'), ((1665, 1682), 'nose.tools.raises', 'raises', (['Exception'], {}), '(Exception)\n', (1671, 1682), False, 'from nose.tools import eq_, ok_, raises\n'), ((1931, 1948), 'nose.... |
# -*- coding: utf-8 -*-
import sys
import os
sys.path.insert(1, os.path.abspath(os.path.curdir))
import numpy as np
from models import Connect4ActionMaskModel
from config.connect4_config import Connect3Config
from utils.learning_behaviour_utils import LSTM_model,split_train_val,\
minimax_vs_minimax_connect3_singl... | [
"os.path.abspath",
"numpy.load",
"tensorflow.math.reduce_mean",
"tensorflow.math.argmax",
"env.connect4_multiagent_env.Connect4Env",
"numpy.argmax",
"utils.learning_behaviour_utils.LSTM_model",
"numpy.asarray",
"ray.rllib.agents.ppo.PPOTrainer",
"numpy.expand_dims",
"numpy.exp",
"numpy.random.... | [((64, 95), 'os.path.abspath', 'os.path.abspath', (['os.path.curdir'], {}), '(os.path.curdir)\n', (79, 95), False, 'import os\n'), ((1175, 1222), 'os.path.join', 'os.path.join', (['data_dir', '"""lstm_best_weights.npy"""'], {}), "(data_dir, 'lstm_best_weights.npy')\n", (1187, 1222), False, 'import os\n'), ((1241, 1285)... |
import json
import sys
from pathlib import Path
from pprint import pprint
ROOT = Path(__file__).absolute().parent.parent
sys.path.insert(0, str(ROOT / "api"))
sys.path.insert(0, str(ROOT))
import Functions
from metadata import generate_metadata
exitcode = 0
for n in dir(Functions):
f = getattr(... | [
"json.dumps",
"pathlib.Path",
"metadata.generate_metadata",
"pprint.pprint",
"sys.exit"
] | [((1069, 1087), 'sys.exit', 'sys.exit', (['exitcode'], {}), '(exitcode)\n', (1077, 1087), False, 'import sys\n'), ((821, 831), 'pprint.pprint', 'pprint', (['md'], {}), '(md)\n', (827, 831), False, 'from pprint import pprint\n'), ((448, 483), 'metadata.generate_metadata', 'generate_metadata', (['n', 'f'], {'tidy': '(Fal... |
#! /usr/bin/env python3
#
# Multicast Chat Application - Server implementation
# https://github.com/rtauxerre/Multicast
# Copyright (c) 2021 <NAME>
# usage : $ ./receiver.py
#
# External dependencies
import asyncio
import socket
# Multicast address and port
multicast_address = '172.16.58.3'
multicast_port = 10000
... | [
"socket.inet_aton",
"asyncio.sleep",
"asyncio.get_running_loop"
] | [((805, 831), 'asyncio.get_running_loop', 'asyncio.get_running_loop', ([], {}), '()\n', (829, 831), False, 'import asyncio\n'), ((1052, 1071), 'asyncio.sleep', 'asyncio.sleep', (['(3600)'], {}), '(3600)\n', (1065, 1071), False, 'import asyncio\n'), ((520, 555), 'socket.inet_aton', 'socket.inet_aton', (['multicast_addre... |
"""
smorest_sfs.modules.auth.helpers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
auth辅助文件
"""
from datetime import datetime
from typing import Dict, Optional
from flask_jwt_extended import decode_token
from sqlalchemy.orm.exc import NoResultFound
from .models import TokenBlackList
def _epoch_utc_to_datetime(epoch_... | [
"flask_jwt_extended.decode_token"
] | [((1018, 1074), 'flask_jwt_extended.decode_token', 'decode_token', (['encoded_token'], {'allow_expired': 'allow_expired'}), '(encoded_token, allow_expired=allow_expired)\n', (1030, 1074), False, 'from flask_jwt_extended import decode_token\n')] |
import re
import datetime
from typing import Optional, List, SupportsInt
from .format import plural, human_join
from datetime import timedelta
TIME_RE_STRING = r"\s?".join(
[
r"((?P<weeks>\d+?)\s?(weeks?|w))?", # e.g. 2w
r"((?P<days>\d+?)\s?(days?|d))?", # e.g. 4... | [
"datetime.timedelta.total_seconds",
"re.compile"
] | [((557, 589), 're.compile', 're.compile', (['TIME_RE_STRING', 're.I'], {}), '(TIME_RE_STRING, re.I)\n', (567, 589), False, 'import re\n'), ((761, 786), 'datetime.timedelta.total_seconds', 'timedelta.total_seconds', ([], {}), '()\n', (784, 786), False, 'from datetime import timedelta\n')] |
# -*- coding: utf-8 -*- #
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | [
"textwrap.dedent",
"googlecloudsdk.api_lib.container.binauthz.attestors.Client",
"googlecloudsdk.command_lib.container.binauthz.flags.GetAttestorPresentationSpec"
] | [((1162, 1259), 'googlecloudsdk.command_lib.container.binauthz.flags.GetAttestorPresentationSpec', 'flags.GetAttestorPresentationSpec', ([], {'positional': '(True)', 'group_help': '"""The attestor to be created."""'}), "(positional=True, group_help=\n 'The attestor to be created.')\n", (1195, 1259), False, 'from goo... |
import pandas as pd
import numpy as np
from scipy.stats import norm
import matplotlib.pyplot as plt
from numpy import genfromtxt
import os
def gaus(feature):
data = genfromtxt('./dataset/modified_weather/'+ feature +'.csv', delimiter=',')
data = data.ravel()
# clear nan values
data = dat... | [
"pandas.DataFrame",
"os.makedirs",
"pandas.read_csv",
"os.path.exists",
"numpy.genfromtxt",
"numpy.isnan"
] | [((182, 257), 'numpy.genfromtxt', 'genfromtxt', (["('./dataset/modified_weather/' + feature + '.csv')"], {'delimiter': '""","""'}), "('./dataset/modified_weather/' + feature + '.csv', delimiter=',')\n", (192, 257), False, 'from numpy import genfromtxt\n'), ((400, 418), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {})... |
# -*- coding: utf-8 -*-
from __future__ import annotations
import warnings
import collections
from typing import Dict, Optional
from dataclasses import dataclass, field
import numpy as np
import pandas as pd # type: ignore
import xarray as xr
from shapely.geometry import LineString # type: ignore
from shapely.geomet... | [
"pandas.DataFrame",
"warnings.filterwarnings",
"xarray.open_dataset",
"dataclasses.field",
"collections.defaultdict",
"geopandas.GeoDataFrame",
"shapely.geometry.LineString",
"warnings.catch_warnings",
"numpy.array",
"numpy.linalg.norm",
"numpy.dot",
"pandas.concat"
] | [((369, 394), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (392, 394), False, 'import warnings\n'), ((400, 462), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'DeprecationWarning'}), "('ignore', category=DeprecationWarning)\n", (423, 462), False, 'impor... |
from django.conf import settings
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.mail import send_mail
from django.template.loader import render_to_string
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
from django.views.generic import TemplateView
... | [
"helpme.models.Comment.objects.all",
"helpme.models.Category.objects.filter",
"django.utils.translation.gettext_lazy",
"helpme.forms.CommentForm",
"django.urls.reverse_lazy",
"django.template.loader.render_to_string",
"helpme.models.Team.objects.filter",
"helpme.config.SupportEmailClass",
"helpme.mo... | [((1380, 1412), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""helpme:anonymous"""'], {}), "('helpme:anonymous')\n", (1392, 1412), False, 'from django.urls import reverse_lazy\n'), ((3327, 3359), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""helpme:dashboard"""'], {}), "('helpme:dashboard')\n", (3339, 3359), Fal... |
from flask import request
from flask_restful import Resource
from sqlalchemy.exc import SQLAlchemyError
from web.helpers import PaginationHelper
from web.models import UserSchema, User
from web.resources import AuthRequiredResource, auth
from web.status import status
from web.db import db
user_schema = UserSchema()
... | [
"web.models.User",
"web.models.UserSchema",
"web.models.User.query.filter_by",
"web.models.User.query.get_or_404",
"web.models.User.query.get",
"web.db.db.session.rollback",
"flask.request.get_json",
"web.helpers.PaginationHelper"
] | [((306, 318), 'web.models.UserSchema', 'UserSchema', ([], {}), '()\n', (316, 318), False, 'from web.models import UserSchema, User\n'), ((402, 427), 'web.models.User.query.get_or_404', 'User.query.get_or_404', (['id'], {}), '(id)\n', (423, 427), False, 'from web.models import UserSchema, User\n'), ((1465, 1616), 'web.h... |
"""
fuzzable_request.py
Copyright 2006 <NAME>
This file is part of w3af, http://w3af.org/ .
w3af 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 version 2 of the License.
w3af is distributed in the hope that it... | [
"string.maketrans",
"base64.b64decode",
"w3af.core.data.parsers.doc.url.URL",
"w3af.core.controllers.exceptions.BaseFrameworkException",
"w3af.core.data.dc.headers.Headers",
"urllib.quote",
"urllib.quote_plus",
"w3af.core.data.dc.cookie.Cookie",
"w3af.core.data.parsers.doc.http_request_parser.raw_ht... | [((1628, 1666), 'string.maketrans', 'string.maketrans', (['ALL_CHARS', 'ALL_CHARS'], {}), '(ALL_CHARS, ALL_CHARS)\n', (1644, 1666), False, 'import string\n'), ((5355, 5384), 'w3af.core.data.dc.headers.Headers', 'Headers', ([], {'init_val': 'req_headers'}), '(init_val=req_headers)\n', (5362, 5384), False, 'from w3af.cor... |
#!/usr/bin/env python3
import argparse
import subprocess
import shlex
import json
import os
from utils import progressBar,mapcount
def localize_files(gpath,file_list):
"""
Get list of jsons to merge
"""
with open(file_list,'wt') as f:
if not gpath.endswith('/'): gpath += '/'
gpath = ... | [
"json.dump",
"utils.mapcount",
"os.remove",
"json.load",
"argparse.ArgumentParser",
"utils.progressBar",
"os.path.dirname",
"shlex.split",
"os.path.join"
] | [((681, 700), 'utils.mapcount', 'mapcount', (['file_list'], {}), '(file_list)\n', (689, 700), False, 'from utils import progressBar, mapcount\n'), ((1199, 1218), 'os.remove', 'os.remove', (['tmp_json'], {}), '(tmp_json)\n', (1208, 1218), False, 'import os\n'), ((1223, 1243), 'os.remove', 'os.remove', (['file_list'], {}... |
# -*- coding: utf-8 -*-
import time
from util.log import log
import uuid
import hashlib
timetoolong = []
def uuidgen():
return str(uuid.uuid4())
def hashgen(s):
return hashlib.sha224(s).hexdigest()
def counttime(func):
def _warpper(*args, **kwargs):
start_time = time.time()
result = ... | [
"hashlib.sha224",
"util.log.log.info",
"uuid.uuid4",
"time.time"
] | [((139, 151), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (149, 151), False, 'import uuid\n'), ((291, 302), 'time.time', 'time.time', ([], {}), '()\n', (300, 302), False, 'import time\n'), ((396, 457), 'util.log.log.info', 'log.info', (["('%s time spent is %f' % (func.__name__, spent_time))"], {}), "('%s time spent i... |
from utils.db import sqlur
from utils.google_sheets_utils import undo as sheets_undo
from utils.guild_member import check_guild_crew, get_guild_member_nickname, get_guild_channel_board
from utils.cmds_registry import register
register(cmd="undo", alias="undo")
class undo:
def __init__(self):
self.usage = ... | [
"utils.cmds_registry.register",
"utils.db.sqlur.undo",
"utils.guild_member.get_guild_channel_board",
"utils.guild_member.check_guild_crew",
"utils.google_sheets_utils.undo"
] | [((227, 261), 'utils.cmds_registry.register', 'register', ([], {'cmd': '"""undo"""', 'alias': '"""undo"""'}), "(cmd='undo', alias='undo')\n", (235, 261), False, 'from utils.cmds_registry import register\n'), ((607, 640), 'utils.guild_member.check_guild_crew', 'check_guild_crew', (["auth['user_id']"], {}), "(auth['user_... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------#
# author: <NAME> #
# email: <EMAIL> #
# -------------------------------------------#
from __future__ import absolute_import, unicode_literals
import io
import sys
from math import ... | [
"math.log",
"xmnlp.utils.safe_input",
"sys.setdefaultencoding",
"io.open"
] | [((462, 492), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""utf8"""'], {}), "('utf8')\n", (484, 492), False, 'import sys\n'), ((2540, 2577), 'io.open', 'io.open', (['fname', '"""r"""'], {'encoding': '"""utf-8"""'}), "(fname, 'r', encoding='utf-8')\n", (2547, 2577), False, 'import io\n'), ((2690, 2706), 'xmn... |
#!/usr/bin/env python3
###############################################################################
###############################################################################
## ##
## _ ___ ___ ___ ___ ___ ... | [
"source.phasep.phsmrk",
"source.phasep.ph2fil",
"source.phasep.ph1fil",
"source.dopest.dopest"
] | [((18259, 18306), 'source.phasep.phsmrk', 'phasep.phsmrk', (['rnxdata', 'rnxstep', 'goodsats', 'inps'], {}), '(rnxdata, rnxstep, goodsats, inps)\n', (18272, 18306), False, 'from source import phasep\n'), ((18479, 18541), 'source.dopest.dopest', 'dopest.dopest', (['rnxmark', 'goodsats', 'tstart', 'tstop', 'rnxstep', 'in... |
import os
import random
import argparse
import torch
import torch.nn as nn
import numpy as np
import net as net
from utils import load_data
from sklearn.metrics import f1_score
import pdb
import pruning
import copy
import utils
import warnings
warnings.filterwarnings('ignore')
def run_fix_mask(args, index, rewind_we... | [
"pruning.setup_seed",
"pruning.get_final_weight_mask_epoch",
"utils.load_data",
"net.net_gcn_baseline",
"argparse.ArgumentParser",
"warnings.filterwarnings",
"torch.nn.CrossEntropyLoss",
"utils.sparse_mx_to_torch_sparse_tensor",
"pruning.add_mask",
"pruning.print_weight_sparsity",
"utils.normali... | [((246, 279), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (269, 279), False, 'import warnings\n'), ((427, 451), 'utils.normalize_adj', 'utils.normalize_adj', (['adj'], {}), '(adj)\n', (446, 451), False, 'import utils\n'), ((462, 505), 'utils.sparse_mx_to_torch_sparse_te... |
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
import time
import os
import numpy as np
from nltk.tokenize import word_tokenize
import unicodedata
import re
import pickle
GREEK_STOP = ['αδιακοπα', 'αι', 'ακομα', 'ακομη', 'ακριβως', 'αληθεια', 'αληθινα', 'αλλα', 'αλλαχου', 'αλλες',
'αλλη', ... | [
"unicodedata.normalize",
"os.makedirs",
"unicodedata.category",
"os.path.exists",
"time.sleep",
"numpy.mean",
"requests.get",
"bs4.BeautifulSoup",
"nltk.tokenize.word_tokenize",
"re.compile"
] | [((7697, 7711), 'numpy.mean', 'np.mean', (['proba'], {}), '(proba)\n', (7704, 7711), True, 'import numpy as np\n'), ((7993, 8007), 'numpy.mean', 'np.mean', (['proba'], {}), '(proba)\n', (8000, 8007), True, 'import numpy as np\n'), ((8664, 8686), 'requests.get', 'requests.get', (['seed_url'], {}), '(seed_url)\n', (8676,... |
from datetime import datetime
from pathlib import Path
import bokeh
import pandas as pd
from bokeh.io import curdoc
from bokeh.layouts import Spacer, column, row
from bokeh.models import (ColumnDataSource, DataTable, DateFormatter, Div,
HoverTool, Label, NumeralTickFormatter, Panel,
... | [
"pathlib.Path.home",
"bokeh.plotting.output_file",
"bokeh.models.NumberFormatter",
"bokeh.plotting.save",
"bokeh.models.TableColumn",
"pandas.DataFrame",
"bokeh.models.Panel",
"bokeh.io.curdoc",
"datetime.datetime.now",
"pandas.concat",
"bokeh.models.Tabs",
"bokeh.layouts.row",
"pandas.perio... | [((1309, 1337), 'pandas.DataFrame', 'pd.DataFrame', (["peers['peers']"], {}), "(peers['peers'])\n", (1321, 1337), True, 'import pandas as pd\n'), ((1349, 1380), 'pandas.DataFrame', 'pd.DataFrame', (["chans['channels']"], {}), "(chans['channels'])\n", (1361, 1380), True, 'import pandas as pd\n'), ((2788, 2850), 'bokeh.p... |
import os
from copy import deepcopy
import argparse
from tqdm import tqdm
import torch
import torch.nn as nn
import torch.multiprocessing as mp
from torch.utils.data import DataLoader
from torch.utils.data.distributed import DistributedSampler
from transformers import AdamW, get_linear_schedule_with_warmup
from ivad... | [
"utils.binary_accuracy",
"utils.split_dataset",
"argparse.ArgumentParser",
"torch.cuda.device_count",
"datasets.MSSeg2Dataset",
"torch.device",
"torch.no_grad",
"os.path.join",
"torch.cuda.amp.autocast",
"torch.utils.data.DataLoader",
"torch.load",
"torch.nn.parallel.DistributedDataParallel",
... | [((593, 697), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Script for training custom models for MSSeg2 Challenge 2021."""'}), "(description=\n 'Script for training custom models for MSSeg2 Challenge 2021.')\n", (616, 697), False, 'import argparse\n'), ((8465, 8847), 'models.ModelCo... |
# -*- coding: utf-8 -*-
### LIST of all the regexes supported by readability
import re
## Regex stolen from Arc90's readability.js
REGEXPS = {
'unlikelyNodes': re.compile(r'ad_wrapper|adwrapper|combx|comment|community|disqus|extra|foot|header|menu|remark|rss|shoutbox|sidebar|sponsor|ad-break|agegate|pagination|p... | [
"re.compile"
] | [((167, 380), 're.compile', 're.compile', (['"""ad_wrapper|adwrapper|combx|comment|community|disqus|extra|foot|header|menu|remark|rss|shoutbox|sidebar|sponsor|ad-break|agegate|pagination|pager|popup|tweet|twitter|facebook|pinterest"""', 're.I'], {}), "(\n 'ad_wrapper|adwrapper|combx|comment|community|disqus|extra|fo... |
from pythonforandroid.toolchain import CompiledComponentsPythonRecipe, shprint, current_directory
from os.path import exists, join
import sh
import glob
class NumpyRecipe(CompiledComponentsPythonRecipe):
version = '1.7.1'
url = 'http://pypi.python.org/packages/source/n/numpy/numpy-{version}.tar.gz'
... | [
"os.path.join"
] | [((532, 559), 'os.path.join', 'join', (['build_dir', '""".patched"""'], {}), "(build_dir, '.patched')\n", (536, 559), False, 'from os.path import exists, join\n'), ((714, 741), 'os.path.join', 'join', (['build_dir', '""".patched"""'], {}), "(build_dir, '.patched')\n", (718, 741), False, 'from os.path import exists, joi... |
import setuptools
with open('README.md', 'r') as fh:
long_description = fh.read()
setuptools.setup(
name='tkinter-nav',
version='0.0.5',
author='<NAME>',
author_email='<EMAIL>',
description='Lightweight navigation wrapper for Tkinter',
long_description=long_description,
long_descriptio... | [
"setuptools.find_packages"
] | [((418, 444), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (442, 444), False, 'import setuptools\n')] |
import logging
import time
import traceback
from django.db import connection
from django.core.management.base import BaseCommand, CommandError
from django.db.models import F, RowRange, Window
from django.db.models.functions import Rank, ExtractYear
from waterspout_api import models
from Waterspout import settings
l... | [
"waterspout_api.models.ModelRun.objects.filter",
"traceback.format_exc",
"logging.getLogger",
"time.sleep"
] | [((325, 378), 'logging.getLogger', 'logging.getLogger', (['"""waterspout_service_run_processor"""'], {}), "('waterspout_service_run_processor')\n", (342, 378), False, 'import logging\n'), ((2071, 2144), 'waterspout_api.models.ModelRun.objects.filter', 'models.ModelRun.objects.filter', ([], {'ready': '(True)', 'running'... |
#!/usr/bin/env python3
import argparse
import fileinput
import sys
import time
from struct import unpack, error
from random import random
from ctypes import c_int
from collections import defaultdict
from math import ceil
from lt import decode
def run(stream=sys.stdin.buffer):
"""Reads from stream, applying the L... | [
"lt.decode.decode",
"argparse.ArgumentParser"
] | [((480, 501), 'lt.decode.decode', 'decode.decode', (['stream'], {}), '(stream)\n', (493, 501), False, 'from lt import decode\n'), ((588, 622), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""decoder"""'], {}), "('decoder')\n", (611, 622), False, 'import argparse\n')] |
#!/Users/glezma/OneDrive/Programming/Python/cloud_projects/training-hub2/th2/venv/bin/python3.6
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| [
"django.core.management.execute_from_command_line"
] | [((163, 201), 'django.core.management.execute_from_command_line', 'management.execute_from_command_line', ([], {}), '()\n', (199, 201), False, 'from django.core import management\n')] |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | [
"unittest.mock.patch",
"unittest.skipIf",
"airflow.providers.mysql.transfers.presto_to_mysql.PrestoToMySqlOperator"
] | [((1218, 1286), 'unittest.mock.patch', 'patch', (['"""airflow.providers.mysql.transfers.presto_to_mysql.MySqlHook"""'], {}), "('airflow.providers.mysql.transfers.presto_to_mysql.MySqlHook')\n", (1223, 1286), False, 'from unittest.mock import patch\n'), ((1292, 1361), 'unittest.mock.patch', 'patch', (['"""airflow.provid... |
from django.shortcuts import render,redirect
from django.http import HttpResponse,HttpResponse
from django.contrib.auth.decorators import login_required
from .models import Project, Profile, Reviews
from django.contrib.auth.models import User
from .forms import ProjectForm, ProfileForm, ReviewForm
from rest_framework... | [
"django.contrib.auth.decorators.login_required",
"django.shortcuts.redirect",
"rest_framework.response.Response",
"django.shortcuts.render"
] | [((466, 510), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""/accounts/login/"""'}), "(login_url='/accounts/login/')\n", (480, 510), False, 'from django.contrib.auth.decorators import login_required\n'), ((1023, 1066), 'django.contrib.auth.decorators.login_required', 'login_re... |
import PicNumero
imagePath = "Wheat_Images/001.jpg"
count = PicNumero.run_with_cnn(imagePath)
| [
"PicNumero.run_with_cnn"
] | [((61, 94), 'PicNumero.run_with_cnn', 'PicNumero.run_with_cnn', (['imagePath'], {}), '(imagePath)\n', (83, 94), False, 'import PicNumero\n')] |
"""General-purpose training script for image-to-image translation.
This script works for various models (with option '--model': e.g., pix2pix, cyclegan, colorization) and
different datasets (with option '--dataset_mode': e.g., aligned, unaligned, single, colorization).
You need to specify the dataset ('--dataroot'), e... | [
"vectornet.tester.Tester",
"util.util.tensor2im",
"models.create_model",
"vectornet.config.get_config",
"time.time",
"vectornet.utils.prepare_dirs_and_logger",
"vectornet.utils.save_config",
"util.visualizer.Visualizer",
"options.train_options.TrainOptions",
"data.create_dataset"
] | [((1770, 1789), 'data.create_dataset', 'create_dataset', (['opt'], {}), '(opt)\n', (1784, 1789), False, 'from data import create_dataset\n'), ((2005, 2022), 'models.create_model', 'create_model', (['opt'], {}), '(opt)\n', (2017, 2022), False, 'from models import create_model\n'), ((2191, 2206), 'util.visualizer.Visuali... |
"""
This module is intended to summarize the output of a comparison. It can be called independently of the comparison
module on completed excel comparisons or as part of the comparison function call itself.
"""
from collections import namedtuple
import openpyxl as xl
from openpyxl.styles import PatternFill
fr... | [
"openpyxl.styles.PatternFill",
"openpyxl.load_workbook",
"openpyxl.utils.get_column_letter",
"collections.namedtuple"
] | [((469, 622), 'collections.namedtuple', 'namedtuple', (['"""SummaryNode"""', "['sheet_name', 'column_with_differences', 'number_of_differences',\n 'number_of_rows', 'match_percent', 'column_index']"], {}), "('SummaryNode', ['sheet_name', 'column_with_differences',\n 'number_of_differences', 'number_of_rows', 'mat... |
import torch.nn as nn
import common.model.unet as unet
class PostNet(nn.Module):
def __init__(self, in_channels, nb_classes, nb_convs=3, dropout=None):
super().__init__()
convs = [unet.Conv2dBnRelu(in_channels, in_channels, dropout, kernel=1, padding=0) for _ in range(nb_convs)]
self.con... | [
"torch.nn.Conv2d",
"common.model.unet.Conv2dBnRelu",
"torch.nn.Sequential"
] | [((325, 346), 'torch.nn.Sequential', 'nn.Sequential', (['*convs'], {}), '(*convs)\n', (338, 346), True, 'import torch.nn as nn\n'), ((374, 411), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_channels', 'nb_classes', '(1)'], {}), '(in_channels, nb_classes, 1)\n', (383, 411), True, 'import torch.nn as nn\n'), ((204, 277), 'commo... |
# Generated by Django 3.1.3 on 2021-02-03 20:49
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('server', '0018_auto_20210203_2023'),
]
operations = [
migrations.AlterField(
model_name='housek... | [
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((367, 465), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'default': '"""7351451907"""', 'editable': '(False)', 'max_length': '(10)', 'unique': '(True)'}), "(blank=True, default='7351451907', editable=False,\n max_length=10, unique=True)\n", (383, 465), False, 'from django.db import mi... |
import pandas
import sqlalchemy
class ModelVariantReadCountLike(object):
"""Takes a any type of VariantReadCount models/table with at least run_id, marker_id, sample_id, replicate, variant_id
attributes/columns and performs various operations on it"""
def __init__(self, engine, variant_read_count_like_mo... | [
"pandas.DataFrame",
"sqlalchemy.bindparam"
] | [((712, 748), 'pandas.DataFrame', 'pandas.DataFrame', (['sample_record_list'], {}), '(sample_record_list)\n', (728, 748), False, 'import pandas\n'), ((1001, 1031), 'sqlalchemy.bindparam', 'sqlalchemy.bindparam', (['"""run_id"""'], {}), "('run_id')\n", (1021, 1031), False, 'import sqlalchemy\n'), ((1140, 1173), 'sqlalch... |
"""One dimensional dataset,
Gaussian with sinus wave mean, variance increasing in x
Taken from paper: "https://arxiv.org/abs/1906.01620"
"""
import logging
from pathlib import Path
import csv
import numpy as np
import torch.utils.data
import matplotlib.pyplot as plt
class GaussianSinus(torch.utils.data.Dataset):
... | [
"numpy.random.uniform",
"matplotlib.pyplot.show",
"numpy.random.shuffle",
"csv.reader",
"matplotlib.pyplot.legend",
"numpy.savetxt",
"pathlib.Path",
"numpy.sin",
"numpy.arange",
"numpy.array",
"numpy.exp",
"numpy.column_stack",
"numpy.diag",
"matplotlib.pyplot.subplots",
"logging.getLogg... | [((3117, 3127), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (3125, 3127), True, 'import matplotlib.pyplot as plt\n'), ((3221, 3230), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (3227, 3230), True, 'import numpy as np\n'), ((3559, 3588), 'matplotlib.pyplot.legend', 'plt.legend', ([], {'prop': "{'size': 20}"... |
import numpy as np
from pytest import approx, raises
import context # noqa
from src import line_search
from src.least_squares import least_squares
class TestGoldenSection:
def test_correct_1d(self):
""" Check if one dimensional problems which are well specified are
solved correctly.
"""
... | [
"numpy.random.uniform",
"src.least_squares.least_squares",
"src.line_search.goldensection",
"pytest.raises",
"pytest.approx"
] | [((339, 404), 'src.line_search.goldensection', 'line_search.goldensection', ([], {'func': '(lambda x: (x - 4) ** 2)', 'x': '(3)', 'dx': '(2)'}), '(func=lambda x: (x - 4) ** 2, x=3, dx=2)\n', (364, 404), False, 'from src import line_search\n'), ((569, 635), 'src.line_search.goldensection', 'line_search.goldensection', (... |
# -*- coding: utf-8 -*-
from z3c.dependencychecker.modules import BaseModule
from z3c.dependencychecker.tests.utils import write_source_file_at
import os
import pytest
import tempfile
def test_module_path():
obj = BaseModule('/some/path', '/some/path/random/bla')
assert obj.path == '/some/path/random/bla'
d... | [
"pytest.raises",
"tempfile.mkdtemp",
"z3c.dependencychecker.modules.BaseModule.create_from_files",
"z3c.dependencychecker.modules.BaseModule",
"os.path.join",
"z3c.dependencychecker.tests.utils.write_source_file_at"
] | [((220, 269), 'z3c.dependencychecker.modules.BaseModule', 'BaseModule', (['"""/some/path"""', '"""/some/path/random/bla"""'], {}), "('/some/path', '/some/path/random/bla')\n", (230, 269), False, 'from z3c.dependencychecker.modules import BaseModule\n'), ((353, 402), 'z3c.dependencychecker.modules.BaseModule', 'BaseModu... |
import numpy as np
# from numpy import linalg as LA
import matplotlib.pyplot as plt
# import networkx as nx
# from scipy import integrate
from dynamic_systems import Dynamics
import reservoir
NODES = 400
TIME_STEP = 0.1
TRAINING_TIME = 260
TRANSIENT_TIME = 200
TEST_TIME = 100
INPUTS = [0]
OUTPUTS = [1, 2]
INITIAL_CO... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"reservoir.split_data",
"reservoir.gen_data",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"reservoir.gen_A"
] | [((667, 743), 'reservoir.gen_data', 'reservoir.gen_data', (['dynamic_system', 'INITIAL_CONDITION', 'total_time', 'TIME_STEP'], {}), '(dynamic_system, INITIAL_CONDITION, total_time, TIME_STEP)\n', (685, 743), False, 'import reservoir\n'), ((797, 886), 'reservoir.split_data', 'reservoir.split_data', (['DATA', 'INPUTS', '... |
# ===============================================================================
# Created: 13 Sep 2018
# @author: <NAME> (Anaplan Asia Pte Ltd)
# Description: Class to contain Anaplan connection details required for all API calls
# Input: Authorization header string, workspace ID string, and... | [
"dataclasses.dataclass"
] | [((512, 523), 'dataclasses.dataclass', 'dataclass', ([], {}), '()\n', (521, 523), False, 'from dataclasses import dataclass\n')] |
from datetime import datetime, timedelta
from typing import Any, Union, Optional
from fastapi import Header
from jose import jwt, ExpiredSignatureError, JWTError
# 导入配置文件
from settings import Config
ALGORITHM = "HS256"
def create_access_token(subject: Union[str, Any]) -> str:
"""
# 生成token
:param subje... | [
"jose.jwt.decode",
"fastapi.Header",
"datetime.datetime.utcnow",
"datetime.timedelta",
"jose.jwt.encode"
] | [((536, 597), 'jose.jwt.encode', 'jwt.encode', (['to_encode', 'Config.SECRET_KEY'], {'algorithm': 'ALGORITHM'}), '(to_encode, Config.SECRET_KEY, algorithm=ALGORITHM)\n', (546, 597), False, 'from jose import jwt, ExpiredSignatureError, JWTError\n'), ((666, 678), 'fastapi.Header', 'Header', (['None'], {}), '(None)\n', (6... |
from django.contrib import admin
# Register your models here.
from .models import User, Computer, Canvas
admin.site.register(Computer)
admin.site.register(Canvas)
class CanvasAdmin(admin.ModelAdmin):
search_fields = ('version', 'date_creation')
| [
"django.contrib.admin.site.register"
] | [((108, 137), 'django.contrib.admin.site.register', 'admin.site.register', (['Computer'], {}), '(Computer)\n', (127, 137), False, 'from django.contrib import admin\n'), ((138, 165), 'django.contrib.admin.site.register', 'admin.site.register', (['Canvas'], {}), '(Canvas)\n', (157, 165), False, 'from django.contrib impor... |
#!/usr/bin/env python
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
# Copyright (C) 2012-2020 German Aerospace Center (DLR) and others.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.ec... | [
"sumolib.options.ArgumentParser",
"sumolib.xml.parse",
"collections.defaultdict",
"sys.stderr.write",
"sumolib.miscutils.parseTime",
"os.path.join",
"sys.exit"
] | [((1307, 1382), 'sumolib.options.ArgumentParser', 'sumolib.options.ArgumentParser', ([], {'description': '"""Sample routes to match counts"""'}), "(description='Sample routes to match counts')\n", (1337, 1382), False, 'import sumolib\n'), ((2056, 2073), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\... |
import datetime
import random
import re
import time
import unicodedata
import nltk
from torch import nn
from config import *
def encode_text(word_map, c):
return [word_map.get(word, word_map['<unk>']) for word in c] + [word_map['<end>']]
# Since we are dealing with batches of padded sequences, we cannot simpl... | [
"unicodedata.normalize",
"random.sample",
"unicodedata.category",
"time.time",
"re.sub",
"nltk.word_tokenize"
] | [((2716, 2744), 're.sub', 're.sub', (['"""([.!?])"""', '""" \\\\1"""', 's'], {}), "('([.!?])', ' \\\\1', s)\n", (2722, 2744), False, 'import re\n'), ((2754, 2785), 're.sub', 're.sub', (['"""[^a-zA-Z.!?]+"""', '""" """', 's'], {}), "('[^a-zA-Z.!?]+', ' ', s)\n", (2760, 2785), False, 'import re\n'), ((5819, 5844), 'rando... |