code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | [
"logging.getLogger",
"apache_beam.io.kafka.ReadFromKafka",
"apache_beam.io.WriteToBigQuery",
"argparse.ArgumentParser",
"apache_beam.io.kafka.WriteToKafka",
"apache_beam.options.pipeline_options.PipelineOptions",
"apache_beam.io.ReadFromPubSub",
"apache_beam.window.FixedWindows",
"sys.exit",
"apac... | [((4449, 4474), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (4472, 4474), False, 'import argparse\n'), ((5452, 5522), 'apache_beam.options.pipeline_options.PipelineOptions', 'PipelineOptions', (['pipeline_args'], {'save_main_session': '(True)', 'streaming': '(True)'}), '(pipeline_args, save_... |
import os
import json
import re
import subprocess
import sys
import logging
from datetime import datetime
def install(package):
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
install('boto3')
import boto3
LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO").upper()
logger = logging.getLogger()
lo... | [
"logging.getLogger",
"boto3.client",
"os.getenv",
"subprocess.check_call",
"os.environ.get",
"os.path.isfile",
"datetime.datetime.now",
"json.load",
"re.search"
] | [((298, 317), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (315, 317), False, 'import logging\n'), ((354, 398), 'os.environ.get', 'os.environ.get', (['"""Region"""', '"""NoAWSRegionFound"""'], {}), "('Region', 'NoAWSRegionFound')\n", (368, 398), False, 'import os\n'), ((415, 468), 'os.environ.get', 'os.e... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | [
"os.environ.setdefault",
"django.setup",
"os.getenv",
"django.utils.encoding.force_text",
"os.path.abspath",
"inspect.isclass"
] | [((1051, 1095), 'os.getenv', 'os.getenv', (['"""REDIS_URL"""', '"""redis://redis:6379"""'], {}), "('REDIS_URL', 'redis://redis:6379')\n", (1060, 1095), False, 'import os\n'), ((1096, 1168), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""config.settings.local"""'], {}), "('DJANGO... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.auth import authenticate, base_user
from django.core.mail import EmailMessage
from django.shortcuts import get_object_or_404
from django.views.decorators.csrf import csrf_exempt
from rest_framework im... | [
"core.models.Organization.objects.all",
"core.models.ContactUs.objects.create",
"rest_framework.response.Response",
"core.models.Email.objects.create",
"django.core.mail.EmailMessage"
] | [((1099, 1125), 'core.models.Organization.objects.all', 'Organization.objects.all', ([], {}), '()\n', (1123, 1125), False, 'from core.models import Email, Organization, ContactUs as ContactUsModel\n'), ((2387, 2476), 'django.core.mail.EmailMessage', 'EmailMessage', (['subject', 'body', 'from_address', 'to_address'], {'... |
import folium
import random
import geoloc
import twitterAPI
def add_marker(group, coords, name, status="OK"):
"""
(FeatureGroup, [latitude, longitude], status="OK") -> None
"POINT"
"NO"
Function adds foliu... | [
"twitterAPI.json_get_user_info",
"folium.Icon",
"geoloc.random_coords",
"geoloc.get_geo_position_ArcGIS",
"folium.Marker",
"folium.PolyLine"
] | [((1511, 1546), 'twitterAPI.json_get_user_info', 'twitterAPI.json_get_user_info', (['acct'], {}), '(acct)\n', (1540, 1546), False, 'import twitterAPI\n'), ((416, 460), 'folium.Icon', 'folium.Icon', ([], {'color': '"""green"""', 'icon': '"""ok-circle"""'}), "(color='green', icon='ok-circle')\n", (427, 460), False, 'impo... |
import RPi.GPIO as GPIO
import time
## Define function for blinking LED
def Blink(pins, num=5, speed=1):
"""
Blink LED using given GPIO pin, number of times and speed.
- pin: GPIO pin to send signal
- num: num of times to blink (default: 5)
- speed: speed of each blink in seconds (default: ... | [
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"RPi.GPIO.output",
"time.sleep",
"RPi.GPIO.setmode"
] | [((1516, 1538), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (1528, 1538), True, 'import RPi.GPIO as GPIO\n'), ((2067, 2081), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (2077, 2081), False, 'import time\n'), ((2223, 2237), 'RPi.GPIO.cleanup', 'GPIO.cleanup', ([], {}), '()\n', (2235... |
# Copyright 2013 <NAME>, Univ.Politecnica Valencia, Consejo Superior de
# Investigaciones Cientificas
#
# 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/LI... | [
"csv.DictReader",
"django.db.transaction.atomic",
"csv.Sniffer",
"django.core.management.base.CommandError",
"goldenbraid.management.commands.db_utils.get_or_load_cvterm",
"goldenbraid.management.commands.db_utils.get_or_load_cv"
] | [((2302, 2315), 'csv.Sniffer', 'csv.Sniffer', ([], {}), '()\n', (2313, 2315), False, 'import csv\n'), ((2789, 2809), 'django.db.transaction.atomic', 'transaction.atomic', ([], {}), '()\n', (2807, 2809), False, 'from django.db import transaction\n'), ((2828, 2888), 'csv.DictReader', 'csv.DictReader', (['fhand'], {'field... |
import torch
def mse(output, target):
loss = torch.mean((output - target) ** 2)
return loss
def hybrid_mse(output, target, coe1=1, coe2=0.2):
comp1 = torch.mean((output - target) ** 2)
comp2 = torch.mean((torch.sum(output, dim=-1) - torch.sum(target, dim=-1)) ** 2)
loss = coe1 * comp1 + coe2 * co... | [
"torch.mean",
"torch.sum"
] | [((51, 85), 'torch.mean', 'torch.mean', (['((output - target) ** 2)'], {}), '((output - target) ** 2)\n', (61, 85), False, 'import torch\n'), ((165, 199), 'torch.mean', 'torch.mean', (['((output - target) ** 2)'], {}), '((output - target) ** 2)\n', (175, 199), False, 'import torch\n'), ((224, 249), 'torch.sum', 'torch.... |
"""Plot match's mod* files
usage:
cd matchX.X/Model/data
e.g.,
python -m match.makemod.plot_mods -p 'mod*'
"""
from __future__ import print_function
import glob
import os
import sys
import argparse
import numpy as np
import matplotlib.pylab as plt
from ..scripts.config import EXT
def plot_mods(sub=None, pref='mod1_*... | [
"matplotlib.pylab.subplots",
"matplotlib.pylab.savefig",
"os.listdir",
"numpy.log10",
"argparse.ArgumentParser",
"matplotlib.pylab.colorbar",
"os.getcwd",
"os.chdir",
"os.path.isfile",
"os.path.isdir",
"numpy.loadtxt",
"matplotlib.pylab.close",
"glob.glob"
] | [((1045, 1056), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1054, 1056), False, 'import os\n'), ((1462, 1477), 'glob.glob', 'glob.glob', (['pref'], {}), '(pref)\n', (1471, 1477), False, 'import glob\n'), ((2529, 2543), 'os.chdir', 'os.chdir', (['here'], {}), '(here)\n', (2537, 2543), False, 'import os\n'), ((2612, 267... |
from __future__ import absolute_import
import copy
import netlib.tcp
from .. import stateobject, utils, version
from ..proxy.primitives import AddressPriority
from ..proxy.connection import ClientConnection, ServerConnection
KILL = 0 # const for killed requests
class BackreferenceMixin(object):
"""
If an a... | [
"copy.copy"
] | [((1966, 1981), 'copy.copy', 'copy.copy', (['self'], {}), '(self)\n', (1975, 1981), False, 'import copy\n'), ((2833, 2848), 'copy.copy', 'copy.copy', (['self'], {}), '(self)\n', (2842, 2848), False, 'import copy\n')] |
import numpy as np
import cPickle as pickle
from classifier import Classifier
from util.layers import *
from util.dump import dump_big_matrix
class NNClassifier(Classifier):
def __init__(self, D, H, W, K, iternum):
Classifier.__init__(self, D, H, W, K, iternum)
self.L = 100 # size of hidden layer
""" La... | [
"classifier.Classifier.__init__",
"util.dump.dump_big_matrix",
"numpy.sum",
"numpy.zeros",
"numpy.random.randn"
] | [((222, 268), 'classifier.Classifier.__init__', 'Classifier.__init__', (['self', 'D', 'H', 'W', 'K', 'iternum'], {}), '(self, D, H, W, K, iternum)\n', (241, 268), False, 'from classifier import Classifier\n'), ((457, 478), 'numpy.zeros', 'np.zeros', (['(1, self.L)'], {}), '((1, self.L))\n', (465, 478), True, 'import nu... |
"""Aireplay-ng"""
import asyncio
from parse import parse
from .executor import ExecutorHelper
class AireplayNg(ExecutorHelper):
""" Aireplay-ng 1.6 - (C) 2006-2020 <NAME>
https://www.aircrack-ng.org
Usage: aireplay-ng <options> <replay interface>
Options:
-b bssid : MAC address, Access ... | [
"parse.parse",
"asyncio.sleep"
] | [((3439, 3488), 'parse.parse', 'parse', (['"""{date} {message} -- BSSID: [{bssid}]"""', 'a'], {}), "('{date} {message} -- BSSID: [{bssid}]', a)\n", (3444, 3488), False, 'from parse import parse\n'), ((3070, 3086), 'asyncio.sleep', 'asyncio.sleep', (['(1)'], {}), '(1)\n', (3083, 3086), False, 'import asyncio\n'), ((32... |
from django.db import models
# Create your models here.
from myuser.models import TemplateUser
class Event(models.Model):
description = models.CharField(max_length=300, blank=True,null=True, unique=False)
title = models.CharField(max_length=300, blank=False, null=False, unique=False)
enabled = models.Boo... | [
"django.db.models.IntegerField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((143, 212), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(300)', 'blank': '(True)', 'null': '(True)', 'unique': '(False)'}), '(max_length=300, blank=True, null=True, unique=False)\n', (159, 212), False, 'from django.db import models\n'), ((224, 295), 'django.db.models.CharField', 'models.Cha... |
import pytest
from acconeer_utils.clients import SocketClient, SPIClient, UARTClient
from acconeer_utils.example_utils import autodetect_serial_port
from acconeer_utils.clients import configs
@pytest.fixture(scope="module")
def setup(request):
conn_type, *args = request.param
if conn_type == "spi":
... | [
"acconeer_utils.example_utils.autodetect_serial_port",
"acconeer_utils.clients.configs.EnvelopeServiceConfig",
"acconeer_utils.clients.SocketClient",
"acconeer_utils.clients.configs.IQServiceConfig",
"acconeer_utils.clients.UARTClient",
"acconeer_utils.clients.SPIClient",
"pytest.fail",
"pytest.fixtur... | [((196, 226), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (210, 226), False, 'import pytest\n'), ((769, 813), 'acconeer_utils.clients.configs.EnvelopeServiceConfig', 'configs.EnvelopeServiceConfig', ([], {'sensor': 'sensor'}), '(sensor=sensor)\n', (798, 813), False, 'from ... |
from django.contrib import admin
from .models import Post, Comment
from django.utils import timezone
from markdownx.widgets import AdminMarkdownxWidget
from markdownx.models import MarkdownxField
class PostAdmin(admin.ModelAdmin):
list_display = ("title", "slug", "status", "created_on")
list_filter = ("statu... | [
"django.contrib.admin.site.register"
] | [((840, 876), 'django.contrib.admin.site.register', 'admin.site.register', (['Post', 'PostAdmin'], {}), '(Post, PostAdmin)\n', (859, 876), False, 'from django.contrib import admin\n'), ((877, 919), 'django.contrib.admin.site.register', 'admin.site.register', (['Comment', 'CommentAdmin'], {}), '(Comment, CommentAdmin)\n... |
# Generated by Django 2.2.7 on 2020-04-08 07:54
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('lista_saida', '0004_ontitem_ontlista'),
]
operations = [
migrations.AlterField(
model_name='ont... | [
"django.db.models.ForeignKey"
] | [((374, 493), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""cont_material_listas"""', 'to': '"""cont.Ont"""'}), "(on_delete=django.db.models.deletion.CASCADE, related_name\n ='cont_material_listas', to='cont.Ont')\n", (391, 493), False... |
import numpy as np
from calculatearea import AreaEstimator
from math import sqrt
area_estimator = AreaEstimator(filename='rancho_rd.jpg', # name of the image in the directory
color_range=((0, 0, 118), (100, 100, 255)),
default_area_color=(255, 20, 160)) ... | [
"calculatearea.AreaEstimator",
"numpy.array",
"math.sqrt"
] | [((100, 222), 'calculatearea.AreaEstimator', 'AreaEstimator', ([], {'filename': '"""rancho_rd.jpg"""', 'color_range': '((0, 0, 118), (100, 100, 255))', 'default_area_color': '(255, 20, 160)'}), "(filename='rancho_rd.jpg', color_range=((0, 0, 118), (100, 100,\n 255)), default_area_color=(255, 20, 160))\n", (113, 222)... |
from flask.ext.wtf import Form
from wtforms import StringField, IntegerField, SelectField, PasswordField
from flask_wtf.html5 import EmailField
from wtforms.validators import DataRequired, Required
from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileRequired, FileAllowed
class LoginForm(... | [
"wtforms.validators.DataRequired",
"flask_wtf.file.FileRequired",
"flask_wtf.file.FileAllowed"
] | [((376, 390), 'wtforms.validators.DataRequired', 'DataRequired', ([], {}), '()\n', (388, 390), False, 'from wtforms.validators import DataRequired, Required\n'), ((444, 458), 'wtforms.validators.DataRequired', 'DataRequired', ([], {}), '()\n', (456, 458), False, 'from wtforms.validators import DataRequired, Required\n'... |
'''Faça um programa que ajude um jogador da MEGA SENA a criar palpites.
O programa vai perguntar quantos jogos serão gerados e vai sortear 6 números entre 1 e 60 para cada jogo, cadastrando tudo em uma lista composta.'''
from random import randint,sample
from time import sleep
print('-='*15)
print('{:=^30}'.format('Jog... | [
"time.sleep"
] | [((491, 499), 'time.sleep', 'sleep', (['(2)'], {}), '(2)\n', (496, 499), False, 'from time import sleep\n'), ((1924, 1932), 'time.sleep', 'sleep', (['(2)'], {}), '(2)\n', (1929, 1932), False, 'from time import sleep\n')] |
import cv2
import numpy as np
import random
import matplotlib.pyplot as plt
def similarity_transform(image, center, dim, angle=0.0, scale=1.0, clip=True):
#similarity transform includes rotation+translation+scaling
#it retains parallel and angles
M = cv2.getRotationMatrix2D(center, angle, scale)
(w,h,... | [
"cv2.imshow",
"cv2.warpPerspective",
"cv2.destroyAllWindows",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"cv2.waitKey",
"random.randint",
"numpy.abs",
"cv2.warpAffine",
"numpy.ones",
"cv2.getPerspectiveTransform",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.gcf",
"cv2.getAffineTr... | [((265, 310), 'cv2.getRotationMatrix2D', 'cv2.getRotationMatrix2D', (['center', 'angle', 'scale'], {}), '(center, angle, scale)\n', (288, 310), False, 'import cv2\n'), ((777, 811), 'cv2.getAffineTransform', 'cv2.getAffineTransform', (['pts1', 'pts2'], {}), '(pts1, pts2)\n', (799, 811), False, 'import cv2\n'), ((849, 88... |
import os
import sys
import pytest
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
from base import TestBaseClass
class TestClassOelintVarsFileSettingsDouble(TestBaseClass):
@pytest.mark.parametrize('id', ['oelint.vars.filessetting.double'])
@pytest.mark.parametrize('occurrence', [1])
@p... | [
"os.path.dirname",
"pytest.mark.parametrize"
] | [((199, 265), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""id"""', "['oelint.vars.filessetting.double']"], {}), "('id', ['oelint.vars.filessetting.double'])\n", (222, 265), False, 'import pytest\n'), ((271, 313), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""occurrence"""', '[1]'], {}), "('... |
# Imports from 3rd party libraries
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
# from pages.predictions import predict
# Imports from this application
from app import app, server, port
from pages ... | [
"dash_html_components.Hr",
"dash_html_components.I",
"joblib.load",
"dash_core_components.Location",
"dash.dependencies.Output",
"dash_bootstrap_components.Container",
"dash_core_components.Link",
"dash_html_components.Span",
"dash.dependencies.Input",
"dash_core_components.Markdown",
"app.app.r... | [((431, 451), 'joblib.load', 'load', (['"""assets/index"""'], {}), "('assets/index')\n", (435, 451), False, 'from joblib import load\n'), ((505, 527), 'joblib.load', 'load', (['"""assets/process"""'], {}), "('assets/process')\n", (509, 527), False, 'from joblib import load\n'), ((547, 578), 'joblib.load', 'load', (['""... |
from twilio.rest import Client
from dagster import Field, StringSource, resource
@resource(
{
"account_sid": Field(StringSource, description="Twilio Account SID"),
"auth_token": Field(StringSource, description="Twilio Auth Token"),
},
description="This resource is for connecting to Twilio... | [
"twilio.rest.Client",
"dagster.Field"
] | [((366, 456), 'twilio.rest.Client', 'Client', (["context.resource_config['account_sid']", "context.resource_config['auth_token']"], {}), "(context.resource_config['account_sid'], context.resource_config[\n 'auth_token'])\n", (372, 456), False, 'from twilio.rest import Client\n'), ((124, 177), 'dagster.Field', 'Field... |
from abc import abstractmethod, ABC
import torch
from dpm.distributions import (
Distribution, Normal, Data,
GumbelSoftmax, ConditionalModel,
Categorical
)
from dpm.distributions import MixtureModel
from dpm.train import train
from dpm.criterion import cross_entropy, ELBO
from torch.nn import Softmax, Modul... | [
"dpm.train.train",
"torch.nn.Softmax",
"torch.eye",
"functools.partial",
"dpm.criterion.ELBO",
"dpm.distributions.Data",
"torch.randn",
"numpy.arange"
] | [((1003, 1010), 'dpm.distributions.Data', 'Data', (['x'], {}), '(x)\n', (1007, 1010), False, 'from dpm.distributions import Distribution, Normal, Data, GumbelSoftmax, ConditionalModel, Categorical\n'), ((1027, 1075), 'dpm.train.train', 'train', (['data', 'self.model', 'cross_entropy'], {}), '(data, self.model, cross_en... |
# gui_07_2.py
import tkinter
SMILE = """
#define smileywe_width 16
#define smiley_height 16
static unsigned char smiley_bits[] = {
0xc0, 0x07, 0x30, 0x18, 0x08, 0x20, 0x04, 0x40, 0x44, 0x44, 0x02, 0x80,
0x02, 0x80, 0x02, 0x80, 0x22, 0x88, 0x62, 0x8c, 0xc4, 0x47, 0x04, 0x40,
0x08, 0x20, 0x30, 0x18, 0xc0, 0x07, 0x00, 0x... | [
"tkinter.BitmapImage",
"tkinter.Canvas",
"tkinter.Tk"
] | [((337, 349), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (347, 349), False, 'import tkinter\n'), ((356, 397), 'tkinter.Canvas', 'tkinter.Canvas', (['root'], {'width': '(50)', 'height': '(30)'}), '(root, width=50, height=30)\n', (370, 397), False, 'import tkinter\n'), ((415, 446), 'tkinter.BitmapImage', 'tkinter.Bitm... |
#!/usr/bin/evn python
#-*-:coding:utf-8 -*-
#Author:404
#Name: 泛微e-office 任意文件下载(应该不重复)
#Refer:
import re
def assign(service,arg):
if service=="weaver_oa":
return True,arg
def audit(arg):
url=arg+"E-mobile/Data/downfile.php?url=123"
code,head,res,errcode,_=curl.curl2(url)
... | [
"re.search"
] | [((350, 394), 're.search', 're.search', (['"""No error in <b>([^<]+)</b>"""', 'res'], {}), "('No error in <b>([^<]+)</b>', res)\n", (359, 394), False, 'import re\n')] |
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
cls = get_driver(Provider.EC2)
driver = cls('temporary access key', 'temporary secret key',
token='<PASSWORD>', region="us-west-1")
| [
"libcloud.compute.providers.get_driver"
] | [((101, 125), 'libcloud.compute.providers.get_driver', 'get_driver', (['Provider.EC2'], {}), '(Provider.EC2)\n', (111, 125), False, 'from libcloud.compute.providers import get_driver\n')] |
"""Create Config Model"""
# pylint: disable=no-self-argument,no-self-use
# standard library
from typing import Any, Dict
# third-party
from pydantic import BaseModel, root_validator
class CreateConfigModel(BaseModel):
"""Create Config Model"""
# TODO: [low] workaround for PLAT-4393
@root_validator(pre=T... | [
"pydantic.root_validator"
] | [((300, 324), 'pydantic.root_validator', 'root_validator', ([], {'pre': '(True)'}), '(pre=True)\n', (314, 324), False, 'from pydantic import BaseModel, root_validator\n')] |
""" PyTorch dataset classes for molecular data. """
import itertools
from typing import Dict, List, Tuple, Union
import numpy as np
import torch
from rdkit import Chem
# noinspection PyUnresolvedReferences
from rdkit.Chem import AllChem, rdmolops, rdPartialCharges, rdForceFieldHelpers, rdchem
from scipy impor... | [
"torch.from_numpy",
"numpy.isfinite",
"numpy.arange",
"rdkit.Chem.rdForceFieldHelpers.MMFFGetMoleculeProperties",
"rdkit.Chem.rdchem.BondStereo.values.values",
"rdkit.Chem.rdmolops.AssignStereochemistryFrom3D",
"numpy.ones",
"rdkit.Chem.GetPeriodicTable",
"conformation.graph_data.Data",
"conformat... | [((1794, 1832), 'torch.load', 'torch.load', (["self.metadata[idx]['path']"], {}), "(self.metadata[idx]['path'])\n", (1804, 1832), False, 'import torch\n'), ((2418, 2460), 'conformation.distance_matrix.distmat_to_vec', 'distmat_to_vec', (["self.metadata[idx]['path']"], {}), "(self.metadata[idx]['path'])\n", (2432, 2460)... |
# NewLst : creates a new lst. If already exists return a error.
# IsALst : checks if the input is an int. Return true or false.
# CToLst : converts a value to int. If can not, return a error.
# fin() : returns the key of a item in a list or a string.
# add() : adds a value in a list or string.
# del() : dels a ... | [
"ErrorMessage.Error"
] | [((1109, 1179), 'ErrorMessage.Error', 'Error', (['"""[Compiler Error] This name already exits as lst."""', '"""lin"""', 'elin'], {}), "('[Compiler Error] This name already exits as lst.', 'lin', elin)\n", (1114, 1179), False, 'from ErrorMessage import Error\n'), ((4408, 4465), 'ErrorMessage.Error', 'Error', (['"""[Sint... |
import re
import sys
import os
import shutil
if len(sys.argv)<2:
print('Less number of arguments. Please pass the POSCAR file !')
sys.exit()
if os.path.exists("Output"):
print('Deleting old Output files')
shutil.rmtree("Output")
procar = open(sys.argv[1])
lines = procar.readlines()
#Extract data reg... | [
"os.path.exists",
"re.findall",
"shutil.rmtree",
"sys.exit"
] | [((154, 178), 'os.path.exists', 'os.path.exists', (['"""Output"""'], {}), "('Output')\n", (168, 178), False, 'import os\n'), ((139, 149), 'sys.exit', 'sys.exit', ([], {}), '()\n', (147, 149), False, 'import sys\n'), ((223, 246), 'shutil.rmtree', 'shutil.rmtree', (['"""Output"""'], {}), "('Output')\n", (236, 246), False... |
'''
Copyright 2019 Broadcom. The term "Broadcom" refers to Broadcom Inc.
and/or its subsidiaries.
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
Unles... | [
"pytest.raises",
"ztp.JsonReader.JsonReader"
] | [((1333, 1375), 'ztp.JsonReader.JsonReader', 'JsonReader', (['ZTP_CFG_JSON', '"""/tmp/test.json"""'], {}), "(ZTP_CFG_JSON, '/tmp/test.json')\n", (1343, 1375), False, 'from ztp.JsonReader import JsonReader\n'), ((3347, 3371), 'ztp.JsonReader.JsonReader', 'JsonReader', (['ZTP_CFG_JSON'], {}), '(ZTP_CFG_JSON)\n', (3357, 3... |
import random as r
#create a range of random number between 1-100
n = r.randrange(1,100)
#to take input to enter a number
guess = int(input("Enter any number : "))
print(guess)
while n!=guess:
if guess <n:
print("Too low")
guess = int(input("Enter number again: "))
elif guess > n:
... | [
"random.randrange"
] | [((72, 91), 'random.randrange', 'r.randrange', (['(1)', '(100)'], {}), '(1, 100)\n', (83, 91), True, 'import random as r\n')] |
import torch,math
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from roialign.roi_align.crop_and_resize import CropAndResizeFunction
def log2(x):
"""Implementatin of Log2. Pytorch doesn't have a native implemenation."""
ln2 = Variable(torch.log(torch.FloatTensor([2.... | [
"torch.nn.functional.upsample",
"torch.nn.ReLU",
"math.floor",
"torch.nn.Sequential",
"torch.sqrt",
"torch.nn.functional.pad",
"roialign.roi_align.crop_and_resize.CropAndResizeFunction",
"torch.nn.BatchNorm2d",
"torch.nn.Sigmoid",
"torch.sort",
"torch.nn.modules.utils._pair",
"torch.cat",
"t... | [((3779, 3803), 'torch.cat', 'torch.cat', (['pooled'], {'dim': '(0)'}), '(pooled, dim=0)\n', (3788, 3803), False, 'import torch, math\n'), ((3939, 3969), 'torch.cat', 'torch.cat', (['box_to_level'], {'dim': '(0)'}), '(box_to_level, dim=0)\n', (3948, 3969), False, 'import torch, math\n'), ((4066, 4090), 'torch.sort', 't... |
from typing import Sequence
from eth_typing import BLSSignature
from eth_utils import ValidationError
from eth2._utils.bls import bls
from eth2._utils.hash import hash_eth2
from eth2.beacon.attestation_helpers import (
validate_indexed_attestation_aggregate_signature,
)
from eth2.beacon.committee_helpers import g... | [
"eth2.beacon.epoch_processing_helpers.get_attesting_indices",
"eth2.beacon.typing.Bitfield",
"eth_utils.ValidationError",
"eth2._utils.hash.hash_eth2",
"eth2.beacon.attestation_helpers.validate_indexed_attestation_aggregate_signature",
"eth2._utils.bls.bls.sign",
"eth2.beacon.typing.SerializableUint64",... | [((1453, 1484), 'eth2._utils.bls.bls.sign', 'bls.sign', (['privkey', 'signing_root'], {}), '(privkey, signing_root)\n', (1461, 1484), False, 'from eth2._utils.bls import bls\n'), ((2358, 2406), 'eth2.beacon.committee_helpers.get_beacon_committee', 'get_beacon_committee', (['state', 'slot', 'index', 'config'], {}), '(st... |
import discord
from discord.ext import commands
from discord.utils import get
import asyncio
from gtoken import *
comando = ["turma entrar", "turma sair", "turma add", "info", "alterar prefix"]
client = discord.Client()
prefixo = Prefixo()
msg_id = None
msg_user = None
@client.event
async def on_ready():
pri... | [
"discord.Client",
"discord.utils.get",
"discord.Embed"
] | [((206, 222), 'discord.Client', 'discord.Client', ([], {}), '()\n', (220, 222), False, 'import discord\n'), ((954, 1094), 'discord.Embed', 'discord.Embed', ([], {'title': '"""Escolha a turma que deseja entrar!"""', 'color': '(6885315)', 'description': '"""- IHC = 🐤\n- Grafos = 📘 \n- LIP-Rodrigo = 📙"""'}), '(title... |
import json
from unittest.mock import patch
import graphene
import pytest
from django.shortcuts import reverse
from saleor.dashboard.graphql.mutations import (
ModelFormMutation, ModelFormUpdateMutation)
from ..utils import get_graphql_content
@patch('saleor.dashboard.graphql.mutations.convert_form_fields')
@p... | [
"graphene.String",
"graphene.Node.to_global_id",
"json.dumps",
"pytest.raises",
"django.shortcuts.reverse",
"unittest.mock.patch"
] | [((254, 317), 'unittest.mock.patch', 'patch', (['"""saleor.dashboard.graphql.mutations.convert_form_fields"""'], {}), "('saleor.dashboard.graphql.mutations.convert_form_fields')\n", (259, 317), False, 'from unittest.mock import patch\n'), ((319, 381), 'unittest.mock.patch', 'patch', (['"""saleor.dashboard.graphql.mutat... |
import sys
import os
import cv2
import glob
import math
from time import sleep, time
import matplotlib
matplotlib.use('agg')
import numpy as np
from time import time
from nnlib import nnlib
import matplotlib.pyplot as plt
from facelib import S3FDExtractor, LandmarksExtractor
class SlimFace(object):
def __init__... | [
"nnlib.nnlib.import_all",
"facelib.S3FDExtractor",
"matplotlib.use",
"facelib.LandmarksExtractor",
"os.path.join",
"math.sqrt",
"cv2.imshow",
"nnlib.nnlib.keras.models.load_model",
"cv2.waitKey",
"nnlib.nnlib.DeviceConfig",
"math.fabs",
"cv2.VideoCapture",
"numpy.concatenate",
"cv2.resize"... | [((103, 124), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (117, 124), False, 'import matplotlib\n'), ((11258, 11264), 'time.time', 'time', ([], {}), '()\n', (11262, 11264), False, 'from time import time\n'), ((11275, 11313), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""./media/jcdemo.mp4"""']... |
from flask_testing import TestCase
from flask import g
from maintain_frontend import main
from unittest.mock import patch
from maintain_frontend.dependencies.session_api.session import Session
class TestApp(TestCase):
def create_app(self):
main.app.config['PRESERVE_CONTEXT_ON_EXCEPTION'] = False
... | [
"maintain_frontend.main.app.app_context",
"unittest.mock.patch"
] | [((342, 380), 'unittest.mock.patch', 'patch', (['"""maintain_frontend.app.Session"""'], {}), "('maintain_frontend.app.Session')\n", (347, 380), False, 'from unittest.mock import patch\n'), ((961, 999), 'unittest.mock.patch', 'patch', (['"""maintain_frontend.app.Session"""'], {}), "('maintain_frontend.app.Session')\n", ... |
from django.db import models
from django.contrib.auth.models import User
from django.utils.text import slugify
from django.db.models.signals import pre_save
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from comments.models import Comment
from django.contrib.contenttypes.models imp... | [
"django.db.models.GenericIPAddressField",
"django.db.models.OneToOneField",
"django.utils.text.slugify",
"django.contrib.contenttypes.models.ContentType.objects.get_for_model",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"comments.models.Comment.objects.filter_by_instance",
"django.db... | [((3034, 3088), 'django.db.models.signals.pre_save.connect', 'pre_save.connect', (['pre_save_post_receiver'], {'sender': 'Video'}), '(pre_save_post_receiver, sender=Video)\n', (3050, 3088), False, 'from django.db.models.signals import pre_save\n'), ((587, 618), 'django.db.models.CharField', 'models.CharField', ([], {'m... |
import pandas as pd
import numpy as np
import glob
import math
import re
import sys
import multiprocessing
def downsampleRow(args):
row, targetSum = args
currentCount = row.sum()
downsampledRow = row.copy()
while currentCount > targetSum and currentCount != 0:
possible = downsamp... | [
"multiprocessing.Pool"
] | [((1027, 1050), 'multiprocessing.Pool', 'multiprocessing.Pool', (['(8)'], {}), '(8)\n', (1047, 1050), False, 'import multiprocessing\n')] |
from __future__ import unicode_literals
from django.db import migrations
from django.contrib.auth.hashers import make_password
from django.utils import timezone
def create_test_models(apps, schema_editor):
User = apps.get_model("auth", "User")
Question = apps.get_model("polls", "Question")
Choice = apps.... | [
"django.utils.timezone.now",
"django.db.migrations.RunPython",
"django.contrib.auth.hashers.make_password"
] | [((421, 448), 'django.contrib.auth.hashers.make_password', 'make_password', (['"""<PASSWORD>"""'], {}), "('<PASSWORD>')\n", (434, 448), False, 'from django.contrib.auth.hashers import make_password\n'), ((1202, 1242), 'django.db.migrations.RunPython', 'migrations.RunPython', (['create_test_models'], {}), '(create_test_... |
import logging
import pytest
from collections import defaultdict
from typing import Iterator
from pathlib import Path
from _pytest.tmpdir import TempPathFactory
from test_lib import (run_pseudo, get_data_root_dir,
iter_pseudo_files_db_rows)
LOGGER = logging.getLogger(__name__)
def _iter_files_... | [
"logging.getLogger",
"test_lib.run_pseudo",
"test_lib.get_data_root_dir",
"pytest.mark.parametrize",
"collections.defaultdict",
"test_lib.iter_pseudo_files_db_rows"
] | [((274, 301), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (291, 301), False, 'import logging\n'), ((556, 1133), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""script_rel_filename"""', "['250_opencreate/300_two_files.sh',\n '400_create/400_inode_reuse_after_delete.sh',\n... |
import pyttsx3
import PySimpleGUI as sg
def falar(texto):
engine = pyttsx3.init('sapi5')
engine.setProperty('rate', 180)
engine.save_to_file(texto, 'output.mp3')
engine.runAndWait()
sg.theme('LightBlue')
layout = [
[sg.Text('Convert texto to sound file:')],
[sg.Multiline(size=(40, 10), key='text... | [
"pyttsx3.init",
"PySimpleGUI.Text",
"PySimpleGUI.Multiline",
"PySimpleGUI.theme",
"PySimpleGUI.Button",
"PySimpleGUI.Window"
] | [((198, 219), 'PySimpleGUI.theme', 'sg.theme', (['"""LightBlue"""'], {}), "('LightBlue')\n", (206, 219), True, 'import PySimpleGUI as sg\n'), ((459, 538), 'PySimpleGUI.Window', 'sg.Window', (['"""Convert text to sound file"""', 'layout'], {'element_justification': '"""center"""'}), "('Convert text to sound file', layou... |
import librosa
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import tensor as T
import numpy as np
from torch.nn.functional import conv1d
import torchopenl3.core
class CustomSTFT(nn.Module):
"""
STFT implemented like kapre 0.1.4.
Attributes
----------
n_dft: int
... | [
"torch.nn.ZeroPad2d",
"torch.nn.functional.conv1d",
"torch.sqrt",
"numpy.log",
"torch.nn.BatchNorm1d",
"torch.nn.functional.pad",
"numpy.arange",
"torch.nn.BatchNorm2d",
"numpy.multiply",
"torch.nn.BatchNorm3d",
"torch.nn.Conv3d",
"librosa.filters.mel",
"torch.nn.functional.relu",
"torch.n... | [((3277, 3332), 'librosa.filters.get_window', 'librosa.filters.get_window', (['"""hann"""', 'n_dft'], {'fftbins': '(True)'}), "('hann', n_dft, fftbins=True)\n", (3303, 3332), False, 'import librosa\n'), ((3509, 3550), 'numpy.multiply', 'np.multiply', (['dft_real_kernels', 'dft_window'], {}), '(dft_real_kernels, dft_win... |
# -*- coding: utf-8 -*-
"""
@file polygon.py
@author <NAME>
@date 2011-03-16
@version $Id: polygon.py 15031 2013-11-05 19:52:41Z behrisch $
Python implementation of the TraCI interface.
SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
Copyright (C) 2011-2013 DLR (http://www.dlr.de/) and contributor... | [
"traci.SubscriptionResults",
"traci._subscribeContext",
"traci._sendReadOneStringCmd",
"traci._sendExact",
"traci._beginMessage",
"struct.pack",
"traci._subscribe"
] | [((980, 1025), 'traci.SubscriptionResults', 'traci.SubscriptionResults', (['_RETURN_VALUE_FUNC'], {}), '(_RETURN_VALUE_FUNC)\n', (1005, 1025), False, 'import struct, traci\n'), ((1077, 1151), 'traci._sendReadOneStringCmd', 'traci._sendReadOneStringCmd', (['tc.CMD_GET_POLYGON_VARIABLE', 'varID', 'polygonID'], {}), '(tc.... |
from torch import nn as nn
from torch.nn import functional as F
from torch.nn.utils import spectral_norm
import torch
from torch import nn as nn
from torch.nn import functional as F
from torch.nn.utils import spectral_norm
from basicsr.utils.registry import ARCH_REGISTRY
import torch
class add_attn(nn.Module):
... | [
"numpy.uint8",
"os.path.exists",
"torch.nn.BatchNorm2d",
"cv2.imwrite",
"argparse.ArgumentParser",
"torch.load",
"torch.nn.Conv2d",
"shutil.rmtree",
"torch.nn.AvgPool2d",
"numpy.squeeze",
"os.mkdir",
"torch.nn.functional.interpolate",
"torch.nn.functional.relu",
"torch.nn.functional.pad",
... | [((5411, 5436), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (5434, 5436), False, 'import argparse\n'), ((6116, 6135), 'cv2.imread', 'cv2.imread', (['imgpath'], {}), '(imgpath)\n', (6126, 6135), False, 'import cv2\n'), ((573, 659), 'torch.nn.Conv2d', 'nn.Conv2d', (['x_channels', 'x_channels']... |
# Copyright 2017 SrMouraSilva
#
# 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,... | [
"zoom.model.zoom.zoom_param.ZoomParam",
"pluginsmanager.util.dict_tuple.DictTuple"
] | [((1144, 1189), 'pluginsmanager.util.dict_tuple.DictTuple', 'DictTuple', (['params', '(lambda param: param.symbol)'], {}), '(params, lambda param: param.symbol)\n', (1153, 1189), False, 'from pluginsmanager.util.dict_tuple import DictTuple\n'), ((1234, 1281), 'pluginsmanager.util.dict_tuple.DictTuple', 'DictTuple', (['... |
# -----------------------------------------------------------
# Copyright (C) 2020 NVIDIA Corporation. All rights reserved.
# Nvidia Source Code License-NC
# Code written by <NAME>.
# -----------------------------------------------------------
import numpy as np
import os
import ntpath
import time
import termcolor
# c... | [
"time.strftime",
"os.path.join"
] | [((935, 993), 'os.path.join', 'os.path.join', (['opt.checkpoint_dir', 'opt.name', '"""loss_log.txt"""'], {}), "(opt.checkpoint_dir, opt.name, 'loss_log.txt')\n", (947, 993), False, 'import os\n'), ((1063, 1082), 'time.strftime', 'time.strftime', (['"""%c"""'], {}), "('%c')\n", (1076, 1082), False, 'import time\n')] |
import boto3
import json
def lambda_handler(event, context):
print(event)
client = boto3.client('kinesis')
response = client.put_record(
StreamName='pooh',
Data=json.dumps({"score": event['score']}),
PartitionKey='seagull'
)
return { "action": {"score": ... | [
"json.dumps",
"boto3.client"
] | [((102, 125), 'boto3.client', 'boto3.client', (['"""kinesis"""'], {}), "('kinesis')\n", (114, 125), False, 'import boto3\n'), ((205, 242), 'json.dumps', 'json.dumps', (["{'score': event['score']}"], {}), "({'score': event['score']})\n", (215, 242), False, 'import json\n')] |
import uuid
from django.db import models
class TimestampedModel(models.Model):
updated_at = models.DateTimeField(auto_now=True)
created_at = models.DateTimeField(auto_now_add=True)
class Meta:
abstract = True
class KeyModel(TimestampedModel):
key = models.CharField(
max_length=255,... | [
"django.db.models.DateTimeField",
"django.db.models.CharField",
"uuid.uuid4"
] | [((99, 134), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now': '(True)'}), '(auto_now=True)\n', (119, 134), False, 'from django.db import models\n'), ((152, 191), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)'}), '(auto_now_add=True)\n', (172, 191), Fa... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import logging
import math
import numpy as np
import os
from datetime import datetime
import torch
import slowfast.utils.logging as logging
logger = logging.get_logger(__name__)
def check_nan_losses(loss):
"""
De... | [
"slowfast.utils.logging.get_logger",
"datetime.datetime.now",
"torch.cuda.max_memory_allocated",
"os.system",
"math.isnan"
] | [((247, 275), 'slowfast.utils.logging.get_logger', 'logging.get_logger', (['__name__'], {}), '(__name__)\n', (265, 275), True, 'import slowfast.utils.logging as logging\n'), ((444, 460), 'math.isnan', 'math.isnan', (['loss'], {}), '(loss)\n', (454, 460), False, 'import math\n'), ((886, 919), 'torch.cuda.max_memory_allo... |
"""
Runs a model on a single node across N-gpus.
"""
import os
from argparse import ArgumentParser
import pathlib
import numpy as np
import torch
import pytorch_lightning as pl
from lightning_models import LightningModel
from pytorch_lightning import Trainer
from pytorch_lightning.callbacks import EarlyStopping, Mode... | [
"pytorch_lightning.callbacks.ModelCheckpoint",
"pytorch_lightning.callbacks.EarlyStopping",
"lightning_models.LightningModel",
"argparse.ArgumentParser",
"pathlib.Path",
"pytorch_lightning.seed_everything",
"pytorch_lightning.profiler.AdvancedProfiler",
"lightning_models.LightningModel.add_model_speci... | [((650, 672), 'pathlib.Path', 'pathlib.Path', (['exp_path'], {}), '(exp_path)\n', (662, 672), False, 'import pathlib\n'), ((1015, 1038), 'pathlib.Path', 'pathlib.Path', (['ckpt_path'], {}), '(ckpt_path)\n', (1027, 1038), False, 'import pathlib\n'), ((1365, 1388), 'pathlib.Path', 'pathlib.Path', (['prof_path'], {}), '(p... |
from django.conf.urls import patterns, include, url
from inventory_print_label.views import comic, print_history, print_redo
urlpatterns = (
url(r'^inventory/(\d+)/(\d+)/print_labels/comics$', comic.comics_print_labels_page),
url(r'^inventory/(\d+)/(\d+)/print_labels/comics/series/(\d+)$', comic.series_qrcode... | [
"django.conf.urls.url"
] | [((147, 236), 'django.conf.urls.url', 'url', (['"""^inventory/(\\\\d+)/(\\\\d+)/print_labels/comics$"""', 'comic.comics_print_labels_page'], {}), "('^inventory/(\\\\d+)/(\\\\d+)/print_labels/comics$', comic.\n comics_print_labels_page)\n", (150, 236), False, 'from django.conf.urls import patterns, include, url\n'), ... |
"""Test_qpushbutton module."""
import unittest
class TestQPushButton(unittest.TestCase):
"""TestQPushButton Class."""
def test_enabled(self) -> None:
"""Test if the control enabled/disabled."""
from pineboolib.q3widgets import qpushbutton
button = qpushbutton.QPushButton()
... | [
"pineboolib.q3widgets.qpushbutton.QPushButton"
] | [((286, 311), 'pineboolib.q3widgets.qpushbutton.QPushButton', 'qpushbutton.QPushButton', ([], {}), '()\n', (309, 311), False, 'from pineboolib.q3widgets import qpushbutton\n'), ((557, 582), 'pineboolib.q3widgets.qpushbutton.QPushButton', 'qpushbutton.QPushButton', ([], {}), '()\n', (580, 582), False, 'from pineboolib.q... |
import torch.nn as nn
import torch
class Yolo_v2(nn.Module):
def __init__(self, num_classes=3, num_boxes=5):
super(Yolo_v2, self).__init__()
self.num_classes = num_classes
self.num_boxes = num_boxes
# First Stage
self.layer_1 = nn.Sequential(nn.Conv2d(3, 32, 3, 1, 1, bias=False), nn.BatchNorm2d(... | [
"torch.nn.BatchNorm2d",
"torch.nn.LeakyReLU",
"torch.nn.Unfold",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"torch.cat"
] | [((2457, 2475), 'torch.nn.MaxPool2d', 'nn.MaxPool2d', (['(2)', '(2)'], {}), '(2, 2)\n', (2469, 2475), True, 'import torch.nn as nn\n'), ((3860, 3927), 'torch.nn.Unfold', 'nn.Unfold', ([], {'kernel_size': '(self.block_size, self.block_size)', 'stride': '(2)'}), '(kernel_size=(self.block_size, self.block_size), stride=2)... |
import rq
from rq import Queue
from rq import Connection
from redis import Redis
class Worker(object):
def __init__(self, job_queue_name_list):
self.queues = job_queue_name_list
def run(self, redis):
redis_connection = Redis(redis[0], redis[1], password=redis[2])
with Connection(redis... | [
"rq.Connection",
"rq.Worker",
"rq.Queue",
"redis.Redis"
] | [((246, 290), 'redis.Redis', 'Redis', (['redis[0]', 'redis[1]'], {'password': 'redis[2]'}), '(redis[0], redis[1], password=redis[2])\n', (251, 290), False, 'from redis import Redis\n'), ((304, 332), 'rq.Connection', 'Connection', (['redis_connection'], {}), '(redis_connection)\n', (314, 332), False, 'from rq import Con... |
#!/usr/bin/env python
"""Parser for 454 Flowgram files in native binary format."""
__author__ = '<NAME>'
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__license__ = 'GPL'
__version__ = "1.5.3"
__credits__ = ['<NAME>']
__maintainer__ = '<NAME>'
__email__ = '<EMAIL>'
__status__ = 'Prototype'
from cStringIO ... | [
"string.maketrans",
"struct.calcsize",
"cStringIO.StringIO",
"struct.pack",
"struct.unpack"
] | [((12736, 12836), 'string.maketrans', 'string.maketrans', (['"""ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"""', '"""0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"""'], {}), "('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',\n '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ')\n", (12752, 12836), False, 'import string\n'), ((3412, 3422), 'cStringIO.St... |
import os
import time
import math
import utils
from tqdm import tqdm
import logging
from torch.autograd import Variable
from evaluate import evaluate, evaluate_kd
from tensorboardX import SummaryWriter
from torch.optim.lr_scheduler import StepLR, MultiStepLR
# KD train and evaluate
def train_and_evaluate_kd(model, tea... | [
"evaluate.evaluate_kd",
"tensorboardX.SummaryWriter",
"torch.optim.lr_scheduler.MultiStepLR",
"utils.load_checkpoint",
"torch.autograd.Variable",
"utils.RunningAverage",
"os.path.join",
"utils.save_dict_to_json",
"utils.AverageMeter",
"evaluate.evaluate"
] | [((914, 944), 'tensorboardX.SummaryWriter', 'SummaryWriter', ([], {'log_dir': 'log_dir'}), '(log_dir=log_dir)\n', (927, 944), False, 'from tensorboardX import SummaryWriter\n'), ((1012, 1062), 'evaluate.evaluate_kd', 'evaluate_kd', (['teacher_model', 'val_dataloader', 'params'], {}), '(teacher_model, val_dataloader, pa... |
import json
import os
from time import time, sleep
import stat
from subprocess import check_call, check_output, call, Popen, DEVNULL
import shutil
import traceback
import docker
class ProfileStrategy(object):
'''A strategy for profiling the performance of PE problems.'''
name = 'PROFILE'
extensions = {}
... | [
"json.loads",
"os.getuid",
"subprocess.Popen",
"os.access",
"os.path.splitext",
"time.sleep",
"os.chmod",
"os.path.isfile",
"os.path.dirname",
"docker.from_env",
"os.path.basename",
"os.stat",
"traceback.print_exc",
"os.remove"
] | [((1075, 1092), 'docker.from_env', 'docker.from_env', ([], {}), '()\n', (1090, 1092), False, 'import docker\n'), ((6759, 6781), 'os.path.isfile', 'os.path.isfile', (['target'], {}), '(target)\n', (6773, 6781), False, 'import os\n'), ((8614, 8636), 'os.path.isfile', 'os.path.isfile', (['target'], {}), '(target)\n', (862... |
from typing import Text, Any, Dict, List, Union, Optional
from jsonpath_ng import jsonpath, parse
from pprint import pprint
from sagas.conf.conf import cf
def feats_for_path(path:Text):
if path=='_':
return '$.feats'
prefix = '$.'
suffix = '.feats'
parts = path.split('/')
parts_str = '.'.jo... | [
"sagas.conf.conf.cf.engine"
] | [((1114, 1129), 'sagas.conf.conf.cf.engine', 'cf.engine', (['lang'], {}), '(lang)\n', (1123, 1129), False, 'from sagas.conf.conf import cf\n')] |
"""
Checking the downsampling algorithm (reduce size by a factor of 2 in each dimension)
"""
import numpy as np
import matplotlib.pyplot as plt
import sunpy.map
import sunpy.visualization.colormaps as cm
from CIMP import Snapshot as snap
pcase = 1
# dcase = 1: subtract the background
# dcase = 2: take a ratio with ... | [
"CIMP.Snapshot.snapshot.testcase",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.get_cmap",
"matplotlib.pyplot.show"
] | [((678, 710), 'CIMP.Snapshot.snapshot.testcase', 'snap.snapshot.testcase', (['testcase'], {}), '(testcase)\n', (700, 710), True, 'from CIMP import Snapshot as snap\n'), ((1224, 1251), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '[16, 8]'}), '(figsize=[16, 8])\n', (1234, 1251), True, 'import matplotlib.py... |
import unittest
from eating_cookies import eating_cookies
class Test(unittest.TestCase):
def test_eating_cookies_small_n(self):
self.assertEqual(eating_cookies(0), 1)
self.assertEqual(eating_cookies(1), 1)
self.assertEqual(eating_cookies(2), 2)
self.assertEqual(eating_cookies(5), ... | [
"unittest.main",
"eating_cookies.eating_cookies"
] | [((881, 896), 'unittest.main', 'unittest.main', ([], {}), '()\n', (894, 896), False, 'import unittest\n'), ((160, 177), 'eating_cookies.eating_cookies', 'eating_cookies', (['(0)'], {}), '(0)\n', (174, 177), False, 'from eating_cookies import eating_cookies\n'), ((207, 224), 'eating_cookies.eating_cookies', 'eating_cook... |
from __future__ import print_function
from setuptools import setup, find_packages # , Command
conf_dir = "/etc/sawtooth"
setup(
name='token-processor',
version='0.1',
description='Da Client',
author='Author <author email>',
url='https://github.com/author/da',
packages=find_packages(),
ins... | [
"setuptools.find_packages"
] | [((296, 311), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (309, 311), False, 'from setuptools import setup, find_packages\n')] |
import pip
import pygame
import os
def install(package):
if hasattr(pip, 'main'):
pip.main(['install', package])
else:
pip._internal.main(['install', package])
GAMEFILE = "LoK text.xlsx"
WINDOW_WIDTH = 960
WINDOW_HEIGHT = 480
FPS = 30
# R G B
BLACK = ( 0, 0, 0)
LIGHT_BLAC... | [
"pip._internal.main",
"pip.main",
"pygame.Rect"
] | [((1763, 1788), 'pygame.Rect', 'pygame.Rect', (['CONTINUE_BOX'], {}), '(CONTINUE_BOX)\n', (1774, 1788), False, 'import pygame\n'), ((101, 131), 'pip.main', 'pip.main', (["['install', package]"], {}), "(['install', package])\n", (109, 131), False, 'import pip\n'), ((152, 192), 'pip._internal.main', 'pip._internal.main',... |
from django.urls import path, re_path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('update/', views.update, name='update'),
path('delete/', views.delete, name='delete'),
path('books/', views.BooksView.as_view(), name='show-books'),
path('authors/', views.AuthorView.... | [
"django.urls.path"
] | [((79, 114), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (83, 114), False, 'from django.urls import path, re_path\n'), ((120, 164), 'django.urls.path', 'path', (['"""update/"""', 'views.update'], {'name': '"""update"""'}), "('update/', views.upd... |
#!/usr/bin/python3
import time
import numpy as np
import tkinter as tk
from tkinter.ttk import *
class GameBoard(tk.Frame):
def __init__(self, parent, rows=8, columns=8, size=32, color1="white", color2="gray"):
'''size is the size of a square, in pixels'''
self.rows = rows
self.columns = ... | [
"tkinter.PhotoImage",
"tkinter.Canvas",
"tkinter.Tk",
"tkinter.Frame.__init__"
] | [((4184, 4191), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (4189, 4191), True, 'import tkinter as tk\n'), ((4300, 4341), 'tkinter.PhotoImage', 'tk.PhotoImage', ([], {'file': '"""blackpieces/rdt.png"""'}), "(file='blackpieces/rdt.png')\n", (4313, 4341), True, 'import tkinter as tk\n'), ((520, 551), 'tkinter.Frame.__init__... |
import json
import logging
import math
import os
import pathlib
import subprocess
import numpy as np
import shapely.geometry
import shapely.affinity
import venn7.bezier
ROOT = pathlib.Path(os.path.realpath(__file__)).parent
class VennDiagram:
"""A simple symmetric monotone Venn diagram. The diagram is encoded ... | [
"json.loads",
"json.dumps",
"numpy.hypot",
"os.path.realpath",
"numpy.array",
"math.cos",
"numpy.arctan2",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"math.sin",
"math.comb",
"matplotlib.pyplot.subplots",
"json.dump",
"matplotlib.pyplot.show"
] | [((192, 218), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (208, 218), False, 'import os\n'), ((5641, 5667), 'json.loads', 'json.loads', (['process.stdout'], {}), '(process.stdout)\n', (5651, 5667), False, 'import json\n'), ((6138, 6152), 'matplotlib.pyplot.subplots', 'plt.subplots', ([],... |
import json
import boto3
import rds_config
from db_wrapper import execute_statement, extract_records
def put_tag(tag_name):
client = boto3.client('rds-data')
# query database to get next id number
sql = "SELECT MAX(tag_id) FROM tags;"
query_result = execute_statement(client, sql)
max_id = extract... | [
"db_wrapper.execute_statement",
"json.loads",
"boto3.client",
"json.dumps",
"db_wrapper.extract_records"
] | [((139, 163), 'boto3.client', 'boto3.client', (['"""rds-data"""'], {}), "('rds-data')\n", (151, 163), False, 'import boto3\n'), ((269, 299), 'db_wrapper.execute_statement', 'execute_statement', (['client', 'sql'], {}), '(client, sql)\n', (286, 299), False, 'from db_wrapper import execute_statement, extract_records\n'),... |
import click
from flask import Blueprint, current_app
from cache import cache
from koro.geo import resolve_coordinates
cli = Blueprint("flaxen", __name__, cli_group=None)
merge = Blueprint("flaxen-merge", __name__, cli_group="merge")
t = Blueprint("flaxen-tasks", __name__, cli_group="task")
@cli.cli.command("clear-... | [
"click.option",
"commandbus.popular_end_trip.end_trip",
"click.echo",
"commandbus.popular_stations_peak_hour.run",
"cache.cache.clear",
"flask.current_app.app_context",
"koro.geo.resolve_coordinates",
"flask.Blueprint",
"commandbus.shopping_mall_traffic.mall_traffic"
] | [((127, 172), 'flask.Blueprint', 'Blueprint', (['"""flaxen"""', '__name__'], {'cli_group': 'None'}), "('flaxen', __name__, cli_group=None)\n", (136, 172), False, 'from flask import Blueprint, current_app\n'), ((181, 235), 'flask.Blueprint', 'Blueprint', (['"""flaxen-merge"""', '__name__'], {'cli_group': '"""merge"""'})... |
import json
import pandas as pd
class Ingredients():
"""The Ingrediens class contains a list of ingredients and provides access to them. It provides
functionality to search the list of substances using a search term.
If it is generated manually, a list of ingredients can be transferred to it. A... | [
"json.load",
"json.dump",
"pandas.read_excel"
] | [((2793, 2818), 'pandas.read_excel', 'pd.read_excel', (['excel_path'], {}), '(excel_path)\n', (2806, 2818), True, 'import pandas as pd\n'), ((2182, 2202), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (2191, 2202), False, 'import json\n'), ((3636, 3702), 'json.dump', 'json.dump', (['ingrediens_data.__... |
from rest_framework import viewsets
from .models import Batch, BatchIntegrity, TimestampTransaction
from .serializers import BatchSerializer, BatchIntegritySerializer, TimestampTransactionSerializer
# from rest_framework.views import APIView
# from rest_framework.mixins import ListModelMixin, RetrieveModelMixin
from re... | [
"rest_framework.response.Response",
"rest_framework.decorators.action"
] | [((987, 1007), 'rest_framework.decorators.action', 'action', ([], {'detail': '(False)'}), '(detail=False)\n', (993, 1007), False, 'from rest_framework.decorators import action\n'), ((1254, 1279), 'rest_framework.response.Response', 'Response', (['serializer.data'], {}), '(serializer.data)\n', (1262, 1279), False, 'from... |
"""
Backwards-compatible for django-crispy-forms versions previous to 0.9.0
Helpers.py was split into 3 different files in version 0.9.0: helper.py, layout.py and util.py
In order to keep former imports working this file is kept.
This usage will be deprecated and will be removed for django-crispy-forms 1.1.0
"""
imp... | [
"warnings.warn"
] | [((334, 456), 'warnings.warn', 'warnings.warn', (['"""Importing from helpers is deprecated; import from helper or layout instead."""', 'DeprecationWarning'], {}), "(\n 'Importing from helpers is deprecated; import from helper or layout instead.'\n , DeprecationWarning)\n", (347, 456), False, 'import warnings\n')] |
from flask import (
blueprints,
current_app,
flash,
jsonify,
redirect,
request,
url_for
)
from sqlalchemy.exc import IntegrityError
from patchserver.exc import (
InvalidPatchDefinitionError,
InvalidWebhook,
PatchArchiveRestoreFailure,
SoftwareTitleNotFound,
Unauthorized
... | [
"flask.request.args.get",
"flask.flash",
"flask.jsonify",
"flask.url_for",
"flask.blueprints.Blueprint",
"flask.current_app.logger.error"
] | [((335, 383), 'flask.blueprints.Blueprint', 'blueprints.Blueprint', (['"""error_handlers"""', '__name__'], {}), "('error_handlers', __name__)\n", (355, 383), False, 'from flask import blueprints, current_app, flash, jsonify, redirect, request, url_for\n'), ((455, 492), 'flask.current_app.logger.error', 'current_app.log... |
from dcmn_seq2seq.utils import parse_mc, select_field
import logging
import os
import torch
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
from tqdm import tqdm
logging.basicConfig(format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',
datefmt='%m... | [
"logging.basicConfig",
"logging.getLogger",
"dcmn_seq2seq.utils.parse_mc",
"torch.LongTensor",
"tqdm.tqdm",
"torch.utils.data.SequentialSampler",
"os.path.join",
"torch.utils.data.TensorDataset",
"torch.utils.data.DataLoader",
"dcmn_seq2seq.utils.select_field"
] | [((204, 347), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(name)s - %(message)s"""', 'datefmt': '"""%m/%d/%Y %H:%M:%S"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt=\n '%m/%d/%Y %H:%M:%S', level=l... |
from datetime import date
# Exercise 012 - Military Enlistment
"""Make a program that reads a young person's year of birth and reports, according to their age,whether he is still going to enlist in the military,
whether it's the exact time to enlist or whether it's past the time of enlistment. Your program should al... | [
"datetime.date.today"
] | [((463, 475), 'datetime.date.today', 'date.today', ([], {}), '()\n', (473, 475), False, 'from datetime import date\n')] |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
from tempfile import NamedTemporaryFile
import gzip
import os
import io
from petl.test.helpers import ieq, eq_
from petl.io.text import fromtext, totext
def test_fromtext():
# initial data
f = NamedTemporaryFile(dele... | [
"gzip.open",
"os.rename",
"petl.test.helpers.eq_",
"petl.test.helpers.ieq",
"io.open",
"tempfile.NamedTemporaryFile",
"petl.io.text.fromtext",
"petl.io.text.totext"
] | [((297, 340), 'tempfile.NamedTemporaryFile', 'NamedTemporaryFile', ([], {'delete': '(False)', 'mode': '"""wb"""'}), "(delete=False, mode='wb')\n", (315, 340), False, 'from tempfile import NamedTemporaryFile\n'), ((465, 499), 'petl.io.text.fromtext', 'fromtext', (['f.name'], {'encoding': '"""ascii"""'}), "(f.name, encod... |
from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from .views import PinCommentViewSet, PinIssueViewSet
app_name = 'catfood.apps.issues'
pin_issue_list = PinIssueViewSet.as_view({'get': 'list', 'post': 'create'})
pin_issue_detail = PinIssueViewSet.as_view({'delete': 'destroy'... | [
"django.urls.path"
] | [((526, 578), 'django.urls.path', 'path', (['"""pins/"""', 'pin_issue_list'], {'name': '"""pin-issue-list"""'}), "('pins/', pin_issue_list, name='pin-issue-list')\n", (530, 578), False, 'from django.urls import path\n'), ((588, 653), 'django.urls.path', 'path', (['"""pins/<int:pk>/"""', 'pin_issue_detail'], {'name': '"... |
'''
==========================================================================
test_sinks.py
==========================================================================
A collection of test sinks.
Author : <NAME>
Date : Feb 3, 2020
'''
from pymtl3 import *
from pymtl3.stdlib.ifcs import RecvRTL2SendCL
from pymtl3.std... | [
"pymtl3.stdlib.stream.ifcs.RecvIfcRTL",
"pymtl3.stdlib.ifcs.RecvRTL2SendCL"
] | [((3529, 3551), 'pymtl3.stdlib.stream.ifcs.RecvIfcRTL', 'RecvIfcRTL', (['s.PhitType'], {}), '(s.PhitType)\n', (3539, 3551), False, 'from pymtl3.stdlib.stream.ifcs import RecvIfcRTL\n'), ((3730, 3756), 'pymtl3.stdlib.ifcs.RecvRTL2SendCL', 'RecvRTL2SendCL', (['s.PhitType'], {}), '(s.PhitType)\n', (3744, 3756), False, 'fr... |
from wtforms import TextField,BooleanField,PasswordField,IntegerField,FloatField,FileField
from flask_wtf import Form
from flask.ext.wtf.html5 import URLField
from wtforms.validators import ValidationError,InputRequired,EqualTo
from models import User
import re
EMAIL_VALIDATE = "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA... | [
"wtforms.FileField",
"re.compile",
"wtforms.validators.ValidationError",
"flask.ext.wtf.html5.URLField",
"wtforms.validators.EqualTo",
"models.User.email.ilike",
"models.User.email.like",
"wtforms.validators.InputRequired"
] | [((1627, 1643), 'flask.ext.wtf.html5.URLField', 'URLField', (['"""Link"""'], {}), "('Link')\n", (1635, 1643), False, 'from flask.ext.wtf.html5 import URLField\n'), ((1653, 1677), 'wtforms.FileField', 'FileField', (['"""Image image"""'], {}), "('Image image')\n", (1662, 1677), False, 'from wtforms import TextField, Bool... |
from django.db import models
from django.contrib.auth.models import User
from django.urls import reverse
class PhoneBook(models.Model):
name = models.CharField(max_length=20, null=False, blank=False , db_index=True, verbose_name='Name')
last_name= models.CharField(max_length=20, null=False, blank=False , db... | [
"django.urls.reverse",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((151, 247), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)', 'null': '(False)', 'blank': '(False)', 'db_index': '(True)', 'verbose_name': '"""Name"""'}), "(max_length=20, null=False, blank=False, db_index=True,\n verbose_name='Name')\n", (167, 247), False, 'from django.db import models... |
# -*- coding: utf-8 -*-
import configparser
import copy
import importlib
import os
import pkgutil
from collections import defaultdict
def find_subclasses(parent_class, recursive=False):
"""Find the subclasses of a given parent class."""
subclasses = parent_class.__subclasses__()
if recursive:
fo... | [
"importlib.import_module",
"configparser.ConfigParser",
"os.path.isfile",
"collections.defaultdict",
"copy.deepcopy",
"pkgutil.iter_modules"
] | [((522, 548), 'collections.defaultdict', 'defaultdict', (['recursivedict'], {}), '(recursivedict)\n', (533, 548), False, 'from collections import defaultdict\n'), ((588, 633), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {'interpolation': 'None'}), '(interpolation=None)\n', (613, 633), False, 'import ... |
"""Non-core-specific tests for cachier."""
import os
from cachier.core import (
MAX_WORKERS_ENVAR_NAME,
DEFAULT_MAX_WORKERS,
_max_workers,
_set_max_workers,
_get_executor
)
def test_max_workers():
"""Just call this function for coverage."""
try:
del os.environ[MAX_WORKERS_ENVAR_N... | [
"cachier.core._get_executor",
"cachier.core._set_max_workers",
"cachier.core._max_workers"
] | [((487, 502), 'cachier.core._get_executor', '_get_executor', ([], {}), '()\n', (500, 502), False, 'from cachier.core import MAX_WORKERS_ENVAR_NAME, DEFAULT_MAX_WORKERS, _max_workers, _set_max_workers, _get_executor\n'), ((507, 527), 'cachier.core._get_executor', '_get_executor', (['(False)'], {}), '(False)\n', (520, 52... |
from unittest import TestCase
from camunda.variables.variables import Variables
class VariablesTest(TestCase):
def test_get_variable_returns_none_when_variable_absent(self):
variables = Variables({})
self.assertIsNone(variables.get_variable("var1"))
def test_get_variable_returns_value_when_... | [
"camunda.variables.variables.Variables.format",
"camunda.variables.variables.Variables"
] | [((202, 215), 'camunda.variables.variables.Variables', 'Variables', (['{}'], {}), '({})\n', (211, 215), False, 'from camunda.variables.variables import Variables\n'), ((364, 397), 'camunda.variables.variables.Variables', 'Variables', (["{'var1': {'value': 1}}"], {}), "({'var1': {'value': 1}})\n", (373, 397), False, 'fr... |
#!/usr/bin/env python3
#<NAME>, Sanger Institute, 2019
import sys
import argparse
from collections import defaultdict
def main():
parser = argparse.ArgumentParser(description='My nice tool.')
parser.add_argument('--input', metavar='INPUTFILE', default="/dev/stdin", help='The input file.')
parser.add_arg... | [
"argparse.ArgumentParser"
] | [((147, 199), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""My nice tool."""'}), "(description='My nice tool.')\n", (170, 199), False, 'import argparse\n')] |
import hashlib
from assemblyline.common import entropy
from assemblyline.common.charset import safe_str
DEFAULT_BLOCKSIZE = 65536
# noinspection PyBroadException
def get_digests_for_file(path, blocksize=DEFAULT_BLOCKSIZE,
calculate_entropy=True,
on_first_block=lambd... | [
"hashlib.sha256",
"hashlib.md5",
"hashlib.sha1",
"assemblyline.common.charset.safe_str",
"assemblyline.common.entropy.BufferedCalculator"
] | [((639, 652), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (650, 652), False, 'import hashlib\n'), ((664, 678), 'hashlib.sha1', 'hashlib.sha1', ([], {}), '()\n', (676, 678), False, 'import hashlib\n'), ((692, 708), 'hashlib.sha256', 'hashlib.sha256', ([], {}), '()\n', (706, 708), False, 'import hashlib\n'), ((1519, ... |
#!/usr/bin/env python3
from scholarly import scholarly
AUTHOR = 'Fernandez-Lozano, Carlos'
SCHOLARLY_FILL_SECTIONS = ['indices']
# https://scholarly.readthedocs.io/en/latest/quickstart.html#fill-the-author-and-publications-container-objects-with-additional-information
search_query = scholarly.searc... | [
"scholarly.scholarly.search_author",
"scholarly.scholarly.fill"
] | [((305, 336), 'scholarly.scholarly.search_author', 'scholarly.search_author', (['AUTHOR'], {}), '(AUTHOR)\n', (328, 336), False, 'from scholarly import scholarly\n'), ((386, 442), 'scholarly.scholarly.fill', 'scholarly.fill', (['author'], {'sections': 'SCHOLARLY_FILL_SECTIONS'}), '(author, sections=SCHOLARLY_FILL_SECTI... |
#!/usr/bin/env python
import click as ck
import numpy as np
import pandas as pd
import gzip
import os
import torch as th
from collections import Counter
from aminoacids import MAXLEN, to_ngrams
import logging
import json
from sklearn.metrics import roc_curve, auc, matthews_corrcoef
from utils import get_goplus_defs,... | [
"logging.basicConfig",
"pandas.read_pickle",
"numpy.mean",
"click.option",
"sklearn.metrics.auc",
"torch.load",
"numpy.sum",
"deepgoel.load_normal_forms",
"torch_utils.FastTensorDataLoader",
"utils.Ontology",
"utils.get_goplus_defs",
"click.command"
] | [((343, 382), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (362, 382), False, 'import logging\n'), ((493, 505), 'click.command', 'ck.command', ([], {}), '()\n', (503, 505), True, 'import click as ck\n'), ((507, 574), 'click.option', 'ck.option', (['"""--data-r... |
import py
from pypy.rpython.lltypesystem import lltype
from pypy.jit.timeshifter import rvalue
from pypy.jit.timeshifter import rcontainer
from pypy.jit.timeshifter.test.support import *
def test_create_int_redbox_var():
jitstate = FakeJITState()
gv = FakeGenVar()
box = rvalue.IntRedBox("dummy kind", gv)
... | [
"pypy.jit.timeshifter.rvalue.IntRedBox",
"pypy.rpython.lltypesystem.lltype.Struct",
"py.test.raises",
"pypy.jit.timeshifter.rvalue.copy_memo",
"pypy.rpython.lltypesystem.lltype.Ptr",
"pypy.jit.timeshifter.rvalue.PtrRedBox"
] | [((285, 319), 'pypy.jit.timeshifter.rvalue.IntRedBox', 'rvalue.IntRedBox', (['"""dummy kind"""', 'gv'], {}), "('dummy kind', gv)\n", (301, 319), False, 'from pypy.jit.timeshifter import rvalue\n'), ((605, 639), 'pypy.jit.timeshifter.rvalue.IntRedBox', 'rvalue.IntRedBox', (['"""dummy kind"""', 'gv'], {}), "('dummy kind'... |
#!/usr/bin/env python3
import argparse
import sys
# Check correct usage
parser = argparse.ArgumentParser(description="Parse some data.")
parser.add_argument('input', metavar='input', type=str,
help='Input data file.')
args = parser.parse_args()
data = []
# Parse the input file
def parseInput(in... | [
"argparse.ArgumentParser",
"sys.exit"
] | [((83, 138), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Parse some data."""'}), "(description='Parse some data.')\n", (106, 138), False, 'import argparse\n'), ((395, 440), 'sys.exit', 'sys.exit', (["('Unable to open input file: ' + inp)"], {}), "('Unable to open input file: ' + inp)\... |
#<NAME>
#october 6, 20202
import pysam
import pandas as pd
import numpy as np
def get_sample_counts(bam_file, reference):
bamfile_obj = pysam.AlignmentFile(bam_file,'rb')
ref = open(reference + "/chrName.txt",'r')
curr_file_counts = []
ref_list = []
for seq in ref:
seq = seq.strip()
curr_seq_reads = bamf... | [
"pandas.DataFrame",
"pandas.concat",
"pysam.AlignmentFile"
] | [((1464, 1489), 'pandas.concat', 'pd.concat', (['counts'], {'axis': '(1)'}), '(counts, axis=1)\n', (1473, 1489), True, 'import pandas as pd\n'), ((141, 176), 'pysam.AlignmentFile', 'pysam.AlignmentFile', (['bam_file', '"""rb"""'], {}), "(bam_file, 'rb')\n", (160, 176), False, 'import pysam\n'), ((506, 536), 'pandas.Dat... |
#!/usr/bin/env python
# encoding: utf-8
"""
File name: project.py
Function Des: ...
~~~~~~~~~~
author: 1_x7 <<EMAIL>> <http://lixuanqi.github.io>
"""
from flask_restful import fields
project_single_fields = {
'id': fields.Integer,
'name': fields.String,
'value': fields.Integer
}
projec... | [
"flask_restful.fields.Nested"
] | [((362, 398), 'flask_restful.fields.Nested', 'fields.Nested', (['project_single_fields'], {}), '(project_single_fields)\n', (375, 398), False, 'from flask_restful import fields\n')] |
from lxml import etree
import lxml
import pickle
with open('/Users/billchen/OneDrive/Workspace/LearningRepo/Python3/专利检索爬虫/20050101_20101231_B09B_PAGE1.pickle', 'rb') as f:
source = ''
p = pickle.load(f)
html = etree.HTML(p)
| [
"pickle.load",
"lxml.etree.HTML"
] | [((220, 233), 'lxml.etree.HTML', 'etree.HTML', (['p'], {}), '(p)\n', (230, 233), False, 'from lxml import etree\n'), ((198, 212), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (209, 212), False, 'import pickle\n')] |
import os
from typing import Dict, Any, Union
from urllib.request import URLopener
from requests.sessions import Session
from library.authentication import Authentication
from library.entities import Entities
from library.jobs import Jobs
from library.models.export_format import ExportFormat
from library.models.job_t... | [
"requests.sessions.Session",
"library.jobs.Jobs",
"urllib.request.URLopener",
"os.path.join",
"library.sequences.Sequences",
"library.shareables.Shareables",
"library.authentication.Authentication",
"library.entities.Entities"
] | [((640, 649), 'requests.sessions.Session', 'Session', ([], {}), '()\n', (647, 649), False, 'from requests.sessions import Session\n'), ((725, 749), 'library.authentication.Authentication', 'Authentication', (['base_url'], {}), '(base_url)\n', (739, 749), False, 'from library.authentication import Authentication\n'), ((... |
from pyqtgraph import QtCore
from lxml import etree
from .Data import ElementNode, Node
class EtreeModel(QtCore.QAbstractItemModel):
sortRole = QtCore.Qt.UserRole
filterRole = QtCore.Qt.UserRole + 1
def __init__(self, root, parent=None):
super(EtreeModel, self).__init__(parent)
if not isi... | [
"lxml.etree.Element",
"pyqtgraph.QtCore.QModelIndex"
] | [((2133, 2153), 'pyqtgraph.QtCore.QModelIndex', 'QtCore.QModelIndex', ([], {}), '()\n', (2151, 2153), False, 'from pyqtgraph import QtCore\n'), ((2428, 2448), 'pyqtgraph.QtCore.QModelIndex', 'QtCore.QModelIndex', ([], {}), '()\n', (2446, 2448), False, 'from pyqtgraph import QtCore\n'), ((2948, 2968), 'pyqtgraph.QtCore.... |
from django.shortcuts import render
from django.http import HttpResponse
from .models import Listing
import requests
import json
# Create your views here.
def index(request):
listings = Listing.objects.all()
context = {
'listings' : listings
}
return render(request, 'listings/listings.html', ... | [
"django.shortcuts.render"
] | [((278, 328), 'django.shortcuts.render', 'render', (['request', '"""listings/listings.html"""', 'context'], {}), "(request, 'listings/listings.html', context)\n", (284, 328), False, 'from django.shortcuts import render\n'), ((375, 415), 'django.shortcuts.render', 'render', (['request', '"""listings/listing.html"""'], {... |
import os
import torch
import create_data
from model import shape_net
import numpy as np
def align_bone_len(opt_, pre_):
opt = opt_.copy()
pre = pre_.copy()
opt_align = opt.copy()
for i in range(opt.shape[0]):
ratio = pre[i][6] / opt[i][6]
opt_align[i] = ratio * opt_align[i]
... | [
"numpy.abs",
"model.shape_net.ShapeNet",
"torch.Tensor",
"os.path.join",
"create_data.DataSet",
"numpy.load"
] | [((688, 708), 'model.shape_net.ShapeNet', 'shape_net.ShapeNet', ([], {}), '()\n', (706, 708), False, 'from model import shape_net\n'), ((923, 968), 'create_data.DataSet', 'create_data.DataSet', ([], {'_mano_root': '"""mano/models"""'}), "(_mano_root='mano/models')\n", (942, 968), False, 'import create_data\n'), ((747, ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# avro2csv - Avro file converter to CSV
# Copyright (c) 2021 <NAME> <<EMAIL>>
#
# Requirements: pip install avro
#
import argparse
import csv
import sys
from os.path import basename
from typing import Dict, List, NoReturn
from avro.datafile import DataFileReader
from ... | [
"avro.io.DatumReader",
"os.path.basename",
"argparse.ArgumentParser",
"sys.exit"
] | [((790, 914), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""avro2csv"""', 'usage': '"""%(prog)s [OPTIONS]"""', 'description': '"""Converts an Avro file into CSV file."""'}), "(prog='avro2csv', usage='%(prog)s [OPTIONS]',\n description='Converts an Avro file into CSV file.')\n", (813, 914), ... |
# -*- coding: utf-8 -*-
'''
(c) Copyright 2013 Telefonica, I+D. Printed in Spain (Europe). All Rights
Reserved.
The copyright to the software program(s) is property of Telefonica I+D.
The program(s) may be used and or copied only with the express written
consent of Telefonica I+D or in accordance with the terms and co... | [
"common.api_utils.APIUtils",
"string.Template",
"common.mongo_utils.MongoUtils",
"common.web_utils.WebUtils",
"lettuce.step",
"common.rest_utils.RestUtils"
] | [((649, 660), 'common.rest_utils.RestUtils', 'RestUtils', ([], {}), '()\n', (658, 660), False, 'from common.rest_utils import RestUtils\n'), ((673, 683), 'common.api_utils.APIUtils', 'APIUtils', ([], {}), '()\n', (681, 683), False, 'from common.api_utils import APIUtils\n'), ((698, 710), 'common.mongo_utils.MongoUtils'... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.conf.urls import patterns
from django.conf.urls import url
from networkapi.interface.resource.InterfaceDisconnectResource import InterfaceDisconnectResource
from networkapi.interface.resource.InterfaceGetResource import InterfaceGetResource
fr... | [
"networkapi.interface.resource.InterfaceResource.InterfaceResource",
"networkapi.interface.resource.InterfaceGetResource.InterfaceGetResource",
"django.conf.urls.url",
"networkapi.interface.resource.InterfaceDisconnectResource.InterfaceDisconnectResource"
] | [((418, 437), 'networkapi.interface.resource.InterfaceResource.InterfaceResource', 'InterfaceResource', ([], {}), '()\n', (435, 437), False, 'from networkapi.interface.resource.InterfaceResource import InterfaceResource\n'), ((463, 485), 'networkapi.interface.resource.InterfaceGetResource.InterfaceGetResource', 'Interf... |