code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# coding: utf-8
import os
import torch
import torch.nn as nn
import torch.optim as optim
from flearn.client import Client
from flearn.common.trainer import Trainer
from flearn.common.utils import setup_seed
from flearn.server import Server
from flearn.server.Communicator import Communicator as sc
setup_seed(0)
os.en... | [
"os.mkdir",
"flearn.common.utils.setup_seed",
"torch.randint",
"os.path.isdir",
"torch.nn.CrossEntropyLoss",
"torch.nn.Linear",
"flearn.client.Client",
"flearn.server.Server",
"torch.rand",
"flearn.server.Communicator.Communicator"
] | [((301, 314), 'flearn.common.utils.setup_seed', 'setup_seed', (['(0)'], {}), '(0)\n', (311, 314), False, 'from flearn.common.utils import setup_seed\n'), ((615, 628), 'flearn.server.Communicator.Communicator', 'sc', ([], {'conf': 'conf'}), '(conf=conf)\n', (617, 628), True, 'from flearn.server.Communicator import Commu... |
import asyncio
import discord
import wavelink
from discord.ext import commands
from src.embeds.music.choose_track_embed import ChooseTrackEmbed, ChooseTrackOptions
from src.helpers.music.queue import Queue, QueueIsEmptyError
from src.text import get_text
class AlreadyConnectedToChannelError(commands.CommandError):
... | [
"src.helpers.music.queue.Queue",
"src.embeds.music.choose_track_embed.ChooseTrackOptions.keys",
"src.text.get_text",
"src.embeds.music.choose_track_embed.ChooseTrackEmbed"
] | [((642, 649), 'src.helpers.music.queue.Queue', 'Queue', ([], {}), '()\n', (647, 649), False, 'from src.helpers.music.queue import Queue, QueueIsEmptyError\n'), ((2206, 2235), 'src.embeds.music.choose_track_embed.ChooseTrackEmbed', 'ChooseTrackEmbed', (['ctx', 'tracks'], {}), '(ctx, tracks)\n', (2222, 2235), False, 'fro... |
from setuptools import setup
setup(name='armDOF_0',
version='1.0',
install_requires=['gym']
)
| [
"setuptools.setup"
] | [((30, 93), 'setuptools.setup', 'setup', ([], {'name': '"""armDOF_0"""', 'version': '"""1.0"""', 'install_requires': "['gym']"}), "(name='armDOF_0', version='1.0', install_requires=['gym'])\n", (35, 93), False, 'from setuptools import setup\n')] |
from __future__ import absolute_import, division, print_function
from os.path import join as pjoin
from pathlib import Path
import io
import re
import pytorch_3T27T as pkg
#root = Path(pkg.__path__[0]).parent.absolute()
#readme = pjoin(root, 'README.md')
#def read_long_description(readme):
# text_type = type(u"")
#... | [
"os.path.join"
] | [((2035, 2053), 'os.path.join', 'pjoin', (['"""data"""', '"""*"""'], {}), "('data', '*')\n", (2040, 2053), True, 'from os.path import join as pjoin\n')] |
#!/usr/bin/env python3
# -*- coding:UTF-8 -*-
# File Name: androidbot/alipay.py
# Author: Shechucheng
# Created Time: 2020-06-24 22:15:20
import os
import sys
import time
from threading import Thread
from os.path import join
from collections.abc import Iterable
from .tools import Images, App, Device, get_bounds, Ma... | [
"threading.Thread",
"time.strftime",
"time.time",
"time.sleep",
"os.path.join"
] | [((3416, 3431), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (3426, 3431), False, 'import time\n'), ((6210, 6221), 'time.time', 'time.time', ([], {}), '()\n', (6219, 6221), False, 'import time\n'), ((2104, 2132), 'os.path.join', 'join', (['storage_path', 'filename'], {}), '(storage_path, filename)\n', (2108,... |
from pathlib import Path
import sys
path = str(Path(Path(__file__).parent.absolute()).parent.absolute())
sys.path.insert(0, path)
from dataloader.dc_data_loader import DataLoader
from preprocess.twostep_preprocessor import TwoStepPreprocessor
from models.svm_model import SvmModel
from trainers.svm_trainer import SvmT... | [
"trainers.svm_trainer.SvmTrainer",
"dataloader.dc_data_loader.DataLoader",
"sys.path.insert",
"models.svm_model.SvmModel",
"pathlib.Path",
"utils.config.process_config",
"utils.utils.get_args",
"preprocess.twostep_preprocessor.TwoStepPreprocessor"
] | [((106, 130), 'sys.path.insert', 'sys.path.insert', (['(0)', 'path'], {}), '(0, path)\n', (121, 130), False, 'import sys\n'), ((654, 672), 'dataloader.dc_data_loader.DataLoader', 'DataLoader', (['config'], {}), '(config)\n', (664, 672), False, 'from dataloader.dc_data_loader import DataLoader\n'), ((786, 828), 'preproc... |
import io
import sys
import numpy as np
def read_input_npy(filepath):
if not filepath and sys.stdin.isatty():
raise RuntimeError("Please specify the npy_filepath or give npy file via stdin.")
data = filepath.read_bytes() if filepath else sys.stdin.buffer.read()
buf = io.BytesIO()
buf.write(da... | [
"io.BytesIO",
"numpy.save",
"sys.stdin.isatty",
"numpy.load",
"sys.stdin.buffer.read"
] | [((291, 303), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (301, 303), False, 'import io\n'), ((351, 382), 'numpy.load', 'np.load', (['buf'], {'allow_pickle': '(True)'}), '(buf, allow_pickle=True)\n', (358, 382), True, 'import numpy as np\n'), ((423, 435), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (433, 435), Fals... |
#!/usr/bin/env python3
from aws_cdk import core
from cognito_appsync.cognito_appsync_stack import CognitoAppsyncStack
app = core.App()
CognitoAppsyncStack(app, "cognito-appsync")
app.synth()
| [
"aws_cdk.core.App",
"cognito_appsync.cognito_appsync_stack.CognitoAppsyncStack"
] | [((128, 138), 'aws_cdk.core.App', 'core.App', ([], {}), '()\n', (136, 138), False, 'from aws_cdk import core\n'), ((139, 182), 'cognito_appsync.cognito_appsync_stack.CognitoAppsyncStack', 'CognitoAppsyncStack', (['app', '"""cognito-appsync"""'], {}), "(app, 'cognito-appsync')\n", (158, 182), False, 'from cognito_appsyn... |
# *****************************************************************************
# © Copyright IBM Corp. 2018. All Rights Reserved.
#
# This program and the accompanying materials
# are made available under the terms of the Apache V2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/... | [
"pyarrow.Table.from_pandas",
"s3fs.S3FileSystem",
"pyarrow.parquet.ParquetWriter",
"datetime.datetime.now",
"pandas.concat"
] | [((2710, 2892), 's3fs.S3FileSystem', 's3fs.S3FileSystem', ([], {'key': "self.cos_credentials['cos_hmac_keys']['access_key_id']", 'secret': "self.cos_credentials['cos_hmac_keys']['secret_access_key']", 'client_kwargs': 'client_kwargs'}), "(key=self.cos_credentials['cos_hmac_keys']['access_key_id'\n ], secret=self.cos... |
import turtle
t = turtle.Turtle()
# screen
s = turtle.Screen()
s.bgcolor("black")
t.pencolor("white")
t.speed(0)
t.penup()
t.goto(0, 200)
t.pendown()
a = 0
for b in range(210):
t.forward(a)
t.right(b)
a += 3
t.hideturtle()
turtle.done()
| [
"turtle.Screen",
"turtle.done",
"turtle.Turtle"
] | [((19, 34), 'turtle.Turtle', 'turtle.Turtle', ([], {}), '()\n', (32, 34), False, 'import turtle\n'), ((49, 64), 'turtle.Screen', 'turtle.Screen', ([], {}), '()\n', (62, 64), False, 'import turtle\n'), ((243, 256), 'turtle.done', 'turtle.done', ([], {}), '()\n', (254, 256), False, 'import turtle\n')] |
import sys
import click
from parsec.cli import pass_context
from parsec.decorators import custom_exception
@click.command('cmp')
@click.argument("method", type=str, required=True)
@click.argument("cmp_with", type=str, required=True)
@pass_context
@custom_exception
def cli(ctx, method, cmp_with):
"""comparison too... | [
"sys.stderr.write",
"sys.stdin.read",
"click.argument",
"click.command"
] | [((110, 130), 'click.command', 'click.command', (['"""cmp"""'], {}), "('cmp')\n", (123, 130), False, 'import click\n'), ((132, 181), 'click.argument', 'click.argument', (['"""method"""'], {'type': 'str', 'required': '(True)'}), "('method', type=str, required=True)\n", (146, 181), False, 'import click\n'), ((183, 234), ... |
# -*- coding:utf-8 -*-
# @project: BlockShuffleTest
# @filename: train
# @author: swift
# @source: https://github.com/liucongg/BlockShuffleTest
"""
文件说明:
"""
import torch
import json
import os
from torch.utils.data import Dataset
import logging
from torch.nn.utils.rnn import pad_sequence
logger = logg... | [
"torch.load",
"os.path.exists",
"logging.getLogger",
"torch.save",
"torch.nn.utils.rnn.pad_sequence",
"torch.tensor"
] | [((316, 343), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (333, 343), False, 'import logging\n'), ((3172, 3235), 'torch.nn.utils.rnn.pad_sequence', 'pad_sequence', (['input_ids_list'], {'batch_first': '(True)', 'padding_value': '(0)'}), '(input_ids_list, batch_first=True, padding_value... |
'''
delete_tab.py: implementation of the "Delete records" tab
Copyright
---------
Copyright (c) 2021-2022 by the California Institute of Technology. This code
is open-source software released under a 3-clause BSD license. Please see the
file "LICENSE" for more information.
'''
from commonpy.data_utils import uni... | [
"commonpy.interrupt.interrupt",
"pywebio.output.clear",
"foliage.folio.unique_identifiers",
"foliage.folio.Folio",
"foliage.ui.confirm",
"pywebio.output.use_scope",
"json.loads",
"pywebio.output.set_processbar",
"foliage.ui.tell_success",
"traceback.format_exc",
"pywebio.output.put_processbar",
... | [((2343, 2381), 'sidetrack.log', 'log', (['f"""generating delete tab contents"""'], {}), "(f'generating delete tab contents')\n", (2346, 2381), False, 'from sidetrack import set_debug, log\n'), ((3541, 3561), 'sidetrack.log', 'log', (['f"""clearing tab"""'], {}), "(f'clearing tab')\n", (3544, 3561), False, 'from sidetr... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1. / np.sqrt(fan_in)
return -lim, lim
class ActorNetwork(nn.Module):
def __init__(self, observation_size, action_size, use_batch_norm, seed,
... | [
"torch.manual_seed",
"torch.nn.BatchNorm1d",
"torch.cat",
"torch.nn.Linear",
"numpy.sqrt"
] | [((168, 183), 'numpy.sqrt', 'np.sqrt', (['fan_in'], {}), '(fan_in)\n', (175, 183), True, 'import numpy as np\n'), ((1275, 1328), 'torch.nn.Linear', 'nn.Linear', (['observation_size', 'fc1_units'], {'bias': 'use_bias'}), '(observation_size, fc1_units, bias=use_bias)\n', (1284, 1328), True, 'import torch.nn as nn\n'), ((... |
from typing import List, Dict
from aiohttp import web
from openapi_server.models.computer_set import ComputerSet
from openapi_server.models.free_style_build import FreeStyleBuild
from openapi_server.models.free_style_project import FreeStyleProject
from openapi_server.models.hudson import Hudson
from openapi_server.mo... | [
"aiohttp.web.Response"
] | [((645, 669), 'aiohttp.web.Response', 'web.Response', ([], {'status': '(200)'}), '(status=200)\n', (657, 669), False, 'from aiohttp import web\n'), ((805, 829), 'aiohttp.web.Response', 'web.Response', ([], {'status': '(200)'}), '(status=200)\n', (817, 829), False, 'from aiohttp import web\n'), ((1010, 1034), 'aiohttp.w... |
import os
from flask import Flask
this_file_dir = os.path.dirname(os.path.realpath(__file__))
data_dir = '{}/data'.format(this_file_dir)
output_dir = '{}/out'.format(this_file_dir)
downloads_dir = '{}/downloads'.format(data_dir)
def create_app():
app = Flask(__name__)
return app
| [
"os.path.realpath",
"flask.Flask"
] | [((68, 94), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (84, 94), False, 'import os\n'), ((263, 278), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (268, 278), False, 'from flask import Flask\n')] |
#!/usr/bin/env python
__author__ = "bt3"
def qs(array):
'''
>>> qs([4,1,6,2,7,9,3])
[1, 2, 3, 4, 6, 7, 9]
'''
if len(array) < 2:
return array
piv = len(array)//2
piv_element = array[piv]
new_array = array[:piv] + array[piv+1:]
left = [a for a in new_array if a <= piv_el... | [
"doctest.testmod"
] | [((927, 944), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (942, 944), False, 'import doctest\n')] |
import pyttsx3
import pyttsx3
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from interpretador import interpretar
# texto para voz
speaker = pyttsx3.init()
def navegar(ordens):
ordens="navegar"
if ordens == "navegar":
speaker.say(f... | [
"interpretador.interpretar",
"pyttsx3.init",
"selenium.webdriver.Chrome"
] | [((200, 214), 'pyttsx3.init', 'pyttsx3.init', ([], {}), '()\n', (212, 214), False, 'import pyttsx3\n'), ((1443, 1514), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'executable_path': '"""C:/Users/user/kali/chromedriver.exe"""'}), "(executable_path='C:/Users/user/kali/chromedriver.exe')\n", (1459, 1514), False... |
import json
import os
from typing import Callable, Any
import yaml
class DatabaseEncoder:
def encode(self, data: dict) -> str:
raise NotImplementedError()
def decode(self, data: str) -> dict:
raise NotImplementedError()
JSON: 'DatabaseEncoder' = None
YAML: 'DatabaseEncoder' = None
... | [
"os.remove",
"json.loads",
"yaml.safe_dump",
"os.path.exists",
"json.dumps",
"yaml.safe_load"
] | [((415, 441), 'json.dumps', 'json.dumps', (['data'], {'indent': '(2)'}), '(data, indent=2)\n', (425, 441), False, 'import json\n'), ((499, 515), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (509, 515), False, 'import json\n'), ((612, 632), 'yaml.safe_dump', 'yaml.safe_dump', (['data'], {}), '(data)\n', (626,... |
#' % HW19 - BIOE232
#' % <NAME>
#' % May 7, 2015
#' My First Python Script!
# For outputting nice HTML file/PDF
# import pweave
import pprint as pp
# All the essentials
import numpy as np # np.__version__
import matplotlib.pyplot as plt
import math
from decimal import *
from pylab import *
#' Question 1
# Declare ... | [
"matplotlib.pyplot.figure",
"math.log10",
"pprint.pprint",
"numpy.linspace"
] | [((369, 396), 'numpy.linspace', 'np.linspace', (['(0)', '(14)'], {'num': '(140)'}), '(0, 14, num=140)\n', (380, 396), True, 'import numpy as np\n'), ((456, 480), 'pprint.pprint', 'pp.pprint', (["['Ka = ', Ka]"], {}), "(['Ka = ', Ka])\n", (465, 480), True, 'import pprint as pp\n'), ((481, 507), 'pprint.pprint', 'pp.ppri... |
# -*- coding: utf-8 -*-
from smtplib import SMTPException
import pytest
from mock import patch, call
from nameko import config
from users.dependencies.email import EmailDependency
from users.exceptions import EmailSendError
class TestEmailDependency:
@config.patch({
"MAIL_HOST": "163.com",
"EM... | [
"users.dependencies.email.EmailDependency",
"smtplib.SMTPException",
"mock.call",
"nameko.config.patch",
"mock.patch",
"pytest.raises"
] | [((262, 396), 'nameko.config.patch', 'config.patch', (["{'MAIL_HOST': '163.com', 'EMAIL_USER': 'email_user', 'EMAIL_PASSWORD':\n '<PASSWORD>', 'EMAIL_SENDER': 'email_sender'}"], {}), "({'MAIL_HOST': '163.com', 'EMAIL_USER': 'email_user',\n 'EMAIL_PASSWORD': '<PASSWORD>', 'EMAIL_SENDER': 'email_sender'})\n", (274,... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright 2020 Huawei Technologies Co., Ltd
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... | [
"acl.op.cast",
"acl.op.create_attr",
"numpy.dtype",
"numpy.array",
"acl.rt.synchronize_stream",
"acl.rt.destroy_stream",
"acl.op.execute"
] | [((1443, 1462), 'numpy.dtype', 'np.dtype', (['"""float16"""'], {}), "('float16')\n", (1451, 1462), True, 'import numpy as np\n'), ((2577, 2694), 'acl.op.cast', 'acl.op.cast', (['self.tensor_in.desc', 'self.tensor_in.buff', 'self.tensor_out.desc', 'self.tensor_out.buff', '(0)', 'self.stream'], {}), '(self.tensor_in.desc... |
import unittest
import oapackage
class TestGWLP(unittest.TestCase):
def test_gwlp(self):
array = oapackage.exampleArray(1, 0)
array = array.selectFirstColumns(3)
gwlp = oapackage.GWLP(array)
gwlp_mixed = oapackage.GWLPmixed(array, 0)
self.assertEqual(gwlp, (1.0, 0.0, 0.... | [
"unittest.main",
"oapackage.GWLPmixed",
"oapackage.GWLP",
"oapackage.exampleArray"
] | [((898, 913), 'unittest.main', 'unittest.main', ([], {}), '()\n', (911, 913), False, 'import unittest\n'), ((113, 141), 'oapackage.exampleArray', 'oapackage.exampleArray', (['(1)', '(0)'], {}), '(1, 0)\n', (135, 141), False, 'import oapackage\n'), ((201, 222), 'oapackage.GWLP', 'oapackage.GWLP', (['array'], {}), '(arra... |
from django.db import models
class AuthorContainer(models.Model):
created = models.DateField(auto_now=True, null=True)
def __str__(self):
return '{}'.format(self.created)
class Author(models.Model):
author_container = models.ForeignKey(AuthorContainer, on_delete=models.CASCADE)
first_name =... | [
"django.db.models.DateField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((82, 124), 'django.db.models.DateField', 'models.DateField', ([], {'auto_now': '(True)', 'null': '(True)'}), '(auto_now=True, null=True)\n', (98, 124), False, 'from django.db import models\n'), ((243, 303), 'django.db.models.ForeignKey', 'models.ForeignKey', (['AuthorContainer'], {'on_delete': 'models.CASCADE'}), '(A... |
from absl import flags
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.rnn import pack_sequence, pack_padded_sequence, pad_packed_sequence, PackedSequence
from torch_scatter import scatter_min, scatter_sum
from cfq import utils
FLAGS = flags.FLAGS
class LSTMModel(nn... | [
"torch.nn.Dropout",
"torch.nn.Embedding",
"torch.cat",
"torch.randn",
"torch.cos",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.arange",
"torch.nn.TransformerEncoderLayer",
"torch.sin",
"torch.nn.Linear",
"torch.zeros",
"math.log",
"torch.nn.LSTM",
"torch.nn.TransformerEncoder",
"tor... | [((459, 483), 'torch.nn.Embedding', 'nn.Embedding', (['ntok', 'ninp'], {}), '(ntok, ninp)\n', (471, 483), True, 'import torch.nn as nn\n'), ((512, 582), 'torch.nn.LSTM', 'nn.LSTM', (['ninp', '(nhid // 2)', 'nlayer'], {'batch_first': '(True)', 'bidirectional': '(True)'}), '(ninp, nhid // 2, nlayer, batch_first=True, bid... |
# =========================================================================================
# Copyright 2016 Community Information Online Consortium (CIOC) and KCL Software Solutions
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.... | [
"datetime.time",
"sqlalchemy.func.count",
"logging.getLogger",
"offlinetools.scheduler.key_to_schedule"
] | [((1143, 1189), 'logging.getLogger', 'logging.getLogger', (['"""offlinetools.views.status"""'], {}), "('offlinetools.views.status')\n", (1160, 1189), False, 'import logging\n'), ((1847, 1878), 'offlinetools.scheduler.key_to_schedule', 'key_to_schedule', (['cfg.public_key'], {}), '(cfg.public_key)\n', (1862, 1878), Fals... |
"""add file table
Revision ID: ccf4b069fbe3
Revises:
Create Date: 2020-02-05 16:38:34.152505
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.crea... | [
"alembic.op.drop_table",
"sqlalchemy.Unicode",
"alembic.op.drop_index",
"alembic.op.create_index",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Integer"
] | [((796, 884), 'alembic.op.create_index', 'op.create_index', (['"""IXUQ-file-remote_file_id"""', '"""file"""', "['remote_file_id']"], {'unique': '(True)'}), "('IXUQ-file-remote_file_id', 'file', ['remote_file_id'],\n unique=True)\n", (811, 884), False, 'from alembic import op\n'), ((905, 965), 'alembic.op.drop_index'... |
from flask import Blueprint
from datetime import datetime
from datetime import timezone
from datetime import timedelta
import json
import pandas as pd
import numpy as np
#import re
from flask import request, jsonify
import root.conf as conf
mod = Blueprint ('gold',__name__)
#common methods fo... | [
"pandas.DataFrame",
"json.dump",
"json.load",
"datetime.datetime.fromisoformat",
"flask.Blueprint",
"flask.jsonify",
"flask.request.get_json"
] | [((265, 292), 'flask.Blueprint', 'Blueprint', (['"""gold"""', '__name__'], {}), "('gold', __name__)\n", (274, 292), False, 'from flask import Blueprint\n'), ((609, 643), 'datetime.datetime.fromisoformat', 'datetime.fromisoformat', (['_isoformat'], {}), '(_isoformat)\n', (631, 643), False, 'from datetime import datetime... |
# Copyright 2019 ZTE corporation. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
The test of automatic test.
"""
import unittest
import subprocess
import os
class TestAutomaticTest(unittest.TestCase):
"""
The test of automatic test
"""
@staticmethod
def test_automatic_test():
... | [
"subprocess.run",
"subprocess.Popen",
"os.path.join",
"os.path.abspath"
] | [((576, 636), 'subprocess.run', 'subprocess.run', ([], {'args': 'model_command', 'cwd': 'base_dir', 'check': '(True)'}), '(args=model_command, cwd=base_dir, check=True)\n', (590, 636), False, 'import subprocess\n'), ((1096, 1135), 'os.path.join', 'os.path.join', (['base_dir', '"""benchmark/log"""'], {}), "(base_dir, 'b... |
from abc import abstractmethod
from typing import Union, Optional, Any, List, Coroutine
import inspect
from .typings import TProtocol
from .interact import InteractiveObject, IOManager
from .component import MetadataComponent
from .behavior import BaseBehavior
from .utilles import IOStatus
class MonoMetaComponent(Me... | [
"inspect.currentframe"
] | [((2160, 2182), 'inspect.currentframe', 'inspect.currentframe', ([], {}), '()\n', (2180, 2182), False, 'import inspect\n')] |
# -*- coding: utf-8 -*-
"""
Created on Tue May 09 17:59:27 2017
References - http://machinelearningmastery.com/evaluate-performance-machine-learning-algorithms-python-using-resampling/
@author: Anish
"""
import pandas as pd
from sklearn.linear_model import LinearRegression
#from sklearn.model_selection import T... | [
"pandas.DataFrame",
"pandas.read_csv",
"sklearn.linear_model.ElasticNet",
"sklearn.model_selection.cross_val_score",
"sklearn.linear_model.LinearRegression",
"sklearn.model_selection.ShuffleSplit",
"sklearn.linear_model.Ridge"
] | [((438, 498), 'pandas.read_csv', 'pd.read_csv', (['"""../Weather_ride_NJ.csv"""'], {'index_col': '(0)', 'header': '(0)'}), "('../Weather_ride_NJ.csv', index_col=0, header=0)\n", (449, 498), True, 'import pandas as pd\n'), ((687, 702), 'pandas.DataFrame', 'pd.DataFrame', (['X'], {}), '(X)\n', (699, 702), True, 'import p... |
import os
import json
TEST_DIR = os.path.dirname(__file__)
def json_from_file(filename):
path_to_file = os.path.join(TEST_DIR, 'json', filename)
with open(path_to_file) as fh:
return json.load(fh)
| [
"os.path.dirname",
"json.load",
"os.path.join"
] | [((34, 59), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (49, 59), False, 'import os\n'), ((111, 151), 'os.path.join', 'os.path.join', (['TEST_DIR', '"""json"""', 'filename'], {}), "(TEST_DIR, 'json', filename)\n", (123, 151), False, 'import os\n'), ((202, 215), 'json.load', 'json.load', ([... |
# all seam carving helper functions
# this file will be used as a custom module
import cv2 as cv
import numpy as np
def draw_vertical_seam(img, seam):
img_seam = img.copy()
# extracting the points from the seam
points = [(index, int(item)) for index, item in enumerate(seam)]
x_coords, y_coords = np.... | [
"cv2.resize",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.destroyAllWindows",
"numpy.transpose",
"numpy.zeros",
"numpy.argmin",
"cv2.addWeighted",
"numpy.hstack",
"cv2.imread",
"cv2.convertScaleAbs",
"cv2.imshow",
"cv2.Sobel",
"numpy.vstack"
] | [((317, 337), 'numpy.transpose', 'np.transpose', (['points'], {}), '(points)\n', (329, 337), True, 'import numpy as np\n'), ((612, 632), 'numpy.transpose', 'np.transpose', (['coords'], {}), '(coords)\n', (624, 632), True, 'import numpy as np\n'), ((787, 822), 'cv2.cvtColor', 'cv.cvtColor', (['img', 'cv.COLOR_BGR2GRAY']... |
import sys
import datetime
import csv
import logging
import dateutil
import requests
from common import enums
from .check import classify_check
from .models import Check, Content, Proxy, Site
logger = logging.getLogger("uptime")
# https://stackoverflow.com/questions/15063936/csv-error-field-larger-than-field-limit... | [
"csv.DictReader",
"csv.field_size_limit",
"dateutil.parser.isoparse",
"datetime.datetime",
"requests.get",
"logging.getLogger"
] | [((205, 232), 'logging.getLogger', 'logging.getLogger', (['"""uptime"""'], {}), "('uptime')\n", (222, 232), False, 'import logging\n'), ((328, 361), 'csv.field_size_limit', 'csv.field_size_limit', (['sys.maxsize'], {}), '(sys.maxsize)\n', (348, 361), False, 'import csv\n'), ((436, 468), 'csv.DictReader', 'csv.DictReade... |
import os
import numpy as np
from skimage import io
dask_available = True
try:
from dask import array as da
except ImportError:
dask_available = False
def imread(filenames, *, use_dask=None, stack=True):
"""Read image files and return an array.
If multiple images are selected, they are stacked alon... | [
"numpy.stack",
"dask.array.stack",
"os.path.splitext",
"skimage.io.imread",
"dask.array.from_zarr"
] | [((1066, 1085), 'skimage.io.imread', 'io.imread', (['filename'], {}), '(filename)\n', (1075, 1085), False, 'from skimage import io\n'), ((2074, 2104), 'os.path.splitext', 'os.path.splitext', (['filenames[0]'], {}), '(filenames[0])\n', (2090, 2104), False, 'import os\n'), ((1215, 1231), 'dask.array.stack', 'da.stack', (... |
from marshmallow import fields
from schemas.request.park_request_schema import ParkRequestSchema
from schemas.response.transaction_response_schema import TransactionsSchema
class ParkResponseSchema(ParkRequestSchema):
id = fields.Integer()
card = fields.String()
income = fields.String()
outcome = fie... | [
"marshmallow.fields.Integer",
"marshmallow.fields.Boolean",
"marshmallow.fields.String",
"marshmallow.fields.Number",
"marshmallow.fields.Nested"
] | [((230, 246), 'marshmallow.fields.Integer', 'fields.Integer', ([], {}), '()\n', (244, 246), False, 'from marshmallow import fields\n'), ((258, 273), 'marshmallow.fields.String', 'fields.String', ([], {}), '()\n', (271, 273), False, 'from marshmallow import fields\n'), ((287, 302), 'marshmallow.fields.String', 'fields.S... |
"""Platzigram views."""
# Django
from django.http import HttpResponse
# Utilities
from datetime import datetime
def hello_world(request):
"""Return a greeting."""
return HttpResponse('Oh, hi! Current server time is {now}'.format(
now=datetime.now().strftime('%b %dth, %Y - %H:%M hrs')
))
def hi... | [
"datetime.datetime.now"
] | [((254, 268), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (266, 268), False, 'from datetime import datetime\n')] |
import os
import ahocorasick
import string
import re
class QuestionClassifier:
def __init__(self):
cur_dir = '/'.join(os.path.abspath(__file__).split('/')[:-1])
# path for the keywords
self.collection_path = os.path.join(cur_dir, 'dict/Collection.txt')
self.country_path = os.path.joi... | [
"os.path.abspath",
"ahocorasick.Automaton",
"os.path.join"
] | [((236, 280), 'os.path.join', 'os.path.join', (['cur_dir', '"""dict/Collection.txt"""'], {}), "(cur_dir, 'dict/Collection.txt')\n", (248, 280), False, 'import os\n'), ((309, 350), 'os.path.join', 'os.path.join', (['cur_dir', '"""dict/Country.txt"""'], {}), "(cur_dir, 'dict/Country.txt')\n", (321, 350), False, 'import o... |
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.http import Http404
from contacts_and_people.models import Entity
from models import VacanciesPlugin, Vacancy, Studentship, Lesson
from cms_plugins import CMSVacanciesPlugin
from arkestra_utiliti... | [
"django.shortcuts.render_to_response",
"django.shortcuts.get_object_or_404",
"cms_plugins.CMSVacanciesPlugin",
"contacts_and_people.models.Entity.objects.base_entity",
"models.VacanciesPlugin",
"django.template.RequestContext"
] | [((908, 931), 'django.template.RequestContext', 'RequestContext', (['request'], {}), '(request)\n', (922, 931), False, 'from django.template import RequestContext\n'), ((947, 964), 'models.VacanciesPlugin', 'VacanciesPlugin', ([], {}), '()\n', (962, 964), False, 'from models import VacanciesPlugin, Vacancy, Studentship... |
import datetime
import json
import subprocess
from ClusterShell import NodeSet
args = ["sacct", "-X", "--allusers", "--parsable2", "--format",
"jobid,jobidraw,cluster,partition,account,group,gid,"
"user,uid,submit,eligible,start,end,elapsed,elapsedraw,exitcode,state,nnodes,"
"ncpus,reqcpus,req... | [
"subprocess.run",
"json.dumps",
"collections.defaultdict",
"datetime.datetime.utcnow",
"datetime.timedelta",
"ClusterShell.NodeSet.NodeSet"
] | [((568, 594), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (592, 594), False, 'import datetime\n'), ((894, 986), 'subprocess.run', 'subprocess.run', (['args'], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.STDOUT', 'encoding': '"""UTF-8"""'}), "(args, stdout=subprocess.PIPE, stderr=su... |
from qtpy.QtGui import QColor
CHIP_CORRECTION = {'low': {1: {'xoffset': 0,
'yoffset': 0},
2: {'xoffset': 2,
'yoffset': 0},
3: {'xoffset': 0,
'yoffset': 3},
... | [
"qtpy.QtGui.QColor"
] | [((1103, 1125), 'qtpy.QtGui.QColor', 'QColor', (['(255)', '(0)', '(0)', '(255)'], {}), '(255, 0, 0, 255)\n', (1109, 1125), False, 'from qtpy.QtGui import QColor\n'), ((1140, 1166), 'qtpy.QtGui.QColor', 'QColor', (['(255)', '(255)', '(255)', '(255)'], {}), '(255, 255, 255, 255)\n', (1146, 1166), False, 'from qtpy.QtGui ... |
import jwt
from passlib.context import CryptContext
from fastapi import APIRouter, Depends, HTTPException, status
from fastapi.security import OAuth2PasswordRequestForm
from datetime import datetime, timedelta
from sqlalchemy.orm import Session
from .. import crud, schemas, settings
from ..database import SessionL... | [
"fastapi.HTTPException",
"jwt.encode",
"datetime.datetime.utcnow",
"datetime.timedelta",
"fastapi.Depends",
"passlib.context.CryptContext",
"fastapi.APIRouter"
] | [((336, 347), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (345, 347), False, 'from fastapi import APIRouter, Depends, HTTPException, status\n'), ((362, 413), 'passlib.context.CryptContext', 'CryptContext', ([], {'schemes': "['bcrypt']", 'deprecated': '"""auto"""'}), "(schemes=['bcrypt'], deprecated='auto')\n", ... |
# conding=utf-8
from __future__ import division
from ryu import cfg
from ryu.base import app_manager
from ryu.base.app_manager import lookup_service_brick
from ryu.controller import ofp_event
from ryu.controller.handler import MAIN_DISPATCHER, DEAD_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofpro... | [
"ryu.base.app_manager.lookup_service_brick",
"ryu.controller.handler.set_ev_cls",
"ryu.topology.switches.LLDPPacket.lldp_parse",
"time.time",
"operator.attrgetter",
"ryu.lib.hub.sleep",
"ryu.lib.hub.spawn"
] | [((1848, 1925), 'ryu.controller.handler.set_ev_cls', 'set_ev_cls', (['ofp_event.EventOFPStateChange', '[MAIN_DISPATCHER, DEAD_DISPATCHER]'], {}), '(ofp_event.EventOFPStateChange, [MAIN_DISPATCHER, DEAD_DISPATCHER])\n', (1858, 1925), False, 'from ryu.controller.handler import set_ev_cls\n'), ((6130, 6191), 'ryu.controll... |
import sys
import os
import cv2 as cv
dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(dir, '../../bin'))
import lightnet
import darknet
IMAGE_MODE = False
if __name__ == "__main__":
lightnet.set_cwd(dir)
net, meta = lightnet.load_network_meta(
"obj.cfg"... | [
"darknet.rgbgr_image",
"os.path.abspath",
"lightnet.set_cwd",
"cv2.putText",
"cv2.waitKey",
"cv2.getTextSize",
"darknet.array_to_image",
"cv2.VideoCapture",
"lightnet.to_str",
"cv2.rectangle",
"lightnet.load_network_meta",
"darknet.classify",
"cv2.imshow",
"os.path.join"
] | [((65, 90), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (80, 90), False, 'import os\n'), ((109, 139), 'os.path.join', 'os.path.join', (['dir', '"""../../bin"""'], {}), "(dir, '../../bin')\n", (121, 139), False, 'import os\n'), ((233, 254), 'lightnet.set_cwd', 'lightnet.set_cwd', (['dir'], ... |
from django import forms
from django.forms.models import ModelChoiceField
from gameon.submissions.widgets import CategorySelectWidget
from gameon.submissions.models import Entry, Category
MARKET_CHOICES = (('True', 'Yes, I want to submit by game to the marketplace (you will get forwarded to the Firefox Marketplace o... | [
"django.forms.RadioSelect",
"django.forms.BooleanField",
"django.forms.TextInput",
"gameon.submissions.models.Category.objects.all",
"django.forms.ValidationError",
"django.forms.FileInput",
"gameon.submissions.widgets.CategorySelectWidget",
"django.forms.Textarea"
] | [((611, 666), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'aria-describedby': 'info_url'}"}), "(attrs={'aria-describedby': 'info_url'})\n", (626, 666), False, 'from django import forms\n'), ((687, 779), 'django.forms.Textarea', 'forms.Textarea', ([], {'attrs': "{'aria-describedby': 'info_description',... |
from generateActions import generateActions
from os import urandom
from random import choice, randint, shuffle
from struct import Struct
def generateInstructions(maxLength):
instructions = []
while True:
instructionLength = randint(24, maxLength - len(''.join(instructions)))
type = choice([1, 2, 3, 4, 5, ... | [
"struct.Struct",
"random.randint",
"random.shuffle",
"random.choice",
"generateActions.generateActions",
"os.urandom"
] | [((1179, 1200), 'random.shuffle', 'shuffle', (['instructions'], {}), '(instructions)\n', (1186, 1200), False, 'from random import choice, randint, shuffle\n'), ((297, 330), 'random.choice', 'choice', (['[1, 2, 3, 4, 5, 6, 65535]'], {}), '([1, 2, 3, 4, 5, 6, 65535])\n', (303, 330), False, 'from random import choice, ran... |
import time
from django.views.generic import TemplateView
from django.utils.decorators import method_decorator
from django.shortcuts import render
from django.views.decorators.cache import never_cache
from cache_helpers.decorators import cache_page_forever, cache_result
from cache_helpers.views import CachePageMixin
... | [
"django.utils.decorators.method_decorator",
"cache_helpers.decorators.cache_result",
"time.sleep",
"django.shortcuts.render",
"cache_helpers.decorators.cache_page_forever"
] | [((371, 386), 'cache_helpers.decorators.cache_result', 'cache_result', (['(3)'], {}), '(3)\n', (383, 386), False, 'from cache_helpers.decorators import cache_page_forever, cache_result\n'), ((1656, 1702), 'django.utils.decorators.method_decorator', 'method_decorator', (['never_cache'], {'name': '"""dispatch"""'}), "(ne... |
# Generated by Django 3.0.10 on 2020-10-27 22:00
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('blo... | [
"django.db.models.ForeignKey",
"django.db.models.OneToOneField",
"django.db.migrations.swappable_dependency",
"django.db.models.ManyToManyField"
] | [((248, 305), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (279, 305), False, 'from django.db import migrations, models\n'), ((470, 590), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'n... |
#!/usr/bin/env python3
from codeforces import CodeforcesAPI
def get_all_user_handles(ranklist_rows):
return set(m.handle for row in ranklist_rows for m in row.party.members)
def filter_by_organization(ranklist_row, handle_to_user_mapping, organization):
return (r for r in ranklist_row if handle_to_user_map... | [
"codeforces.CodeforcesAPI"
] | [((587, 602), 'codeforces.CodeforcesAPI', 'CodeforcesAPI', ([], {}), '()\n', (600, 602), False, 'from codeforces import CodeforcesAPI\n')] |
"""
This is a procedural interface to the yttalab library
<EMAIL>
The following commands are provided:
Design and plot commands
dlqr - Discrete linear quadratic regulator
d2c - discrete to continous time conversion
full_obs - full order observer
red_obs - reduced order observer
comp_f... | [
"scipy.linalg.logm",
"scipy.linalg.eigvals",
"numpy.zeros",
"numpy.hstack",
"numpy.shape",
"numpy.around",
"numpy.imag",
"scipy.linalg.inv",
"numpy.real",
"numpy.eye",
"scipy.finfo",
"numpy.mat",
"numpy.vstack",
"numpy.sqrt"
] | [((1493, 1501), 'numpy.shape', 'shape', (['a'], {}), '(a)\n', (1498, 1501), False, 'from numpy import hstack, vstack, imag, zeros, eye, mat, shape, real, around, sqrt\n'), ((1512, 1520), 'numpy.shape', 'shape', (['b'], {}), '(b)\n', (1517, 1520), False, 'from numpy import hstack, vstack, imag, zeros, eye, mat, shape, r... |
# -*- coding: utf-8 -*-
# Copyright 2015-2016 Cisco Systems, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LI... | [
"datetime.timedelta",
"traceback.format_exc"
] | [((764, 784), 'datetime.timedelta', 'timedelta', ([], {'seconds': '(0)'}), '(seconds=0)\n', (773, 784), False, 'from datetime import timedelta\n'), ((2182, 2204), 'traceback.format_exc', 'traceback.format_exc', ([], {}), '()\n', (2202, 2204), False, 'import traceback\n'), ((1516, 1538), 'traceback.format_exc', 'traceba... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.MobileAppInfo import MobileAppInfo
class AlipayOpenMiniAmpeMobileappBatchqueryResponse(AlipayResponse):
def __init__(self):
super(AlipayOpenMiniAmpeMobil... | [
"alipay.aop.api.domain.MobileAppInfo.MobileAppInfo.from_alipay_dict"
] | [((867, 900), 'alipay.aop.api.domain.MobileAppInfo.MobileAppInfo.from_alipay_dict', 'MobileAppInfo.from_alipay_dict', (['i'], {}), '(i)\n', (897, 900), False, 'from alipay.aop.api.domain.MobileAppInfo import MobileAppInfo\n')] |
import torch
import evaluation_models
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--data_name', default='wiki', help="{coco, f30k, wiki}")
parser.add_argument('--cnn', default='ViT-B/16', help='[RN50, RN101, RN50x4, RN50x16, ViT-B/32, ViT-B/16]')
parser.add_arg... | [
"evaluation_models.evalrank",
"argparse.ArgumentParser"
] | [((82, 107), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (105, 107), False, 'import argparse\n'), ((1143, 1175), 'evaluation_models.evalrank', 'evaluation_models.evalrank', (['args'], {}), '(args)\n', (1169, 1175), False, 'import evaluation_models\n')] |
"""logs the current running process of SMNW."""
import logging
def init():
logging.basicConfig(level=logging.DEBUG,
filename="SMNW.log",
filemode="w",
format="%(name)s:%(asctime)s -- %(levelname)s -- %(message)s"
)
| [
"logging.basicConfig"
] | [((81, 223), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'filename': '"""SMNW.log"""', 'filemode': '"""w"""', 'format': '"""%(name)s:%(asctime)s -- %(levelname)s -- %(message)s"""'}), "(level=logging.DEBUG, filename='SMNW.log', filemode='w',\n format='%(name)s:%(asctime)s -- %(level... |
# Copyright (C) 2017 <NAME> <<EMAIL>>
#
# This file is part of repology
#
# repology is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
... | [
"repology.package.Package"
] | [((1009, 1018), 'repology.package.Package', 'Package', ([], {}), '()\n', (1016, 1018), False, 'from repology.package import Package\n')] |
import torch
from torch import nn as nn
from torch.nn import functional as F
import math
class RunningBatchNorm3d(nn.Module):
def __init__(self, nf, mom=0.1, eps=1e-5):
super().__init__()
self.mom,self.eps = mom,eps
self.mults = nn.Parameter(torch.ones (nf,1,1,1))
self.adds = nn.Para... | [
"torch.ones",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.ReLU",
"torch.nn.AdaptiveAvgPool3d",
"math.sqrt",
"torch.nn.Conv3d",
"torch.nn.ConvTranspose3d",
"torch.nn.Conv2d",
"torch.cat",
"torch.nn.ELU",
"torch.nn.functional.interpolate",
"torch.nn.GroupNorm",
"torch.zeros",
"torch.nn.LeakyReLU... | [((6247, 6268), 'torch.nn.ReLU', 'nn.ReLU', ([], {'inplace': '(True)'}), '(inplace=True)\n', (6254, 6268), True, 'from torch import nn as nn\n'), ((6292, 6304), 'torch.nn.Sigmoid', 'nn.Sigmoid', ([], {}), '()\n', (6302, 6304), True, 'from torch import nn as nn\n'), ((12388, 12427), 'torch.cat', 'torch.cat', (['(encoder... |
from cmstk.util import data_directory
from cmstk.vasp import incar
import os
def test_incar_file():
"""Tests initialization of an IncarFile object."""
path = os.path.join(data_directory(), "vasp", "Fe_BCC.incar")
incarfile = incar.IncarFile(filepath=path)
incarfile.load()
incar_tags = {tag.name: t... | [
"cmstk.vasp.incar.IncarFile",
"os.remove",
"cmstk.util.data_directory"
] | [((239, 269), 'cmstk.vasp.incar.IncarFile', 'incar.IncarFile', ([], {'filepath': 'path'}), '(filepath=path)\n', (254, 269), False, 'from cmstk.vasp import incar\n'), ((1523, 1561), 'cmstk.vasp.incar.IncarFile', 'incar.IncarFile', ([], {'filepath': '"""test.incar"""'}), "(filepath='test.incar')\n", (1538, 1561), False, ... |
"""Add twitter_stream_id
Revision ID: 314883886cb7
Revises: <KEY>
Create Date: 2020-11-12 15:54:04.723534
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
def upgrade():
# ### commands ... | [
"alembic.op.drop_column",
"alembic.op.create_foreign_key",
"sqlalchemy.Integer",
"alembic.op.drop_constraint"
] | [((460, 539), 'alembic.op.create_foreign_key', 'op.create_foreign_key', (['None', '"""guilds"""', '"""streams"""', "['twitter_stream_id']", "['id']"], {}), "(None, 'guilds', 'streams', ['twitter_stream_id'], ['id'])\n", (481, 539), False, 'from alembic import op\n'), ((664, 718), 'alembic.op.drop_constraint', 'op.drop_... |
# coding: utf-8
import unittest
from problems.two_sum_ii_input_array_is_sorted import Solution
class TestCase(unittest.TestCase):
def setUp(self):
self.solution = Solution()
def test(self):
test_data = [
{'numbers': [2, 7, 11, 15], 'target': 9, 'expected': [1, 2]},
{'... | [
"unittest.main",
"problems.two_sum_ii_input_array_is_sorted.Solution"
] | [((877, 892), 'unittest.main', 'unittest.main', ([], {}), '()\n', (890, 892), False, 'import unittest\n'), ((178, 188), 'problems.two_sum_ii_input_array_is_sorted.Solution', 'Solution', ([], {}), '()\n', (186, 188), False, 'from problems.two_sum_ii_input_array_is_sorted import Solution\n')] |
from flask import render_template, jsonify
from app import app
from app import models, db
import json
import random
class User:
def as_dict(self):
return {c.name: getattr(self, c.name) for c in self.__table__.columns}
@app.route('/')
@app.route('/index')
def index():
return render_template('index.ht... | [
"app.app.route",
"random.randint",
"random.uniform",
"app.models.Requesters.query.all",
"json.dumps",
"flask.jsonify",
"flask.render_template"
] | [((235, 249), 'app.app.route', 'app.route', (['"""/"""'], {}), "('/')\n", (244, 249), False, 'from app import app\n'), ((251, 270), 'app.app.route', 'app.route', (['"""/index"""'], {}), "('/index')\n", (260, 270), False, 'from app import app\n'), ((341, 358), 'app.app.route', 'app.route', (['"""/nav"""'], {}), "('/nav'... |
from django.urls import reverse
from django.utils.safestring import mark_safe
from project_core.utils.utils import format_date
def error_due_date_too_early(project):
project_basic_information_edit = reverse('logged-grant_management-project-basic-information-update',
k... | [
"django.urls.reverse",
"project_core.utils.utils.format_date"
] | [((206, 310), 'django.urls.reverse', 'reverse', (['"""logged-grant_management-project-basic-information-update"""'], {'kwargs': "{'project': project.id}"}), "('logged-grant_management-project-basic-information-update', kwargs=\n {'project': project.id})\n", (213, 310), False, 'from django.urls import reverse\n'), ((... |
###############################################################################
# ProteusLib Copyright (c) 2021, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory, Oak Ridge National
# Laboratory, National Renewable Energy Laboratory, and National Energy
# Technology Laborator... | [
"pymongo.MongoClient",
"pytest.mark.skipif",
"pytest.fixture"
] | [((1136, 1259), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(g_mongo_server is False)'], {'reason': 'f"""Cannot connect to MongoDB server at {ElectrolyteDB.DEFAULT_URL}"""'}), "(g_mongo_server is False, reason=\n f'Cannot connect to MongoDB server at {ElectrolyteDB.DEFAULT_URL}')\n", (1154, 1259), False, 'import ... |
import math
import json
import urllib
import time
from ipaddress import ip_address
from flask import Blueprint, render_template, abort, request, redirect
from flask import url_for, g
import dateutil.parser
from pagination_from_request import pagination_from_request
from . import require_client
from accounts.views imp... | [
"flask.g.patreon.accounts.group_names_to_bits.items",
"accounts.views.require_permissions",
"flask.url_for",
"flask.g.patreon.edit_tier_permissions",
"flask.g.patreon.populate_client_tiers",
"flask.g.patreon.accounts.search_authentications",
"pagination_from_request.pagination_from_request",
"flask.re... | [((361, 426), 'flask.Blueprint', 'Blueprint', (['"""patreon_admin"""', '__name__'], {'template_folder': '"""templates"""'}), "('patreon_admin', __name__, template_folder='templates')\n", (370, 426), False, 'from flask import Blueprint, render_template, abort, request, redirect\n'), ((500, 540), 'accounts.views.require_... |
# coding=utf-8
import unittest
from ddt import ddt, data
from letterparser import utils
from tests import data_path, read_fixture
@ddt
class TestRemoveNonBreakingSpace(unittest.TestCase):
@data(
{"comment": "None value", "string": None, "expected": ""},
{"comment": "Basic string", "string": "stri... | [
"tests.read_fixture",
"letterparser.utils.open_tag",
"letterparser.utils.get_file_name_path",
"letterparser.utils.remove_complex_scripts_styles",
"ddt.data",
"tests.data_path",
"letterparser.utils.get_file_name_file",
"letterparser.utils.xml_string_fix_namespaces",
"letterparser.utils.replace_charac... | [((196, 590), 'ddt.data', 'data', (["{'comment': 'None value', 'string': None, 'expected': ''}", "{'comment': 'Basic string', 'string': 'string', 'expected': 'string'}", '{\'comment\': "Test \'\\\\xc2\\\\xa0\' character", \'string\': \'Â\\xa0\', \'expected\': \'\'}', '{\'comment\': "Test \'\\\\xa0\' character", \'strin... |
# This is automatically-generated code.
# Uses the jinja2 library for templating.
import cvxpy as cp
import numpy as np
import scipy as sp
# setup
problemID = "max_softmax_epigraph_0"
prob = None
opt_val = None
problemID = problemID + "_epigraph"
# Variable declarations
import scipy.sparse as sps
def norma... | [
"numpy.random.seed",
"numpy.sum",
"numpy.random.randn",
"numpy.ones",
"numpy.random.randint",
"scipy.sparse.rand",
"numpy.arange",
"cvxpy.Variable",
"cvxpy.sum_largest",
"cvxpy.sum_squares",
"cvxpy.Minimize"
] | [((683, 700), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (697, 700), True, 'import numpy as np\n'), ((805, 831), 'numpy.random.randint', 'np.random.randint', (['(0)', 'k', 'm'], {}), '(0, k, m)\n', (822, 831), True, 'import numpy as np\n'), ((984, 1001), 'cvxpy.Variable', 'cp.Variable', (['n', 'k'],... |
from curtsies import Input
import sys
import time
import rospy
from smach import StateMachine, CBState
import smach_ros
from actionlib import *
from actionlib_msgs.msg import *
sys.path.append("../../")
try:
from ros_atlas.utils.uav_utils import connect_uav, manual_control
from ros_atlas.base_nodes.CameraPubl... | [
"sys.path.append",
"custom_ros_action.msg.InitDroneResult",
"ros_atlas.utils.uav_utils.connect_uav",
"custom_ros_action.msg.InitDroneGoal",
"smach.StateMachine",
"smach_ros.SimpleActionState",
"rospy.signal_shutdown",
"time.time",
"rospy.loginfo",
"rospy.init_node",
"curtsies.Input",
"ros_atla... | [((179, 204), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (194, 204), False, 'import sys\n'), ((7032, 7062), 'rospy.init_node', 'rospy.init_node', (['"""pid_tracker"""'], {}), "('pid_tracker')\n", (7047, 7062), False, 'import rospy\n'), ((7148, 7216), 'rospy.loginfo', 'rospy.loginfo', ... |
#!/usr/bin/env python3
import argparse
import multiprocessing
import ipaddress
import requests
from requests import ReadTimeout, ConnectTimeout, ConnectionError
from requests.packages.urllib3.exceptions import InsecureRequestWarning
from requests.exceptions import TooManyRedirects
requests.packages.urllib3.disable_... | [
"ipaddress.IPv4Network",
"requests.packages.urllib3.disable_warnings",
"multiprocessing.Process",
"argparse.ArgumentParser"
] | [((286, 352), 'requests.packages.urllib3.disable_warnings', 'requests.packages.urllib3.disable_warnings', (['InsecureRequestWarning'], {}), '(InsecureRequestWarning)\n', (328, 352), False, 'import requests\n'), ((1342, 1367), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1365, 1367), False, '... |
#!/bin/env python
"""
@author: <NAME>
Co-authors: <NAME>, <NAME>
Creates a customizable image sequence for the spectrum of an audio file.
"""
from arguments import args, initArgs, processArgs # Handles arguments
from styles import renderFrame # Handles styles
from audio2numpy import open_audio # Works with ... | [
"os.mkdir",
"os.remove",
"numpy.load",
"numpy.fft.rfft",
"cv2.VideoWriter_fourcc",
"os.path.isfile",
"numpy.mean",
"matplotlib.pyplot.imsave",
"cv2.VideoWriter",
"arguments.initArgs",
"styles.renderFrame",
"os.path.exists",
"numpy.max",
"subprocess.Popen",
"numpy.ceil",
"numpy.log2",
... | [((9213, 9270), 'subprocess.Popen', 'subprocess.Popen', (['arguments'], {'stdout': 'stdout', 'stderr': 'stderr'}), '(arguments, stdout=stdout, stderr=stderr)\n', (9229, 9270), False, 'import subprocess\n'), ((9340, 9377), 'os.remove', 'remove', (["(args.destination + '/vidList')"], {}), "(args.destination + '/vidList')... |
# encoding: utf-8
import argparse
import logging
from os import environ as env
from collections import Iterable
import pika
from twisted.internet import defer, reactor, protocol, task
from .utils import AMQPConnection, asleep
logger = logging.getLogger(__name__)
def default_converter(message):
return message... | [
"pika.PlainCredentials",
"argparse.ArgumentParser",
"logging.basicConfig",
"twisted.internet.defer.returnValue",
"pika.ConnectionParameters",
"logging.Formatter",
"os.environ.get",
"twisted.internet.defer.Deferred",
"twisted.internet.reactor.run",
"logging.handlers.TimedRotatingFileHandler",
"tw... | [((240, 267), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (257, 267), False, 'import logging\n'), ((524, 601), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), '(formatter_class=argparse.RawDescriptionHelpFormatter... |
#import required modules
from flask import Flask, render_template, request, redirect, flash, url_for
from database import *
import datetime
app = Flask(__name__)
# define urls for pages
not_found = 'no_result.html'
upload = 'upload_image.html'
search_result = 'search_result.html'
error_404 = "404.html"
er... | [
"flask.Flask",
"flask.render_template"
] | [((152, 167), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (157, 167), False, 'from flask import Flask, render_template, request, redirect, flash, url_for\n'), ((751, 788), 'flask.render_template', 'render_template', (['bootstrap'], {'rows': 'pics'}), '(bootstrap, rows=pics)\n', (766, 788), False, 'from ... |
import login_module
def my_login_hook(username):
"""
If there are messages for the user return them
:param username:
:type username: str
:return: None
:rtype: None
"""
if user_has_messages(username):
show_messages(username)
def user_has_messages(name):
"""
Stub for te... | [
"login_module.login_report",
"login_module.set_login_hook"
] | [((624, 666), 'login_module.set_login_hook', 'login_module.set_login_hook', (['my_login_hook'], {}), '(my_login_hook)\n', (651, 666), False, 'import login_module\n'), ((689, 734), 'login_module.login_report', 'login_module.login_report', (['"""<NAME>"""', '"""secret"""'], {}), "('<NAME>', 'secret')\n", (714, 734), Fals... |
import pickle
import argparse
import dvc.api
import mlflow
from mlflow import log_metric, log_param, log_artifacts
import pandas as pd
from sklearn.datasets import make_classification
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
if __name__ == "__main__":
... | [
"mlflow.start_run",
"pickle.dump",
"mlflow.log_param",
"argparse.ArgumentParser",
"mlflow.sklearn.log_model",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"mlflow.log_artifact",
"sklearn.linear_model.LogisticRegression"
] | [((333, 358), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (356, 358), False, 'import argparse\n'), ((800, 814), 'pandas.read_csv', 'pd.read_csv', (['f'], {}), '(f)\n', (811, 814), True, 'import pandas as pd\n'), ((825, 843), 'mlflow.start_run', 'mlflow.start_run', ([], {}), '()\n', (841, 843... |
import sys
import os
import unittest
from nose.plugins.attrib import attr
# To change this, re-run 'build-unittests.py'
from fortranformat._input import input as _input
from fortranformat._lexer import lexer as _lexer
from fortranformat._parser import parser as _parser
import unittest
class LEditDescriptorBatch1Tes... | [
"unittest.main",
"fortranformat._input.input",
"fortranformat._lexer.lexer",
"nose.plugins.attrib.attr"
] | [((352, 384), 'nose.plugins.attrib.attr', 'attr', ([], {'platform': '"""9-1_linux_intel"""'}), "(platform='9-1_linux_intel')\n", (356, 384), False, 'from nose.plugins.attrib import attr\n'), ((390, 403), 'nose.plugins.attrib.attr', 'attr', (['"""input"""'], {}), "('input')\n", (394, 403), False, 'from nose.plugins.attr... |
from __future__ import division
from collections import OrderedDict
import json
import OreCalculator
def ore(inputs, query_result_list):
ore_class_list = []
class_inputs = exp_duration_handler(inputs)
for query in query_result_list:
"""
Loop over each "row" of the spreadsheet; this is det... | [
"OreCalculator.InhalNonCancer",
"OreCalculator.CombinedDose",
"OreCalculator.DermalNonCancer"
] | [((2472, 2870), 'OreCalculator.DermalNonCancer', 'OreCalculator.DermalNonCancer', (['activity', 'crop_target', 'app_rate', 'app_rate_unit', 'crop_name', 'loc_dermal', 'loc_inhal', 'area_treated', 'area_treated_unit', 'active_ingredient', 'formulation', 'app_equip', 'app_type', 'abs_frac_dermal', 'bw_dermal', 'pod_derma... |
from struct import pack
try:
# For Python 2
from cStringIO import StringIO
except ImportError:
# For Python 3
from io import StringIO
class RopGen():
def __init__(self, endian = 'le', padding = 'A', total_length = 0):
"""
Constructior
:param endian: The Endianess, can be ... | [
"io.StringIO",
"texttable.Texttable",
"struct.pack"
] | [((3790, 3800), 'io.StringIO', 'StringIO', ([], {}), '()\n', (3798, 3800), False, 'from io import StringIO\n'), ((1533, 1549), 'struct.pack', 'pack', (['"""<B"""', 'byte'], {}), "('<B', byte)\n", (1537, 1549), False, 'from struct import pack\n'), ((5260, 5271), 'texttable.Texttable', 'Texttable', ([], {}), '()\n', (526... |
from __future__ import print_function
from decimal import Decimal
from numpy import round, subtract
import matplotlib.pyplot as plt
class AStarGraph(object):
# Define a class board like grid with two barriers
def __init__(self, walls):
self.barriers = []
for wall in walls:
self.b... | [
"numpy.round",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.show"
] | [((873, 894), 'numpy.round', 'round', (['(pos[0] + dx)', '(2)'], {}), '(pos[0] + dx, 2)\n', (878, 894), False, 'from numpy import round, subtract\n'), ((912, 933), 'numpy.round', 'round', (['(pos[1] + dy)', '(2)'], {}), '(pos[1] + dy, 2)\n', (917, 933), False, 'from numpy import round, subtract\n'), ((1027, 1041), 'num... |
import sys
import pygments
from pygments.lexers import get_lexer_by_name
from pygments.token import Token
if __name__ == '__main__':
unformatted_code = sys.stdin.read()
lexer = get_lexer_by_name("postgres", stripall=True)
tokens = list(lexer.get_tokens(unformatted_code))
print(f'count={len(tokens)}... | [
"pygments.lexers.get_lexer_by_name",
"sys.stdin.read"
] | [((159, 175), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (173, 175), False, 'import sys\n'), ((189, 233), 'pygments.lexers.get_lexer_by_name', 'get_lexer_by_name', (['"""postgres"""'], {'stripall': '(True)'}), "('postgres', stripall=True)\n", (206, 233), False, 'from pygments.lexers import get_lexer_by_name\... |
#
# Model
#
from pow3.db import Base,engine, Session
from sqlalchemy import Column, Integer, String, Sequence
from pow3.powlib import relation
from pow3.models.post import Post
@relation.has_many(Post)
class User(Base):
#__tablename__ = "users"
#id = Column(Integer, primary_key=True)
#id = Column(Integer, ... | [
"pow3.powlib.relation.has_many",
"sqlalchemy.Column"
] | [((179, 202), 'pow3.powlib.relation.has_many', 'relation.has_many', (['Post'], {}), '(Post)\n', (196, 202), False, 'from pow3.powlib import relation\n'), ((379, 393), 'sqlalchemy.Column', 'Column', (['String'], {}), '(String)\n', (385, 393), False, 'from sqlalchemy import Column, Integer, String, Sequence\n'), ((409, 4... |
import re
# Format first paragraph to suitable HTML
def to_html(title: str, content: str):
# Remove unusable tags
new_content = re.sub(r'\<\/?p\>', '', content)
new_content = re.sub(r'\<\/?dfn.*?\>', '', new_content)
new_content = re.sub(r'\<\/?img.*?\>', '', new_content)
new_content = re.sub(r'\<\... | [
"re.findall",
"re.sub"
] | [((137, 171), 're.sub', 're.sub', (['"""\\\\<\\\\/?p\\\\>"""', '""""""', 'content'], {}), "('\\\\<\\\\/?p\\\\>', '', content)\n", (143, 171), False, 'import re\n'), ((188, 231), 're.sub', 're.sub', (['"""\\\\<\\\\/?dfn.*?\\\\>"""', '""""""', 'new_content'], {}), "('\\\\<\\\\/?dfn.*?\\\\>', '', new_content)\n", (194, 23... |
from irf import irf_utils # installed from https://github.com/Yu-Group/iterative-Random-Forest
from irf.ensemble import wrf, RandomForestClassifierWithWeights # https://github.com/Yu-Group/iterative-Random-Forest
import numpy as np
class IRFClassifier():
def __init__(self):
self.model = wrf()
self.... | [
"irf.ensemble.wrf"
] | [((301, 306), 'irf.ensemble.wrf', 'wrf', ([], {}), '()\n', (304, 306), False, 'from irf.ensemble import wrf, RandomForestClassifierWithWeights\n')] |
#bolttools - a framework for creation of part libraries
#Copyright (C) 2013 <NAME> <<EMAIL>>
#
#This library is free software; you can redistribute it and/or
#modify it under the terms of the GNU Lesser General Public
#License as published by the Free Software Foundation; either
#version 2.1 of the License, or any late... | [
"os.path.splitext",
"os.path.exists",
"os.path.join"
] | [((5549, 5561), 'os.path.exists', 'exists', (['path'], {}), '(path)\n', (5555, 5561), False, 'from os.path import splitext, exists, join\n'), ((6495, 6513), 'os.path.join', 'join', (['path', '"""data"""'], {}), "(path, 'data')\n", (6499, 6513), False, 'from os.path import splitext, exists, join\n'), ((5680, 5698), 'os.... |
# Generated by Django 3.0.11 on 2020-11-21 15:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0004_auto_20201116_0140'),
]
operations = [
migrations.CreateModel(
name='Badge',
fields=[
... | [
"django.db.models.CharField",
"django.db.models.ManyToManyField",
"django.db.models.ImageField",
"django.db.models.AutoField"
] | [((688, 749), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'related_name': '"""users"""', 'to': '"""user.Badge"""'}), "(related_name='users', to='user.Badge')\n", (710, 749), False, 'from django.db import migrations, models\n'), ((327, 420), 'django.db.models.AutoField', 'models.AutoField', ([], ... |
import numpy as np
import pickle
import psycopg2 as pg
import pandas.io.sql as psql
import pandas as pd
from typing import Union, List, Tuple
connection = pg.connect(host='pgsql-196447.vipserv.org', port=5432, dbname='wbauer_adb', user='wbauer_adb', password='<PASSWORD>');
def film_in_category(category_id:int)->pd.... | [
"psycopg2.connect"
] | [((158, 279), 'psycopg2.connect', 'pg.connect', ([], {'host': '"""pgsql-196447.vipserv.org"""', 'port': '(5432)', 'dbname': '"""wbauer_adb"""', 'user': '"""wbauer_adb"""', 'password': '"""<PASSWORD>"""'}), "(host='pgsql-196447.vipserv.org', port=5432, dbname='wbauer_adb',\n user='wbauer_adb', password='<PASSWORD>')\... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 31 16:29:33 2019
@author: jlee
"""
import time
start_time = time.time()
import numpy as np
import glob, os
import g0_init_cfg as ic
# ----- Line number (to be revised!) ----- #
pk_line = 1400
'''
Line for finding peaks (gfreduce)
Line/column fo... | [
"pyraf.iraf.gfdisplay",
"pyraf.iraf.sleep",
"pyraf.iraf.gfresponse",
"os.getcwd",
"os.system",
"time.time",
"numpy.loadtxt",
"pyraf.iraf.gfreduce",
"pyraf.iraf.unlearn",
"pyraf.iraf.gfscatsub",
"pyraf.iraf.chdir",
"os.chdir",
"pyraf.iraf.imdelete"
] | [((133, 144), 'time.time', 'time.time', ([], {}), '()\n', (142, 144), False, 'import time\n'), ((472, 483), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (481, 483), False, 'import glob, os\n'), ((484, 505), 'os.chdir', 'os.chdir', (['ic.dir_iraf'], {}), '(ic.dir_iraf)\n', (492, 505), False, 'import glob, os\n'), ((567, ... |
#!/usr/bin/env python
import sys
import json
import output
import requests
BASE_URL = 'http://localhost:8080'
# -----------------------------------------------------------------------------
def import_workflow( filepath ):
# http://galaxy-central.readthedocs.org/en/latest/lib/galaxy.webapps.galaxy.api.html#galax... | [
"requests.post",
"output.output_response"
] | [((699, 733), 'requests.post', 'requests.post', (['full_url'], {'data': 'data'}), '(full_url, data=data)\n', (712, 733), False, 'import requests\n'), ((895, 927), 'output.output_response', 'output.output_response', (['response'], {}), '(response)\n', (917, 927), False, 'import output\n')] |
# Copyright (c) 2019 The Johns Hopkins University/Applied Physics Laboratory
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICEN... | [
"kmip.core.objects.CurrentAttribute",
"kmip.core.objects.AttributeReference",
"kmip.core.primitives.TextString",
"kmip.core.objects.Attribute",
"kmip.core.primitives.Integer",
"kmip.core.exceptions.InvalidField",
"kmip.core.exceptions.InvalidKmipEncoding",
"kmip.core.utils.BytearrayStream"
] | [((10157, 10180), 'kmip.core.utils.BytearrayStream', 'utils.BytearrayStream', ([], {}), '()\n', (10178, 10180), False, 'from kmip.core import utils\n'), ((18723, 18746), 'kmip.core.utils.BytearrayStream', 'utils.BytearrayStream', ([], {}), '()\n', (18744, 18746), False, 'from kmip.core import utils\n'), ((7163, 7218), ... |
"""
WSGI config for open_humans project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
"""
import logging
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "open_humans.settin... | [
"django.core.wsgi.get_wsgi_application",
"os.environ.setdefault",
"logging.getLogger"
] | [((253, 324), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""open_humans.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'open_humans.settings')\n", (274, 324), False, 'import os\n'), ((551, 578), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (568... |
# -*- coding: utf-8 -*-
"""
The main purpose of this script, is to encapsulate all the functionalities for
Exploratory Data Analysis (EDA) problems. Letting the user run simple analysis
on input data (CSV format).
Credits:
-------
Author: <NAME> (@LukeMaxMusic)
License: MIT License 2020
Ref... | [
"streamlit.text_input",
"pptx.util.Pt",
"pandas.read_csv",
"nbformat.write",
"streamlit.title",
"streamlit.sidebar.title",
"matplotlib.pyplot.figure",
"seaborn.pairplot",
"streamlit.sidebar.button",
"streamlit.subheader",
"streamlit.sidebar.checkbox",
"streamlit.button",
"streamlit.sidebar.m... | [((686, 746), 'streamlit.set_option', 'st.set_option', (['"""deprecation.showfileUploaderEncoding"""', '(False)'], {}), "('deprecation.showfileUploaderEncoding', False)\n", (699, 746), True, 'import streamlit as st\n'), ((986, 1007), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (997, 1007), Tru... |
import requests
import json
from exceptions.exceptions import InvalidAlertType
from utils.time import convert_utc_time_to_local_time
class Alert(object):
ALERT_DESCRIPTION = None
def __init__(self, alert_id) -> None:
self.alert_id = alert_id
@staticmethod
def create_alert_from_row(alert_row:... | [
"exceptions.exceptions.InvalidAlertType",
"utils.time.convert_utc_time_to_local_time",
"json.dumps"
] | [((729, 787), 'exceptions.exceptions.InvalidAlertType', 'InvalidAlertType', (['f"""Got invalid alert type - {alert_type}"""'], {}), "(f'Got invalid alert type - {alert_type}')\n", (745, 787), False, 'from exceptions.exceptions import InvalidAlertType\n'), ((969, 985), 'json.dumps', 'json.dumps', (['data'], {}), '(data)... |
# Generated by Django 2.1.13 on 2020-11-09 17:52
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('heart', '0018_meetings_status'),
]
operations = [
migrations.RemoveField(
model_name='group',
name='delegate',
),
... | [
"django.db.migrations.RemoveField",
"django.db.migrations.DeleteModel"
] | [((223, 282), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""group"""', 'name': '"""delegate"""'}), "(model_name='group', name='delegate')\n", (245, 282), False, 'from django.db import migrations\n'), ((327, 389), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], ... |
from . import with_fd
from flashmedia.types import AMF3Object, AMF3ObjectBase, AMF3ObjectPacker
@AMF3ObjectBase.register("org.amf.ASClass")
class ASClass(AMF3ObjectBase):
def __init__(self, foo, baz=None):
self.foo = foo
self.baz = baz
NAMED_TYPE = ASClass("bar")
NAMED_TYPE_BYTES = b"#\x1forg.amf... | [
"flashmedia.types.AMF3Object",
"flashmedia.types.AMF3ObjectPacker.read",
"flashmedia.types.AMF3ObjectPacker.pack",
"flashmedia.types.AMF3ObjectBase.register",
"flashmedia.types.AMF3ObjectPacker.size"
] | [((98, 140), 'flashmedia.types.AMF3ObjectBase.register', 'AMF3ObjectBase.register', (['"""org.amf.ASClass"""'], {}), "('org.amf.ASClass')\n", (121, 140), False, 'from flashmedia.types import AMF3Object, AMF3ObjectBase, AMF3ObjectPacker\n'), ((412, 424), 'flashmedia.types.AMF3Object', 'AMF3Object', ([], {}), '()\n', (42... |
from __future__ import print_function, division, absolute_import
from six import iteritems, string_types
from cobra import Metabolite as Component
from cobrame.util import dogma, mass
class MEComponent(Component):
"""
COBRAme component representation. Inherits from
:class:`cobra.core.metabolite.Metabol... | [
"cobra.Metabolite",
"six.iteritems",
"cobrame.util.mass.compute_rna_mass",
"cobra.Metabolite.__init__"
] | [((505, 533), 'cobra.Metabolite.__init__', 'Component.__init__', (['self', 'id'], {}), '(self, id)\n', (523, 533), True, 'from cobra import Metabolite as Component\n'), ((8606, 8643), 'six.iteritems', 'iteritems', (['complex_data.stoichiometry'], {}), '(complex_data.stoichiometry)\n', (8615, 8643), False, 'from six imp... |
from argparse import ArgumentParser
from logging import error
import math
import torch
from torch.serialization import save
from tqdm import tqdm
from os.path import split, join
from os import makedirs
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.rnn import pad_sequence
impor... | [
"argparse.ArgumentParser",
"turngpt.models.pretrained.TurnGPTPretrained.load_from_checkpoint",
"ttd.utils.fscores",
"torch.cat",
"turngpt.turngpt_utils.get_positive_and_negative_indices",
"matplotlib.pyplot.style.use",
"turngpt.turngpt_utils.batch_to_context_ablation_batch",
"matplotlib.pyplot.gca",
... | [((940, 956), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (954, 956), False, 'from argparse import ArgumentParser\n'), ((1101, 1141), 'turngpt.turngpt_dm.TurnGPTDM.add_data_specific_args', 'TurnGPTDM.add_data_specific_args', (['parser'], {}), '(parser)\n', (1133, 1141), False, 'from turngpt.turngpt_d... |
import requests
import csv
import os
def get_api_key():
"""
Function reading api key
from key.txt
"""
with open('key.txt', 'r') as file:
api_key = file.readline()
return api_key
def parse_value(value):
"""
function parsing given
str to int
"""
value = value.strip()
if value == 'N/A':
return 0
va... | [
"os.remove",
"requests.get"
] | [((714, 736), 'requests.get', 'requests.get', (['full_url'], {}), '(full_url)\n', (726, 736), False, 'import requests\n'), ((3104, 3124), 'os.remove', 'os.remove', (['"""key.txt"""'], {}), "('key.txt')\n", (3113, 3124), False, 'import os\n'), ((3167, 3190), 'os.remove', 'os.remove', (['"""movies.csv"""'], {}), "('movie... |
#!/usr/bin/env
#
# Auxiliary script for extracting baseline parameters from a set of runs
# and reporting their mean. This is useful to run a calibration with
# a pre-selected model.
import argparse
import re
import json_tricks as jt
import numpy as np
from tqdm import tqdm
if __name__ == '__main__':
parser =... | [
"tqdm.tqdm",
"argparse.ArgumentParser",
"json_tricks.load"
] | [((321, 346), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (344, 346), False, 'import argparse\n'), ((474, 506), 'tqdm.tqdm', 'tqdm', (['args.INPUT'], {'desc': '"""Loading"""'}), "(args.INPUT, desc='Loading')\n", (478, 506), False, 'from tqdm import tqdm\n'), ((1290, 1300), 'json_tricks.load'... |
import dataclasses
from typing import Dict, Iterator, List, Optional
import pandas as pd
from rich.progress import BarColumn, Progress, TimeElapsedColumn, TimeRemainingColumn
from . import healpix_geom
@dataclasses.dataclass
class SourceObservation:
exposure_id: str
obscode: str
id: bytes
ra: float
... | [
"rich.progress.BarColumn",
"pandas.HDFStore",
"rich.progress.TimeRemainingColumn",
"rich.progress.TimeElapsedColumn"
] | [((3292, 3332), 'pandas.HDFStore', 'pd.HDFStore', (['filename'], {'key': 'key', 'mode': '"""r"""'}), "(filename, key=key, mode='r')\n", (3303, 3332), True, 'import pandas as pd\n'), ((3481, 3492), 'rich.progress.BarColumn', 'BarColumn', ([], {}), '()\n', (3490, 3492), False, 'from rich.progress import BarColumn, Progre... |
import numpy as np
import time
import matplotlib.pyplot as plt
from scipy import interpolate
from mpl_toolkits.mplot3d import Axes3D
import math
class InterpolationLine():
def __init__(self, x, y, z=0):
self.number_of_point = 25
if not z == 0:
"To use 3D plot"
points = Poin... | [
"math.fabs",
"scipy.interpolate.splprep",
"matplotlib.pyplot.figure",
"numpy.linspace",
"scipy.interpolate.splev"
] | [((760, 809), 'scipy.interpolate.splprep', 'interpolate.splprep', (['[self.x, self.y]'], {'s': '(100)', 'k': '(2)'}), '([self.x, self.y], s=100, k=2)\n', (779, 809), False, 'from scipy import interpolate\n'), ((837, 867), 'scipy.interpolate.splev', 'interpolate.splev', (['tck[0]', 'tck'], {}), '(tck[0], tck)\n', (854, ... |
from __future__ import annotations
from collections.abc import Sequence
import configparser
import logging
import os
import os.path
import shutil
import subprocess
from typing import Callable, Union
class RequirementNotMetError(RuntimeError):
pass
class Builder(object):
def __init__(self,
profil... | [
"os.remove",
"os.environ.copy",
"os.path.isfile",
"os.path.join",
"shutil.copy",
"os.path.abspath",
"os.path.dirname",
"os.path.exists",
"configparser.ConfigParser",
"os.chmod",
"os.path.basename",
"os.path.getsize",
"subprocess.check_output",
"shutil.which",
"subprocess.run",
"os.make... | [((552, 580), 'logging.getLogger', 'logging.getLogger', (['"""builder"""'], {}), "('builder')\n", (569, 580), False, 'import logging\n'), ((735, 778), 'os.path.join', 'os.path.join', (['self.cache_dir', '"""session.txt"""'], {}), "(self.cache_dir, 'session.txt')\n", (747, 778), False, 'import os\n'), ((815, 862), 'os.p... |
import typing
import bs4
import requests
import tqdm
def scrape_all_comic_ids() -> typing.List[int]:
URL = 'http://ruijianime.com/comic/title/all_title.php?q='
QUERY = (
'a', 'ka', 'sa', 'ta', 'na',
'ha', 'ma', 'ya', 'ra', 'wa',
)
def find_per_page(query: str) -> typing.NoReturn:
response = r... | [
"bs4.BeautifulSoup",
"tqdm.tqdm",
"requests.get"
] | [((598, 614), 'tqdm.tqdm', 'tqdm.tqdm', (['QUERY'], {}), '(QUERY)\n', (607, 614), False, 'import tqdm\n'), ((319, 348), 'requests.get', 'requests.get', (['f"""{URL}{query}"""'], {}), "(f'{URL}{query}')\n", (331, 348), False, 'import requests\n'), ((360, 410), 'bs4.BeautifulSoup', 'bs4.BeautifulSoup', (['response.conten... |
import torch
import torch.nn as nn
import torch.nn.functional as F
# TecoGAN generator
class TecoGAN(nn.Module):
def __init__(self, upscale_factor, input_channels, channel_mask, output_channels, opt):
'''
upscaling_factor: how much to upscale, e.g. 4
upsample: nearest, bilinear, or pixelShu... | [
"torch.nn.ConvTranspose2d",
"torch.nn.ModuleList",
"torch.nn.Conv2d",
"torch.nn.functional.interpolate",
"torch.nn.init.calculate_gain",
"torch.nn.LeakyReLU"
] | [((1012, 1128), 'torch.nn.functional.interpolate', 'F.interpolate', (['inputs[:, self.channel_mask, :, :]'], {'size': '[outputs.shape[2], outputs.shape[3]]', 'mode': 'self.upsample'}), '(inputs[:, self.channel_mask, :, :], size=[outputs.shape[2],\n outputs.shape[3]], mode=self.upsample)\n', (1025, 1128), True, 'impo... |