code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import numpy as np
import pandas as pd
import xarray as xr
import matplotlib.pyplot as plt
import geocat.viz.util as gvutil
path = r'H:\Python project 2021\climate_data_analysis_with_python\data\sst.mnmean.nc'
ds= xr.open_dataset(path)
# time slicing
sst = ds.sst.sel(time=slice('1920-01-01','2020-12-01'))
# anomaly wi... | [
"matplotlib.pyplot.savefig",
"geocat.viz.util.add_major_minor_ticks",
"pandas.Timestamp",
"pandas.to_datetime",
"matplotlib.pyplot.figure",
"xarray.corr",
"numpy.deg2rad",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.tight_layout",
"numpy.linspace",
"matplotlib.pyplot.draw",
"xarray.open_d... | [((215, 236), 'xarray.open_dataset', 'xr.open_dataset', (['path'], {}), '(path)\n', (230, 236), True, 'import xarray as xr\n'), ((509, 529), 'numpy.arange', 'np.arange', (['time.size'], {}), '(time.size)\n', (518, 529), True, 'import numpy as np\n'), ((1330, 1356), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsi... |
# SpheralConservation
import mpi
from SpheralCompiledPackages import *
#-------------------------------------------------------------------------------
# Conservation
#-------------------------------------------------------------------------------
class SpheralConservation:
#--------------------------------------... | [
"mpi.allreduce"
] | [((2341, 2370), 'mpi.allreduce', 'mpi.allreduce', (['total', 'mpi.SUM'], {}), '(total, mpi.SUM)\n', (2354, 2370), False, 'import mpi\n'), ((3165, 3194), 'mpi.allreduce', 'mpi.allreduce', (['total', 'mpi.SUM'], {}), '(total, mpi.SUM)\n', (3178, 3194), False, 'import mpi\n'), ((4344, 4373), 'mpi.allreduce', 'mpi.allreduc... |
from django import forms
from django.contrib.auth.models import User
from models import Question, Answer
class AskForm(forms.ModelForm):
class Meta:
model = Question
fields = ['title', 'text']
def save(self, commit=True):
question = super(AskForm, self).save(commit=False)
que... | [
"models.Answer.objects.create",
"django.forms.CharField",
"models.Question.objects.get",
"django.forms.PasswordInput",
"django.forms.ValidationError",
"django.forms.IntegerField",
"django.contrib.auth.models.User.objects.create_user"
] | [((458, 475), 'django.forms.CharField', 'forms.CharField', ([], {}), '()\n', (473, 475), False, 'from django import forms\n'), ((491, 511), 'django.forms.IntegerField', 'forms.IntegerField', ([], {}), '()\n', (509, 511), False, 'from django import forms\n'), ((926, 1016), 'models.Answer.objects.create', 'Answer.objects... |
#
# Pow Default Tests
#
#
# runtest script.
# runs test with respect to some paramters
# currently only os
import sys
import pytest
# possible sys.platform results:
# http://stackoverflow.com/questions/446209/possible-values-from-sys-platform
MODELNAME = "pow_test_model"
class TestClass:
@pytest.mark.notonosx
... | [
"coronadash.models.tinydb.pow_test_model.PowTestModel",
"coronadash.generate_model.generate_model",
"pytest.mark.run",
"multiprocessing.Process",
"sys.platform.startswith",
"requests.get",
"time.sleep",
"os.chdir",
"pytest.main",
"os.path.normpath",
"os.path.dirname"
] | [((325, 349), 'pytest.mark.run', 'pytest.mark.run', ([], {'order': '(1)'}), '(order=1)\n', (340, 349), False, 'import pytest\n'), ((1099, 1123), 'pytest.mark.run', 'pytest.mark.run', ([], {'order': '(2)'}), '(order=2)\n', (1114, 1123), False, 'import pytest\n'), ((1613, 1637), 'pytest.mark.run', 'pytest.mark.run', ([],... |
import os
from datatable import dt, as_type
# -- Enable logging
from loguru import logger
import sys
logger_config = {
"handlers": [
{"sink": sys.stdout, "colorize": True, "format":
"<green>{time}</green> <level>{message}</level>"},
{"sink": f"logs/write_pset_tables.log",
"... | [
"os.path.exists",
"os.path.join",
"os.mkdir",
"loguru.logger.configure",
"datatable.dt.Frame"
] | [((442, 475), 'loguru.logger.configure', 'logger.configure', ([], {}), '(**logger_config)\n', (458, 475), False, 'from loguru import logger\n'), ((832, 863), 'os.path.join', 'os.path.join', (['df_dir', 'pset_name'], {}), '(df_dir, pset_name)\n', (844, 863), False, 'import os\n'), ((1048, 1065), 'datatable.dt.Frame', 'd... |
from timemachines.skaters.orbt.orbitinclusion import using_orbit
if using_orbit:
from timemachines.skaters.orbt.orbitwrappers import orbit_lgt_iskater
from timemachines.skatertools.utilities.conventions import Y_TYPE, A_TYPE, R_TYPE, E_TYPE, T_TYPE
from timemachines.skatertools.batch.batchskater import ba... | [
"timemachines.skatertools.batch.batchskater.batch_skater_factory"
] | [((549, 723), 'timemachines.skatertools.batch.batchskater.batch_skater_factory', 'batch_skater_factory', ([], {'y': 'y', 's': 's', 'k': 'k', 'a': 'a', 't': 't', 'e': 'e', 'r': 'r', 'emp_mass': 'emp_mass', 'iskater': 'orbit_lgt_iskater', 'iskater_kwargs': "{'seasonality': seasonality}", 'min_e': '(0)', 'n_warm': '(20)'}... |
"""Support for Luxtronik heatpump binary states."""
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import CONF_FRIENDLY_NAME, CONF_ICON, CONF_ID, CONF_SENSORS
import homeassistant.helpers.config_validation as cv
f... | [
"logging.getLogger",
"voluptuous.Required",
"homeassistant.util.slugify",
"voluptuous.Optional",
"voluptuous.In"
] | [((608, 635), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (625, 635), False, 'import logging\n'), ((722, 748), 'voluptuous.Required', 'vol.Required', (['CONF_SENSORS'], {}), '(CONF_SENSORS)\n', (734, 748), True, 'import voluptuous as vol\n'), ((2888, 2907), 'homeassistant.util.slugify'... |
from setuptools import setup, find_packages
# Building and Distributing Packages with Setuptools
# Documentation here: https://setuptools.pypa.io/en/latest/setuptools.html
setup(name='app', version='1.0', packages=find_packages())
| [
"setuptools.find_packages"
] | [((216, 231), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (229, 231), False, 'from setuptools import setup, find_packages\n')] |
# Generated by Django 2.0.13 on 2021-08-27 12:23
from django.db import migrations
def populate_sponsorship_package_fk(apps, schema_editor):
Sponsorship = apps.get_model('sponsors.Sponsorship')
SponsorshipPackage = apps.get_model('sponsors.SponsorshipPackage')
for sponsorship in Sponsorship.objects.all()... | [
"django.db.migrations.RunPython"
] | [((717, 802), 'django.db.migrations.RunPython', 'migrations.RunPython', (['populate_sponsorship_package_fk', 'migrations.RunPython.noop'], {}), '(populate_sponsorship_package_fk, migrations.RunPython.noop\n )\n', (737, 802), False, 'from django.db import migrations\n')] |
from builtins import isinstance
from typing import Any, Dict, Tuple
from fugue import (
DataFrame,
FugueWorkflow,
WorkflowDataFrame,
WorkflowDataFrames,
Yielded,
)
from fugue.constants import FUGUE_CONF_SQL_IGNORE_CASE
from fugue.workflow import is_acceptable_raw_df
from fugue_sql._parse import Fug... | [
"fugue_sql._utils.LazyWorkflowDataFrame",
"builtins.isinstance",
"triad.utils.convert.get_caller_global_local_vars",
"fugue.workflow.is_acceptable_raw_df",
"fugue_sql._visitors.FugueSQLHooks",
"fugue_sql._utils.fill_sql_template"
] | [((5708, 5738), 'triad.utils.convert.get_caller_global_local_vars', 'get_caller_global_local_vars', ([], {}), '()\n', (5736, 5738), False, 'from triad.utils.convert import get_caller_global_local_vars\n'), ((1100, 1130), 'triad.utils.convert.get_caller_global_local_vars', 'get_caller_global_local_vars', ([], {}), '()\n... |
#!/usr/bin/python
# -*- coding:utf-8 -*-
from Spider import Spider
# 入口
spider = Spider()
fans = spider.get_my_fans()
for fan in fans:
spider.user_crawl(fan.user_id)
spider.status_crawl(fan.user_id)
followers = spider.get_my_follower()
for follower in followers:
spider.user_crawl(fan.user_id)
spider... | [
"Spider.Spider"
] | [((82, 90), 'Spider.Spider', 'Spider', ([], {}), '()\n', (88, 90), False, 'from Spider import Spider\n')] |
import pygame
import random
import yaml
import os
import Objects
OBJECT_TEXTURE = os.path.join("texture", "objects")
ENEMY_TEXTURE = os.path.join("texture", "enemies")
ALLY_TEXTURE = os.path.join("texture", "ally")
def create_sprite(img, sprite_size, mmp_tile):
icon = pygame.image.load(img).convert_a... | [
"Objects.Ally",
"Objects.Weakness",
"pygame.Surface",
"Objects.Enemy",
"os.path.join",
"Objects.Berserk",
"Objects.Blessing",
"Objects.EvilEye",
"pygame.image.load",
"random.randint",
"Objects.Enhance",
"pygame.transform.scale"
] | [((89, 123), 'os.path.join', 'os.path.join', (['"""texture"""', '"""objects"""'], {}), "('texture', 'objects')\n", (101, 123), False, 'import os\n'), ((141, 175), 'os.path.join', 'os.path.join', (['"""texture"""', '"""enemies"""'], {}), "('texture', 'enemies')\n", (153, 175), False, 'import os\n'), ((192, 223), 'os.pat... |
import os
import glob
import json
import unittest
import satsearch.config as config
from satstac import Item
from satsearch.search import SatSearchError, Search
class Test(unittest.TestCase):
path = os.path.dirname(__file__)
results = []
@classmethod
def setUpClass(cls):
fnames = glob.glob... | [
"satsearch.search.Search",
"os.path.join",
"os.path.dirname",
"json.load",
"satsearch.search.Search.items_by_id",
"satsearch.search.Search.search"
] | [((208, 233), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (223, 233), False, 'import os\n'), ((1396, 1425), 'satsearch.search.Search', 'Search', ([], {'datetime': '"""2001-01-01"""'}), "(datetime='2001-01-01')\n", (1402, 1425), False, 'from satsearch.search import SatSearchError, Search\n'... |
import tensorflow as tf
def extract_image_patches(image_batch, patch_size,patch_stride):
patches = tf.extract_image_patches(images =image_batch,ksizes=[1,patch_size,patch_size,1],rates=[1,1,1,1],strides=[1,patch_stride,patch_stride,1],padding='VALID')
patches_shape = patches.get_shape().as_list()
return tf.reshap... | [
"tensorflow.nn.conv2d",
"tensorflow.nn.max_pool",
"tensorflow.shape",
"tensorflow.variable_scope",
"tensorflow.nn.relu",
"tensorflow.get_variable",
"tensorflow.nn.xw_plus_b",
"tensorflow.nn.dropout",
"tensorflow.reshape",
"tensorflow.extract_image_patches",
"tensorflow.nn.bias_add"
] | [((103, 275), 'tensorflow.extract_image_patches', 'tf.extract_image_patches', ([], {'images': 'image_batch', 'ksizes': '[1, patch_size, patch_size, 1]', 'rates': '[1, 1, 1, 1]', 'strides': '[1, patch_stride, patch_stride, 1]', 'padding': '"""VALID"""'}), "(images=image_batch, ksizes=[1, patch_size,\n patch_size, 1],... |
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 5 06:34:04 2015
@author: tanay
"""
from lasagne.layers import InputLayer, DropoutLayer, DenseLayer
from lasagne.updates import nesterov_momentum
from lasagne.objectives import binary_crossentropy
from nolearn.lasagne import NeuralNet
import theano
from theano import tens... | [
"sklearn.utils.shuffle",
"numpy.float32",
"sklearn.metrics.roc_auc_score"
] | [((1809, 1843), 'sklearn.utils.shuffle', 'shuffle', (['Xtrh', 'y'], {'random_state': '(123)'}), '(Xtrh, y, random_state=123)\n', (1816, 1843), False, 'from sklearn.utils import shuffle\n'), ((479, 494), 'numpy.float32', 'np.float32', (['(0.1)'], {}), '(0.1)\n', (489, 494), True, 'import numpy as np\n'), ((1986, 2024), ... |
# -*- coding: utf-8 -*-
""" Train the Boston house prices model on your local machine.
"""
import pandas as pd
from ml2p.core import LocalEnv
import model
def train(env):
""" Train and save the model locally. """
trainer = model.BostonModel().trainer(env)
trainer.train()
def predict(env):
""" Load... | [
"ml2p.core.LocalEnv",
"model.BostonModel",
"pandas.read_csv"
] | [((447, 478), 'pandas.read_csv', 'pd.read_csv', (['"""house-prices.csv"""'], {}), "('house-prices.csv')\n", (458, 478), True, 'import pandas as pd\n'), ((708, 733), 'ml2p.core.LocalEnv', 'LocalEnv', (['"""."""', '"""ml2p.yml"""'], {}), "('.', 'ml2p.yml')\n", (716, 733), False, 'from ml2p.core import LocalEnv\n'), ((235... |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/01a_datasets_download.ipynb (unless otherwise specified).
__all__ = ['get_cifar10', 'get_oxford_102_flowers', 'get_cub_200_2011']
# Internal Cell
import glob
import json
from pathlib import Path
import os
import subprocess
import tarfile
import urllib
import zlib
# In... | [
"tarfile.open",
"os.makedirs",
"pathlib.Path",
"urllib.request.urlretrieve",
"json.dump",
"os.path.join",
"os.path.isfile",
"glob.glob",
"os.path.basename",
"os.path.expanduser"
] | [((666, 690), 'os.path.expanduser', 'os.path.expanduser', (['root'], {}), '(root)\n', (684, 690), False, 'import os\n'), ((765, 793), 'os.path.join', 'os.path.join', (['root', 'filename'], {}), '(root, filename)\n', (777, 793), False, 'import os\n'), ((798, 830), 'os.makedirs', 'os.makedirs', (['root'], {'exist_ok': '(... |
#!/usr/bin/env python
# coding: utf-8
#Project name: Excel --> netCDF
#Description: It receives an excel file with a predefined format and returns the equivalent file in netCDF format.
#Programmers: <NAME>
#Date: 07-09-2020
import pandas as pd
import xarray
import scipy
print("Enter the exact name of the workbo... | [
"pandas.read_excel"
] | [((672, 759), 'pandas.read_excel', 'pd.read_excel', (['data_file'], {'sheet_name': 'sheet_name', 'index_col': '[0]', 'na_values': "['b.d.']"}), "(data_file, sheet_name=sheet_name, index_col=[0], na_values=[\n 'b.d.'])\n", (685, 759), True, 'import pandas as pd\n')] |
"""Module defining DiagGGNPermute."""
from backpack.core.derivatives.permute import PermuteDerivatives
from backpack.extensions.secondorder.diag_ggn.diag_ggn_base import DiagGGNBaseModule
class DiagGGNPermute(DiagGGNBaseModule):
"""DiagGGN extension of Permute."""
def __init__(self):
"""Initialize.""... | [
"backpack.core.derivatives.permute.PermuteDerivatives"
] | [((359, 379), 'backpack.core.derivatives.permute.PermuteDerivatives', 'PermuteDerivatives', ([], {}), '()\n', (377, 379), False, 'from backpack.core.derivatives.permute import PermuteDerivatives\n')] |
import sys
import numpy as np
from sklearn.externals import joblib
sys.path.append("common")
from train_classifier import *
staring_verb_extractor = StartingVerbExtractor()
verb_count_extractor = VerbCountExtractor()
starting_modal_extractor = StartingModalExtractor()
noun_count_extractor = NounCountExtractor()
def... | [
"sklearn.externals.joblib.load",
"sys.path.append"
] | [((68, 93), 'sys.path.append', 'sys.path.append', (['"""common"""'], {}), "('common')\n", (83, 93), False, 'import sys\n'), ((1037, 1060), 'sklearn.externals.joblib.load', 'joblib.load', (['model_path'], {}), '(model_path)\n', (1048, 1060), False, 'from sklearn.externals import joblib\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 11 10:44:44 2020.
@author: powel
"""
import random
from random import randint
import numpy as np
from mazes import RandomMaze, PrimMaze, KruskalMaze, RecursiveDivisionMaze, MazeBase
from percolation import check_percolation
class Maze:
def _... | [
"random.randint",
"random.seed",
"percolation.check_percolation"
] | [((1839, 1853), 'random.seed', 'random.seed', (['(1)'], {}), '(1)\n', (1850, 1853), False, 'import random\n'), ((1119, 1142), 'percolation.check_percolation', 'check_percolation', (['maze'], {}), '(maze)\n', (1136, 1142), False, 'from percolation import check_percolation\n'), ((1413, 1442), 'random.randint', 'randint',... |
import json
import os
from pathlib import Path
from subprocess import run
import pytest
from examples import verify_and_test_examples
from git import Repo
import cruft
from cruft import exceptions
from cruft._commands.utils import get_cruft_file
def test_invalid_cookiecutter_repo(tmpdir):
with pytest.raises(exc... | [
"examples.verify_and_test_examples",
"pathlib.Path",
"subprocess.run",
"cruft._commands.utils.get_cruft_file",
"os.path.join",
"cruft.check",
"os.chdir",
"pytest.raises",
"json.load",
"cruft.link",
"cruft.update",
"json.dump"
] | [((654, 692), 'examples.verify_and_test_examples', 'verify_and_test_examples', (['cruft.create'], {}), '(cruft.create)\n', (678, 692), False, 'from examples import verify_and_test_examples\n'), ((860, 881), 'os.chdir', 'os.chdir', (['project_dir'], {}), '(project_dir)\n', (868, 881), False, 'import os\n'), ((886, 923),... |
"""
Helper for loading a ``Trading History`` dataset
"""
import json
import zlib
import pandas as pd
import analysis_engine.consts as ae_consts
import spylunking.log.setup_logging as log_utils
log = log_utils.build_colorized_logger(name=__name__)
def prepare_history_dataset(
data,
compress=False,
... | [
"json.loads",
"pandas.DataFrame",
"pandas.to_datetime",
"spylunking.log.setup_logging.build_colorized_logger",
"zlib.decompress"
] | [((201, 248), 'spylunking.log.setup_logging.build_colorized_logger', 'log_utils.build_colorized_logger', ([], {'name': '__name__'}), '(name=__name__)\n', (233, 248), True, 'import spylunking.log.setup_logging as log_utils\n'), ((2136, 2159), 'json.loads', 'json.loads', (['parsed_data'], {}), '(parsed_data)\n', (2146, 2... |
"""
Holds the base classes for storage module.
These are special hashables whose state can be serialized on disk.
"""
import typing as t
import pathlib
import datetime
import dataclasses
import abc
from .. import util, logger, settings
from .. import marshalling as m
from .. import error as e
from . import state
# n... | [
"datetime.datetime.now",
"dataclasses.dataclass"
] | [((526, 560), 'dataclasses.dataclass', 'dataclasses.dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (547, 560), False, 'import dataclasses\n'), ((21890, 21924), 'dataclasses.dataclass', 'dataclasses.dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (21911, 21924), False, 'import dataclasses\n'), ((3... |
import pulp as pl
def create_affine_expression(coeffs, var_names):
assert len(coeffs) == len(var_names)
n = len(coeffs)
X = [pl.LpVariable(var_names[i]) for i in range(n)]
affine = pl.LpAffineExpression([(X[i], coeffs[i]) for i in range(n)])
return affine
def create_constraint(coeffs, var_names,... | [
"pulp.LpProblem",
"pulp.listSolvers",
"pulp.LpConstraint",
"pulp.getSolver",
"pulp.value",
"pulp.LpVariable"
] | [((733, 775), 'pulp.LpConstraint', 'pl.LpConstraint', (['lhs'], {'sense': 'sense', 'rhs': 'rhs'}), '(lhs, sense=sense, rhs=rhs)\n', (748, 775), True, 'import pulp as pl\n'), ((1325, 1363), 'pulp.LpProblem', 'pl.LpProblem', (['"""Example"""', 'pl.LpMaximize'], {}), "('Example', pl.LpMaximize)\n", (1337, 1363), True, 'im... |
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.feature_selection import VarianceThreshold
from sklearn.preprocessing import PolynomialFeatures, StandardScaler
from sklearn import metrics
from sklearn.bas... | [
"sklearn.model_selection.GridSearchCV",
"sklearn.preprocessing.PolynomialFeatures",
"matplotlib.pyplot.hist",
"sklearn.feature_selection.VarianceThreshold",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"numpy.array",
"sklearn.decomposition.PCA",
"numpy.where",
"matplotlib.pyplot.xlabel",
... | [((491, 508), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (505, 508), True, 'import numpy as np\n'), ((1217, 1240), 'numpy.array', 'np.array', (['X', 'np.float64'], {}), '(X, np.float64)\n', (1225, 1240), True, 'import numpy as np\n'), ((1250, 1273), 'numpy.array', 'np.array', (['y', 'np.float64'], {... |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from telemetry.core.platform.power_monitor import android_ds2784_power_monitor
class DS2784PowerMonitorMonitorTest(unittest.TestCase):
d... | [
"telemetry.core.platform.power_monitor.android_ds2784_power_monitor.DS2784PowerMonitor.ParseSamplingOutput"
] | [((576, 649), 'telemetry.core.platform.power_monitor.android_ds2784_power_monitor.DS2784PowerMonitor.ParseSamplingOutput', 'android_ds2784_power_monitor.DS2784PowerMonitor.ParseSamplingOutput', (['data'], {}), '(data)\n', (643, 649), False, 'from telemetry.core.platform.power_monitor import android_ds2784_power_monitor... |
import logging, operator, functools, itertools, array, ptypes
from ptypes import *
from .headers import *
from . import portable
class Signature(pint.enum, uint16):
# We'll just store all signature types here
_values_ = [
('IMAGE_DOS_SIGNATURE', 0x5a4d),
('IMAGE_OS2_SIGNATURE', 0x454e),
... | [
"array.array",
"operator.methodcaller",
"functools.partial",
"ptypes.prov.file"
] | [((6473, 6514), 'functools.partial', 'functools.partial', (['operator.getitem', 'self'], {}), '(operator.getitem, self)\n', (6490, 6514), False, 'import logging, operator, functools, itertools, array, ptypes\n'), ((20328, 20360), 'ptypes.prov.file', 'ptypes.prov.file', (['filename', '"""rb"""'], {}), "(filename, 'rb')\... |
import src.data_structures.heap
from src.algorithms.misc import powerfulIntegers
class Solution:
def balancedStringSplit(self, s: str) -> int:
bal = 0
stack = []
for c in s:
if c not in stack:
stack.append(c)
else:
stack.pop()
bal += 1
re... | [
"src.algorithms.misc.powerfulIntegers"
] | [((365, 391), 'src.algorithms.misc.powerfulIntegers', 'powerfulIntegers', (['(2)', '(3)', '(10)'], {}), '(2, 3, 10)\n', (381, 391), False, 'from src.algorithms.misc import powerfulIntegers\n')] |
from __future__ import print_function
from flask import Flask
from flask import request
import argparse
import json
import sys
from safirnotification.alarm.alarm_handler import AlarmHandler
from safirnotification.utils import log
from safirnotification.utils.opts import ConfigOpts
LOG = log.get_logger()
Flask.get ... | [
"safirnotification.alarm.alarm_handler.AlarmHandler",
"json.loads",
"safirnotification.utils.log.get_logger",
"argparse.ArgumentParser",
"flask.Flask",
"safirnotification.utils.opts.ConfigOpts",
"sys.exit"
] | [((291, 307), 'safirnotification.utils.log.get_logger', 'log.get_logger', ([], {}), '()\n', (305, 307), False, 'from safirnotification.utils import log\n'), ((381, 396), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (386, 396), False, 'from flask import Flask\n'), ((1357, 1406), 'argparse.ArgumentParser',... |
import logging
import click
import slack_sdk
from slack_primitive_cli.common.utils import TOKEN_ENVVAR, TOKEN_HELP_MESSAGE, set_logger
logger = logging.getLogger(__name__)
@click.command(
name="chat.postMessage", help="Sends a message to a channel. See https://api.slack.com/methods/chat.postMessage "
)
@click.... | [
"logging.getLogger",
"slack_primitive_cli.common.utils.set_logger",
"click.option",
"slack_sdk.WebClient",
"click.command"
] | [((147, 174), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (164, 174), False, 'import logging\n'), ((178, 316), 'click.command', 'click.command', ([], {'name': '"""chat.postMessage"""', 'help': '"""Sends a message to a channel. See https://api.slack.com/methods/chat.postMessage """'}), ... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.utils.translation import gettext as _
from jaseci_serv.base import models
class UserAdmin(BaseUserAdmin):
"""
Customized user listing for admin page
"""
ordering = ["time_created"]
list_... | [
"django.contrib.admin.site.register",
"django.utils.translation.gettext"
] | [((967, 1010), 'django.contrib.admin.site.register', 'admin.site.register', (['models.User', 'UserAdmin'], {}), '(models.User, UserAdmin)\n', (986, 1010), False, 'from django.contrib import admin\n'), ((1313, 1372), 'django.contrib.admin.site.register', 'admin.site.register', (['models.JaseciObject', 'JaseciObjectAdmin... |
from re import match
with open("input.txt") as x:
lines = x.read().strip().split("\n\n")
lines = [line.replace("\n", " ") for line in lines]
valid = 0
fields = {
'byr': lambda x: 1920 <= int(x) <= 2002,
'iyr': lambda x: 2010 <= int(x) <= 2020,
'eyr': lambda x: 2020 <= int(x) <= 2030,
... | [
"re.match"
] | [((462, 488), 're.match', 'match', (['"""^#[a-f0-9]{6}$"""', 'x'], {}), "('^#[a-f0-9]{6}$', x)\n", (467, 488), False, 'from re import match\n')] |
"""Test ImageNet pretrained DenseNet"""
import cv2
import numpy as np
from tensorflow.keras.optimizers import SGD
import tensorflow.keras.backend as K
# We only test DenseNet-121 in this script for demo purpose
from densenet121 import DenseNet
im = cv2.resize(cv2.imread('resources/cat.jpg'), (224, 224)).astype(np.f... | [
"numpy.argmax",
"tensorflow.keras.optimizers.SGD",
"densenet121.DenseNet",
"numpy.expand_dims",
"cv2.imread",
"tensorflow.keras.backend.image_data_format"
] | [((822, 848), 'numpy.expand_dims', 'np.expand_dims', (['im'], {'axis': '(0)'}), '(im, axis=0)\n', (836, 848), True, 'import numpy as np\n'), ((882, 946), 'densenet121.DenseNet', 'DenseNet', ([], {'reduction': '(0.5)', 'classes': '(1000)', 'weights_path': 'weights_path'}), '(reduction=0.5, classes=1000, weights_path=wei... |
from flask_wtf import FlaskForm
from wtforms import StringField,PasswordField,SubmitField,BooleanField
from flask_wtf.file import FileAllowed,FileRequired,FileField
from wtforms.validators import DataRequired,Length,EqualTo,Email,ValidationError
from App.models import User
from App.extensions import file
class Regist... | [
"wtforms.validators.Email",
"wtforms.validators.ValidationError",
"flask_wtf.file.FileAllowed",
"wtforms.BooleanField",
"wtforms.SubmitField",
"wtforms.validators.EqualTo",
"App.models.User.query.filter_by",
"flask_wtf.file.FileRequired",
"wtforms.validators.Length",
"wtforms.validators.DataRequir... | [((1156, 1173), 'wtforms.SubmitField', 'SubmitField', (['"""注册"""'], {}), "('注册')\n", (1167, 1173), False, 'from wtforms import StringField, PasswordField, SubmitField, BooleanField\n'), ((1867, 1886), 'wtforms.BooleanField', 'BooleanField', (['"""记住我"""'], {}), "('记住我')\n", (1879, 1886), False, 'from wtforms import St... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Class that manages a UQtie application's stylesheet
There are advantages and disadvantages to Qt stylesheets, Qt settings, and
Qt Style. They aren't mutually exclusive, and they don't all play together
either.
This module attempts to make it possible to use a stylesheet w... | [
"pickle.dump",
"argparse.ArgumentParser",
"PyQt5.QtCore.QSettings",
"PyQt5.QtWidgets.QApplication",
"sys.exit",
"re.sub",
"os.path.expanduser"
] | [((9201, 9226), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (9224, 9226), False, 'import argparse, sys\n'), ((9767, 9787), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['qtArgs'], {}), '(qtArgs)\n', (9779, 9787), False, 'from PyQt5.QtWidgets import QApplication, QVBoxLayout, QMainWindow\... |
##########################################################################
# NSAp - Copyright (C) CEA, 2013
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
# for details.
##########... | [
"cubicweb._",
"packaging.version.parse",
"logilab.common.registry.yes"
] | [((480, 515), 'packaging.version.parse', 'version.parse', (['cubicweb.__version__'], {}), '(cubicweb.__version__)\n', (493, 515), False, 'from packaging import version\n'), ((533, 556), 'packaging.version.parse', 'version.parse', (['"""3.21.0"""'], {}), "('3.21.0')\n", (546, 556), False, 'from packaging import version\... |
# Generated by Django 2.0 on 2018-08-25 14:19
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("events", "0042_allow_team_without_country")]
operations = [
migrations.RemoveField(model_name="team", name="is_premium"),
migrations.RemoveField(model_name... | [
"django.db.migrations.RemoveField"
] | [((217, 277), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""team"""', 'name': '"""is_premium"""'}), "(model_name='team', name='is_premium')\n", (239, 277), False, 'from django.db import migrations\n'), ((287, 347), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([]... |
from hypatia import Model,Plotter
#%%
utopia = Model(
path = 'sets',
mode = 'Planning'
)
#%%
#utopia.create_data_excels(
# path = r'parameters'
#)
#%%
utopia.read_input_data(
path = r'parameters'
)
#%%
utopia.run(
solver = 'scipy',
verbosity = True,
)
#%%
utopia.to_csv(path='results')
#%%
#uto... | [
"hypatia.Plotter",
"hypatia.Model"
] | [((48, 83), 'hypatia.Model', 'Model', ([], {'path': '"""sets"""', 'mode': '"""Planning"""'}), "(path='sets', mode='Planning')\n", (53, 83), False, 'from hypatia import Model, Plotter\n'), ((378, 440), 'hypatia.Plotter', 'Plotter', (['utopia'], {'config': '"""config.xlsx"""', 'hourly_resolution': '(False)'}), "(utopia, ... |
from Ruikowa.ObjectRegex.Node import Ref, AstParser, SeqParser, LiteralParser, CharParser, MetaInfo, DependentAstParser
try:
from .etoken import token
except:
from etoken import token
import re
namespace = globals()
recurSearcher = set()
PrimaryDefList = AstParser([Ref('FieldDef'), SeqParser([LiteralParser(',... | [
"Ruikowa.ObjectRegex.Node.LiteralParser",
"Ruikowa.ObjectRegex.Node.Ref"
] | [((276, 291), 'Ruikowa.ObjectRegex.Node.Ref', 'Ref', (['"""FieldDef"""'], {}), "('FieldDef')\n", (279, 291), False, 'from Ruikowa.ObjectRegex.Node import Ref, AstParser, SeqParser, LiteralParser, CharParser, MetaInfo, DependentAstParser\n'), ((682, 695), 'Ruikowa.ObjectRegex.Node.Ref', 'Ref', (['"""Symbol"""'], {}), "(... |
import heapq
class Solution:
"""
@param matrix: a matrix of integers
@param k: An integer
@return: the kth smallest number in the matrix
在一个排序矩阵中找从小到大的第 k 个整数。
排序矩阵的定义为:每一行递增,每一列也递增。
Example
样例 1:
输入:
[
[1 ,5 ,7],
[3 ,7 ,8],
[4 ,8 ,9],
]
k = 4
输出: 5
... | [
"heapq.heappush",
"heapq.heappop"
] | [((1121, 1157), 'heapq.heappush', 'heapq.heappush', (['self.maxheap', '(-value)'], {}), '(self.maxheap, -value)\n', (1135, 1157), False, 'import heapq\n'), ((1226, 1261), 'heapq.heappush', 'heapq.heappush', (['self.minheap', 'value'], {}), '(self.minheap, value)\n', (1240, 1261), False, 'import heapq\n'), ((1288, 1324)... |
import _recurrence_map
import numpy as np
def poincare_map(ts, ts2=None, threshold=0.1):
rec_dist = poincare_recurrence_dist(ts, ts2)
return (rec_dist < threshold).astype(int)
def poincare_recurrence_dist(ts, ts2=None):
if ts2 is None:
return _recurrence_map.recurrence_map(ts, ts)
else:
... | [
"_recurrence_map.recurrence_map"
] | [((267, 305), '_recurrence_map.recurrence_map', '_recurrence_map.recurrence_map', (['ts', 'ts'], {}), '(ts, ts)\n', (297, 305), False, 'import _recurrence_map\n'), ((331, 370), '_recurrence_map.recurrence_map', '_recurrence_map.recurrence_map', (['ts', 'ts2'], {}), '(ts, ts2)\n', (361, 370), False, 'import _recurrence_... |
import cv2
import math
import numpy as np
import os
import matplotlib.pyplot as plt
from scipy import ndimage
from utils import ValueInvert
# TO-DO: Refactor this with np.nonzero??
def find_center_image(img):
left = 0
right = img.shape[1] - 1
empty_left = True
empty_right = True
for col in rang... | [
"cv2.warpAffine",
"math.ceil",
"math.floor",
"cv2.threshold",
"utils.ValueInvert",
"numpy.lib.pad",
"scipy.ndimage.measurements.center_of_mass",
"cv2.resize",
"numpy.float32",
"numpy.round"
] | [((1339, 1379), 'scipy.ndimage.measurements.center_of_mass', 'ndimage.measurements.center_of_mass', (['img'], {}), '(img)\n', (1374, 1379), False, 'from scipy import ndimage\n'), ((1590, 1626), 'numpy.float32', 'np.float32', (['[[1, 0, sx], [0, 1, sy]]'], {}), '([[1, 0, sx], [0, 1, sy]])\n', (1600, 1626), True, 'import... |
import numpy as np
from collections import namedtuple, deque
import random
Transition = namedtuple('Transition', ('state', 'action', 'next_state', 'reward', 'not_done'))
class ReplayBuffer(object):
def __init__(self, capacity):
self.memory = deque([], maxlen=capacity)
def push(self, *ar... | [
"random.sample",
"collections.namedtuple",
"collections.deque",
"numpy.vstack"
] | [((93, 178), 'collections.namedtuple', 'namedtuple', (['"""Transition"""', "('state', 'action', 'next_state', 'reward', 'not_done')"], {}), "('Transition', ('state', 'action', 'next_state', 'reward',\n 'not_done'))\n", (103, 178), False, 'from collections import namedtuple, deque\n'), ((268, 294), 'collections.deque... |
# SPDX-License-Identifier: MIT
# Copyright (c) 2022 MBition GmbH
from dataclasses import dataclass, field
from typing import List, Literal, Optional
from .nameditemlist import NamedItemList
from .utils import read_description_from_odx
UnitGroupCategory = Literal["COUNTRY", "EQUIV-UNITS"]
@dataclass
class PhysicalD... | [
"dataclasses.field"
] | [((4528, 4555), 'dataclasses.field', 'field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (4533, 4555), False, 'from dataclasses import dataclass, field\n'), ((5304, 5331), 'dataclasses.field', 'field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (5309, 5331), False, 'from dataclas... |
import os
from test import test_support
# Skip this test if _tkinter does not exist.
test_support.import_module('_tkinter')
this_dir = os.path.dirname(os.path.abspath(__file__))
lib_tk_test = os.path.abspath(os.path.join(this_dir, '..', 'lib-tk', 'test'))
with test_support.DirsOnSysPath(lib_tk_test):
i... | [
"runtktests.get_tests",
"os.path.join",
"test.test_support.DirsOnSysPath",
"os.path.abspath",
"test.test_support.import_module"
] | [((90, 128), 'test.test_support.import_module', 'test_support.import_module', (['"""_tkinter"""'], {}), "('_tkinter')\n", (116, 128), False, 'from test import test_support\n'), ((159, 184), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (174, 184), False, 'import os\n'), ((217, 263), 'os.path... |
from flask_wtf import FlaskForm
from wtforms import StringField,BooleanField,PasswordField,SubmitField
from wtforms.validators import Email,Required,EqualTo
from wtforms import ValidationError
from ..models import User
class LoginForm(FlaskForm):
email = StringField("enter your email adress",validators = [Require... | [
"wtforms.validators.Email",
"wtforms.BooleanField",
"wtforms.SubmitField",
"wtforms.validators.EqualTo",
"wtforms.validators.Required"
] | [((423, 450), 'wtforms.BooleanField', 'BooleanField', (['"""remember me"""'], {}), "('remember me')\n", (435, 450), False, 'from wtforms import StringField, BooleanField, PasswordField, SubmitField\n'), ((463, 484), 'wtforms.SubmitField', 'SubmitField', (['"""login """'], {}), "('login ')\n", (474, 484), False, 'from w... |
#!/usr/bin/python2.6
# (c) [2013] LinkedIn Corp. 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 ... | [
"sys.path.append",
"optparse.OptionParser"
] | [((545, 580), 'sys.path.append', 'sys.path.append', (['"""/usr/local/admin"""'], {}), "('/usr/local/admin')\n", (560, 580), False, 'import sys\n'), ((717, 782), 'optparse.OptionParser', 'OptionParser', ([], {'usage': '"""usage: %prog [options]"""', 'version': '"""%prog 1.0"""'}), "(usage='usage: %prog [options]', versi... |
from django.db import models
from lbworkflow.models import BaseWFObj
class Purchase(BaseWFObj):
title = models.CharField("Title", max_length=255)
reason = models.CharField("Reason", max_length=255)
def __str__(self):
return self.reason
class Item(models.Model):
purchase = models.ForeignKey... | [
"django.db.models.IntegerField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((111, 152), 'django.db.models.CharField', 'models.CharField', (['"""Title"""'], {'max_length': '(255)'}), "('Title', max_length=255)\n", (127, 152), False, 'from django.db import models\n'), ((166, 208), 'django.db.models.CharField', 'models.CharField', (['"""Reason"""'], {'max_length': '(255)'}), "('Reason', max_len... |
from sanic import Request, Sanic
from sanic.response import text
from sanic_ext import openapi
from sanic_ext.extensions.openapi.definitions import ExternalDocumentation
from utils import get_spec
def test_external_docs(app: Sanic):
@app.route("/test0")
@openapi.document("http://example.com/more", "Find more... | [
"utils.get_spec",
"sanic_ext.openapi.document",
"sanic_ext.extensions.openapi.definitions.ExternalDocumentation",
"sanic_ext.openapi.definition",
"sanic.response.text"
] | [((266, 332), 'sanic_ext.openapi.document', 'openapi.document', (['"""http://example.com/more"""', '"""Find more info here"""'], {}), "('http://example.com/more', 'Find more info here')\n", (282, 332), False, 'from sanic_ext import openapi\n'), ((668, 722), 'sanic_ext.openapi.definition', 'openapi.definition', ([], {'d... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-LOG 蓝鲸日志平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-LOG 蓝鲸日志平台 is licensed under the MIT License.
License for BK-LOG 蓝鲸日志平台:
------------------------------------------------... | [
"apps.api.base.DataAPI",
"django.utils.translation.ugettext_lazy"
] | [((1703, 1719), 'django.utils.translation.ugettext_lazy', '_', (['"""数据平台aiops模块"""'], {}), "('数据平台aiops模块')\n", (1704, 1719), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((1778, 2000), 'apps.api.base.DataAPI', 'DataAPI', ([], {'method': '"""POST"""', 'url': "(AIOPS_APIGATEWAY_ROOT + 'sample_set... |
"""
Hypothesis data generator helpers.
"""
from datetime import datetime
from hypothesis import strategies as st
from hypothesis.extra.dateutil import timezones as dateutil_timezones
from hypothesis.extra.pytz import timezones as pytz_timezones
from pandas.compat import is_platform_windows
import pandas as pd
from ... | [
"hypothesis.strategies.text",
"datetime.datetime",
"hypothesis.strategies.none",
"hypothesis.strategies.integers",
"pandas.Timestamp",
"pandas.Timestamp.max.to_pydatetime",
"hypothesis.strategies.floats",
"hypothesis.strategies.datetimes",
"pandas.compat.is_platform_windows",
"hypothesis.extra.dat... | [((1075, 1096), 'pandas.compat.is_platform_windows', 'is_platform_windows', ([], {}), '()\n', (1094, 1096), False, 'from pandas.compat import is_platform_windows\n'), ((1643, 1665), 'hypothesis.strategies.integers', 'st.integers', (['(-999)', '(999)'], {}), '(-999, 999)\n', (1654, 1665), True, 'from hypothesis import s... |
# coding: utf-8
# Copyright 2013 The Font Bakery Authors. 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 re... | [
"os.path.splitext",
"os.path.join",
"os.path.basename",
"re.sub",
"os.walk"
] | [((1456, 1486), 're.sub', 're.sub', (['"""\n{3,}"""', '"""\n\n"""', 'data'], {}), "('\\n{3,}', '\\n\\n', data)\n", (1462, 1486), False, 'import re\n'), ((2945, 2972), 'os.walk', 'os.walk', (['self.upstream_path'], {}), '(self.upstream_path)\n', (2952, 2972), False, 'import os\n'), ((3029, 3045), 'os.path.join', 'op.joi... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-26 12:31
from __future__ import unicode_literals
import json
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('annotations', '0005_auto_20170826_1424'),
... | [
"json.dumps",
"json.loads",
"django.db.migrations.RunPython",
"django.db.migrations.RenameField"
] | [((1571, 1665), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""annotation"""', 'old_name': '"""vector"""', 'new_name': '"""raw_vector"""'}), "(model_name='annotation', old_name='vector', new_name\n ='raw_vector')\n", (1593, 1665), False, 'from django.db import migrations\n'), (... |
import os
import statistics
import sys
def get_mean_std(out_csv):
with open(out_csv) as f:
lines = f.readlines()
tests = dict()
for t in lines[1:]:
t = t.split(",")
test_name = t[0].strip()
opt = float(t[2].strip())
tests[test_name] = tests.get(test_name, list()) + [... | [
"statistics.stdev",
"sys.exit"
] | [((396, 415), 'statistics.stdev', 'statistics.stdev', (['v'], {}), '(v)\n', (412, 415), False, 'import statistics\n'), ((895, 914), 'statistics.stdev', 'statistics.stdev', (['v'], {}), '(v)\n', (911, 914), False, 'import statistics\n'), ((1116, 1127), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1124, 1127), False,... |
# Copyright <NAME> and contributors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | [
"django.forms.BooleanField",
"crispy_forms.helper.FormHelper",
"django.forms.CharField",
"images.models.Image.objects.filter",
"django.forms.URLField",
"django.core.urlresolvers.reverse",
"django.forms.ChoiceField",
"hosts.models.Host.objects.filter",
"django.utils.translation.ugettext",
"django.f... | [((1004, 1037), 'hosts.models.Host.objects.filter', 'Host.objects.filter', ([], {'enabled': '(True)'}), '(enabled=True)\n', (1023, 1037), False, 'from hosts.models import Host\n'), ((1478, 1510), 'django.forms.ChoiceField', 'forms.ChoiceField', ([], {'required': '(True)'}), '(required=True)\n', (1495, 1510), False, 'fr... |
#!/usr/bin/python
from http.server import BaseHTTPRequestHandler, HTTPServer
from os import curdir, sep
PORT_NUMBER = 8080
class myHandler(BaseHTTPRequestHandler):
#Handler for the GET requests
def do_GET(self):
self.send_response(200)
self.send_header('Content-type','image/png')
self.end_headers()
with o... | [
"http.server.HTTPServer"
] | [((409, 449), 'http.server.HTTPServer', 'HTTPServer', (["('', PORT_NUMBER)", 'myHandler'], {}), "(('', PORT_NUMBER), myHandler)\n", (419, 449), False, 'from http.server import BaseHTTPRequestHandler, HTTPServer\n')] |
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def hello(request):
return HttpResponse("Hello world")
def date(request, year, month, day):
return HttpResponse({
year: year,
month: month,
day: day
})
| [
"django.http.HttpResponse"
] | [((133, 160), 'django.http.HttpResponse', 'HttpResponse', (['"""Hello world"""'], {}), "('Hello world')\n", (145, 160), False, 'from django.http import HttpResponse\n'), ((211, 261), 'django.http.HttpResponse', 'HttpResponse', (['{year: year, month: month, day: day}'], {}), '({year: year, month: month, day: day})\n', (... |
# Generated by Django 2.2.1 on 2019-05-22 08:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('insta', '0002_pictures'),
]
operations = [
migrations.CreateModel(
name='Comment',
fields=[
('id', m... | [
"django.db.models.AutoField",
"django.db.migrations.RenameField",
"django.db.models.CharField"
] | [((508, 586), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""profile"""', 'old_name': '"""bio"""', 'new_name': '"""about"""'}), "(model_name='profile', old_name='bio', new_name='about')\n", (530, 586), False, 'from django.db import migrations, models\n'), ((319, 412), 'django.db.m... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import enum
import json
import os
import plistlib
import subprocess
import time
import tools
import requests
python_script_debug_enable = False # 是否开启debug模式 用于测试脚本
pwd = os.getcwd() # 当前文件的路径
ios_project_path = os.path.abspath(os.path.dirname(
pwd) + os.path.sep... | [
"os.path.expanduser",
"json.loads",
"os.listdir",
"json.dumps",
"os.path.join",
"plistlib.dump",
"time.sleep",
"os.getcwd",
"requests.get",
"os.path.dirname",
"subprocess.call",
"tools.end_program",
"tools.notice_print",
"json.load",
"tools.warn_print",
"tools.fail_print",
"os.walk"
... | [((222, 233), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (231, 233), False, 'import os\n'), ((385, 408), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (403, 408), False, 'import os\n'), ((437, 463), 'os.path.join', 'os.path.join', (['pwd', '"""build"""'], {}), "(pwd, 'build')\n", (449, 463)... |
import pdfplumber
import re
import csv
from tqdm import tqdm
print('(When entering file paths on windows, use \'/\' in the place of \'\\\')')
pdf_path = input('Enter the file path of the 1099 pdf:\n')
# open up the pdf file, keep trying until user enters valid file
valid_pdf = False
while not valid_pdf:
try:
pdf =... | [
"csv.writer",
"pdfplumber.open",
"tqdm.tqdm",
"re.compile"
] | [((1480, 1512), 're.compile', 're.compile', (['""".*\\\\/ Symbol:\\\\s*$"""'], {}), "('.*\\\\/ Symbol:\\\\s*$')\n", (1490, 1512), False, 'import re\n'), ((1544, 1586), 're.compile', 're.compile', (['"""^\\\\d{2}\\\\/\\\\d{2}\\\\/\\\\d{2} .*"""'], {}), "('^\\\\d{2}\\\\/\\\\d{2}\\\\/\\\\d{2} .*')\n", (1554, 1586), False,... |
import torch
import torch.nn as nn
import torch.nn.functional as F
def _make_residual(channels): # Nawid- Performs a 3x3 convolution followed by a 1x1 convolution - The 3x3 convolution is padded and so the overall shape is the same.
return nn.Sequential(
nn.ReLU(),
nn.Conv2d(channels, channels, 3, ... | [
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.functional.relu",
"torch.nn.ConvTranspose2d",
"torch.cat"
] | [((268, 277), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (275, 277), True, 'import torch.nn as nn\n'), ((287, 330), 'torch.nn.Conv2d', 'nn.Conv2d', (['channels', 'channels', '(3)'], {'padding': '(1)'}), '(channels, channels, 3, padding=1)\n', (296, 330), True, 'import torch.nn as nn\n'), ((340, 349), 'torch.nn.ReLU'... |
import os
import csv
import librosa
import numpy as np
import pandas as pd
from spider.featurization.audio_featurization import AudioFeaturization
# Read the test data csv
csv_file='data/testAudioData.csv'
df = pd.read_csv(csv_file)
# Read in the audio data specified by the csv
data = []
for idx, row in df.iterrows()... | [
"pandas.read_csv",
"os.path.join",
"numpy.savetxt",
"spider.featurization.audio_featurization.AudioFeaturization",
"librosa.load"
] | [((212, 233), 'pandas.read_csv', 'pd.read_csv', (['csv_file'], {}), '(csv_file)\n', (223, 233), True, 'import pandas as pd\n'), ((616, 711), 'spider.featurization.audio_featurization.AudioFeaturization', 'AudioFeaturization', ([], {'sampling_rate': 'sampling_rate', 'frame_length': 'frame_length', 'overlap': 'overlap'})... |
import scipy.io as sio
import numpy as np
class MatWrapper(object):
def __init__(self,mat_file):
self.mat_fp = mat_file
self.data = None
class NeuroSurgMat(MatWrapper):
def __init__(self, mat_file):
self.mat_fp = mat_file
self.data = None
self._clfp = None
se... | [
"scipy.io.loadmat",
"numpy.empty",
"numpy.arange",
"numpy.squeeze"
] | [((492, 516), 'scipy.io.loadmat', 'sio.loadmat', (['self.mat_fp'], {}), '(self.mat_fp)\n', (503, 516), True, 'import scipy.io as sio\n'), ((567, 611), 'numpy.empty', 'np.empty', (["(3, self.data['CLFP_01'].shape[1])"], {}), "((3, self.data['CLFP_01'].shape[1]))\n", (575, 611), True, 'import numpy as np\n'), ((632, 644)... |
# Copyright 2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# 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
#
# Un... | [
"nnabla.functions.transpose",
"nnabla.functions.one_hot",
"nnabla.parametric_functions.convolution",
"nnabla.functions.log",
"nnabla.parametric_functions.deconvolution",
"nnabla.parametric_functions.batch_normalization",
"nnabla.parameter_scope",
"nnabla.functions.sum",
"numpy.random.seed",
"nnabl... | [((774, 791), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (788, 791), True, 'import numpy as np\n'), ((1222, 1233), 'nnabla.functions.relu', 'F.relu', (['out'], {}), '(out)\n', (1228, 1233), True, 'import nnabla.functions as F\n'), ((2692, 2720), 'nnabla.functions.transpose', 'F.transpose', (['x', '(... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project : StreamlitApp.
# @File : utils
# @Time : 2020/11/3 12:17 下午
# @Author : yuanjie
# @Email : <EMAIL>
# @Software : PyCharm
# @Description : https://share.streamlit.io/daniellewisdl/streamlit-cheat-sheet/app.py
import pandas ... | [
"streamlit.image",
"streamlit.beta_columns",
"streamlit.file_uploader",
"streamlit.subheader",
"streamlit.sidebar.radio"
] | [((396, 426), 'streamlit.sidebar.radio', 'st.sidebar.radio', (['"""R:"""', '[1, 2]'], {}), "('R:', [1, 2])\n", (412, 426), True, 'import streamlit as st\n'), ((472, 505), 'streamlit.file_uploader', 'st.file_uploader', (['"""File uploader"""'], {}), "('File uploader')\n", (488, 505), True, 'import streamlit as st\n'), (... |
import multiprocessing
from time import sleep
from datetime import datetime, time
from logging import INFO
from vnpy.event import EventEngine
from vnpy.trader.setting import SETTINGS
from vnpy.trader.engine import MainEngine
from vnpy.gateway.hbdm import HbdmGateway
from vnpy.gateway.hbsdm import HbsdmGateway
from vn... | [
"vnpy.trader.engine.MainEngine",
"vnpy.event.EventEngine",
"time.sleep"
] | [((1036, 1049), 'vnpy.event.EventEngine', 'EventEngine', ([], {}), '()\n', (1047, 1049), False, 'from vnpy.event import EventEngine\n'), ((1068, 1092), 'vnpy.trader.engine.MainEngine', 'MainEngine', (['event_engine'], {}), '(event_engine)\n', (1078, 1092), False, 'from vnpy.trader.engine import MainEngine\n'), ((1570, ... |
# Copyright 2016, IBM US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | [
"opsmgr.inventory.rack_mgr.list_racks",
"horizon.exceptions.handle",
"operational_mgmt.inventory.tables.ResourcesTable",
"django.utils.translation.ugettext_lazy",
"logging.debug",
"django.views.decorators.debug.sensitive_post_parameters",
"opsmgr.inventory.resource_mgr.list_resources",
"django.core.ur... | [((1606, 1620), 'django.utils.translation.ugettext_lazy', '_', (['"""Inventory"""'], {}), "('Inventory')\n", (1607, 1620), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((4745, 4762), 'django.utils.translation.ugettext_lazy', '_', (['"""Add Resource"""'], {}), "('Add Resource')\n", (4746, 4762), T... |
import csv
def carregar_acessos():
dados = []#lado direito
marcacoes =[]#as classificaçoes lado esquerdo
#abrir o arquivo
arquivo = open('acesso.csv', 'r')
#leitor de csv
leitor = csv.reader(arquivo)
#ler cada linha
for acessou_home,acessou_como_funciona,acessou_contato,comprou in le... | [
"csv.reader"
] | [((207, 226), 'csv.reader', 'csv.reader', (['arquivo'], {}), '(arquivo)\n', (217, 226), False, 'import csv\n')] |
import time
import numpy as np
import torch
class Profiler:
def __init__(self, dummy=False, device=None):
self.events = []
self.dummy = dummy
self.device = device if device != torch.device('cpu') else None
self.log('start')
def log(self, name):
if self.dummy:
... | [
"numpy.diff",
"torch.cuda.synchronize",
"numpy.argsort",
"torch.is_tensor",
"gc.get_objects",
"time.time",
"torch.cuda.memory_summary",
"torch.device"
] | [((1863, 1879), 'gc.get_objects', 'gc.get_objects', ([], {}), '()\n', (1877, 1879), False, 'import gc\n'), ((853, 873), 'numpy.diff', 'np.diff', (['event_times'], {}), '(event_times)\n', (860, 873), True, 'import numpy as np\n'), ((437, 472), 'torch.cuda.synchronize', 'torch.cuda.synchronize', (['self.device'], {}), '(... |
"""
WLS filter: Edge-preserving smoothing based onthe weightd least squares
optimization framework, as described in Farbman, Fattal, Lischinski, and
Szeliski, "Edge-Preserving Decompositions for Multi-Scale Tone and Detail
Manipulation", ACM Transactions on Graphics, 27(3), August 2008.
Given an input image IN, we see... | [
"numpy.abs",
"numpy.reshape",
"numpy.log",
"numpy.diff",
"cv2.imshow",
"numpy.max",
"numpy.array",
"cv2.waitKey",
"numpy.concatenate",
"cv2.cvtColor",
"numpy.pad",
"scipy.sparse.spdiags",
"cv2.imread"
] | [((1124, 1142), 'numpy.log', 'np.log', (['(IN + 1e-22)'], {}), '(IN + 1e-22)\n', (1130, 1142), True, 'import numpy as np\n'), ((1353, 1376), 'numpy.diff', 'np.diff', (['L'], {'n': '(1)', 'axis': '(0)'}), '(L, n=1, axis=0)\n', (1360, 1376), True, 'import numpy as np\n'), ((1468, 1508), 'numpy.pad', 'np.pad', (['dy', '((... |
from typing import Dict, List, Tuple, Union
from collections import OrderedDict
from functools import lru_cache
import warnings
from torch.utils.data import BatchSampler, DataLoader
from catalyst.core.callback import (
Callback,
CallbackWrapper,
IBackwardCallback,
ICriterionCallback,
IOptimizerCal... | [
"warnings.warn",
"functools.lru_cache",
"collections.OrderedDict"
] | [((2053, 2074), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(42)'}), '(maxsize=42)\n', (2062, 2074), False, 'from functools import lru_cache\n'), ((1491, 1504), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1502, 1504), False, 'from collections import OrderedDict\n'), ((3487, 3659), 'warnings.w... |
import numpy as np
def place_mirror(im, x1, x2, y1, y2, mr):
""" Place an image mr in specified locations of an image im. The edge locations in im where mr is to be placed are
(x1,y1) and (x2,y2)
Programmer
---------
<NAME> (JHU/APL, 10/12/05)
"""
nxa = np.zeros(2)
nya = np.zeros... | [
"numpy.flip",
"numpy.zeros",
"numpy.float",
"numpy.min"
] | [((290, 301), 'numpy.zeros', 'np.zeros', (['(2)'], {}), '(2)\n', (298, 301), True, 'import numpy as np\n'), ((312, 323), 'numpy.zeros', 'np.zeros', (['(2)'], {}), '(2)\n', (320, 323), True, 'import numpy as np\n'), ((474, 485), 'numpy.min', 'np.min', (['nxa'], {}), '(nxa)\n', (480, 485), True, 'import numpy as np\n'), ... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: protobufs/services/team/actions/get_teams.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor",
"google.protobuf.descriptor.FileDescriptor"
] | [((428, 454), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (452, 454), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((688, 1507), 'google.protobuf.descriptor.FileDescriptor', '_descriptor.FileDescriptor', ([], {'name': '"""protobufs/services/tea... |
# -*- coding: utf-8 -*-
"""
:author: <NAME> (徐天明)
:url: http://greyli.com
:copyright: © 2021 <NAME> <<EMAIL>>
:license: MIT, see LICENSE for more details.
"""
from flask import render_template, current_app, request, Blueprint
from albumy.models import User, Photo
user_bp = Blueprint('user', __name__)
... | [
"flask.render_template",
"flask.request.args.get",
"albumy.models.Photo.timestamp.desc",
"albumy.models.Photo.query.with_parent",
"albumy.models.User.query.filter_by",
"flask.Blueprint"
] | [((292, 319), 'flask.Blueprint', 'Blueprint', (['"""user"""', '__name__'], {}), "('user', __name__)\n", (301, 319), False, 'from flask import render_template, current_app, request, Blueprint\n'), ((450, 487), 'flask.request.args.get', 'request.args.get', (['"""page"""', '(1)'], {'type': 'int'}), "('page', 1, type=int)\... |
from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, cast
import kubernetes
import dagster._check as check
from dagster.config.validate import process_config
from dagster.core.errors import DagsterInvalidConfigError
from dagster.core.storage.pipeline_run import PipelineRun
from dagster.core.utils ... | [
"dagster.core.errors.DagsterInvalidConfigError",
"dagster._check.opt_str_param",
"dagster.utils.merge_dicts",
"dagster._check.opt_list_param",
"dagster.utils.make_readonly_value",
"dagster.core.utils.parse_env_var",
"typing.NamedTuple",
"dagster._check.opt_dict_param",
"typing.cast"
] | [((662, 1096), 'typing.NamedTuple', 'NamedTuple', (['"""_K8sContainerContext"""', "[('image_pull_policy', Optional[str]), ('image_pull_secrets', List[Dict[str,\n str]]), ('service_account_name', Optional[str]), ('env_config_maps',\n List[str]), ('env_secrets', List[str]), ('env_vars', List[str]), (\n 'volume_m... |
import random
from src.datastruct.bin_treenode import TreeNode
import unittest
class Solution:
def hasPathSum(self, root: TreeNode, targetSum: int) -> bool:
num = random.randint(0, 1)
d = {
0: self.dfs,
1: self.postorder,
2: self.bfs,
}
return d... | [
"unittest.main",
"random.randint",
"src.datastruct.bin_treenode.TreeNode.create"
] | [((2575, 2590), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2588, 2590), False, 'import unittest\n'), ((177, 197), 'random.randint', 'random.randint', (['(0)', '(1)'], {}), '(0, 1)\n', (191, 197), False, 'import random\n'), ((2428, 2449), 'src.datastruct.bin_treenode.TreeNode.create', 'TreeNode.create', (['num... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "<NAME> <<EMAIL>>"
from setuptools import setup, find_packages
setup(
name='python-highcharts_df',
version='0.1.0',
description='python-highcharts_df wrapper for customizable pretty plotting quickly from pandas dataframes',
author="<NAME>",
... | [
"setuptools.find_packages"
] | [((379, 394), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (392, 394), False, 'from setuptools import setup, find_packages\n')] |
from django.db import models
# Description of an object in the arena
class Entity(models.Model):
entityId = models.AutoField(primary_key=True)
entityClass = models.CharField(max_length=30)
entityName = models.CharField(max_length=30, null=True, blank=True)
entityCategory = models.CharField(max_length=... | [
"django.db.models.FloatField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((114, 148), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)'}), '(primary_key=True)\n', (130, 148), False, 'from django.db import models\n'), ((167, 198), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (183, 198), False, 'from django... |
import os
import psycopg2
DATABASE_URL = os.environ.get('DATABASE_URL')
def test_db():
conn = psycopg2.connect(DATABASE_URL)
cur = conn.cursor()
cur.execute("SELECT * FROM country;")
for country in cur:
print(country)
cur.close()
conn.close()
if __name__ == '__main__':
test_db(... | [
"psycopg2.connect",
"os.environ.get"
] | [((42, 72), 'os.environ.get', 'os.environ.get', (['"""DATABASE_URL"""'], {}), "('DATABASE_URL')\n", (56, 72), False, 'import os\n'), ((101, 131), 'psycopg2.connect', 'psycopg2.connect', (['DATABASE_URL'], {}), '(DATABASE_URL)\n', (117, 131), False, 'import psycopg2\n')] |
from requests_html import HTMLSession
from sys import argv
if len(argv) != 2:
print("Usage: python3 VanillaGift.py VanillaGift.txt")
else: # VanillaGift card balance checker
for card in reversed(list(open(argv[1]))):
cardNumber, expMonth, expYear, cvv = card.rstrip().split(':')
c = cardNumber + ' ' + expMo... | [
"requests_html.HTMLSession"
] | [((496, 509), 'requests_html.HTMLSession', 'HTMLSession', ([], {}), '()\n', (507, 509), False, 'from requests_html import HTMLSession\n')] |
# -*- coding: utf-8 -*-
#
# Testing module for ACME's `ParallelMap` interface
#
# Builtin/3rd party package imports
from multiprocessing import Value
import os
import sys
import pickle
import shutil
import inspect
import subprocess
import getpass
import time
import itertools
import logging
from typing import Type
impo... | [
"acme.esi_cluster_setup",
"scipy.signal.filtfilt",
"acme.cluster_cleanup",
"time.sleep",
"numpy.array",
"numpy.sin",
"getpass.getuser",
"acme.shared.is_slurm_node",
"subprocess.Popen",
"os.path.split",
"numpy.linspace",
"os.unlink",
"pytest.mark.skipif",
"os.path.expanduser",
"numpy.roun... | [((663, 739), 'pytest.mark.skipif', 'pytest.mark.skipif', (["(sys.platform == 'win32')"], {'reason': '"""Not running in Windows"""'}), "(sys.platform == 'win32', reason='Not running in Windows')\n", (681, 739), False, 'import pytest\n'), ((1951, 1966), 'acme.shared.is_slurm_node', 'is_slurm_node', ([], {}), '()\n', (19... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the analysis front-end object."""
import unittest
from plaso.frontend import analysis_frontend
from plaso.storage import zip_file as storage_zip_file
from tests.frontend import test_lib
class AnalysisFrontendTests(test_lib.FrontendTestCase):
"""Tests for the... | [
"unittest.main",
"plaso.frontend.analysis_frontend.AnalysisFrontend"
] | [((750, 765), 'unittest.main', 'unittest.main', ([], {}), '()\n', (763, 765), False, 'import unittest\n'), ((444, 480), 'plaso.frontend.analysis_frontend.AnalysisFrontend', 'analysis_frontend.AnalysisFrontend', ([], {}), '()\n', (478, 480), False, 'from plaso.frontend import analysis_frontend\n')] |
import numpy as np
from numpy import log
#Se define la función a integrar
def f(x):
return 1 / log(x)
#Implementación del método de Simpson
#Parámetros:
#f es la función a integrar
#a el límite inferior de la integral
#b el límite superior de la integral
#n el número de intervalos
def simpson (f, a... | [
"numpy.log"
] | [((105, 111), 'numpy.log', 'log', (['x'], {}), '(x)\n', (108, 111), False, 'from numpy import log\n')] |
import argparse
import i18n
import logging
import os
import rdflib
import sys
from termcolor import colored
from timeit import default_timer as timer
__VERSION__ = '0.2.0'
__LOG__ = None
FORMATS = ['nt', 'n3', 'turtle', 'rdfa', 'xml', 'pretty-xml']
HEADER_SEP = '='
COLUMN_SEP = '|'
EMPTY_LINE = ''
COLUMN_SPEC = '{:... | [
"logging.basicConfig",
"logging.getLogger",
"argparse.FileType",
"termcolor.colored",
"argparse.ArgumentParser",
"timeit.default_timer",
"shutil.get_terminal_size",
"rdflib.Graph",
"i18n.set",
"os.path.dirname",
"sys.stdout.buffer.write",
"rdflib.util.guess_format",
"i18n.t"
] | [((490, 513), 'i18n.t', 'i18n.t', (['description_key'], {}), '(description_key)\n', (496, 513), False, 'import i18n\n'), ((1196, 1222), 'i18n.set', 'i18n.set', (['"""fallback"""', '"""en"""'], {}), "('fallback', 'en')\n", (1204, 1222), False, 'import i18n\n'), ((1292, 1340), 'argparse.ArgumentParser', 'argparse.Argumen... |
from loguru import logger
from scrapy.crawler import CrawlerProcess
from scrapy.utils.log import DEFAULT_LOGGING
from scrapy.utils.project import get_project_settings
from scrape_magic.spiders.gatherer_spider import GathererSpider
from scrape_magic.spiders.starcity_spider import StarcitySpider
settings = get_project_... | [
"loguru.logger.error",
"scrapy.crawler.CrawlerProcess",
"scrapy.utils.project.get_project_settings"
] | [((308, 330), 'scrapy.utils.project.get_project_settings', 'get_project_settings', ([], {}), '()\n', (328, 330), False, 'from scrapy.utils.project import get_project_settings\n'), ((429, 481), 'scrapy.crawler.CrawlerProcess', 'CrawlerProcess', (['settings'], {'install_root_handler': '(False)'}), '(settings, install_roo... |
from flask import (
Blueprint, request, jsonify, render_template, session, redirect, url_for
)
from app.models import User
bp = Blueprint('auth', __name__, url_prefix='/auth')
... | [
"flask.render_template",
"flask.request.args.get",
"flask.url_for",
"flask.session.pop",
"flask.Blueprint",
"app.models.User.update"
] | [((133, 180), 'flask.Blueprint', 'Blueprint', (['"""auth"""', '__name__'], {'url_prefix': '"""/auth"""'}), "('auth', __name__, url_prefix='/auth')\n", (142, 180), False, 'from flask import Blueprint, request, jsonify, render_template, session, redirect, url_for\n'), ((1264, 1283), 'flask.session.pop', 'session.pop', ([... |
import json
import pathlib
from src.extract_old_site.extract import run_extraction
from src.generate_new_site.generate import generate_site
if __name__ == "__main__":
script_root_dir = pathlib.Path(__file__).parent
config = None
with open((script_root_dir / "config.json")) as f:
config = json.load... | [
"json.load",
"src.generate_new_site.generate.generate_site",
"src.extract_old_site.extract.run_extraction",
"pathlib.Path"
] | [((190, 212), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (202, 212), False, 'import pathlib\n'), ((311, 323), 'json.load', 'json.load', (['f'], {}), '(f)\n', (320, 323), False, 'import json\n'), ((1276, 1298), 'src.extract_old_site.extract.run_extraction', 'run_extraction', (['config'], {}), '(... |
"""Environments."""
import gin
from alpacka.envs import bin_packing
from alpacka.envs import cartpole
from alpacka.envs import gfootball
from alpacka.envs import octomaze
from alpacka.envs import sokoban
from alpacka.envs.base import *
from alpacka.envs.wrappers import *
# Configure envs in this module to ensure th... | [
"gin.external_configurable"
] | [((414, 473), 'gin.external_configurable', 'gin.external_configurable', (['env_class'], {'module': '"""alpacka.envs"""'}), "(env_class, module='alpacka.envs')\n", (439, 473), False, 'import gin\n')] |
from typing import List, Tuple
import mlflow
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from interpret.glassbox import ExplainableBoostingClassifier, ExplainableBoostingRegressor
from ..OEA_model import OEAModelInterface, ModelType, ExplanationType
from ..modeling_ut... | [
"interpret.glassbox.ExplainableBoostingRegressor",
"sklearn.model_selection.train_test_split",
"interpret.glassbox.ExplainableBoostingClassifier",
"numpy.concatenate",
"pandas.concat",
"mlflow.pyfunc.load_model",
"mlflow.pyfunc.save_model",
"mlflow.pyfunc.log_model"
] | [((8051, 8096), 'pandas.concat', 'pd.concat', (['[self.X_train, self.X_val]'], {'axis': '(0)'}), '([self.X_train, self.X_val], axis=0)\n', (8060, 8096), True, 'import pandas as pd\n'), ((8119, 8169), 'numpy.concatenate', 'np.concatenate', (['[self.y_train, self.y_val]'], {'axis': '(0)'}), '([self.y_train, self.y_val], ... |
import os
import sys
from optparse import make_option
from django.core.management import BaseCommand, call_command
from django.conf import settings
def rel(*x):
return os.path.join(os.path.abspath(os.path.dirname(__file__)), *x)
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
m... | [
"django.core.management.call_command",
"os.environ.get",
"os.path.dirname",
"os.path.isdir",
"optparse.make_option"
] | [((911, 943), 'os.environ.get', 'os.environ.get', (['"""GENERATORS_DIR"""'], {}), "('GENERATORS_DIR')\n", (925, 943), False, 'import os\n'), ((1320, 1345), 'django.core.management.call_command', 'call_command', (['"""runserver"""'], {}), "('runserver')\n", (1332, 1345), False, 'from django.core.management import BaseCo... |
"""Add contact_details to House
Revision ID: 1<PASSWORD>7
Revises: <PASSWORD>
Create Date: 2018-08-08 10:58:44.869939
"""
# revision identifiers, used by Alembic.
revision = '1<PASSWORD>'
down_revision = '<PASSWORD>'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by ... | [
"sqlalchemy.Text",
"alembic.op.drop_column"
] | [((552, 594), 'alembic.op.drop_column', 'op.drop_column', (['"""house"""', '"""contact_details"""'], {}), "('house', 'contact_details')\n", (566, 594), False, 'from alembic import op\n'), ((405, 414), 'sqlalchemy.Text', 'sa.Text', ([], {}), '()\n', (412, 414), True, 'import sqlalchemy as sa\n')] |
from random import randint
def longname():
return ''.join(chr(randint(0,143859)) for i in range(10000)).encode('utf-8','ignore').decode()
| [
"random.randint"
] | [((67, 85), 'random.randint', 'randint', (['(0)', '(143859)'], {}), '(0, 143859)\n', (74, 85), False, 'from random import randint\n')] |
"""
This module contains utility functions used in the example scripts. They are
implemented separately because they use scipy and numpy and we want to remove
external dependencies from within the core library.
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ impo... | [
"numpy.clip",
"numpy.abs",
"numpy.ceil",
"numpy.mean",
"scipy.stats.t._ppf",
"numpy.ones",
"scipy.linalg.solve",
"numpy.array",
"numpy.zeros",
"concept_formation.utils.mean",
"numpy.sum",
"scipy.stats.sem",
"numpy.cumsum"
] | [((703, 728), 'numpy.cumsum', 'np.cumsum', (['a'], {'dtype': 'float'}), '(a, dtype=float)\n', (712, 728), True, 'import numpy as np\n'), ((1840, 1851), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (1848, 1851), True, 'import numpy as np\n'), ((1865, 1875), 'numpy.ones', 'np.ones', (['n'], {}), '(n)\n', (1872, 1875)... |
from aiohttp import web
from avio.app_builder import AppBuilder
from avio.default_handlers import InfoHandler
def test_create_app():
app = AppBuilder().build_app()
assert isinstance(app, web.Application)
def test_app_config():
builder = AppBuilder({'app_key': 'value'})
app = builder.build_app({'upd... | [
"avio.app_builder.AppBuilder"
] | [((254, 286), 'avio.app_builder.AppBuilder', 'AppBuilder', (["{'app_key': 'value'}"], {}), "({'app_key': 'value'})\n", (264, 286), False, 'from avio.app_builder import AppBuilder\n'), ((611, 623), 'avio.app_builder.AppBuilder', 'AppBuilder', ([], {}), '()\n', (621, 623), False, 'from avio.app_builder import AppBuilder\... |
# -*- coding: utf-8 -*-
# Copyright 2022 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | [
"turbinia.workers.analysis.postgresql_acct.PostgresAccountAnalysisTask",
"os.path.realpath",
"os.path.join",
"turbinia.config.LoadConfig"
] | [((1361, 1413), 'os.path.join', 'os.path.join', (['filedir', '""".."""', '""".."""', '""".."""', '"""test_data"""'], {}), "(filedir, '..', '..', '..', 'test_data')\n", (1373, 1413), False, 'import os\n'), ((1550, 1569), 'turbinia.config.LoadConfig', 'config.LoadConfig', ([], {}), '()\n', (1567, 1569), False, 'from turb... |
#!/usr/bin/env python
from collections import defaultdict
import gzip
import os
import pandas as pd
import sys
import pdb
def collectDataForMatchesToPMProteins(annotated_PM_proteins, blast_directory):
pORF_to_PM_protein_matches = defaultdict(set)
blast_file_columns = ["query", "subject", "perc_ident",... | [
"os.path.exists",
"pandas.read_csv",
"gzip.open",
"collections.defaultdict",
"sys.exit"
] | [((243, 259), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (254, 259), False, 'from collections import defaultdict\n'), ((486, 524), 'gzip.open', 'gzip.open', (['annotated_PM_proteins', '"""rb"""'], {}), "(annotated_PM_proteins, 'rb')\n", (495, 524), False, 'import gzip\n'), ((1744, 1771), 'gzip.... |
# -*- coding: UTF-8 -*-
import numpy as np
from numpy.testing import assert_array_almost_equal
from spectral_clustering.spectral_embedding_ import spectral_embedding
def assert_first_col_equal(maps):
constant_vec = [1] * maps.shape[0]
assert_array_almost_equal(maps[:, 0] / maps[0, 0], constant_vec)
def test... | [
"spectral_clustering.spectral_embedding_.spectral_embedding",
"numpy.array",
"numpy.testing.assert_array_almost_equal"
] | [((245, 309), 'numpy.testing.assert_array_almost_equal', 'assert_array_almost_equal', (['(maps[:, 0] / maps[0, 0])', 'constant_vec'], {}), '(maps[:, 0] / maps[0, 0], constant_vec)\n', (270, 309), False, 'from numpy.testing import assert_array_almost_equal\n'), ((414, 516), 'numpy.array', 'np.array', (['[[0.0, 0.8, 0.9,... |
from setuptools import setup, find_packages
def readme():
with open('README.md') as f:
return f.read()
setup(
name='pyschemavalidator',
version='1.0.4',
description='Decorator for endpoint inputs on APIs and a dictionary/JSON validator.',
long_description=readme(),
long_description_con... | [
"setuptools.find_packages"
] | [((903, 946), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests.*', 'tests']"}), "(exclude=['tests.*', 'tests'])\n", (916, 946), False, 'from setuptools import setup, find_packages\n')] |
"""
Specification for what parameters are used at what location within
the Cascade.
"""
from os import linesep
from types import SimpleNamespace
import networkx as nx
from cascade.core import getLoggers
from cascade.core.parameters import ParameterProperty, _ParameterHierarchy
from cascade.input_data import InputData... | [
"networkx.topological_sort",
"types.SimpleNamespace",
"networkx.DiGraph",
"cascade.input_data.InputDataError",
"cascade.runner.job_graph.RecipeIdentifier",
"cascade.input_data.configuration.sex.SEX_ID_TO_NAME.keys",
"networkx.subgraph",
"cascade.core.getLoggers",
"cascade.core.parameters.ParameterPr... | [((699, 719), 'cascade.core.getLoggers', 'getLoggers', (['__name__'], {}), '(__name__)\n', (709, 719), False, 'from cascade.core import getLoggers\n'), ((6327, 6354), 'networkx.DiGraph', 'nx.DiGraph', ([], {'root': 'recipes[0]'}), '(root=recipes[0])\n', (6337, 6354), True, 'import networkx as nx\n'), ((7106, 7176), 'ca... |