code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from sys import platform
import unittest
import checksieve
class TestVariables(unittest.TestCase):
def test_set(self):
sieve = '''
require "variables";
set "honorific" "Mr";
'''
self.assertFalse(checksieve.parse_string(sieve, False))
def test_mod_length(self):
... | [
"unittest.main",
"checksieve.parse_string"
] | [((1780, 1795), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1793, 1795), False, 'import unittest\n'), ((242, 279), 'checksieve.parse_string', 'checksieve.parse_string', (['sieve', '(False)'], {}), '(sieve, False)\n', (265, 279), False, 'import checksieve\n'), ((431, 468), 'checksieve.parse_string', 'checksieve... |
from pyAudioAnalysis import audioFeatureExtraction
from keras.preprocessing import sequence
from scipy import stats
import numpy as np
import cPickle
import sys
import globalvars
def feature_extract(data, nb_samples, dataset, save=True):
f_global = []
i = 0
for (x, Fs) in data:
# 34D short-term ... | [
"numpy.argmax",
"numpy.sum",
"numpy.zeros",
"scipy.stats.zscore",
"pyAudioAnalysis.audioFeatureExtraction.stFeatureExtraction",
"pyAudioAnalysis.audioFeatureExtraction.stFeatureSpeed",
"keras.preprocessing.sequence.pad_sequences",
"sys.stdout.write"
] | [((927, 1037), 'keras.preprocessing.sequence.pad_sequences', 'sequence.pad_sequences', (['f_global'], {'maxlen': 'globalvars.max_len', 'dtype': '"""float64"""', 'padding': '"""post"""', 'value': '(-100.0)'}), "(f_global, maxlen=globalvars.max_len, dtype='float64',\n padding='post', value=-100.0)\n", (949, 1037), Fal... |
import numpy as np
import math
from os import path
import imageio
from datetime import date
def convertCSVtoImage(Filepath, FileFormat):
supportedFileFormats = ["png","jpeg","jpg","bmp"]
if not FileFormat in supportedFileFormats:
raise ValueError("Outputformat {} is not supported! The following are al... | [
"imageio.imwrite",
"math.floor",
"os.path.splitext",
"numpy.ndindex",
"os.path.isfile",
"numpy.array",
"numpy.zeros",
"imageio.imread",
"datetime.date.today"
] | [((1834, 1873), 'imageio.imwrite', 'imageio.imwrite', (['outputPath', 'imageArray'], {}), '(outputPath, imageArray)\n', (1849, 1873), False, 'import imageio\n'), ((2558, 2582), 'imageio.imread', 'imageio.imread', (['Filepath'], {}), '(Filepath)\n', (2572, 2582), False, 'import imageio\n'), ((395, 416), 'os.path.isfile'... |
from django.db import models
from categorias.models import Categoria
from django.contrib.auth.models import User
from django.utils import timezone
from PIL import Image
from django.conf import settings
import os
# Create your models here.
class Post(models.Model):
titulo_post = models.CharField(max_length=255, ... | [
"PIL.Image.open",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"os.path.join",
"django.db.models.BooleanField",
"django.db.models.ImageField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((287, 342), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'verbose_name': '"""Título"""'}), "(max_length=255, verbose_name='Título')\n", (303, 342), False, 'from django.db import models\n'), ((361, 435), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'on_delete': 'mod... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
from typing import List
from .cli_object_storage import CLIObjectStorage
class S3Storage(CLIObjectStorage... | [
"os.path.join",
"os.environ.copy"
] | [((684, 729), 'os.path.join', 'os.path.join', (['self.AWS_S3_BUCKET', '"""flat"""', 'sid'], {}), "(self.AWS_S3_BUCKET, 'flat', sid)\n", (696, 729), False, 'import os\n'), ((1514, 1531), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (1529, 1531), False, 'import os\n')] |
from typing import Optional
import pytest
from django.test import RequestFactory
from rest_framework.response import Response
from currency_converter.currencies.models import ExchangeRate
from currency_converter.currencies.api.views import ExchangeRateAPIView
pytestmark = pytest.mark.django_db
class TestExchangeRa... | [
"currency_converter.currencies.api.views.ExchangeRateAPIView"
] | [((741, 762), 'currency_converter.currencies.api.views.ExchangeRateAPIView', 'ExchangeRateAPIView', ([], {}), '()\n', (760, 762), False, 'from currency_converter.currencies.api.views import ExchangeRateAPIView\n'), ((1576, 1597), 'currency_converter.currencies.api.views.ExchangeRateAPIView', 'ExchangeRateAPIView', ([],... |
"""重要単語リスト生成器"""
import csv
import os
import MeCab
from gensim.models import word2vec
from directory import Directory
from iomanager import IOManager
from file import File
class Imporwords(IOManager):
"""重要単語リストクラス"""
def __init__(self,
output_path="./resource/imporwords/",
... | [
"gensim.models.word2vec.Word2Vec.load",
"os.listdir",
"csv.writer",
"directory.Directory",
"MeCab.Tagger",
"csv.reader"
] | [((1228, 1242), 'MeCab.Tagger', 'MeCab.Tagger', ([], {}), '()\n', (1240, 1242), False, 'import MeCab\n'), ((3056, 3123), 'gensim.models.word2vec.Word2Vec.load', 'word2vec.Word2Vec.load', (["(self.models['path'] + model_file_.full_name)"], {}), "(self.models['path'] + model_file_.full_name)\n", (3078, 3123), False, 'fro... |
from LedAnimation import Animation, KeyFrame
from neopixel import *
import time
from random import randint
class WipeAnimation(Animation):
def WipeDef(self, strip, kwargs):
pos = kwargs['pos']
ledColor = kwargs['col']
delay = kwargs['delay']
strip.setBrightness(self.ma... | [
"LedAnimation.KeyFrame",
"random.randint",
"time.sleep",
"LedAnimation.Animation.__init__"
] | [((409, 435), 'time.sleep', 'time.sleep', (['(delay / 1000.0)'], {}), '(delay / 1000.0)\n', (419, 435), False, 'import time\n'), ((2678, 2702), 'LedAnimation.Animation.__init__', 'Animation.__init__', (['self'], {}), '(self)\n', (2696, 2702), False, 'from LedAnimation import Animation, KeyFrame\n'), ((841, 898), 'LedAn... |
import pygame, sys, math
class Wall():
def __init__(self, pos=[0,0], size=None):
self.image = pygame.image.load("Resources/Cheese/frontend-large.png")
if size:
self.image = pygame.transform.scale(self.image, [size,size])
self.rect = self.image.get_rect(center = pos)
... | [
"pygame.image.load",
"pygame.transform.scale"
] | [((107, 163), 'pygame.image.load', 'pygame.image.load', (['"""Resources/Cheese/frontend-large.png"""'], {}), "('Resources/Cheese/frontend-large.png')\n", (124, 163), False, 'import pygame, sys, math\n'), ((207, 255), 'pygame.transform.scale', 'pygame.transform.scale', (['self.image', '[size, size]'], {}), '(self.image,... |
# -*- coding: utf-8 -*-
import pyspark
from pyspark.sql import SparkSession
spark = SparkSession.builder.appName('lit').getOrCreate()
data = [("111",50000),("222",60000),("333",40000)]
columns= ["EmpId","Salary"]
df = spark.createDataFrame(data = data, schema = columns)
df.printSchema()
df.show(truncate=False)
from... | [
"pyspark.sql.functions.lit",
"pyspark.sql.functions.col",
"pyspark.sql.SparkSession.builder.appName"
] | [((374, 386), 'pyspark.sql.functions.col', 'col', (['"""EmpId"""'], {}), "('EmpId')\n", (377, 386), False, 'from pyspark.sql.functions import col, lit\n'), ((387, 400), 'pyspark.sql.functions.col', 'col', (['"""Salary"""'], {}), "('Salary')\n", (390, 400), False, 'from pyspark.sql.functions import col, lit\n'), ((87, 1... |
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
#Run Cell
x = np.linspace(0, 20, 100)
plt.plot(x, np.sin(x))
plt.show() | [
"numpy.sin",
"numpy.linspace",
"matplotlib.pyplot.show"
] | [((91, 114), 'numpy.linspace', 'np.linspace', (['(0)', '(20)', '(100)'], {}), '(0, 20, 100)\n', (102, 114), True, 'import numpy as np\n'), ((138, 148), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (146, 148), True, 'import matplotlib.pyplot as plt\n'), ((127, 136), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n'... |
import unittest
import pytest
from django.test import override_settings
from channels import DEFAULT_CHANNEL_LAYER
from channels.exceptions import InvalidChannelLayerError
from channels.layers import InMemoryChannelLayer, channel_layers, get_channel_layer
class TestChannelLayerManager(unittest.TestCase):
@overr... | [
"django.test.override_settings",
"channels.layers.get_channel_layer",
"channels.layers.InMemoryChannelLayer",
"channels.layers.channel_layers.make_test_backend"
] | [((315, 417), 'django.test.override_settings', 'override_settings', ([], {'CHANNEL_LAYERS': "{'default': {'BACKEND': 'channels.layers.InMemoryChannelLayer'}}"}), "(CHANNEL_LAYERS={'default': {'BACKEND':\n 'channels.layers.InMemoryChannelLayer'}})\n", (332, 417), False, 'from django.test import override_settings\n'),... |
import copy, cctk, argparse, sys, re
import numpy as np
# usage: python generate_conformations.py molecule.gjf molecule
parser = argparse.ArgumentParser(prog="generate_conformations.py")
parser.add_argument("--procs", "-p", type=int, default=16, help="Number of processors to use.")
parser.add_argument('-c', '--constr... | [
"re.sub",
"cctk.GaussianFile.read_file",
"argparse.ArgumentParser"
] | [((131, 188), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""generate_conformations.py"""'}), "(prog='generate_conformations.py')\n", (154, 188), False, 'import copy, cctk, argparse, sys, re\n'), ((934, 975), 're.sub', 're.sub', (['""".gjf$"""', '""""""', "args['new_filename']"], {}), "('.gjf$'... |
import os
import os.path as osp
import random
import sys
import cv2
from data import VOC_CLASSES, VOCAnnotationTransform
if sys.version_info[0] == 2:
import xml.etree.cElementTree as ET
else:
import xml.etree.ElementTree as ET
def main():
# voc ids
voc_root = '../Datasets/VOC/data/VOCdevkit/'
s... | [
"cv2.imwrite",
"random.choice",
"xml.etree.ElementTree.parse",
"random.shuffle",
"os.makedirs",
"os.path.join",
"data.VOCAnnotationTransform",
"cv2.imread"
] | [((1660, 1684), 'data.VOCAnnotationTransform', 'VOCAnnotationTransform', ([], {}), '()\n', (1682, 1684), False, 'from data import VOC_CLASSES, VOCAnnotationTransform\n'), ((697, 736), 'os.path.join', 'osp.join', (['"""%s"""', '"""Annotations"""', '"""%s.xml"""'], {}), "('%s', 'Annotations', '%s.xml')\n", (705, 736), Tr... |
from PIL import Image
image = Image.open('landscape.jpg')
print(image.filename)
print(image.format)
print(image.size)
print(image.height)
print(image.width)
print(image.mode) # pixel format
for k,v in image.info.items():
print(k,v)
# convert from one format to another
outfile = 'landscape.png'
image.save(outfil... | [
"PIL.Image.open"
] | [((31, 58), 'PIL.Image.open', 'Image.open', (['"""landscape.jpg"""'], {}), "('landscape.jpg')\n", (41, 58), False, 'from PIL import Image\n'), ((335, 354), 'PIL.Image.open', 'Image.open', (['outfile'], {}), '(outfile)\n', (345, 354), False, 'from PIL import Image\n')] |
from fact.io import read_h5py
from aict_tools.io import append_column_to_hdf5
import h5py
from astropy.time import Time
from astropy.coordinates import SkyCoord, AltAz, EarthLocation
import astropy.units as u
import click
from ctapipe.coordinates import CameraFrame
from astropy.coordinates.erfa_astrom import erfa_astr... | [
"h5py.File",
"astropy.coordinates.AltAz",
"astropy.time.Time",
"astropy.coordinates.erfa_astrom.ErfaAstromInterpolator",
"click.Path",
"astropy.coordinates.EarthLocation.from_geodetic",
"click.command",
"fact.io.read_h5py",
"ctapipe.coordinates.CameraFrame",
"astropy.units.Quantity",
"aict_tools... | [((412, 488), 'astropy.coordinates.EarthLocation.from_geodetic', 'EarthLocation.from_geodetic', (['(-17.89139 * u.deg)', '(28.76139 * u.deg)', '(2184 * u.m)'], {}), '(-17.89139 * u.deg, 28.76139 * u.deg, 2184 * u.m)\n', (439, 488), False, 'from astropy.coordinates import SkyCoord, AltAz, EarthLocation\n'), ((711, 726),... |
#!/usr/bin/python3
import sys
import binascii
import TemporaryExposureKeyExport_pb2
f = open("export.bin", "rb")
g = TemporaryExposureKeyExport_pb2.TemporaryExposureKeyExport()
header = f.read(16)
print("header:"+str(header))
g.ParseFromString(f.read())
f.close()
print("file timestamps: start "+str(g.start_timestamp)+... | [
"binascii.hexlify",
"TemporaryExposureKeyExport_pb2.TemporaryExposureKeyExport"
] | [((118, 177), 'TemporaryExposureKeyExport_pb2.TemporaryExposureKeyExport', 'TemporaryExposureKeyExport_pb2.TemporaryExposureKeyExport', ([], {}), '()\n', (175, 177), False, 'import TemporaryExposureKeyExport_pb2\n'), ((541, 571), 'binascii.hexlify', 'binascii.hexlify', (['key.key_data'], {}), '(key.key_data)\n', (557, ... |
import logging
import re
from bs4 import BeautifulSoup
from ..const import EMAIL_ATTR_FROM, EMAIL_ATTR_BODY
_LOGGER = logging.getLogger(__name__)
EMAIL_ADDRESS = 'luzernsolutions'
ATTR_HUE = 'hue'
def parse_hue(email):
"""Parse Phillips Hue tracking numbers."""
tracking_numbers = []
email_from = email... | [
"logging.getLogger",
"re.findall"
] | [((121, 148), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (138, 148), False, 'import logging\n'), ((564, 610), 're.findall', 're.findall', (['"""tracking number is: (.*?)<"""', 'body'], {}), "('tracking number is: (.*?)<', body)\n", (574, 610), False, 'import re\n')] |
from gym.envs.registration import register
register(
id='Witches_multi-v2',
entry_point='gym_witches_multiv2.envs:WitchesEnvMulti',
)
| [
"gym.envs.registration.register"
] | [((44, 136), 'gym.envs.registration.register', 'register', ([], {'id': '"""Witches_multi-v2"""', 'entry_point': '"""gym_witches_multiv2.envs:WitchesEnvMulti"""'}), "(id='Witches_multi-v2', entry_point=\n 'gym_witches_multiv2.envs:WitchesEnvMulti')\n", (52, 136), False, 'from gym.envs.registration import register\n')... |
import math
import numpy as np
import tvm
from tvm.tir import IterVar
from .hw_abs_dag import construct_dag
from itertools import permutations, product
from functools import reduce
from . import _ffi_api
####################################################
# schedule parameter functions
##############################... | [
"math.ceil",
"functools.reduce",
"itertools.product",
"math.sqrt",
"numpy.max"
] | [((427, 443), 'math.sqrt', 'math.sqrt', (['value'], {}), '(value)\n', (436, 443), False, 'import math\n'), ((3913, 3977), 'functools.reduce', 'reduce', (['(lambda x, y: x + y)', '[nodes[x] for x in output_names]', '[]'], {}), '(lambda x, y: x + y, [nodes[x] for x in output_names], [])\n', (3919, 3977), False, 'from fun... |
###############################################################################
# Script : tweet.py
# Description : Python Class to manage tweets
# Author : <NAME> (<EMAIL>)
# Date : 04/12/2020
# Version : 1.0
##########################################################################... | [
"json.load",
"codecs.open",
"random.randint"
] | [((976, 997), 'random.randint', 'random.randint', (['(0)', '(99)'], {}), '(0, 99)\n', (990, 997), False, 'import random\n'), ((768, 809), 'codecs.open', 'codecs.open', (['self.inputFile', '"""r"""', '"""UTF-8"""'], {}), "(self.inputFile, 'r', 'UTF-8')\n", (779, 809), False, 'import codecs\n'), ((833, 845), 'json.load',... |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is govered by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""Tests for the testing_helpers module."""
import unittest
from testing import testing_helper... | [
"testing.testing_helpers.MakeMonorailRequest",
"testing.testing_helpers.Blank",
"testing.testing_helpers.GetRequestObjects"
] | [((416, 492), 'testing.testing_helpers.MakeMonorailRequest', 'testing_helpers.MakeMonorailRequest', ([], {'path': '"""/foo?key1=2&key2=a%20string&key3"""'}), "(path='/foo?key1=2&key2=a%20string&key3')\n", (451, 492), False, 'from testing import testing_helpers\n'), ((892, 995), 'testing.testing_helpers.GetRequestObject... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Import
import os
from genenetweaver.gene_net_weaver import GeneNetWeaver
import numpy as np
import argparse
def argument_parser():
parser = argparse.ArgumentParser(
description='Run GeneNetWeaver (GNW) to simulate gene expression data '
... | [
"os.path.exists",
"argparse.ArgumentParser",
"os.makedirs",
"genenetweaver.gene_net_weaver.GeneNetWeaver",
"os.path.abspath"
] | [((197, 395), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run GeneNetWeaver (GNW) to simulate gene expression data from which gene regulatory networks can be inferred. Please provide the following arguments:"""'}), "(description=\n 'Run GeneNetWeaver (GNW) to simulate gene expressi... |
# (C) Copyright 1996- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernment... | [
"numpy.load",
"matplotlib.pyplot.savefig",
"cartopy.crs.PlateCarree"
] | [((794, 818), 'matplotlib.pyplot.savefig', 'plt.savefig', (['sys.argv[2]'], {}), '(sys.argv[2])\n', (805, 818), True, 'import matplotlib.pyplot as plt\n'), ((860, 880), 'numpy.load', 'np.load', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (867, 880), True, 'import numpy as np\n'), ((625, 643), 'cartopy.crs.PlateCarree', '... |
"""examples.basic_usage.generic_driver"""
from scrapli.driver import GenericDriver
MY_DEVICE = {
"host": "172.18.0.11",
"auth_username": "scrapli",
"auth_password": "<PASSWORD>",
"auth_strict_key": False,
}
def main():
"""Simple example of connecting to an IOSXEDevice with the GenericDriver"""
... | [
"scrapli.driver.GenericDriver"
] | [((450, 476), 'scrapli.driver.GenericDriver', 'GenericDriver', ([], {}), '(**MY_DEVICE)\n', (463, 476), False, 'from scrapli.driver import GenericDriver\n'), ((877, 903), 'scrapli.driver.GenericDriver', 'GenericDriver', ([], {}), '(**MY_DEVICE)\n', (890, 903), False, 'from scrapli.driver import GenericDriver\n')] |
import time
import numpy
from ..Instruments import EG_G_7265
#from ..Instruments import SRS_SR830
from ..UserInterfaces.Loggers import NullLogger
class VSMController2(object):
#Controlador y sensor del VSM
def __init__(self, Logger = None):
self.LockIn = EG_G_7265(RemoteOnly = False)
... | [
"numpy.abs",
"time.sleep",
"numpy.append",
"numpy.array",
"numpy.zeros"
] | [((1316, 1330), 'time.sleep', 'time.sleep', (['(15)'], {}), '(15)\n', (1326, 1330), False, 'import time\n'), ((1575, 1588), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (1585, 1588), False, 'import time\n'), ((1864, 1878), 'numpy.zeros', 'numpy.zeros', (['n'], {}), '(n)\n', (1875, 1878), False, 'import numpy\n')... |
from typing import Dict
import numpy as np
import torch
import torch.nn.functional as F
from detectron2.modeling import build_backbone
from detectron2.utils.registry import Registry
from detr.models.backbone import Joiner
from detr.models.position_encoding import PositionEmbeddingSine
from detr.util.misc import Nested... | [
"detr.models.position_encoding.PositionEmbeddingSine",
"detectron2.modeling.build_backbone",
"detectron2.utils.registry.Registry",
"detr.util.misc.NestedTensor",
"torch.nn.Module.__init__"
] | [((371, 393), 'detectron2.utils.registry.Registry', 'Registry', (['"""DETR_MODEL"""'], {}), "('DETR_MODEL')\n", (379, 393), False, 'from detectron2.utils.registry import Registry\n'), ((933, 1021), 'detr.models.position_encoding.PositionEmbeddingSine', 'PositionEmbeddingSine', (['N_steps'], {'normalize': '(True)', 'cen... |
import logging
import environ
import json
from selenium import webdriver
from django.apps import AppConfig
from django.core.files.storage import get_storage_class
from sitecomber.apps.shared.interfaces import BaseSiteTest
from .utils.screenshots import generateLatestScreenshot, generateHistoricalScreenshots
logger... | [
"logging.getLogger",
"environ.Path",
"json.dumps",
"django.core.files.storage.get_storage_class",
"environ.Env",
"sitecomber.apps.results.models.PageTestResult.objects.get_or_create"
] | [((323, 350), 'logging.getLogger', 'logging.getLogger', (['"""django"""'], {}), "('django')\n", (340, 350), False, 'import logging\n'), ((430, 443), 'environ.Env', 'environ.Env', ([], {}), '()\n', (441, 443), False, 'import environ\n'), ((397, 419), 'environ.Path', 'environ.Path', (['__file__'], {}), '(__file__)\n', (4... |
from gusto import *
from firedrake import (IcosahedralSphereMesh, cos, sin,
SpatialCoordinate, FunctionSpace)
import sys
dt = 900.
day = 24.*60.*60.
if '--running-tests' in sys.argv:
tmax = dt
else:
tmax = 14*day
refinements = 4 # number of horizontal cells = 20*(4^refinements)
R = 63... | [
"firedrake.FunctionSpace",
"firedrake.SpatialCoordinate",
"firedrake.sin",
"firedrake.cos",
"firedrake.IcosahedralSphereMesh"
] | [((345, 406), 'firedrake.IcosahedralSphereMesh', 'IcosahedralSphereMesh', ([], {'radius': 'R', 'refinement_level': 'refinements'}), '(radius=R, refinement_level=refinements)\n', (366, 406), False, 'from firedrake import IcosahedralSphereMesh, cos, sin, SpatialCoordinate, FunctionSpace\n'), ((440, 463), 'firedrake.Spati... |
# Generated by Django 3.2.6 on 2021-09-02 04:02
from django.db import migrations, models
import users.models
class Migration(migrations.Migration):
dependencies = [
('users', '0004_auto_20210822_1749'),
]
operations = [
migrations.AlterField(
model_name='invitation',
... | [
"django.db.models.DateTimeField"
] | [((364, 436), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'default': 'users.models.get_default_invitation_expiry'}), '(default=users.models.get_default_invitation_expiry)\n', (384, 436), False, 'from django.db import migrations, models\n')] |
from collections import defaultdict
class Graph:
def __init__(self,graph):
self.graph = graph # residual graph
self. ROW = len(graph)
def BFS(self,s, t, parent):
# Mark all the vertices as not visited
visited =[False]*(self.ROW)
queue=[]
... | [
"timeit.default_timer",
"numpy.loadtxt"
] | [((1588, 1610), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (1608, 1610), False, 'import timeit\n'), ((1664, 1686), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (1684, 1686), False, 'import timeit\n'), ((1490, 1513), 'numpy.loadtxt', 'np.loadtxt', (['"""file1.txt"""'], {}), "(... |
import json
from flask import Blueprint, request
from utils.sink import sink_data
data_sink = Blueprint("data-sink", __name__)
@data_sink.route("/", methods=["POST"])
def index():
try:
data = json.loads(request.data)
if not ("key" in data and "message" in data):
raise Exception()
... | [
"json.loads",
"flask.Blueprint",
"utils.sink.sink_data"
] | [((97, 129), 'flask.Blueprint', 'Blueprint', (['"""data-sink"""', '__name__'], {}), "('data-sink', __name__)\n", (106, 129), False, 'from flask import Blueprint, request\n'), ((209, 233), 'json.loads', 'json.loads', (['request.data'], {}), '(request.data)\n', (219, 233), False, 'import json\n'), ((384, 423), 'utils.sin... |
from zipreport import ZipReportCli
from zipreport.processors.zipreport import ZipReportClient, ZipReportProcessor
from zipreport.report import ReportFileLoader, ReportJob
from zipreport.template import JinjaRender
def generate_pdf_server(report:str, data: dict, output_file:str) -> bool:
zpt = ReportFileLoader.loa... | [
"zipreport.processors.zipreport.ZipReportClient",
"zipreport.report.ReportJob",
"zipreport.report.ReportFileLoader.load",
"zipreport.processors.zipreport.ZipReportProcessor",
"zipreport.template.JinjaRender",
"zipreport.ZipReportCli"
] | [((300, 329), 'zipreport.report.ReportFileLoader.load', 'ReportFileLoader.load', (['report'], {}), '(report)\n', (321, 329), False, 'from zipreport.report import ReportFileLoader, ReportJob\n'), ((433, 447), 'zipreport.report.ReportJob', 'ReportJob', (['zpt'], {}), '(zpt)\n', (442, 447), False, 'from zipreport.report i... |
import os
from timemachines.skaters.localskaters import local_skater_from_name
from timemachines.skating import prior
import numpy as np
if __name__=='__main__':
from timemachines.skaters.sk.skinclusion import using_sktime
assert using_sktime
skater_name = __file__.split(os.path.sep)[-1].replace('test_skat... | [
"timemachines.skating.prior",
"numpy.random.randn",
"timemachines.skaters.localskaters.local_skater_from_name"
] | [((380, 415), 'timemachines.skaters.localskaters.local_skater_from_name', 'local_skater_from_name', (['skater_name'], {}), '(skater_name)\n', (402, 415), False, 'from timemachines.skaters.localskaters import local_skater_from_name\n'), ((449, 469), 'numpy.random.randn', 'np.random.randn', (['(100)'], {}), '(100)\n', (4... |
from typing import List, Union, Optional, Sequence
import multiprocessing as mp
from pathlib import Path
import functools
import copy
from itertools import product
import sys
import matplotlib.pyplot as plt
sys.path.append('.')
from shapely.geometry import MultiPoint, Polygon, Point, MultiPolygon, box
from shapely.aff... | [
"shapely.geometry.box",
"multiprocessing.cpu_count",
"shapely.geometry.Point",
"shapely.geometry.Polygon",
"copy.deepcopy",
"sys.path.append",
"hybrid.layout.shadow_flicker.get_sun_pos",
"pathlib.Path",
"itertools.product",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.subplots",
"matplotlib.py... | [((207, 227), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (222, 227), False, 'import sys\n'), ((715, 729), 'multiprocessing.cpu_count', 'mp.cpu_count', ([], {}), '()\n', (727, 729), True, 'import multiprocessing as mp\n'), ((805, 834), 'itertools.product', 'product', (['lat_range', 'lon_range'],... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 14 14:29:29 2021
@author: surajitrana
"""
import matplotlib.pyplot as plt
import numpy as np
def plot_piechart():
dataset = np.array([20, 25, 10, 15, 30])
chart_lables = np.array(["Audi", "Mercedez", "BMW", "Tesla", "Volvo"])
chart_ex... | [
"numpy.array",
"matplotlib.pyplot.pie",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((202, 232), 'numpy.array', 'np.array', (['[20, 25, 10, 15, 30]'], {}), '([20, 25, 10, 15, 30])\n', (210, 232), True, 'import numpy as np\n'), ((252, 307), 'numpy.array', 'np.array', (["['Audi', 'Mercedez', 'BMW', 'Tesla', 'Volvo']"], {}), "(['Audi', 'Mercedez', 'BMW', 'Tesla', 'Volvo'])\n", (260, 307), True, 'import ... |
# -*- coding: utf-8 -*-
"""Scrapping facebook.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1E-mqgZWvaVyJvrwWYyW_n1po9er4rbMq
"""
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import bs4
from pprint import pprin... | [
"bs4.BeautifulSoup",
"selenium.webdriver.Chrome",
"selenium.webdriver.ChromeOptions",
"json.dumps"
] | [((377, 402), 'selenium.webdriver.ChromeOptions', 'webdriver.ChromeOptions', ([], {}), '()\n', (400, 402), False, 'from selenium import webdriver\n'), ((593, 649), 'selenium.webdriver.Chrome', 'webdriver.Chrome', (['"""chromedriver"""'], {'options': 'chrome_options'}), "('chromedriver', options=chrome_options)\n", (609... |
from setuptools import setup, find_packages
__version__ = "0.1.2"
install_requires = ['multipledispatch']
tests_require = ['pytest', 'pytest-cov']
setup_requires = ['pytest-runner', 'multipledispatch']
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="py_hcl",
version=__version... | [
"setuptools.find_packages"
] | [((698, 713), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (711, 713), False, 'from setuptools import setup, find_packages\n')] |
"""Module for storing and loading to excel."""
import string
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
import pandas as pd
def save_sheet(df_to_save: pd.DataFrame, path: Path, sheet_name: str) -> None:
"""Store a dateframe to a sheet.
Args:
df_to_save (pd.DataFram... | [
"pandas.ExcelWriter"
] | [((515, 591), 'pandas.ExcelWriter', 'pd.ExcelWriter', (['path'], {'engine': '"""openpyxl"""', 'mode': '"""a"""', 'if_sheet_exists': '"""replace"""'}), "(path, engine='openpyxl', mode='a', if_sheet_exists='replace')\n", (529, 591), True, 'import pandas as pd\n')] |
#!/bin/python2
# server side revershell script
import socket
def main():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("192.168.1.9", 8208))
s.listen(1)
print('[X] Listening')
# Setting up
conn,addr=s.accept()
while True:
cmd = bytes(input('shell>'), "utf-8")
... | [
"socket.socket"
] | [((81, 130), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (94, 130), False, 'import socket\n')] |
from minpiler.std import Const, M, inline
class A(Const):
a = 1
b = 2
@inline
def f(a: int):
M.print(a)
f(A.a)
f(A.b)
# > print 1
# > print 2
| [
"minpiler.std.M.print"
] | [((109, 119), 'minpiler.std.M.print', 'M.print', (['a'], {}), '(a)\n', (116, 119), False, 'from minpiler.std import Const, M, inline\n')] |
import durationpy
import validators
import yaml
class Config(object):
def __init__(self, path):
with open(path, "r") as f:
try:
loader = yaml.FullLoader
except AttributeError:
loader = yaml.Loader
data = yaml.load(f, Loader=loader)
... | [
"validators.url",
"durationpy.from_str",
"yaml.load"
] | [((286, 313), 'yaml.load', 'yaml.load', (['f'], {'Loader': 'loader'}), '(f, Loader=loader)\n', (295, 313), False, 'import yaml\n'), ((939, 956), 'validators.url', 'validators.url', (['v'], {}), '(v)\n', (953, 956), False, 'import validators\n'), ((1214, 1236), 'durationpy.from_str', 'durationpy.from_str', (['v'], {}), ... |
'''
Thermodynamic helper functions.
'''
from __future__ import division, print_function, absolute_import
import numpy as np
# Saturation vapor pressure from the Clausius-Clapeyron relation.
# --> assumes L is constant with temperature!
def get_satvps(T,T0,e0,Rv,Lv):
return e0*np.exp(-(Lv/Rv)*(1./T - 1./T0))
# -... | [
"numpy.exp"
] | [((283, 324), 'numpy.exp', 'np.exp', (['(-(Lv / Rv) * (1.0 / T - 1.0 / T0))'], {}), '(-(Lv / Rv) * (1.0 / T - 1.0 / T0))\n', (289, 324), True, 'import numpy as np\n')] |
from model.group import Group
from sys import maxsize
def test_create_empty_group(app):
app.group.open_group_page()
old_groups = app.group.get_group_list()
group = Group(name="", header="", footer="")
app.group.create(Group(name="", header="", footer=""))
new_groups = app.group.get_group_list()
... | [
"model.group.Group"
] | [((179, 215), 'model.group.Group', 'Group', ([], {'name': '""""""', 'header': '""""""', 'footer': '""""""'}), "(name='', header='', footer='')\n", (184, 215), False, 'from model.group import Group\n'), ((605, 660), 'model.group.Group', 'Group', ([], {'name': '"""<NAME>"""', 'header': '"""logo"""', 'footer': '"""comment... |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import... | [
"OpenGL.platform.types",
"OpenGL.constant.Constant",
"OpenGL.platform.createFunction"
] | [((537, 574), 'OpenGL.constant.Constant', '_C', (['"""GL_D3D12_FENCE_VALUE_EXT"""', '(38293)'], {}), "('GL_D3D12_FENCE_VALUE_EXT', 38293)\n", (539, 574), True, 'from OpenGL.constant import Constant as _C\n'), ((595, 626), 'OpenGL.constant.Constant', '_C', (['"""GL_DEVICE_LUID_EXT"""', '(38297)'], {}), "('GL_DEVICE_LUID... |
import json
import os
import sys
import albumentations as A
import numpy as np
import pandas as pd
import timm
import torch
import ttach as tta
from albumentations.augmentations.geometric.resize import Resize
from sklearn.model_selection import train_test_split
from torch.utils.data import DataLoader
from tqdm import ... | [
"missed_planes.dataset.PlanesDataset",
"pandas.read_csv",
"torch.load",
"os.path.join",
"numpy.array",
"albumentations.Resize",
"torch.utils.data.DataLoader",
"json.load",
"torch.no_grad",
"ttach.aliases.d4_transform"
] | [((655, 686), 'pandas.read_csv', 'pd.read_csv', (["config['test_csv']"], {}), "(config['test_csv'])\n", (666, 686), True, 'import pandas as pd\n'), ((703, 796), 'missed_planes.dataset.PlanesDataset', 'PlanesDataset', (['test_data'], {'path': "config['test_path']", 'is_test': '(True)', 'augmentation': 'transforms'}), "(... |
import pytest
@pytest.fixture()
def login(request):
name = request.param
print(f"== 账号是:{name} ==")
return name
data = ["pyy1", "polo"]
ids = [f"login_test_name is:{name}" for name in data]
# 添加 indirect=True 参数是为了把 login 当成一个函数去执行,而不是一个参数,并且将data当做参数传入函数
@pytest.mark.parametrize("login", data, ids=... | [
"pytest.fixture",
"pytest.mark.parametrize"
] | [((17, 33), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (31, 33), False, 'import pytest\n'), ((277, 339), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""login"""', 'data'], {'ids': 'ids', 'indirect': '(True)'}), "('login', data, ids=ids, indirect=True)\n", (300, 339), False, 'import pytest\n'), (... |
# Generated by Django 2.2.4 on 2019-10-10 20:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ial', '0013_auto_20191010_2006'),
]
operations = [
migrations.RenameField(
model_name='identityassuranceleveldocumentation',
... | [
"django.db.migrations.RemoveField",
"django.db.migrations.RenameField"
] | [((223, 399), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""identityassuranceleveldocumentation"""', 'old_name': '"""id_document_date_of_date_of_expiry"""', 'new_name': '"""id_document_issuer_date_of_issuance"""'}), "(model_name='identityassuranceleveldocumentation',\n old_nam... |
#!/usr/bin/python3
import troposphere.elasticloadbalancing as elb
from amazonia.classes.asg import Asg
from amazonia.classes.asg_config import AsgConfig
from amazonia.classes.block_devices_config import BlockDevicesConfig
from network_setup import get_network_config
def main():
network_config, template = get_net... | [
"amazonia.classes.asg.Asg",
"amazonia.classes.block_devices_config.BlockDevicesConfig",
"troposphere.elasticloadbalancing.HealthCheck",
"troposphere.elasticloadbalancing.Listener",
"amazonia.classes.asg_config.AsgConfig",
"network_setup.get_network_config"
] | [((313, 333), 'network_setup.get_network_config', 'get_network_config', ([], {}), '()\n', (331, 333), False, 'from network_setup import get_network_config\n'), ((2842, 3176), 'amazonia.classes.asg_config.AsgConfig', 'AsgConfig', ([], {'image_id': '"""ami-dc361ebf"""', 'instance_type': '"""t2.nano"""', 'minsize': '(1)',... |
"""Base class for patching time and I/O modules."""
import sys
import inspect
class BasePatcher(object):
"""Base class for patching time and I/O modules."""
# These modules will not be patched by default, unless explicitly specified
# in `modules_to_patch`.
# This is done to prevent time-travel from... | [
"inspect.ismodule",
"sys.modules.items"
] | [((3633, 3652), 'sys.modules.items', 'sys.modules.items', ([], {}), '()\n', (3650, 3652), False, 'import sys\n'), ((3673, 3697), 'inspect.ismodule', 'inspect.ismodule', (['module'], {}), '(module)\n', (3689, 3697), False, 'import inspect\n')] |
import torch
import torch.nn as nn
from collections import OrderedDict
import numpy as np
from .. import util
class LinearBlock(nn.Module):
def __init__(self, linear_dim, output_dim, init_type='std'):
super().__init__()
modules = []
for i in range(8):
if i == 0:
... | [
"matplotlib.pyplot.imshow",
"collections.OrderedDict",
"torch.nn.LeakyReLU",
"torch.nn.ModuleList",
"matplotlib.pyplot.colorbar",
"torch.nn.Conv2d",
"torch.nn.InstanceNorm2d",
"matplotlib.pyplot.figure",
"torch.nn.Upsample",
"torch.nn.Linear",
"torch.zeros",
"numpy.log2",
"torch.Size",
"to... | [((1197, 1232), 'torch.nn.Linear', 'nn.Linear', (['latent_dim', '(channels * 2)'], {}), '(latent_dim, channels * 2)\n', (1206, 1232), True, 'import torch.nn as nn\n'), ((2153, 2213), 'torch.nn.Conv2d', 'nn.Conv2d', (['channels', 'channels'], {'kernel_size': '(3, 3)', 'padding': '(0)'}), '(channels, channels, kernel_siz... |
# Input Optimization Algorithm
# ReverseLearning, 2017
# Import dependencies
import tensorflow as tf
import numpy as np
from time import time
import pandas
# Suppress warnings
from warnings import filterwarnings
filterwarnings("ignore")
class IOA:
def __init__(self, model, ins, tensorBoardPath = None):
#... | [
"tensorflow.div",
"pandas.read_csv",
"tensorflow.reduce_sum",
"tensorflow.multiply",
"tensorflow.cast",
"tensorflow.log",
"tensorflow.pow",
"tensorflow.Session",
"tensorflow.nn.sigmoid",
"tensorflow.square",
"pandas.DataFrame",
"tensorflow.summary.scalar",
"tensorflow.is_inf",
"tensorflow.... | [((214, 238), 'warnings.filterwarnings', 'filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (228, 238), False, 'from warnings import filterwarnings\n'), ((20992, 21017), 'pandas.DataFrame', 'pandas.DataFrame', (['digests'], {}), '(digests)\n', (21008, 21017), False, 'import pandas\n'), ((21091, 21126), 'pandas.r... |
from os import listdir
import json
import numpy as np
DATA_DIR="quickdraw_data_reduced"
def parse_line(ndjson_line):
"""Parse an ndjson line and return ink (as np array) and classname."""
sample = json.loads(ndjson_line)
class_name = sample["word"]
if not class_name:
print ("Empty classname")
return N... | [
"json.loads",
"os.listdir",
"numpy.max",
"numpy.zeros",
"numpy.min",
"numpy.save"
] | [((1620, 1639), 'numpy.save', 'np.save', (['"""X.npy"""', 'X'], {}), "('X.npy', X)\n", (1627, 1639), True, 'import numpy as np\n'), ((1640, 1659), 'numpy.save', 'np.save', (['"""Y.npy"""', 'Y'], {}), "('Y.npy', Y)\n", (1647, 1659), True, 'import numpy as np\n'), ((203, 226), 'json.loads', 'json.loads', (['ndjson_line']... |
import random
usu = int(input('Digite um número entre 0 e 5:'))
lista = [0, 1, 2, 3, 4, 5]
escolha = random.choice(lista)
print('O número escolhido pelo computador foi {}'.format(escolha))
if usu == escolha:
print('Você ganhou, parabéns!')
else:
print('O computador ganhou')
| [
"random.choice"
] | [((101, 121), 'random.choice', 'random.choice', (['lista'], {}), '(lista)\n', (114, 121), False, 'import random\n')] |
""" This script execute the MSSQL Instance backup and database restore scenario. """
## The script can be run with Python 3.6 or higher version.
## The script requires 'requests' library to make the API calls.
## The library can be installed using the command: pip install requests.
import argparse
import common
impo... | [
"time.sleep",
"common.protection_plan_backupnow",
"workload_mssql.add_mssql_credential",
"workload_mssql.create_mssql_protection_plan",
"workload_mssql.remove_mssql_credential",
"argparse.ArgumentParser",
"workload_mssql.mssql_instance_deepdiscovery",
"workload_mssql.create_and_register_mssql_instance... | [((360, 455), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""MSSQL Instance backup and Database restore scenario"""'}), "(description=\n 'MSSQL Instance backup and Database restore scenario')\n", (383, 455), False, 'import argparse\n'), ((2258, 2326), 'common.get_nbu_base_url', 'commo... |
from .views.search import search_views
from os import walk
class SearchManager:
def __init__(self, app):
self.bp = search_views(self, app.socketio)
self.appmoduleslist = app.appmodules
def get_name(self):
return "search_manager"
def get_blueprint(self):
return self.bp
... | [
"os.walk"
] | [((421, 436), 'os.walk', 'walk', (['querypath'], {}), '(querypath)\n', (425, 436), False, 'from os import walk\n')] |
"""
Galaxy sql view models
"""
from sqlalchemy import Integer, MetaData
from sqlalchemy.orm import mapper
from sqlalchemy.sql import column, text
from sqlalchemy_utils import create_view
from .utils import View
metadata = MetaData()
class HistoryDatasetCollectionJobStateSummary(View):
__view__ = text("""
... | [
"sqlalchemy_utils.create_view",
"sqlalchemy.sql.text",
"sqlalchemy.orm.mapper",
"sqlalchemy.sql.column",
"sqlalchemy.MetaData"
] | [((224, 234), 'sqlalchemy.MetaData', 'MetaData', ([], {}), '()\n', (232, 234), False, 'from sqlalchemy import Integer, MetaData\n'), ((2326, 2428), 'sqlalchemy.orm.mapper', 'mapper', (['HistoryDatasetCollectionJobStateSummary', 'HistoryDatasetCollectionJobStateSummary.__table__'], {}), '(HistoryDatasetCollectionJobStat... |
# Collection of preprocessing functions
from nltk.tokenize import word_tokenize
from transformers import CamembertTokenizer
from transformers import BertTokenizer
from tqdm import tqdm
import numpy as np
import pandas as pd
import re
import string
import unicodedata
import tensorflow as tf
import glob
i... | [
"re.escape",
"pandas.read_csv",
"tensorflow.io.read_file",
"tensorflow.cast",
"os.remove",
"tensorflow.data.Dataset.from_tensor_slices",
"numpy.asarray",
"unicodedata.normalize",
"pandas.DataFrame",
"glob.glob",
"numpy.squeeze",
"tensorflow.io.decode_jpeg",
"re.sub",
"tensorflow.image.resi... | [((502, 563), 'transformers.BertTokenizer.from_pretrained', 'BertTokenizer.from_pretrained', (['model_bert'], {'do_lowercase': '(False)'}), '(model_bert, do_lowercase=False)\n', (531, 563), False, 'from transformers import BertTokenizer\n'), ((581, 652), 'transformers.CamembertTokenizer.from_pretrained', 'CamembertToke... |
#!/usr/bin/env python3.7
import sys
from ton import get_last_tx_hash
tx_hash = get_last_tx_hash(sys.argv[1], sys.argv[2])
if tx_hash == False:
print("error")
else:
print(tx_hash)
| [
"ton.get_last_tx_hash"
] | [((80, 122), 'ton.get_last_tx_hash', 'get_last_tx_hash', (['sys.argv[1]', 'sys.argv[2]'], {}), '(sys.argv[1], sys.argv[2])\n', (96, 122), False, 'from ton import get_last_tx_hash\n')] |
import argparse
import asyncio
import logging
import math
import os
import cv2
import numpy
from aiortc import RTCPeerConnection
from aiortc.mediastreams import VideoFrame, VideoStreamTrack
from signaling import CopyAndPasteSignaling
BLUE = (255, 0, 0)
GREEN = (0, 255, 0)
RED = (0, 0, 255)
OUTPUT_PATH = os.path.joi... | [
"logging.basicConfig",
"cv2.imwrite",
"math.ceil",
"signaling.CopyAndPasteSignaling",
"argparse.ArgumentParser",
"numpy.hstack",
"asyncio.gather",
"os.path.dirname",
"numpy.zeros",
"cv2.cvtColor",
"asyncio.sleep",
"numpy.frombuffer",
"asyncio.get_event_loop",
"aiortc.RTCPeerConnection"
] | [((322, 347), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (337, 347), False, 'import os\n'), ((410, 456), 'cv2.cvtColor', 'cv2.cvtColor', (['data_bgr', 'cv2.COLOR_BGR2YUV_YV12'], {}), '(data_bgr, cv2.COLOR_BGR2YUV_YV12)\n', (422, 456), False, 'import cv2\n'), ((598, 639), 'numpy.frombuffer... |
import pandas as pd
import click
import matplotlib.pyplot as plt
import seaborn as sns
@click.command()
@click.argument("features")
def main(features):
df = pd.read_csv(features)
print(df)
plt.figure()
g = sns.PairGrid(df, diag_sharey=True)
g.map_lower(sns.kdeplot, cmap="Blues_d")
g.map_upper(... | [
"click.argument",
"pandas.read_csv",
"seaborn.PairGrid",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ion",
"click.command",
"matplotlib.pyplot.show"
] | [((90, 105), 'click.command', 'click.command', ([], {}), '()\n', (103, 105), False, 'import click\n'), ((107, 133), 'click.argument', 'click.argument', (['"""features"""'], {}), "('features')\n", (121, 133), False, 'import click\n'), ((163, 184), 'pandas.read_csv', 'pd.read_csv', (['features'], {}), '(features)\n', (17... |
from distutils.core import setup
setup(name='ana', version='0.04', packages=['ana'])
| [
"distutils.core.setup"
] | [((33, 84), 'distutils.core.setup', 'setup', ([], {'name': '"""ana"""', 'version': '"""0.04"""', 'packages': "['ana']"}), "(name='ana', version='0.04', packages=['ana'])\n", (38, 84), False, 'from distutils.core import setup\n')] |
import pymongo
import datetime
import os
import numpy as np
import struct
from array import array
from pymongo import MongoClient
from mspasspy.ccore.seismic import (
Seismogram,
TimeReferenceType,
TimeSeries,
DoubleVector,
)
def find_channel(collection):
st = datetime.datetime(1990, 1, 1, 6)
... | [
"datetime.datetime",
"mspasspy.ccore.seismic.TimeSeries",
"array.array",
"numpy.random.rand",
"os.path.join",
"os.path.realpath",
"os.path.dirname",
"mspasspy.ccore.seismic.DoubleVector"
] | [((283, 315), 'datetime.datetime', 'datetime.datetime', (['(1990)', '(1)', '(1)', '(6)'], {}), '(1990, 1, 1, 6)\n', (300, 315), False, 'import datetime\n'), ((325, 357), 'datetime.datetime', 'datetime.datetime', (['(1990)', '(1)', '(4)', '(6)'], {}), '(1990, 1, 4, 6)\n', (342, 357), False, 'import datetime\n'), ((577, ... |
# Copyright 2018 University of Basel, Center for medical Image Analysis and Navigation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | [
"SimpleITK.BinaryThresholdImageFilter",
"torch.Tensor",
"SimpleITK.ResampleImageFilter",
"multiprocessing.cpu_count",
"SimpleITK.BinaryMorphologicalClosingImageFilter",
"numpy.array",
"SimpleITK.MaskImageFilter",
"SimpleITK.BinaryMorphologicalOpeningImageFilter"
] | [((730, 744), 'multiprocessing.cpu_count', 'mp.cpu_count', ([], {}), '()\n', (742, 744), True, 'import multiprocessing as mp\n'), ((3801, 3821), 'numpy.array', 'np.array', (['image.size'], {}), '(image.size)\n', (3809, 3821), True, 'import numpy as np\n'), ((4018, 4044), 'SimpleITK.ResampleImageFilter', 'sitk.ResampleI... |
import itertools
import os
import shutil
from os import path
import pytest
import pytorch_testing_utils as ptu
import torch
from torch import nn
from pystiche import data
from pystiche.image import read_image, write_image
def test_DownloadableImage_generate_file(subtests, test_image_url):
titles = (None, "girl... | [
"pystiche.image.read_image",
"pystiche.data.LocalImageCollection",
"os.path.exists",
"itertools.product",
"torch.nn.Module",
"os.mkdir",
"pystiche.data.DownloadableImage.generate_file",
"pystiche.data.LocalImage",
"os.path.splitext",
"pystiche.data.DownloadableImageCollection",
"shutil.copyfile"... | [((397, 431), 'itertools.product', 'itertools.product', (['titles', 'authors'], {}), '(titles, authors)\n', (414, 431), False, 'import itertools\n'), ((982, 1020), 'pystiche.data.DownloadableImage', 'data.DownloadableImage', (['test_image_url'], {}), '(test_image_url)\n', (1004, 1020), False, 'from pystiche import data... |
from threading import Lock
from flask import Flask, render_template, session, request, \
copy_current_request_context
from flask_socketio import SocketIO, emit, join_room, leave_room, \
close_room, rooms, disconnect
from keras.models import load_model
import tensorflow as tf
import numpy as np
from vggish_input... | [
"flask.render_template",
"wget.download",
"numpy.mean",
"vggish_input.waveform_to_examples",
"keras.models.load_model",
"pathlib.Path",
"flask.Flask",
"threading.Lock",
"numpy.argmax",
"flask_socketio.SocketIO",
"numpy.take",
"helpers.dbFS",
"numpy.fromstring",
"time.time",
"tensorflow.g... | [((680, 695), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (685, 695), False, 'from flask import Flask, render_template, session, request, copy_current_request_context\n'), ((744, 780), 'flask_socketio.SocketIO', 'SocketIO', (['app'], {'async_mode': 'async_mode'}), '(app, async_mode=async_mode)\n', (752,... |
from utils import *
import numpy as np
import h5py
import os
import pandas as pd
from PIL import Image
from tqdm import tqdm
def resize_images(image_list, im_size):
"""Resize a list of images to a given size.
Parameters
----------
image_list : list
A list of images to resize, in any format... | [
"PIL.Image.open",
"pandas.read_csv",
"tqdm.tqdm",
"os.path.join",
"h5py.File",
"numpy.array"
] | [((2489, 2546), 'pandas.read_csv', 'pd.read_csv', (["param['csv_train']"], {'names': "['label']", 'sep': '""";"""'}), "(param['csv_train'], names=['label'], sep=';')\n", (2500, 2546), True, 'import pandas as pd\n'), ((2566, 2621), 'pandas.read_csv', 'pd.read_csv', (["param['csv_val']"], {'names': "['label']", 'sep': '"... |
# -*- coding: utf-8 -*-
## Copyright 2009-2020 NTESS. Under the terms
## of Contract DE-NA0003525 with NTESS, the U.S.
## Government retains certain rights in this software.
##
## Copyright (c) 2009-2020, NTESS
## All rights reserved.
##
## This file is part of the SST software package. For license
## information, see... | [
"pygments.formatters.Terminal256Formatter",
"traceback.format_exception_only",
"test_engine_support.strclass",
"blessings.Terminal",
"datetime.datetime.utcnow",
"importlib.util.find_spec",
"pygments.highlight",
"test_engine_support.strqual",
"pygments.lexers.Python3TracebackLexer",
"threading.Sema... | [((8114, 8124), 'blessings.Terminal', 'Terminal', ([], {}), '()\n', (8122, 8124), False, 'from blessings import Terminal\n'), ((8589, 8622), 'pygments.formatters.Terminal256Formatter', 'formatters.Terminal256Formatter', ([], {}), '()\n', (8620, 8622), False, 'from pygments import formatters, highlight\n'), ((8639, 8646... |
# # Chapter 5: Image Enhancement
# Author: <NAME>
###########################################
# ## Problems
# ### 1.1 BLUR Filter to remove Salt & Pepper Noise
get_ipython().run_line_magic('matplotlib', 'inline')
import numpy as np
import matplotlib.pylab as plt
from PIL import Image, ImageFilter
from copy impor... | [
"matplotlib.pylab.xlim",
"matplotlib.pylab.subplots",
"scipy.signal.convolve",
"numpy.ma.masked_equal",
"numpy.random.rand",
"scipy.ndimage.gaussian_laplace",
"matplotlib.pylab.hist",
"PIL.ImageDraw.Draw",
"matplotlib.pylab.imshow",
"numpy.array",
"matplotlib.pylab.show",
"copy.deepcopy",
"s... | [((927, 961), 'PIL.Image.open', 'Image.open', (['"""images/Img_05_01.jpg"""'], {}), "('images/Img_05_01.jpg')\n", (937, 961), False, 'from PIL import Image, ImageDraw\n'), ((968, 996), 'matplotlib.pylab.figure', 'plt.figure', ([], {'figsize': '(12, 35)'}), '(figsize=(12, 35))\n', (978, 996), True, 'import matplotlib.py... |
# Generated by Django 2.0.7 on 2018-08-13 03:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('portal', '0018_auto_20180810_1801'),
]
operations = [
migrations.AddField(
model_name='templateinstance',
name='name... | [
"django.db.models.CharField"
] | [((342, 436), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""test"""', 'help_text': '"""Enter template instance name"""', 'max_length': '(200)'}), "(default='test', help_text='Enter template instance name',\n max_length=200)\n", (358, 436), False, 'from django.db import migrations, models\n')... |
from typing import Dict, Tuple
from raiden.transfer.state import NettingChannelState, NetworkState, RouteState
from raiden.utils.typing import Address, ChannelID, List, NodeNetworkStateMap, TokenNetworkAddress
def filter_reachable_routes(
route_states: List[RouteState], nodeaddresses_to_networkstates: NodeNetwor... | [
"raiden.transfer.state.RouteState"
] | [((1742, 1772), 'raiden.transfer.state.RouteState', 'RouteState', ([], {'route': 'rs.route[1:]'}), '(route=rs.route[1:])\n', (1752, 1772), False, 'from raiden.transfer.state import NettingChannelState, NetworkState, RouteState\n')] |
# Copyright (c) 2018 Ansible by Red Hat
# All Rights Reserved.
# Python
import ldap
# Django
from django.utils.encoding import force_str
# 3rd party
from django_auth_ldap.config import LDAPGroupType
class PosixUIDGroupType(LDAPGroupType):
def __init__(self, name_attr='cn', ldap_group_user_attr='uid'):
... | [
"django.utils.encoding.force_str"
] | [((1925, 1944), 'django.utils.encoding.force_str', 'force_str', (['group_dn'], {}), '(group_dn)\n', (1934, 1944), False, 'from django.utils.encoding import force_str\n'), ((1959, 1978), 'django.utils.encoding.force_str', 'force_str', (['user_uid'], {}), '(user_uid)\n', (1968, 1978), False, 'from django.utils.encoding i... |
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... | [
"tempfile.TemporaryDirectory",
"cryptography.x509.NameAttribute",
"cryptography.x509.random_serial_number",
"datetime.datetime.utcnow",
"cryptography.x509.CertificateBuilder",
"magma.common.cert_utils.create_csr",
"os.path.join",
"base64.b64decode",
"cryptography.hazmat.primitives.serialization.NoEn... | [((2273, 2359), 'magma.common.cert_utils.create_csr', 'cu.create_csr', (['key', '"""i am dummy test"""', '"""US"""', '"""CA"""', '"""MPK"""', '"""FB"""', '"""magma"""', '"""<EMAIL>"""'], {}), "(key, 'i am dummy test', 'US', 'CA', 'MPK', 'FB', 'magma',\n '<EMAIL>')\n", (2286, 2359), True, 'import magma.common.cert_ut... |
# -*- coding: utf-8 -*-
from datetime import datetime
from operator import attrgetter
import os
from sqlalchemy import Column, Integer, String, Date, ForeignKey, Enum, Boolean, UniqueConstraint, CheckConstraint, \
DateTime
from sqlalchemy.dialects.postgresql import JSON
from sqlalchemy.ext.associationproxy import ... | [
"flask.current_app.logger.warn",
"sqlalchemy.orm.relationship",
"operator.attrgetter",
"sqlalchemy.ext.associationproxy.association_proxy",
"sqlalchemy.event.listens_for",
"sqlalchemy.orm.backref",
"sqlalchemy.ForeignKey",
"os.environ.get",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.String",
"da... | [((1517, 1595), 'sqlalchemy.Enum', 'Enum', (['"""Inntekt"""', '"""Utgift"""'], {'name': '"""okonomipost_type_types"""', 'convert_unicode': '(True)'}), "('Inntekt', 'Utgift', name='okonomipost_type_types', convert_unicode=True)\n", (1521, 1595), False, 'from sqlalchemy import Column, Integer, String, Date, ForeignKey, E... |
import torch
from torch.distributions import Categorical
from survae.distributions.conditional import ConditionalDistribution
from survae.utils import sum_except_batch
class ConditionalCategorical(ConditionalDistribution):
"""A Categorical distribution with conditional logits."""
def __init__(self, net):
... | [
"survae.utils.sum_except_batch",
"torch.distributions.Categorical"
] | [((480, 506), 'torch.distributions.Categorical', 'Categorical', ([], {'logits': 'logits'}), '(logits=logits)\n', (491, 506), False, 'from torch.distributions import Categorical\n'), ((899, 925), 'survae.utils.sum_except_batch', 'sum_except_batch', (['log_prob'], {}), '(log_prob)\n', (915, 925), False, 'from survae.util... |
import os
import logging
import errno
import platform
is_windows = False
if platform.system() in ('Windows', 'Microsoft'):
is_windows = True
if is_windows:
import msvcrt
else:
import fcntl
logger = logging.getLogger(__name__)
class LockFileCreationException(Exception):
pass
class LockFileObtain... | [
"logging.getLogger",
"fcntl.flock",
"os.open",
"platform.system",
"os.fdopen",
"os.remove"
] | [((215, 242), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (232, 242), False, 'import logging\n'), ((78, 95), 'platform.system', 'platform.system', ([], {}), '()\n', (93, 95), False, 'import platform\n'), ((889, 912), 'os.fdopen', 'os.fdopen', (['self.fd', '"""w"""'], {}), "(self.fd, 'w... |
#
# Generated with WindVelocityProfileBlueprint
from dmt.blueprint import Blueprint
from dmt.dimension import Dimension
from dmt.attribute import Attribute
from dmt.enum_attribute import EnumAttribute
from dmt.blueprint_attribute import BlueprintAttribute
from sima.sima.blueprints.moao import MOAOBlueprint
class Wind... | [
"dmt.dimension.Dimension",
"dmt.attribute.Attribute"
] | [((561, 604), 'dmt.attribute.Attribute', 'Attribute', (['"""name"""', '"""string"""', '""""""'], {'default': '""""""'}), "('name', 'string', '', default='')\n", (570, 604), False, 'from dmt.attribute import Attribute\n'), ((634, 684), 'dmt.attribute.Attribute', 'Attribute', (['"""description"""', '"""string"""', '"""""... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... | [
"pulumi.getter",
"pulumi.set",
"pulumi.get"
] | [((2737, 2766), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""fleetId"""'}), "(name='fleetId')\n", (2750, 2766), False, 'import pulumi\n'), ((4573, 4602), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""roleArn"""'}), "(name='roleArn')\n", (4586, 4602), False, 'import pulumi\n'), ((4828, 4863), 'pulumi.getter... |
from flask import Flask, jsonify, make_response, request, url_for, redirect, render_template, flash, json
from wiki_parsing import output_data
from movie_parsing import output_top_movie
from config import DevConfig
import requests
import sqlalchemy
# need an app before we import models because models need it
... | [
"flask.request.args.get",
"requests.Session",
"movie_parsing.output_top_movie",
"flask.Flask",
"flask.json.dumps",
"wiki_parsing.output_data",
"flask.jsonify"
] | [((327, 342), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (332, 342), False, 'from flask import Flask, jsonify, make_response, request, url_for, redirect, render_template, flash, json\n'), ((1064, 1111), 'flask.jsonify', 'jsonify', (["{'microservice': 'resource gathering'}"], {}), "({'microservice': 're... |
import math
if (float("inf") != math.inf):
if(math.floor(4) == 4):
print(1)
else:
print(2)
else:
print(3)
#3 | [
"math.floor"
] | [((56, 69), 'math.floor', 'math.floor', (['(4)'], {}), '(4)\n', (66, 69), False, 'import math\n')] |
from costflow import Costflow, Config
conf = Config()
costflow = Costflow(conf)
inputs = [
'tomorrow "RiverBank Properties" "Paying the rent" 2400 Assets:US:BofA:Checking > 2400 Expenses:Home:Rent',
"@Verizon 59.61 Assets:US:BofA:Checking > Expenses:Home:Phone",
"Dinner 180 CNY bofa > rx + ry + food",
... | [
"costflow.Config",
"costflow.Costflow"
] | [((47, 55), 'costflow.Config', 'Config', ([], {}), '()\n', (53, 55), False, 'from costflow import Costflow, Config\n'), ((67, 81), 'costflow.Costflow', 'Costflow', (['conf'], {}), '(conf)\n', (75, 81), False, 'from costflow import Costflow, Config\n')] |
import pytest
import numpy as np
import sys
if (sys.version_info > (3, 0)):
from io import StringIO
else:
from StringIO import StringIO
from keras_contrib import callbacks
from keras.models import Sequential, Model
from keras.layers import Input, Dense, Conv2D, Flatten, Activation
from keras import backend as... | [
"StringIO.StringIO",
"keras.layers.Conv2D",
"keras.backend.image_data_format",
"numpy.ones",
"keras.layers.Flatten",
"keras_contrib.callbacks.DeadReluDetector",
"pytest.main",
"keras.models.Sequential",
"numpy.array",
"numpy.zeros",
"keras.layers.Input",
"keras.models.Model",
"keras.layers.A... | [((705, 715), 'StringIO.StringIO', 'StringIO', ([], {}), '()\n', (713, 715), False, 'from StringIO import StringIO\n'), ((2600, 2622), 'numpy.ones', 'np.ones', (['shape_weights'], {}), '(shape_weights)\n', (2607, 2622), True, 'import numpy as np\n'), ((2700, 2722), 'numpy.ones', 'np.ones', (['shape_weights'], {}), '(sh... |
''' This module defines the configuration used to run telewater.
'''
import os
from dotenv import load_dotenv
load_dotenv('.env')
API_ID = os.getenv('API_ID')
API_HASH = os.getenv('API_HASH')
WATERMARK = os.getenv(
'WATERMARK', 'https://user-images.githubusercontent.com/66209958/109513526-35883200-7acb-11eb-97e... | [
"os.getenv",
"dotenv.load_dotenv"
] | [((113, 132), 'dotenv.load_dotenv', 'load_dotenv', (['""".env"""'], {}), "('.env')\n", (124, 132), False, 'from dotenv import load_dotenv\n'), ((143, 162), 'os.getenv', 'os.getenv', (['"""API_ID"""'], {}), "('API_ID')\n", (152, 162), False, 'import os\n'), ((174, 195), 'os.getenv', 'os.getenv', (['"""API_HASH"""'], {})... |
from typing import List
import collections
class Solution:
def sumOfDistancesInTree(self, N, edges):
adjList = collections.defaultdict(set)
result = [0] * N
subTreeNodeCount = [1] * N
for fromNode, toNode in edges:
adjList[fromNode].add(toNode)
adjList[toNod... | [
"collections.defaultdict"
] | [((125, 153), 'collections.defaultdict', 'collections.defaultdict', (['set'], {}), '(set)\n', (148, 153), False, 'import collections\n')] |
# -*- coding: utf-8 -*-
"""Unit tests for classifier base class functionality."""
__author__ = ["mloning", "fkiraly", "TonyBagnall", "MatthewMiddlehurst"]
import numpy as np
import pandas as pd
import pytest
from sktime.classification.base import (
BaseClassifier,
_check_classifier_input,
_internal_conve... | [
"pandas.Series",
"sktime.classification.feature_based.Catch22Classifier",
"pandas.DataFrame",
"numpy.array",
"pytest.mark.parametrize",
"numpy.random.randint",
"sktime.utils._testing.panel._make_classification_y",
"pytest.raises",
"numpy.random.uniform",
"sktime.classification.base._internal_conve... | [((3943, 3981), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""missing"""', 'TF'], {}), "('missing', TF)\n", (3966, 3981), False, 'import pytest\n'), ((3983, 4026), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""multivariate"""', 'TF'], {}), "('multivariate', TF)\n", (4006, 4026), False, 'impo... |
""" `mplsoccer.statsbomb` is a python module for loading StatsBomb data. """
# Authors: <NAME>, https://twitter.com/numberstorm
# License: MIT
import os
import warnings
import numpy as np
import pandas as pd
EVENT_SLUG = 'https://raw.githubusercontent.com/statsbomb/open-data/master/data/events'
MATCH_SLUG = 'https:... | [
"pandas.read_json",
"pandas.json_normalize",
"os.path.basename",
"warnings.warn",
"pandas.isna",
"pandas.concat",
"pandas.to_datetime"
] | [((4586, 4618), 'warnings.warn', 'warnings.warn', (['STATSBOMB_WARNING'], {}), '(STATSBOMB_WARNING)\n', (4599, 4618), False, 'import warnings\n'), ((4724, 4775), 'pandas.read_json', 'pd.read_json', (['path_or_buf.content'], {'encoding': '"""utf-8"""'}), "(path_or_buf.content, encoding='utf-8')\n", (4736, 4775), True, '... |
"""
===============================================
vidgear library source-code is deployed under the Apache 2.0 License:
Copyright (c) 2019 <NAME>(@abhiTronix) <<EMAIL>>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may ob... | [
"logging.getLogger"
] | [((4905, 4931), 'logging.getLogger', 'log.getLogger', (['"""VideoGear"""'], {}), "('VideoGear')\n", (4918, 4931), True, 'import logging as log\n')] |
from flask import jsonify, request, url_for, g, abort
from app.main import db
from app.main.model.products import Product
from app.main.service import bp
from app.main.service.auth import token_auth
from app.main.service.errors import bad_request
@bp.route('/products/', methods=['GET'])
#@token_auth.login_required
d... | [
"app.main.service.bp.route"
] | [((251, 290), 'app.main.service.bp.route', 'bp.route', (['"""/products/"""'], {'methods': "['GET']"}), "('/products/', methods=['GET'])\n", (259, 290), False, 'from app.main.service import bp\n')] |
from typing import List, Iterator, Mapping
from pyot.utils.cdragon import tft_item_sanitize, tft_url
from pyot.core.functional import cache_indexes, lazy_property
from .__core__ import PyotCore
# PYOT CORE OBJECT
class Item(PyotCore):
description: str
effects: Mapping[str, int]
from_ids: List[int]
i... | [
"pyot.utils.cdragon.tft_url",
"pyot.utils.cdragon.tft_item_sanitize"
] | [((981, 1004), 'pyot.utils.cdragon.tft_url', 'tft_url', (['self.icon_path'], {}), '(self.icon_path)\n', (988, 1004), False, 'from pyot.utils.cdragon import tft_item_sanitize, tft_url\n'), ((1075, 1124), 'pyot.utils.cdragon.tft_item_sanitize', 'tft_item_sanitize', (['self.description', 'self.effects'], {}), '(self.descr... |
import urllib.request
with urllib.request.urlopen('http://python.org/') as response:
html = response.read()
import ssl
response = urllib.request.urlopen("https://vip.udel.edu/crypto/mobydick.txt", context=ssl._create_unverified_context())
mobytext = response.read()
onlyletters = mobytext # filter(lambda x: x.isa... | [
"ssl._create_unverified_context"
] | [((209, 241), 'ssl._create_unverified_context', 'ssl._create_unverified_context', ([], {}), '()\n', (239, 241), False, 'import ssl\n')] |
"""
Provide a small client for interacting with Requestbin.
"""
import xml.etree.ElementTree as Et
import requests
import backoff
# pylint: disable=too-few-public-methods
class RequestBinClient:
"""
Requestbin client.
Note: Contains only methods being used by actual tests.
"""
def __init__(self... | [
"backoff.on_predicate",
"requests.post",
"xml.etree.ElementTree.fromstring",
"requests.get"
] | [((539, 625), 'backoff.on_predicate', 'backoff.on_predicate', (['backoff.fibo', '(lambda x: x is None)'], {'max_tries': '(5)', 'jitter': 'None'}), '(backoff.fibo, lambda x: x is None, max_tries=5, jitter\n =None)\n', (559, 625), False, 'import backoff\n'), ((1120, 1150), 'xml.etree.ElementTree.fromstring', 'Et.froms... |
import subprocess
import os
import numpy as np
def main():
header_lines = ['#!/bin/bash']
out_file = '#SBATCH --output=wolff-{0:0.1f}-{1:0.1f}.out'
job_name = '#SBATCH --job-name="{0:0.1f}-{1:0.1f}"'
script_file = 'wolff-{0:0.1f}-{1:0.1f}.sh'
run_command = './wolff {0} {1} {2} {3}'
filenam... | [
"subprocess.Popen",
"numpy.linspace"
] | [((401, 428), 'numpy.linspace', 'np.linspace', (['(0.01)', '(5)', 'num_T'], {}), '(0.01, 5, num_T)\n', (412, 428), True, 'import numpy as np\n'), ((1547, 1583), 'subprocess.Popen', 'subprocess.Popen', (["['sbatch', script]"], {}), "(['sbatch', script])\n", (1563, 1583), False, 'import subprocess\n')] |
# Generated by Django 2.1.3 on 2018-11-21 01:37
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('product', '0002_auto_20181121_0740'),
]
operations = [
migrations.CreateModel(
name='Apistep',
... | [
"django.db.models.DateField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((1857, 1956), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""product.Apitest"""'}), "(null=True, on_delete=django.db.models.deletion.CASCADE,\n to='product.Apitest')\n", (1874, 1956), False, 'from django.db import migrations, ... |
from typing import List, Optional, Union # isort:skip
from pathlib import Path
from catalyst.utils.plotly import plot_tensorboard_log
def plot_metrics(
logdir: Union[str, Path],
step: Optional[str] = "epoch",
metrics: Optional[List[str]] = None,
height: Optional[int] = None,
width: Optional[int]... | [
"catalyst.utils.plotly.plot_tensorboard_log"
] | [((1046, 1104), 'catalyst.utils.plotly.plot_tensorboard_log', 'plot_tensorboard_log', (['logdir', 'step', 'metrics', 'height', 'width'], {}), '(logdir, step, metrics, height, width)\n', (1066, 1104), False, 'from catalyst.utils.plotly import plot_tensorboard_log\n')] |
import get_papers
import fire
def run(issn, email_address):
"""
:param issn: string ISSN of the journal to download
:param email_address: Provide your email address as your username for the CrossRef API (does *not* need to be
preregistered). Will not be stored by this script. CrossRef uses it to get in touch w... | [
"get_papers.write_derived_products",
"get_papers.get_paper_info",
"fire.Fire"
] | [((551, 611), 'get_papers.get_paper_info', 'get_papers.get_paper_info', ([], {'issn': 'issn', 'username': 'email_address'}), '(issn=issn, username=email_address)\n', (576, 611), False, 'import get_papers\n'), ((613, 672), 'get_papers.write_derived_products', 'get_papers.write_derived_products', ([], {'papers': 'papers'... |
import os
import torch
import argparse
import numpy as np
import torch.nn as nn
import torch.optim as optim
from torchviz import make_dot
import torch.nn.functional as F
from timeit import default_timer as timer
from utils import load_data, DEVICE, human_time
class Net(nn.Module):
def __init__(self, gpu=False):
... | [
"torch.nn.Dropout",
"utils.load_data",
"torch.max",
"torch.nn.functional.softmax",
"os.path.exists",
"numpy.multiply",
"argparse.ArgumentParser",
"utils.human_time",
"torch.cuda.get_device_name",
"os.makedirs",
"timeit.default_timer",
"torch.load",
"os.path.join",
"torch.nn.Conv2d",
"num... | [((4503, 4555), 'utils.load_data', 'load_data', ([], {'batch_size': '(4)', 'split_rate': '(0.2)', 'gpu': 'use_gpu'}), '(batch_size=4, split_rate=0.2, gpu=use_gpu)\n', (4512, 4555), False, 'from utils import load_data, DEVICE, human_time\n'), ((4642, 4654), 'torch.nn.BCELoss', 'nn.BCELoss', ([], {}), '()\n', (4652, 4654... |
#!/usr/bin/env python3
import gen
import os
tpuser = os.environ['TPUSER']
tphost = os.environ['TPHOST']
works_cats, years = gen.load_data()
gen.gen_works(works_cats)
gen.gen_timeline(years)
os.system('make html')
os.system('rsync -avz -e "ssh -l %s" output/* %s@%s:~/www/thomaspaine/' % (tpuser, tpuser, tphost))
| [
"os.system",
"gen.load_data",
"gen.gen_timeline",
"gen.gen_works"
] | [((127, 142), 'gen.load_data', 'gen.load_data', ([], {}), '()\n', (140, 142), False, 'import gen\n'), ((143, 168), 'gen.gen_works', 'gen.gen_works', (['works_cats'], {}), '(works_cats)\n', (156, 168), False, 'import gen\n'), ((169, 192), 'gen.gen_timeline', 'gen.gen_timeline', (['years'], {}), '(years)\n', (185, 192), ... |
from StringIO import StringIO
import pandas as pd
from harvest import Harvest
from domain import Domain
from .stream import init_plot
from django.conf import settings
ENABLE_STREAM_VIZ = settings.ENABLE_STREAM_VIZ
class PlotsNotReadyException(Exception):
pass
class AcheDashboard(object):
def __init__(se... | [
"domain.Domain",
"harvest.Harvest"
] | [((493, 507), 'harvest.Harvest', 'Harvest', (['crawl'], {}), '(crawl)\n', (500, 507), False, 'from harvest import Harvest\n'), ((530, 543), 'domain.Domain', 'Domain', (['crawl'], {}), '(crawl)\n', (536, 543), False, 'from domain import Domain\n')] |
# coding: utf-8
#
# Copyright (c) 2018-present <NAME>
# Copyright (c) 2008—2016 <NAME>
#
# This file is part of django-autoslug.
#
# django-autoslug is free software under terms of the GNU Lesser
# General Public License version 3 (LGPLv3) as published by the Free
# Software Foundation. See the file README for co... | [
"django.utils.timezone.is_aware",
"django.utils.timezone.localtime",
"unidecode.unidecode",
"re.compile"
] | [((6918, 6979), 're.compile', 're.compile', (['"""[\\\\t !"#$%&\\\\\'()*\\\\-/<=>?@\\\\[\\\\\\\\\\\\]^_`{|},.]+"""'], {}), '(\'[\\\\t !"#$%&\\\\\\\'()*\\\\-/<=>?@\\\\[\\\\\\\\\\\\]^_`{|},.]+\')\n', (6928, 6979), False, 'import re\n'), ((1067, 1083), 'unidecode.unidecode', 'unidecode', (['value'], {}), '(value)\n', (107... |
import warnings
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
from gears.asset_handler import BaseAssetHandler
from gears.finders import BaseFinder
_cache = {}
def _get_module(path):
try:
return import_module(path)
except ImportError as e:... | [
"warnings.warn",
"django.core.exceptions.ImproperlyConfigured",
"django.utils.importlib.import_module"
] | [((1587, 1682), 'django.core.exceptions.ImproperlyConfigured', 'ImproperlyConfigured', (['(\'"%s" must be a BaseAssetHandler subclass or callable object\' % path)'], {}), '(\n \'"%s" must be a BaseAssetHandler subclass or callable object\' % path)\n', (1607, 1682), False, 'from django.core.exceptions import Improper... |