code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Generated with StiffnessType
#
from enum import Enum
from enum import auto
class StiffnessType(Enum):
""""""
LINEAR = auto()
NON_LINEAR = auto()
def label(self):
if self == StiffnessType.LINEAR:
return "Linear"
if self == StiffnessType.NON_LINEAR:
return "Non... | [
"enum.auto"
] | [((130, 136), 'enum.auto', 'auto', ([], {}), '()\n', (134, 136), False, 'from enum import auto\n'), ((154, 160), 'enum.auto', 'auto', ([], {}), '()\n', (158, 160), False, 'from enum import auto\n')] |
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import Http404, HttpResponse
from django.shortcuts import redirect
from django.urls import reverse
from django.views import View
from .forms import DismissNotificationForm
from .models import Notification
class DismissNotificationView(LoginRe... | [
"django.http.HttpResponse",
"django.http.Http404",
"django.urls.reverse"
] | [((650, 674), 'django.http.HttpResponse', 'HttpResponse', ([], {'status': '(422)'}), '(status=422)\n', (662, 674), False, 'from django.http import Http404, HttpResponse\n'), ((1728, 1743), 'django.urls.reverse', 'reverse', (['"""home"""'], {}), "('home')\n", (1735, 1743), False, 'from django.urls import reverse\n'), ((... |
from bs4 import BeautifulSoup
import pandas as pd
import numpy as np
import requests
import time
def get_corp_code():
url = "http://comp.fnguide.com/XML/Market/CompanyList.txt"
resp = requests.get(url)
resp.encoding = "utf-8-sig"
data = resp.json()
comp = data['Co']
df = pd.DataFrame(data=comp... | [
"pandas.read_html",
"time.sleep",
"requests.get",
"bs4.BeautifulSoup",
"pandas.DataFrame"
] | [((194, 211), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (206, 211), False, 'import requests\n'), ((298, 321), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'comp'}), '(data=comp)\n', (310, 321), True, 'import pandas as pd\n'), ((615, 632), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (6... |
import numpy as np
import argparse
from simple_algo_utils import *
if __name__=='__main__':
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,description=None)
parser.add_argument('--example_n', default=1, type=int, help=None)
parser.add_argument('--verbose', d... | [
"numpy.array",
"numpy.zeros",
"numpy.ones",
"argparse.ArgumentParser"
] | [((107, 207), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.RawDescriptionHelpFormatter', 'description': 'None'}), '(formatter_class=argparse.\n RawDescriptionHelpFormatter, description=None)\n', (130, 207), False, 'import argparse\n'), ((1010, 1054), 'numpy.array', 'np.arr... |
from torchtext.data import Filed, TabularDataset, BucketIterator
def tokenize(x): return x.split()
quote = Field(sequential=True, use_vocab=True, tokenize=tokenize, lower=True)
score = Field(sequential=False, use_vocab=False)
fields = {
'quote': ('q', quote),
'score': ('s', score)
}
train_data, test_data... | [
"torchtext.data.BucketIterator.splits",
"torchtext.data.TabularDataset.splits"
] | [((323, 431), 'torchtext.data.TabularDataset.splits', 'TabularDataset.splits', ([], {'path': '"""mydata"""', 'train': '"""train.json"""', 'test': '"""test.json"""', 'format': '"""json"""', 'fields': 'fields'}), "(path='mydata', train='train.json', test='test.json',\n format='json', fields=fields)\n", (344, 431), Fal... |
# Seenbot module.
from datetime import datetime
import json
from michiru import db, personalities
from michiru.modules import command, hook
_ = personalities.localize
## Module information.
__name__ = 'seenbot'
__author__ = 'Shiz'
__license__ = 'WTFPL'
__desc__ = 'Tells when someone was last seen.'
## Database stu... | [
"json.loads",
"michiru.modules.hook",
"datetime.datetime.strptime",
"michiru.db.from_",
"michiru.db.table",
"json.dumps",
"datetime.datetime.now",
"michiru.modules.command",
"michiru.db.to"
] | [((339, 505), 'michiru.db.table', 'db.table', (['"""seen"""', "{'id': db.ID, 'server': (db.STRING, db.INDEX), 'nickname': (db.STRING, db.\n INDEX), 'action': db.INT, 'data': db.STRING, 'time': db.DATETIME}"], {}), "('seen', {'id': db.ID, 'server': (db.STRING, db.INDEX), 'nickname':\n (db.STRING, db.INDEX), 'actio... |
from soccerpy.modules.Fixture.base_fixture import BaseFixture
from soccerpy.modules.Fundamentals.fixtures import Fixture
from soccerpy.modules.Fundamentals.head2head import Head2Head
class FixturesSpecific(BaseFixture):
def __init__(self, data, headers, request):
super().__init__(headers, request)
... | [
"soccerpy.modules.Fundamentals.fixtures.Fixture",
"soccerpy.modules.Fundamentals.head2head.Head2Head"
] | [((336, 368), 'soccerpy.modules.Fundamentals.fixtures.Fixture', 'Fixture', (["data['fixture']", 'self.r'], {}), "(data['fixture'], self.r)\n", (343, 368), False, 'from soccerpy.modules.Fundamentals.fixtures import Fixture\n'), ((394, 430), 'soccerpy.modules.Fundamentals.head2head.Head2Head', 'Head2Head', (["data['head2... |
#!/usr/bin/env python2.7
# encoding: utf8
import os
import sys
import time
sys.path.append(os.path.realpath(__file__ + '/../../../lib'))
sys.path.append(os.path.realpath(__file__ + '/..'))
import udf
from abstract_performance_test import AbstractPerformanceTest
class SetEmitStartOnlyRPeformanceTest(AbstractPerform... | [
"os.path.realpath",
"udf.main",
"udf.fixindent"
] | [((93, 137), 'os.path.realpath', 'os.path.realpath', (["(__file__ + '/../../../lib')"], {}), "(__file__ + '/../../../lib')\n", (109, 137), False, 'import os\n'), ((155, 189), 'os.path.realpath', 'os.path.realpath', (["(__file__ + '/..')"], {}), "(__file__ + '/..')\n", (171, 189), False, 'import os\n'), ((861, 871), 'ud... |
from dataclasses import dataclass, field
from typing import Optional
__NAMESPACE__ = "http://xsdtesting"
@dataclass
class A:
a: Optional[object] = field(
default=None,
metadata={
"type": "Element",
"namespace": "http://xsdtesting",
}
)
@dataclass
class B:
... | [
"dataclasses.field"
] | [((154, 241), 'dataclasses.field', 'field', ([], {'default': 'None', 'metadata': "{'type': 'Element', 'namespace': 'http://xsdtesting'}"}), "(default=None, metadata={'type': 'Element', 'namespace':\n 'http://xsdtesting'})\n", (159, 241), False, 'from dataclasses import dataclass, field\n'), ((343, 430), 'dataclasses... |
import json
import os
import sys
sys.path.append(".") # Assume script run in project root directory
from multiprocessing import Process, Queue
import argparse
from ai2thor.controller import BFSController
from datasets.offline_sscontroller import SSController
def parse_arguments():
parser = argparse.ArgumentParser... | [
"os.path.exists",
"argparse.ArgumentParser",
"multiprocessing.Process",
"os.path.join",
"os.mkdir",
"multiprocessing.Queue",
"sys.path.append"
] | [((33, 53), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (48, 53), False, 'import sys\n'), ((297, 386), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""scrape all possible images from ai2thor scene"""'}), "(description=\n 'scrape all possible images from ai2thor ... |
import unittest
class TestCodeString(unittest.TestCase):
def test___new__(self):
# code_string = CodeString(string, uncomplete, imports)
assert False # TODO: implement your test here
class TestCombineTwoCodeStrings(unittest.TestCase):
def test_combine_two_code_strings(self):
# self.a... | [
"unittest.main"
] | [((1715, 1730), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1728, 1730), False, 'import unittest\n')] |
# Copyright 2016 The Johns Hopkins University Applied Physics Laboratory
#
# 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 ... | [
"update_lambda_fcn.load_lambdas_on_s3",
"lib.cloudformation.Arg.SecurityGroup",
"lib.aws.azs_lookup",
"lib.cloudformation.Arg.String",
"lib.aws.role_arn_lookup",
"lib.aws.get_lambda_s3_bucket",
"lib.aws.route53_delete_records",
"lib.aws.sg_lookup",
"lib.scalyr.add_instances_to_scalyr",
"lib.aws.rt... | [((2068, 2084), 'lib.names.AWSNames', 'AWSNames', (['domain'], {}), '(domain)\n', (2076, 2084), False, 'from lib.names import AWSNames\n'), ((2098, 2158), 'lib.cloudformation.CloudFormationConfiguration', 'CloudFormationConfiguration', (['"""cachedb"""', 'domain', 'const.REGION'], {}), "('cachedb', domain, const.REGION... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
try:
print('trying installed module')
from kafka_client_decorators import KafkaDecorator
except:
print('installed module failed, trying from path')
import sys
sys.path.insert(1, '../')
from kafka_client_decorators import KafkaDecorator
kc = KafkaDecor... | [
"kafka_client_decorators.KafkaDecorator",
"sys.path.insert"
] | [((310, 326), 'kafka_client_decorators.KafkaDecorator', 'KafkaDecorator', ([], {}), '()\n', (324, 326), False, 'from kafka_client_decorators import KafkaDecorator\n'), ((223, 248), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""../"""'], {}), "(1, '../')\n", (238, 248), False, 'import sys\n')] |
"""Add passcode claimed field
Revision ID: d46ec0214eb2
Revises: <PASSWORD>
Create Date: 2019-08-26 13:18:28.719962
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = 'd46ec0214eb2'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade(... | [
"sqlalchemy.Boolean",
"alembic.op.drop_column"
] | [((602, 647), 'alembic.op.drop_column', 'op.drop_column', (['"""entity"""', '"""pass_code_claimed"""'], {}), "('entity', 'pass_code_claimed')\n", (616, 647), False, 'from alembic import op\n'), ((448, 460), 'sqlalchemy.Boolean', 'sa.Boolean', ([], {}), '()\n', (458, 460), True, 'import sqlalchemy as sa\n')] |
from dataloaders.datasets import cityscapes, coco, combine_dbs, pascal, sbd
from torch.utils.data import DataLoader
import h5py
import os
import torch
def get_data_loader(args,type="train"):
if args.dataset == 'pascal':
# load data
load_dir = "data/VOC2012/"
print("load data from file:{} ".... | [
"dataloaders.datasets.combine_dbs.CombineDBs",
"torch.from_numpy",
"dataloaders.datasets.pascal.VOCSegmentation",
"torch.utils.data.DataLoader",
"dataloaders.datasets.coco.COCOSegmentation",
"dataloaders.datasets.sbd.SBDSegmentation",
"dataloaders.datasets.cityscapes.CityscapesSegmentation"
] | [((1046, 1089), 'dataloaders.datasets.pascal.VOCSegmentation', 'pascal.VOCSegmentation', (['args'], {'split': '"""train"""'}), "(args, split='train')\n", (1068, 1089), False, 'from dataloaders.datasets import cityscapes, coco, combine_dbs, pascal, sbd\n'), ((1108, 1149), 'dataloaders.datasets.pascal.VOCSegmentation', '... |
from .Setup import EngineSetup
from Core.GlobalExceptions import Exceptions
from Services.NetworkRequests import requests
from Services.Utils.Utils import Utils
class ClipDownloader(EngineSetup):
def run(self):
try:
self.download()
except:
self.status.raiseError(Exception... | [
"Services.Utils.Utils.Utils.formatByteSize"
] | [((663, 712), 'Services.Utils.Utils.Utils.formatByteSize', 'Utils.formatByteSize', (['self.progress.totalByteSize'], {}), '(self.progress.totalByteSize)\n', (683, 712), False, 'from Services.Utils.Utils import Utils\n'), ((1130, 1174), 'Services.Utils.Utils.Utils.formatByteSize', 'Utils.formatByteSize', (['self.progres... |
import logging
from vespid import setup_logger
logger = setup_logger(__name__)
import pandas as pd
import numpy as np
from tqdm import tqdm
def calculate_interdisciplinarity_score(
membership_vectors
):
'''
Given a set of entities and
one vector for each representing the (ordered) strength
of memb... | [
"numpy.unique",
"vespid.setup_logger",
"numpy.max",
"numpy.zeros",
"tqdm.tqdm.pandas"
] | [((56, 78), 'vespid.setup_logger', 'setup_logger', (['__name__'], {}), '(__name__)\n', (68, 78), False, 'from vespid import setup_logger\n'), ((7366, 7477), 'tqdm.tqdm.pandas', 'tqdm.pandas', ([], {'desc': '"""Building full cluster membership vectors from citation-based membership per paper"""'}), "(desc=\n 'Buildin... |
import sys
import threading
import time
import serial
import binascii
from linptech.packet import Packet
from linptech.constant import SerialConfig
import logging
try:
import queue
except ImportError:
import Queue as queue
logging.getLogger().setLevel(logging.ERROR)
class LinptechSerial(threading.Thread):
"""
- 实... | [
"logging.getLogger",
"logging.debug",
"linptech.packet.Packet.parse",
"time.sleep",
"threading.Event",
"serial.Serial",
"linptech.packet.Packet.create",
"Queue.Queue",
"logging.error",
"binascii.unhexlify",
"linptech.packet.Packet.check"
] | [((226, 245), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (243, 245), False, 'import logging\n'), ((476, 493), 'threading.Event', 'threading.Event', ([], {}), '()\n', (491, 493), False, 'import threading\n'), ((557, 570), 'Queue.Queue', 'queue.Queue', ([], {}), '()\n', (568, 570), True, 'import Queue as... |
from datetime import date
from typing import Type
import pytest
import sympy
from sympy import Interval, oo
from nettlesome.entities import Entity
from nettlesome.predicates import Predicate
from nettlesome.quantities import Comparison, Q_, Quantity
class TestComparisons:
def test_comparison_with_wrong_comparis... | [
"nettlesome.quantities.Q_",
"sympy.Interval",
"pytest.raises",
"datetime.date",
"nettlesome.quantities.Comparison",
"nettlesome.entities.Entity",
"nettlesome.predicates.Predicate"
] | [((1519, 1627), 'nettlesome.predicates.Predicate', 'Predicate', ([], {'content': '"""$organizer1 and $organizer2 planned for $player1 to play $game with $player2."""'}), "(content=\n '$organizer1 and $organizer2 planned for $player1 to play $game with $player2.'\n )\n", (1528, 1627), False, 'from nettlesome.predi... |
import numpy as np
def Linear_Fit(array_A, array_B):
"""
Returns slope and y-intercept of the line of best fit
"""
array_A = np.array(array_A)
array_B = np.array(array_B)
#Pair arrays then sort them for easier fit
zipped_list = zip(array_A[~np.isnan(array_A)], array_B[~np.isnan(array_B... | [
"numpy.array",
"numpy.isnan",
"numpy.polyfit"
] | [((142, 159), 'numpy.array', 'np.array', (['array_A'], {}), '(array_A)\n', (150, 159), True, 'import numpy as np\n'), ((174, 191), 'numpy.array', 'np.array', (['array_B'], {}), '(array_B)\n', (182, 191), True, 'import numpy as np\n'), ((421, 454), 'numpy.polyfit', 'np.polyfit', (['sorted_a', 'sorted_b', '(1)'], {}), '(... |
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
import uvicorn
from app.api import gas_price_prediction, airbnb_predict
app = FastAPI(
title='RESFEBER CARTER DS API',
description=""" Awesome Data Science Team.
\n**INSTRUCTIONS**
\n- To use the API, click on a *post* met... | [
"fastapi.FastAPI",
"uvicorn.run"
] | [((159, 764), 'fastapi.FastAPI', 'FastAPI', ([], {'title': '"""RESFEBER CARTER DS API"""', 'description': '""" Awesome Data Science Team.\n \n**INSTRUCTIONS** \n \n- To use the API, click on a *post* method below. \n \n- Click on "Try it out" on the right side\n \n- Use the default values or enter your own ... |
# OpenCV: Image processing
import cv2
import time
import popupWindow as detectionWindow
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QWidget, QApplication, QLabel, QVBoxLayout
from PyQt5.QtGui import QPixmap
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QThread
# numpy: numerical computa... | [
"core.utils.load_weights",
"tensorflow.keras.layers.Input",
"core.yolov3.YOLOv3",
"core.utils.draw_bbox",
"numpy.copy",
"popupWindow.DetectionWindow",
"tensorflow.shape",
"tensorflow.config.experimental.set_memory_growth",
"core.yolov3.decode",
"tensorflow.concat",
"core.utils.postprocess_boxes"... | [((494, 545), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (538, 545), True, 'import tensorflow as tf\n'), ((1219, 1269), 'tensorflow.keras.layers.Input', 'tf.keras.layers.Input', (['[input_size, input_size, 3]'], {}), '([input... |
"""
Cadquery Extensions
name: extensions.py
by: Gumyr
date: August 2nd 2021
desc:
This python module provides extensions to the native cadquery code base.
Hopefully future generations of cadquery will incorporate this or similar
functionality.
license:
Copyright 2021 Gumyr
Licensed under the... | [
"cadquery.Vector",
"cadquery.Vertex.makeVertex",
"math.radians"
] | [((3310, 3343), 'cadquery.Vector', 'cq.Vector', (['self.x', 'self.y', 'offset'], {}), '(self.x, self.y, offset)\n', (3319, 3343), True, 'import cadquery as cq\n'), ((3854, 3928), 'cadquery.Vertex.makeVertex', 'cq.Vertex.makeVertex', (['(self.X + other.X)', '(self.Y + other.Y)', '(self.Z + other.Z)'], {}), '(self.X + ot... |
# -*- coding: utf-8 -*-
from pyramid.events import ContextFound
from pkg_resources import iter_entry_points
from pyramid.interfaces import IRequest
from openprocurement.api.interfaces import IContentConfigurator
from openprocurement.auctions.core.models import IAuction
from openprocurement.auctions.core.design import a... | [
"pkg_resources.iter_entry_points",
"openprocurement.auctions.core.design.add_design"
] | [((585, 597), 'openprocurement.auctions.core.design.add_design', 'add_design', ([], {}), '()\n', (595, 597), False, 'from openprocurement.auctions.core.design import add_design\n'), ((1332, 1390), 'pkg_resources.iter_entry_points', 'iter_entry_points', (['"""openprocurement.auctions.core.plugins"""'], {}), "('openprocu... |
from __future__ import print_function
import os
import keras
from keras.layers import Dense,Flatten,Conv2D,MaxPooling2D,Activation,Input,Concatenate,Dropout,GlobalAveragePooling2D
from keras.models import Model
import time
from keras.datasets import cifar10
from keras.optimizers import SGD
from keras.utils impo... | [
"keras.preprocessing.image.img_to_array",
"keras.layers.Conv2D",
"keras.layers.Flatten",
"keras.datasets.cifar10.load_data",
"keras.layers.MaxPooling2D",
"keras.layers.Concatenate",
"keras.utils.to_categorical",
"numpy.zeros",
"keras.layers.Input",
"keras.optimizers.SGD",
"keras.models.Model",
... | [((1747, 1771), 'keras.layers.Input', 'Input', ([], {'shape': 'input_shape'}), '(shape=input_shape)\n', (1752, 1771), False, 'from keras.layers import Dense, Flatten, Conv2D, MaxPooling2D, Activation, Input, Concatenate, Dropout, GlobalAveragePooling2D\n'), ((3171, 3204), 'keras.models.Model', 'Model', ([], {'input': '... |
# Generated by Django 3.2.9 on 2021-12-02 09:54
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('shop', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='category',
options={'ordering': ('name',), 'ver... | [
"django.db.migrations.AlterModelOptions"
] | [((213, 333), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""category"""', 'options': "{'ordering': ('name',), 'verbose_name_plural': 'categories'}"}), "(name='category', options={'ordering': ('name',\n ), 'verbose_name_plural': 'categories'})\n", (241, 333), False, 'from... |
'''
Created on 24.01.2018
@author: gregor
'''
import pandas as pd
from ipet.Key import ProblemStatusCodes, SolverStatusCodes, ObjectiveSenseCode
from ipet import Key
from ipet.misc import getInfinity as infty
from ipet.misc import isInfinite as isInf
import numpy as np
import logging
import sqlite3
logger = logging.g... | [
"logging.getLogger",
"pandas.isnull",
"sqlite3.connect",
"ipet.Key.solverToProblemStatusCode",
"ipet.misc.isInfinite",
"ipet.misc.getInfinity"
] | [((311, 338), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (328, 338), False, 'import logging\n'), ((5397, 5410), 'pandas.isnull', 'pd.isnull', (['pb'], {}), '(pb)\n', (5406, 5410), True, 'import pandas as pd\n'), ((5677, 5690), 'pandas.isnull', 'pd.isnull', (['db'], {}), '(db)\n', (568... |
from copy import deepcopy
from hashlib import sha256
import os
import unittest
from google.protobuf.timestamp_pb2 import Timestamp
from blindai.pb.securedexchange_pb2 import (
Payload,
)
from blindai.client import (
RunModelResponse,
UploadModelResponse,
)
from blindai.dcap_attestation import Policy
from ... | [
"blindai.client.RunModelResponse",
"blindai.client.UploadModelResponse",
"os.path.dirname",
"blindai.pb.securedexchange_pb2.Payload.FromString",
"copy.deepcopy",
"blindai.dcap_attestation.Policy.from_file"
] | [((450, 475), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (465, 475), False, 'import os\n'), ((522, 547), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (537, 547), False, 'import os\n'), ((594, 619), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__... |
from setuptools import find_packages, setup
PACKAGE_NAME = "up-bank-api"
VERSION = "0.3.2"
PROJECT_URL = "https://github.com/jcwillox/up-bank-api"
PROJECT_AUTHOR = "<NAME>"
DOWNLOAD_URL = f"{PROJECT_URL}/archive/{VERSION}.zip"
PACKAGES = find_packages()
with open("README.md", "r", encoding="UTF-8") as file:
LONG_... | [
"setuptools.find_packages",
"setuptools.setup"
] | [((239, 254), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (252, 254), False, 'from setuptools import find_packages, setup\n'), ((378, 880), 'setuptools.setup', 'setup', ([], {'name': 'PACKAGE_NAME', 'version': 'VERSION', 'url': 'PROJECT_URL', 'download_url': 'DOWNLOAD_URL', 'author': 'PROJECT_AUTHOR'... |
#main file to run the scripts that generate the data based off of the
#guassian .out files
#and Sauron forged in secret a master ring...
from IPython import get_ipython;
get_ipython().magic('reset -sf')
import pandas as pd
import glob
import os
from rdkit import Chem
from Environmental_PAH_Mutagenicity.rea... | [
"IPython.get_ipython",
"Environmental_PAH_Mutagenicity.read_IP_EA_functions.read_posneg_energy",
"rdkit.Chem.AddHs",
"rdkit.Chem.MolToMolBlock",
"Environmental_PAH_Mutagenicity.read_IP_EA_functions.read_neut_energy",
"rdkit.Chem.MolFromSmiles",
"os.path.join",
"Environmental_PAH_Mutagenicity.get_padel... | [((2157, 2171), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (2169, 2171), True, 'import pandas as pd\n'), ((7175, 7319), 'pandas.read_excel', 'pd.read_excel', (['"""C:\\\\ResearchWorkingDirectory\\\\Environmental_PAH_Mutagenicity\\\\Final_Data\\\\mutagenicity_data.xlsx"""'], {'sheet_name': '"""Sheet1"""'}), "... |
import torch
class LDA:
"""
Fisher's discriminant class.
Attributes
----------
n_features : int
Number of features
n_classes : int
Number of classes
evals_ : torch.Tensor
LDA eigenvalues
evecs_ : torch.Tensor
LDA eigenvectors
S_b_ : torch.Tensor
... | [
"torch.sort",
"torch.unique",
"torch.mean",
"torch.cholesky",
"torch.Tensor",
"torch.sign",
"torch.t",
"torch.nonzero",
"torch.matmul",
"torch.symeig",
"torch.inverse"
] | [((1622, 1641), 'torch.unique', 'torch.unique', (['label'], {}), '(label)\n', (1634, 1641), False, 'import torch\n'), ((3232, 3264), 'torch.cholesky', 'torch.cholesky', (['S_w'], {'upper': '(False)'}), '(S_w, upper=False)\n', (3246, 3264), False, 'import torch\n'), ((3341, 3351), 'torch.t', 'torch.t', (['L'], {}), '(L)... |
import pytest
import datetime
from gps_time.core import GPSTime
from gps_time.leapseconds import LeapSeconds
@pytest.mark.parametrize("year,leap_seconds", [
(1981, 0), (1982, 1), (1983, 2), (1984, 3), (1986, 4), (1989, 5),
(1991, 6), (1992, 7), (1993, 8), (1995, 10), (1997, 11), (1998, 12),
(2000, 13), ... | [
"datetime.datetime",
"pytest.mark.parametrize",
"gps_time.leapseconds.LeapSeconds.get_next_leap_second",
"gps_time.core.GPSTime.from_datetime",
"gps_time.core.GPSTime"
] | [((114, 393), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""year,leap_seconds"""', '[(1981, 0), (1982, 1), (1983, 2), (1984, 3), (1986, 4), (1989, 5), (1991, 6\n ), (1992, 7), (1993, 8), (1995, 10), (1997, 11), (1998, 12), (2000, 13),\n (2007, 14), (2010, 15), (2013, 16), (2016, 17), (2020, 18), (20... |
#!/usr/bin/env python3
from collections import namedtuple, defaultdict
from os.path import join as join_path, dirname, abspath
from copy import deepcopy
from pegparse import create_parser_from_file, ASTWalker
EBNF_FILE = join_path(dirname(abspath(__file__)), 'c-like.ebnf')
CodeBlock = namedtuple('CodeBlock', ['entr... | [
"pegparse.create_parser_from_file",
"collections.namedtuple",
"collections.defaultdict",
"copy.deepcopy",
"os.path.abspath"
] | [((290, 336), 'collections.namedtuple', 'namedtuple', (['"""CodeBlock"""', "['entrance', 'exits']"], {}), "('CodeBlock', ['entrance', 'exits'])\n", (300, 336), False, 'from collections import namedtuple, defaultdict\n'), ((356, 416), 'collections.namedtuple', 'namedtuple', (['"""LivenessAnalysis"""', "['source', 'lines... |
import sys
import sdl2
import sdl2.ext
GREY = sdl2.ext.Color(200, 200, 200)
RED = sdl2.ext.Color(255, 0, 0)
GREEN = sdl2.ext.Color(0, 255, 0)
def onInput(ui, event):
print("Input: ", ui, event)
# print(dir(event))
# print(event.key)#<sdl2.events.SDL_KeyboardEvent
# print(event.text)#sdl2.events.SDL_TextI... | [
"sdl2.ext.UIFactory",
"sdl2.ext.Color",
"sdl2.ext.init",
"sdl2.ext.SpriteFactory",
"sdl2.ext.get_events",
"sdl2.ext.Window",
"sdl2.ext.UIProcessor"
] | [((47, 76), 'sdl2.ext.Color', 'sdl2.ext.Color', (['(200)', '(200)', '(200)'], {}), '(200, 200, 200)\n', (61, 76), False, 'import sdl2\n'), ((83, 108), 'sdl2.ext.Color', 'sdl2.ext.Color', (['(255)', '(0)', '(0)'], {}), '(255, 0, 0)\n', (97, 108), False, 'import sdl2\n'), ((117, 142), 'sdl2.ext.Color', 'sdl2.ext.Color', ... |
import json
import logging
import os
logger = logging.getLogger(__name__)
class DataManager:
# Get the value of a key from the loaded guild/user
def get(self, data_key):
return self.guild_data[data_key] if data_key in self.guild_data else None
# Load a guild/user using ctx from JSON file
def... | [
"logging.getLogger",
"json.load",
"json.dump",
"os.path.isfile"
] | [((47, 74), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (64, 74), False, 'import logging\n'), ((472, 526), 'os.path.isfile', 'os.path.isfile', (['f"""data/{self.id_type}s/{self.id}.json"""'], {}), "(f'data/{self.id_type}s/{self.id}.json')\n", (486, 526), False, 'import os\n'), ((878, 8... |
"""Run coveralls only on travis."""
import os
import subprocess
import click
def echo_call(cmd):
click.echo('calling: {}'.format(' '.join(cmd)), err=True)
@click.command()
def main():
"""Run coveralls only on travis."""
if os.getenv('TRAVIS'):
cmd = ['coveralls']
echo_call(cmd)
s... | [
"click.command",
"subprocess.call",
"os.getenv"
] | [((164, 179), 'click.command', 'click.command', ([], {}), '()\n', (177, 179), False, 'import click\n'), ((239, 258), 'os.getenv', 'os.getenv', (['"""TRAVIS"""'], {}), "('TRAVIS')\n", (248, 258), False, 'import os\n'), ((319, 339), 'subprocess.call', 'subprocess.call', (['cmd'], {}), '(cmd)\n', (334, 339), False, 'impor... |
from app import db
class GenLoc(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50))
sublocs = db.relationship('SubLoc', backref='general_location', lazy='dynamic')
events = db.relationship('Event', backref='general_location', lazy='dynamic')
def __repr__(self):
return '<Gen... | [
"app.db.String",
"app.db.Column",
"app.db.ForeignKey",
"app.db.relationship"
] | [((50, 89), 'app.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (59, 89), False, 'from app import db\n'), ((134, 203), 'app.db.relationship', 'db.relationship', (['"""SubLoc"""'], {'backref': '"""general_location"""', 'lazy': '"""dynamic"""'}), "('SubLoc', back... |
import os
import argparse
import re
def main(args):
line1_regex = re.compile(r'^iter: (?P<iter>\d{1,10}) \/ \d{1,10}, total loss: (?P<tot_loss>\d{1,10}.\d{1,10})')
line2_regex = re.compile(r'^ >>> loss_cls \(detector\)\: (?P<loss_cls>\d{1,10}.\d{1,10})')
line3_regex = re.compile(r'^ >>> loss_box \(detector... | [
"argparse.ArgumentParser",
"re.compile"
] | [((71, 182), 're.compile', 're.compile', (['"""^iter: (?P<iter>\\\\d{1,10}) \\\\/ \\\\d{1,10}, total loss: (?P<tot_loss>\\\\d{1,10}.\\\\d{1,10})"""'], {}), "(\n '^iter: (?P<iter>\\\\d{1,10}) \\\\/ \\\\d{1,10}, total loss: (?P<tot_loss>\\\\d{1,10}.\\\\d{1,10})'\n )\n", (81, 182), False, 'import re\n'), ((187, 272)... |
import unittest
class Solution:
def compareVersion(self, version1, version2):
"""
:type version1: str
:type version2: str
:rtype: int
"""
version1 = [int(s) for s in version1.split('.')]
version2 = [int(s) for s in version2.split('.')]
for v1, v2 in... | [
"unittest.main"
] | [((1253, 1268), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1266, 1268), False, 'import unittest\n')] |
#!/usr/bin/env python
# coding: utf-8
from __future__ import print_function
import requests
from bs4 import BeautifulSoup
from PIL import Image
from io import BytesIO
from getpass import getpass
import re
import sys
import json
import argparse
import yaml
from six.moves import input
class EmojiRegister(object):
... | [
"re.split",
"PIL.Image.open",
"requests.Session",
"argparse.ArgumentParser",
"six.moves.input",
"io.BytesIO",
"yaml.load",
"getpass.getpass",
"bs4.BeautifulSoup"
] | [((4402, 4464), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Slack Emoji Save Script"""'}), "(description='Slack Emoji Save Script')\n", (4425, 4464), False, 'import argparse\n'), ((1157, 1175), 'requests.Session', 'requests.Session', ([], {}), '()\n', (1173, 1175), False, 'import requ... |
from API_client.python.lib.dataset import dataset
import dh_py_access.lib.datahub as datahub
from dh_py_access import package_api
import datetime
server = 'http://api.planetos.com/v1/datasets/'
API_key = open('APIKEY').read().strip()
today = datetime.datetime.today()
two_days_ago = today - datetime.timedelta(days=1)
... | [
"dh_py_access.lib.datahub.datahub_main",
"datetime.datetime.today",
"datetime.timedelta",
"datetime.datetime.strftime",
"API_client.python.lib.dataset.dataset"
] | [((243, 268), 'datetime.datetime.today', 'datetime.datetime.today', ([], {}), '()\n', (266, 268), False, 'import datetime\n'), ((410, 439), 'dh_py_access.lib.datahub.datahub_main', 'datahub.datahub_main', (['API_key'], {}), '(API_key)\n', (430, 439), True, 'import dh_py_access.lib.datahub as datahub\n'), ((445, 480), '... |
import numpy as np
from scipy.stats import binom
# import modules needed for logging
import logging
import os
logger = logging.getLogger(__name__) # module logger
def cummin(x):
"""A python implementation of the cummin function in R"""
for i in range(1, len(x)):
if x[i-1] < x[i]:
x[i] = ... | [
"logging.getLogger",
"numpy.asarray",
"scipy.stats.binom.sf",
"numpy.argsort",
"numpy.array",
"numpy.isnan",
"numpy.arange"
] | [((121, 148), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (138, 148), False, 'import logging\n'), ((763, 777), 'numpy.array', 'np.array', (['pval'], {}), '(pval)\n', (771, 777), True, 'import numpy as np\n'), ((797, 819), 'numpy.argsort', 'np.argsort', (['pval_array'], {}), '(pval_arra... |
# __main__.py
import argparse
import os
from configparser import ConfigParser
from canvas_client.client import Client
from canvas_client import util
#TODO add progress bar
config_path = os.path.join(".", "config.json")
if not os.path.isfile(config_path):
init = util.query_yes_no( "No conf... | [
"canvas_client.util.query_yes_no",
"canvas_client.util.load_json",
"argparse.ArgumentParser",
"canvas_client.client.Client",
"os.path.join",
"os.path.isfile"
] | [((203, 235), 'os.path.join', 'os.path.join', (['"""."""', '"""config.json"""'], {}), "('.', 'config.json')\n", (215, 235), False, 'import os\n'), ((1263, 1294), 'canvas_client.util.load_json', 'util.load_json', (['"""./config.json"""'], {}), "('./config.json')\n", (1277, 1294), False, 'from canvas_client import util\n... |
# coding=utf8
from email.header import Header
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
from email.utils import parseaddr, formataddr
import smtplib
from cgtk_config import studio_config
def format_addr(s):
name, addr = parseaddr(s)... | [
"smtplib.SMTP",
"smtplib.SMTP_SSL",
"email.utils.parseaddr",
"cgtk_config.studio_config.get",
"email.mime.multipart.MIMEMultipart",
"email.header.Header",
"email.mime.text.MIMEText"
] | [((308, 320), 'email.utils.parseaddr', 'parseaddr', (['s'], {}), '(s)\n', (317, 320), False, 'from email.utils import parseaddr, formataddr\n'), ((531, 557), 'cgtk_config.studio_config.get', 'studio_config.get', (['"""email"""'], {}), "('email')\n", (548, 557), False, 'from cgtk_config import studio_config\n'), ((710, ... |
import io
from flask import (
Blueprint,
render_template,
abort,
current_app,
make_response
)
import numpy as np
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
client = Blueprint('client', __name__, template_folder='templates', ... | [
"flask.render_template",
"numpy.random.rand",
"matplotlib.figure.Figure",
"matplotlib.backends.backend_agg.FigureCanvasAgg",
"io.StringIO",
"flask.Blueprint"
] | [((261, 351), 'flask.Blueprint', 'Blueprint', (['"""client"""', '__name__'], {'template_folder': '"""templates"""', 'static_url_path': '"""/static"""'}), "('client', __name__, template_folder='templates', static_url_path=\n '/static')\n", (270, 351), False, 'from flask import Blueprint, render_template, abort, curre... |
"""
Requirements:
-----------
pyngrok==5.0.5
mlflow==1.15.0
pandas==1.2.3
numpy==1.19.3
scikit-learn==0.24.1
Examples of usege can be found in the url below:
https://nbviewer.jupyter.org/github/abreukuse/ml_utilities/blob/master/examples/experiments_management.ipynb
"""
import os
import mlflow
from pyngrok import ng... | [
"numpy.mean",
"mlflow.set_tag",
"numpy.sqrt",
"os.makedirs",
"pyngrok.ngrok.kill",
"sklearn.model_selection.train_test_split",
"mlflow.log_metric",
"mlflow.set_experiment",
"mlflow.get_experiment_by_name",
"mlflow.log_artifacts",
"pyngrok.ngrok.connect",
"mlflow.start_run",
"numpy.round"
] | [((574, 586), 'pyngrok.ngrok.kill', 'ngrok.kill', ([], {}), '()\n', (584, 586), False, 'from pyngrok import ngrok\n'), ((606, 661), 'pyngrok.ngrok.connect', 'ngrok.connect', ([], {'addr': '"""5000"""', 'proto': '"""http"""', 'bind_tls': '(True)'}), "(addr='5000', proto='http', bind_tls=True)\n", (619, 661), False, 'fro... |
# -*- coding: utf-8 -*-
# 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 "Lic... | [
"pytest.mark.parametrize"
] | [((867, 916), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""value"""', 'data.NOT_A_DICT'], {}), "('value', data.NOT_A_DICT)\n", (890, 916), False, 'import pytest\n'), ((1308, 1367), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""value"""', 'data.NOT_A_DICT_OR_STRING'], {}), "('value', data.NO... |
#!/usr/bin/env python3.6
import random
from account import Credentials
from account import User
def create_account(users_name,username,password):
"""
function to create new credentials for a new account
"""
new_account = User(users_name)
new_account = Credentials(username,password)
return new_... | [
"account.Credentials.display_credentials",
"account.Credentials",
"random.choice",
"account.User",
"account.Credentials.copy_credentials",
"account.Credentials.find_by_username"
] | [((239, 255), 'account.User', 'User', (['users_name'], {}), '(users_name)\n', (243, 255), False, 'from account import User\n'), ((274, 305), 'account.Credentials', 'Credentials', (['username', 'password'], {}), '(username, password)\n', (285, 305), False, 'from account import Credentials\n'), ((716, 754), 'account.Cred... |
#//////////////#####///////////////
#
# ANU u6325688 <NAME>
# Supervisor: Dr.<NAME>
#//////////////#####///////////////
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
from torch.autograd import Variable
import torch.utils.data
impor... | [
"matplotlib.pyplot.ylabel",
"torch.full",
"matplotlib.pyplot.xlabel",
"GAIL.Generator.Generator1D",
"torch.from_numpy",
"matplotlib.pyplot.close",
"torch.nn.BCELoss",
"torch.cuda.is_available",
"numpy.zeros",
"GAIL.PPO.PPO",
"GAIL.Discriminator.Discriminator1D",
"sklearn.preprocessing.normaliz... | [((598, 623), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (621, 623), False, 'import torch\n'), ((741, 766), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (764, 766), False, 'import torch\n'), ((950, 962), 'torch.nn.BCELoss', 'nn.BCELoss', ([], {}), '()\n', (960, 96... |
"""
Lexers
======
Additional Lexers not included in Pygments
"""
import re
from pygments.lexer import Lexer, do_insertions
from pygments.lexers.javascript import JavascriptLexer
from pygments.token import Generic
# =============================================================================
line_re = re.compile('... | [
"pygments.lexers.javascript.JavascriptLexer",
"re.compile"
] | [((308, 327), 're.compile', 're.compile', (['""".*?\n"""'], {}), "('.*?\\n')\n", (318, 327), False, 'import re\n'), ((979, 1010), 'pygments.lexers.javascript.JavascriptLexer', 'JavascriptLexer', ([], {}), '(**self.options)\n', (994, 1010), False, 'from pygments.lexers.javascript import JavascriptLexer\n')] |
from utils import *
from block_descriptor import *
from Crypto.Cipher import AES
import hashlib
import cStringIO
import gzip
import json
import gzip_mod
import os
class Image:
def __init__(self, image_data, read=True):
self.stream = cStringIO.StringIO(image_data)
self.stream_len = le... | [
"os.path.getsize",
"cStringIO.StringIO",
"hashlib.new",
"os.urandom",
"json.dumps",
"gzip_mod.GzipFile",
"gzip.GzipFile",
"Crypto.Cipher.AES.new"
] | [((260, 290), 'cStringIO.StringIO', 'cStringIO.StringIO', (['image_data'], {}), '(image_data)\n', (278, 290), False, 'import cStringIO\n'), ((1337, 1403), 'Crypto.Cipher.AES.new', 'AES.new', ([], {'key': "key_pair['key']", 'mode': 'AES.MODE_CBC', 'IV': "key_pair['iv']"}), "(key=key_pair['key'], mode=AES.MODE_CBC, IV=ke... |
from __future__ import print_function, division
from black import out
import numpy as np
import torch
import torch.nn.functional as F
import torch.nn as nn
import torch
from torch.autograd import Variable
import torch.nn.functional as F
import numpy as np
try:
from itertools import ifilterfalse
except ImportErro... | [
"torch.sort",
"torch.log",
"numpy.unique",
"numpy.ones",
"torch.nn.CrossEntropyLoss",
"torch.mean",
"sklearn.utils.class_weight.compute_class_weight",
"torch.exp",
"itertools.filterfalse",
"torch.pow",
"numpy.array",
"torch.from_numpy",
"torch.sum",
"torch.nn.functional.one_hot",
"torch.... | [((8712, 8754), 'torch.sort', 'torch.sort', (['errors'], {'dim': '(0)', 'descending': '(True)'}), '(errors, dim=0, descending=True)\n', (8722, 8754), False, 'import torch\n'), ((13562, 13594), 'torch.nn.functional.one_hot', 'F.one_hot', (['categorical', 'nb_class'], {}), '(categorical, nb_class)\n', (13571, 13594), Tru... |
#!/usr/bin/env python2
"""Basic Snapchat client
Usage:
get_stories.py [-q -z] -u <username> [-p <password> | -a <auth_token>] --gmail=<gmail> --gpasswd=<gpasswd> <path>
Options:
-h --help Show usage
-q --quiet Suppress output
-u --username=<username> Username
-p ... | [
"snapy.Snapchat",
"zipfile.is_zipfile",
"getpass.getpass",
"sys.exit",
"snapy.utils.unzip_snap_mp4",
"docopt.docopt",
"snapy.get_file_extension"
] | [((878, 893), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (884, 893), False, 'from docopt import docopt\n'), ((1375, 1385), 'snapy.Snapchat', 'Snapchat', ([], {}), '()\n', (1383, 1385), False, 'from snapy import get_file_extension, Snapchat\n'), ((1135, 1161), 'getpass.getpass', 'getpass', (['"""Gmail ... |
from my_utils.dicts.get_config_item import get_config_item
from rlkit.torch.sac.diayn.diayn_env_replay_buffer import DIAYNEnvReplayBuffer
from diayn.memory.replay_buffer_prioritized import DIAYNEnvReplayBufferEBP
from diayn.energy.calc_energy_1D_pos_dim import calc_energy_1d_pos_dim
from diayn.energy.calc_energy_mcar... | [
"diayn.memory.replay_buffer_prioritized.DIAYNEnvReplayBufferEBP",
"diayn.memory.replay_buffer_discrete.DIAYNEnvReplayBufferOptDiscrete",
"my_utils.dicts.get_config_item.get_config_item"
] | [((548, 613), 'my_utils.dicts.get_config_item.get_config_item', 'get_config_item', ([], {'config': 'config', 'key': '"""ebp_sampling"""', 'default': '(False)'}), "(config=config, key='ebp_sampling', default=False)\n", (563, 613), False, 'from my_utils.dicts.get_config_item import get_config_item\n'), ((853, 938), 'diay... |
from errors import LoxRuntimeError
class Environment:
def __init__(self, parent=None):
self.parent: Environment = parent
self.values = {}
def ancestor(self, distance):
e = self
for i in range(0, distance):
e = e.parent
return e
def define(self, name, ... | [
"errors.LoxRuntimeError"
] | [((599, 660), 'errors.LoxRuntimeError', 'LoxRuntimeError', (['name', 'f"""Undefined Variable \'{name.lexeme}\'."""'], {}), '(name, f"Undefined Variable \'{name.lexeme}\'.")\n', (614, 660), False, 'from errors import LoxRuntimeError\n'), ((1041, 1102), 'errors.LoxRuntimeError', 'LoxRuntimeError', (['name', 'f"""Undefine... |
# imports
import numpy as np
from rubin_sim.maf.metrics.baseMetric import BaseMetric
# constants
__all__ = ["UseMetric"]
# exception classes
# interface functions
# classes
class UseMetric(BaseMetric): # pylint: disable=too-few-public-methods
"""Metric to classify visits by type of visits"""
def __ini... | [
"numpy.all"
] | [((1251, 1272), 'numpy.all', 'np.all', (['(notes == note)'], {}), '(notes == note)\n', (1257, 1272), True, 'import numpy as np\n')] |
import time
import numpy as np
from tqdm import tqdm
from sklearn.decomposition import MiniBatchDictionaryLearning
from .metrics import distance_between_atoms
from .visualizations import show_dictionary_atoms_img
from .plots import plot_reconstruction_error_and_dictionary_distances
def loader(X, batch_size):
for ... | [
"numpy.copy",
"sklearn.decomposition.MiniBatchDictionaryLearning",
"numpy.array",
"numpy.zeros",
"time.time"
] | [((1165, 1290), 'sklearn.decomposition.MiniBatchDictionaryLearning', 'MiniBatchDictionaryLearning', ([], {'n_components': 'n_atoms', 'batch_size': 'batch_size', 'transform_algorithm': '"""lasso_lars"""', 'verbose': '(False)'}), "(n_components=n_atoms, batch_size=batch_size,\n transform_algorithm='lasso_lars', verbos... |
from collections import deque
def cin():
return list(map(int, input().split()))
n, q = cin()
graph = [[] for _ in range(n + 1)]
for i in range(n - 1):
a, b = cin()
graph[a].append(b)
graph[b].append(a)
query = [cin() for _ in range(q)]
dist = [-1 for _ in range(n + 1)]
dist[0] = 0
dist[1] = 0
d... | [
"collections.deque"
] | [((323, 330), 'collections.deque', 'deque', ([], {}), '()\n', (328, 330), False, 'from collections import deque\n')] |
import sys
import os
# Add basedir to path
script_dir = os.path.abspath(os.path.dirname(__file__))
sys.path.append(script_dir + "/../")
import numpy as np
import pandas as pd
import torch
from torch.utils.data import Dataset, DataLoader
from data.utils import read_pickle_from_file
from dscribe.descriptors import ACSF
... | [
"data.utils.read_pickle_from_file",
"pandas.read_csv",
"torch.from_numpy",
"os.path.dirname",
"numpy.array",
"numpy.concatenate",
"torch.utils.data.DataLoader",
"numpy.ravel",
"sys.path.append",
"numpy.load",
"time.time"
] | [((100, 136), 'sys.path.append', 'sys.path.append', (["(script_dir + '/../')"], {}), "(script_dir + '/../')\n", (115, 136), False, 'import sys\n'), ((73, 98), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (88, 98), False, 'import os\n'), ((4884, 4976), 'torch.utils.data.DataLoader', 'DataLoa... |
"""Module state store tests."""
import pytest
from pytest_lazyfixture import lazy_fixture # type: ignore[import]
from opentrons.types import DeckSlotName
from opentrons.protocol_engine import commands, actions
from opentrons.protocol_engine.commands import (
heater_shaker as hs_commands,
temperature_module as... | [
"opentrons.protocol_engine.commands.thermocycler.DeactivateLidParams",
"opentrons.protocol_engine.commands.thermocycler.DeactivateLidResult",
"opentrons.protocol_engine.commands.temperature_module.DeactivateTemperatureResult",
"opentrons.protocol_engine.commands.heater_shaker.DeactivateHeaterParams",
"opent... | [((1002, 1015), 'opentrons.protocol_engine.state.modules.ModuleStore', 'ModuleStore', ([], {}), '()\n', (1013, 1015), False, 'from opentrons.protocol_engine.state.modules import ModuleStore, ModuleState, HardwareModule\n'), ((3165, 3178), 'opentrons.protocol_engine.state.modules.ModuleStore', 'ModuleStore', ([], {}), '... |
"""
To check if a point P lies within the N sided polygon:
Step 1: Area of the polygon = sum of area of N-2 triangles formed by the polygon points.
Step 2: Area Covered by P = sum of areas of N triangles formed by P and any two adjasecnt sides of the ploygon.
If areas obtain from step 1 and 2 are equal then P lies with... | [
"sys.exit"
] | [((839, 850), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (847, 850), False, 'import sys\n')] |
from twitchstreams.models import *
from django.contrib import admin
admin.site.register(Channel)
admin.site.register(Tag)
| [
"django.contrib.admin.site.register"
] | [((69, 97), 'django.contrib.admin.site.register', 'admin.site.register', (['Channel'], {}), '(Channel)\n', (88, 97), False, 'from django.contrib import admin\n'), ((98, 122), 'django.contrib.admin.site.register', 'admin.site.register', (['Tag'], {}), '(Tag)\n', (117, 122), False, 'from django.contrib import admin\n')] |
"""award_details JSON blob and awarded_at date stamp on BriefResponse
Constraint on Brief to allow only one BriefResponse with non-null 'awarded_at'
Revision ID: 960
Revises: 950
Create Date: 2017-08-07 15:22:43.619680
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# r... | [
"sqlalchemy.text",
"sqlalchemy.DateTime",
"sqlalchemy.Text",
"alembic.op.drop_column",
"alembic.op.drop_index"
] | [((910, 1011), 'alembic.op.drop_index', 'op.drop_index', (['"""idx_brief_responses_unique_awarded_at_per_brief_id"""'], {'table_name': '"""brief_responses"""'}), "('idx_brief_responses_unique_awarded_at_per_brief_id',\n table_name='brief_responses')\n", (923, 1011), False, 'from alembic import op\n'), ((1012, 1059),... |
import pygame
change = int(input('Digite o Número da música que você deseja tocar: [1/2/3/4]: '))
if change == (1000-999):
print("Está tocando: 'Diego e <NAME> - Pisadinha'")
music1= pygame.mixer.init()
pygame.init()
pygame.mixer.music.load('pis.mp3')
pygame.mixer.music.play()
pygame.event.wai... | [
"pygame.mixer.init",
"pygame.init",
"pygame.event.wait",
"pygame.mixer.music.load",
"pygame.mixer.music.play"
] | [((193, 212), 'pygame.mixer.init', 'pygame.mixer.init', ([], {}), '()\n', (210, 212), False, 'import pygame\n'), ((217, 230), 'pygame.init', 'pygame.init', ([], {}), '()\n', (228, 230), False, 'import pygame\n'), ((235, 269), 'pygame.mixer.music.load', 'pygame.mixer.music.load', (['"""pis.mp3"""'], {}), "('pis.mp3')\n"... |
#!/usr/bin/python
#
# Copyright (c) 2012 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify... | [
"pysam.Fastafile",
"pypeline.common.formats.fasta.FASTA",
"pypeline.node.NodeError",
"pypeline.common.sequences.reverse_complement",
"pypeline.common.fileutils.move_file",
"pypeline.common.formats.msa.MSA.from_file",
"pypeline.common.utilities.safe_coerce_to_frozenset",
"itertools.groupby",
"os.path... | [((1899, 1925), 'copy.deepcopy', 'copy.deepcopy', (['fasta_files'], {}), '(fasta_files)\n', (1912, 1925), False, 'import copy\n'), ((1952, 1997), 'pypeline.common.utilities.safe_coerce_to_frozenset', 'utilities.safe_coerce_to_frozenset', (['sequences'], {}), '(sequences)\n', (1986, 1997), True, 'import pypeline.common.... |
import cv2
import numpy as np
from random import randrange
#generated by:<NAME>
trained_face_data = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
webcam=cv2.VideoCapture(0)
while True:
successful_frame_read , frame = webcam.read()
grayscaled_img = cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
face_c... | [
"random.randrange",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.CascadeClassifier",
"cv2.waitKey"
] | [((100, 160), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""haarcascade_frontalface_default.xml"""'], {}), "('haarcascade_frontalface_default.xml')\n", (121, 160), False, 'import cv2\n'), ((168, 187), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (184, 187), False, 'import cv2\n'), ((271, 31... |
"""
Implementation of a Compiler for INE5426 - UFSC Authors:
<NAME> (18100539)
<NAME> (18102721)
<NAME> (18100547)
"""
import ply.yacc as yacc
from draguilexer import tokens
def p_program(p):
'''program : statement
| funclist
| empty
'''
pass
def p_funclist(p):
... | [
"ply.yacc.yacc"
] | [((6029, 6040), 'ply.yacc.yacc', 'yacc.yacc', ([], {}), '()\n', (6038, 6040), True, 'import ply.yacc as yacc\n')] |
from multiprocessing.pool import ThreadPool as Pool
from typing import Any, Hashable
import pandas as pd
from rockflow.common.datatime_helper import GmtDatetimeCheck
from rockflow.common.logo import Public, Etoro
from rockflow.operators.common import is_none_us_symbol
from rockflow.operators.const import GLOBAL_DEBUG... | [
"rockflow.operators.common.is_none_us_symbol",
"multiprocessing.pool.ThreadPool"
] | [((1362, 1387), 'rockflow.operators.common.is_none_us_symbol', 'is_none_us_symbol', (['symbol'], {}), '(symbol)\n', (1379, 1387), False, 'from rockflow.operators.common import is_none_us_symbol\n'), ((2058, 2078), 'multiprocessing.pool.ThreadPool', 'Pool', (['self.pool_size'], {}), '(self.pool_size)\n', (2062, 2078), T... |
import pandas as pd
from databases.connection import connector_mysql, create_table, create_sale
# CONNECT TO DATABASE MYSQL
mydb = connector_mysql()
# CREATE TABLE SALES
create_table()
mycursor = mydb.cursor()
# LOAD FILE CSV
data = pd.read_csv('sales_data_sample.csv', sep=";", encoding="latin1")
data = data.filln... | [
"pandas.read_csv",
"databases.connection.create_sale",
"databases.connection.create_table",
"databases.connection.connector_mysql",
"pandas.to_datetime"
] | [((133, 150), 'databases.connection.connector_mysql', 'connector_mysql', ([], {}), '()\n', (148, 150), False, 'from databases.connection import connector_mysql, create_table, create_sale\n'), ((173, 187), 'databases.connection.create_table', 'create_table', ([], {}), '()\n', (185, 187), False, 'from databases.connectio... |
from .exception import AuthFailedException
from .client import default_client
def init(client=default_client):
"""
Init configuration for SocketIO client.
Returns:
Event client that will be able to set listeners.
"""
from socketIO_client import SocketIO, BaseNamespace
from . import ge... | [
"gazu.client.make_auth_header"
] | [((461, 479), 'gazu.client.make_auth_header', 'make_auth_header', ([], {}), '()\n', (477, 479), False, 'from gazu.client import make_auth_header\n')] |
#-------------------------------------------------------------------------------
# Project: Paldb
# Name: Paldb
# Purpose:
# Author: zhaozhongyu
# Created: 2/9/2017 4:23 PM
# Copyright: (c) "zhaozhongyu" "2/9/2017 4:23 PM"
# Licence: <your licence>
# -*- coding:utf-8 -*-
#---------------... | [
"Paldb.ipml.ReaderIpml.ReaderIpml",
"Paldb.ipml.WriterIpml.WriterIpml"
] | [((569, 596), 'Paldb.ipml.WriterIpml.WriterIpml', 'WriterIpml.WriterIpml', (['file'], {}), '(file)\n', (590, 596), False, 'from Paldb.ipml import ReaderIpml, WriterIpml\n'), ((667, 694), 'Paldb.ipml.ReaderIpml.ReaderIpml', 'ReaderIpml.ReaderIpml', (['file'], {}), '(file)\n', (688, 694), False, 'from Paldb.ipml import R... |
import connexion
from openapi_server import encoder
from flask import redirect
ARGUMENTS = {
'title': 'OpenAPI for NCATS Biomedical Translator Reasoners'
}
PORT=8080
def main(name:str):
"""
Sets up and runs the web application.
Usage in server/openapi_server/__main__.py:
from reasoner import... | [
"connexion.App"
] | [((406, 457), 'connexion.App', 'connexion.App', (['name'], {'specification_dir': '"""./openapi/"""'}), "(name, specification_dir='./openapi/')\n", (419, 457), False, 'import connexion\n')] |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. py:currentmodule:: pysemeels.tools.generate_hdf5_file
.. moduleauthor:: <NAME> <<EMAIL>>
Generate HDF5 file from Hitachi EELS data.
"""
###############################################################################
# Copyright 2017 <NAME>
#
# Licensed under the... | [
"numpy.zeros",
"pysemeels.hitachi.eels_su.elv_file.ElvFile",
"pysemeels.hitachi.eels_su.elv_text_file.ElvTextParameters",
"numpy.arange"
] | [((1859, 1878), 'pysemeels.hitachi.eels_su.elv_text_file.ElvTextParameters', 'ElvTextParameters', ([], {}), '()\n', (1876, 1878), False, 'from pysemeels.hitachi.eels_su.elv_text_file import ElvTextParameters\n'), ((2883, 2892), 'pysemeels.hitachi.eels_su.elv_file.ElvFile', 'ElvFile', ([], {}), '()\n', (2890, 2892), Fal... |
import torch
class CELoss(torch.nn.Module):
def __init__(self):
super(CELoss, self).__init__()
def forward(self, y_pred, y_true):
y_pred = torch.clamp(y_pred, 1e-9, 1 - 1e-9)
return -(y_true * torch.log(y_pred)).sum(dim=1).mean()
| [
"torch.log",
"torch.clamp"
] | [((167, 204), 'torch.clamp', 'torch.clamp', (['y_pred', '(1e-09)', '(1 - 1e-09)'], {}), '(y_pred, 1e-09, 1 - 1e-09)\n', (178, 204), False, 'import torch\n'), ((229, 246), 'torch.log', 'torch.log', (['y_pred'], {}), '(y_pred)\n', (238, 246), False, 'import torch\n')] |
# MinimalDX version 0.1.4 (https://www.github.com/dmey/minimal-dx).
# Copyright 2018-2020 <NAME> and <NAME>. Licensed under MIT.
import subprocess
import os
from collections import namedtuple
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn a... | [
"os.path.exists",
"matplotlib.pyplot.setp",
"collections.namedtuple",
"pandas.read_csv",
"subprocess.check_call",
"matplotlib.use",
"os.makedirs",
"pandas.DataFrame",
"seaborn.despine",
"os.path.join",
"seaborn.set_style",
"seaborn.boxplot",
"matplotlib.pyplot.close",
"os.path.abspath",
... | [((211, 232), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (225, 232), False, 'import matplotlib\n'), ((326, 348), 'seaborn.set_style', 'sns.set_style', (['"""ticks"""'], {}), "('ticks')\n", (339, 348), True, 'import seaborn as sns\n'), ((952, 1003), 'os.path.join', 'os.path.join', (['path_to_e... |
import sys
import click
import numpy as np
import pandas as pd
import tensorflow as tf
import tensorflow.keras.backend as K
import tensorflow_probability as tfp
import statsmodels.api as sm
import xgboost as xgb
import matplotlib.pyplot as plt
import seaborn as sns
from abc import ABC, abstractmethod
from pathlib... | [
"tensorflow.cast",
"numpy.random.RandomState",
"seaborn.set",
"pathlib.Path",
"click.option",
"bore_experiments.datasets.make_classification_dataset",
"numpy.linspace",
"click.command",
"click.argument",
"statsmodels.api.nonparametric.KDEUnivariate",
"tensorflow.keras.losses.BinaryCrossentropy",... | [((717, 740), 'tensorflow.keras.backend.set_floatx', 'K.set_floatx', (['"""float64"""'], {}), "('float64')\n", (729, 740), True, 'import tensorflow.keras.backend as K\n'), ((3229, 3244), 'click.command', 'click.command', ([], {}), '()\n', (3242, 3244), False, 'import click\n'), ((3246, 3268), 'click.argument', 'click.a... |
"""
imgLog.py - experimental log for imgFolder
initial: 2019-10-04
"""
import os
import pandas as pd
if ('np' not in dir()): import numpy as np
from imlib.imgfolder import ImgFolder
__author__ = '<NAME> <<EMAIL>>'
__version__ = '1.0.0'
class ImgLog(ImgFolder):
""" imgFolder for channel experiment images """
... | [
"os.path.isfile",
"numpy.array",
"pandas.ExcelWriter",
"pandas.read_excel"
] | [((2968, 2998), 'os.path.isfile', 'os.path.isfile', (['self._logfname'], {}), '(self._logfname)\n', (2982, 2998), False, 'import os\n'), ((2744, 2774), 'pandas.ExcelWriter', 'pd.ExcelWriter', (['self._logfname'], {}), '(self._logfname)\n', (2758, 2774), True, 'import pandas as pd\n'), ((3102, 3144), 'pandas.read_excel'... |
# say action
import sys, time
from actionproxy import ActionProxy
ACTION_NAME = 'say'
class SayActionProxy(ActionProxy):
def __init__(self, actionname):
ActionProxy.__init__(self, actionname)
def __del__(self):
ActionProxy.__del__(self)
def action_thread(self, params):
v ... | [
"actionproxy.ActionProxy.__init__",
"actionproxy.ActionProxy.__del__",
"time.sleep"
] | [((172, 210), 'actionproxy.ActionProxy.__init__', 'ActionProxy.__init__', (['self', 'actionname'], {}), '(self, actionname)\n', (192, 210), False, 'from actionproxy import ActionProxy\n'), ((244, 269), 'actionproxy.ActionProxy.__del__', 'ActionProxy.__del__', (['self'], {}), '(self)\n', (263, 269), False, 'from actionp... |
from datetime import datetime
import logging
from weconnect.addressable import AddressableAttribute, AddressableList
from weconnect.elements.generic_settings import GenericSettings
from weconnect.util import robustTimeParse
LOG = logging.getLogger("weconnect")
class ChargingProfiles(GenericSettings):
def __init... | [
"logging.getLogger",
"weconnect.addressable.AddressableAttribute",
"weconnect.util.robustTimeParse",
"weconnect.addressable.AddressableList"
] | [((232, 262), 'logging.getLogger', 'logging.getLogger', (['"""weconnect"""'], {}), "('weconnect')\n", (249, 262), False, 'import logging\n'), ((464, 517), 'weconnect.addressable.AddressableList', 'AddressableList', ([], {'localAddress': '"""profiles"""', 'parent': 'self'}), "(localAddress='profiles', parent=self)\n", (... |
#!/usr/bin/env python3
import os
import ctypes
import platform
import logging
logger = logging.getLogger(__name__)
def load_dll():
dl_path_env = os.getenv("CENTAURUS_DL_PATH", "")
if platform.uname()[0] == "Windows":
dl_path = os.path.join(dl_path_env, "libpycentaurus.dll")
elif platform.uname()[... | [
"logging.getLogger",
"ctypes.CFUNCTYPE",
"ctypes.POINTER",
"os.getenv",
"os.path.join",
"platform.uname",
"ctypes.CDLL"
] | [((89, 116), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (106, 116), False, 'import logging\n'), ((503, 557), 'ctypes.CFUNCTYPE', 'ctypes.CFUNCTYPE', (['None', 'ctypes.c_wchar_p', 'ctypes.c_int'], {}), '(None, ctypes.c_wchar_p, ctypes.c_int)\n', (519, 557), False, 'import ctypes\n'), (... |
import os
import bpy
import bpy_extras
from ..core import animation_lists
from ..core import detection_manager
class DetectFaceShapes(bpy.types.Operator):
bl_idname = "rsl.detect_face_shapes"
bl_label = "Auto Detect"
bl_description = "Automatically detect face shape keys for supported naming schemes"
... | [
"os.path.dirname",
"bpy.props.StringProperty",
"bpy.props.CollectionProperty",
"os.path.basename"
] | [((2071, 2176), 'bpy.props.CollectionProperty', 'bpy.props.CollectionProperty', ([], {'type': 'bpy.types.OperatorFileListElement', 'options': "{'HIDDEN', 'SKIP_SAVE'}"}), "(type=bpy.types.OperatorFileListElement,\n options={'HIDDEN', 'SKIP_SAVE'})\n", (2099, 2176), False, 'import bpy\n'), ((2188, 2284), 'bpy.props.S... |
from django.contrib.auth import get_user_model
from ninja import Schema
from ninja.orm import create_schema
from typing import Dict, List
UsernameSchemaMixin = create_schema(
get_user_model(),
fields=[get_user_model().USERNAME_FIELD]
)
EmailSchemaMixin = create_schema(
get_user_model(),
fields=[get_u... | [
"django.contrib.auth.get_user_model"
] | [((181, 197), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (195, 197), False, 'from django.contrib.auth import get_user_model\n'), ((285, 301), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (299, 301), False, 'from django.contrib.auth import get_user_model\n'), (... |
from prettytable import PrettyTable
pid = [int(x) for x in input('Enter the process ids: ').split()]
burst = [int(x) for x in input('Enter the burst time: ').split()]
table = PrettyTable(['Process Id', 'Burst Time'])
# Assumption: All processes arrive at time t=0
n = len(pid)
timeQuantum = int(input("Enter ... | [
"prettytable.PrettyTable"
] | [((180, 221), 'prettytable.PrettyTable', 'PrettyTable', (["['Process Id', 'Burst Time']"], {}), "(['Process Id', 'Burst Time'])\n", (191, 221), False, 'from prettytable import PrettyTable\n'), ((1298, 1311), 'prettytable.PrettyTable', 'PrettyTable', ([], {}), '()\n', (1309, 1311), False, 'from prettytable import Pretty... |
"""Validates the codecov.yml configuration file."""
import click
import requests
# The exit(1) is used to indicate error in pre-commit
NOT_OK = 1
OK = 0
@click.command()
@click.option(
"--filename", default="codecov.yml", help="Codecov configuration file."
)
def ccv(filename):
"""Open the codecov configurati... | [
"click.option",
"requests.post",
"click.command"
] | [((157, 172), 'click.command', 'click.command', ([], {}), '()\n', (170, 172), False, 'import click\n'), ((174, 264), 'click.option', 'click.option', (['"""--filename"""'], {'default': '"""codecov.yml"""', 'help': '"""Codecov configuration file."""'}), "('--filename', default='codecov.yml', help=\n 'Codecov configura... |
#!/usr/bin/env python3
# Import ATC classes
from dataneeded import DataNeeded
from detectionrule import DetectionRule
from loggingpolicy import LoggingPolicy
# from triggers import Triggers
from enrichment import Enrichment
from responseaction import ResponseAction
from responseplaybook import ResponsePlayboo... | [
"detectionrule.DetectionRule",
"loggingpolicy.LoggingPolicy",
"atcutils.ATCutils.read_yaml_file",
"atcutils.ATCutils.populate_tg_markdown",
"responseplaybook.ResponsePlaybook",
"responseaction.ResponseAction",
"dataneeded.DataNeeded",
"enrichment.Enrichment",
"traceback.print_exc",
"glob.glob"
] | [((478, 515), 'atcutils.ATCutils.read_yaml_file', 'ATCutils.read_yaml_file', (['"""config.yml"""'], {}), "('config.yml')\n", (501, 515), False, 'from atcutils import ATCutils\n'), ((2149, 2222), 'atcutils.ATCutils.populate_tg_markdown', 'ATCutils.populate_tg_markdown', ([], {'art_dir': 'self.art_dir', 'atc_dir': 'self.... |
from mcc_libusb import *
import datetime
import time
import numpy as np
mcc = USB1208FS()
mcc.usbOpen()
#mcc.usbDConfigPort(DIO_PORTA, DIO_DIR_OUT)
#mcc.usbDConfigPort(DIO_PORTB, DIO_DIR_IN)
#mcc.usbDOut(DIO_PORTA, 0)
#num = mcc.usbAIn(1, BP_1_00V)
#print(str(mcc.volts_FS(BP_1_00V, num)))
#channel = np.array([1, 2, 3... | [
"numpy.average"
] | [((585, 602), 'numpy.average', 'np.average', (['sdata'], {}), '(sdata)\n', (595, 602), True, 'import numpy as np\n')] |
'''
Created on 21.01.2021
@author: wf
'''
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy() | [
"flask_sqlalchemy.SQLAlchemy"
] | [((89, 101), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (99, 101), False, 'from flask_sqlalchemy import SQLAlchemy\n')] |
# Copyright (c) <NAME> <<EMAIL>>
# See LICENSE file.
import sys
from _sadm import log, version
from _sadm.cmd import flags
from _sadm.web import app, syslog
def _getArgs(argv):
p = flags.new('sadm-web', desc = 'sadm web interface')
# ~ p.add_argument('--address', help = 'bind to ip address (localhost)',
# ~ meta... | [
"_sadm.version.get",
"_sadm.web.app.run",
"_sadm.cmd.flags.parse",
"_sadm.web.syslog.init",
"_sadm.cmd.flags.new",
"_sadm.web.syslog.close",
"_sadm.log.msg"
] | [((185, 233), '_sadm.cmd.flags.new', 'flags.new', (['"""sadm-web"""'], {'desc': '"""sadm web interface"""'}), "('sadm-web', desc='sadm web interface')\n", (194, 233), False, 'from _sadm.cmd import flags\n'), ((478, 498), '_sadm.cmd.flags.parse', 'flags.parse', (['p', 'argv'], {}), '(p, argv)\n', (489, 498), False, 'fro... |
import unittest
import invoiced
import responses
class TestTask(unittest.TestCase):
def setUp(self):
self.client = invoiced.Client('api_key')
def test_endpoint(self):
task = invoiced.Task(self.client, 123)
self.assertEqual('/tasks/123', task.endpoint())
@responses.activate
d... | [
"responses.add",
"invoiced.Task",
"invoiced.Client"
] | [((130, 156), 'invoiced.Client', 'invoiced.Client', (['"""api_key"""'], {}), "('api_key')\n", (145, 156), False, 'import invoiced\n'), ((202, 233), 'invoiced.Task', 'invoiced.Task', (['self.client', '(123)'], {}), '(self.client, 123)\n', (215, 233), False, 'import invoiced\n'), ((350, 541), 'responses.add', 'responses.... |
#!/usr/bin/env python3
'''
FILE: event_aux_data.py
DESCRIPTION: This script contains the wrapper functions for the sealog-
server event_aux_data routes.
BUGS:
NOTES:
AUTHOR: <NAME>
COMPANY: OceanDataTools.org
VERSION: 0.1
CREATED: 2021-01-01
REVISION:
LICENSE INFO: This co... | [
"json.loads",
"json.dumps",
"logging.info",
"requests.get"
] | [((962, 996), 'requests.get', 'requests.get', (['url'], {'headers': 'headers'}), '(url, headers=headers)\n', (974, 996), False, 'import requests\n'), ((1882, 1899), 'logging.info', 'logging.info', (['url'], {}), '(url)\n', (1894, 1899), False, 'import logging\n'), ((1915, 1949), 'requests.get', 'requests.get', (['url']... |
import nox
@nox.session(python=['3.7', '3.8', '3.9', '3.10', 'pypy3.7', 'pypy3.8', 'pypy3.9'])
def unittest(session):
session.install('.[test]')
session.run('pytest')
| [
"nox.session"
] | [((13, 99), 'nox.session', 'nox.session', ([], {'python': "['3.7', '3.8', '3.9', '3.10', 'pypy3.7', 'pypy3.8', 'pypy3.9']"}), "(python=['3.7', '3.8', '3.9', '3.10', 'pypy3.7', 'pypy3.8',\n 'pypy3.9'])\n", (24, 99), False, 'import nox\n')] |
from inspect import signature
def add_doc(func):
t = ', '.join(signature(func).parameters)
func.__doc__ = func.__doc__.format(t)
return func
def foo(a, b):
"""Hi, I'm the doc
{}
bloo bloo"""
add_doc(foo)
print(help(foo))
| [
"inspect.signature"
] | [((69, 84), 'inspect.signature', 'signature', (['func'], {}), '(func)\n', (78, 84), False, 'from inspect import signature\n')] |
import re
def read_raw(path):
return "".join(open(path).readlines())
def ints(input):
# return a list of ints being separated by non-numerical characters
if input.endswith(".txt"):
return ints(read_raw(input))
else:
return [int(num) for num in re.split("\D+", input) if num !=... | [
"re.split"
] | [((288, 311), 're.split', 're.split', (['"""\\\\D+"""', 'input'], {}), "('\\\\D+', input)\n", (296, 311), False, 'import re\n')] |
import cv2 as cv
import numpy as np
from PIL import Image
import os
import time
import os
import concurrent.futures
#used for resizing, it will resize the image maintaining aspect ratio
# to the smallest dimension, my images were 5000 by 1000, so it gets shrunk to
# 40 px tall and an unknown width.
size = (... | [
"PIL.Image.open",
"cv2.arcLength",
"cv2.samples.findFile",
"os.getcwd",
"cv2.contourArea",
"cv2.blur",
"cv2.moments",
"cv2.findContours",
"cv2.Canny",
"time.time",
"os.walk"
] | [((425, 436), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (434, 436), False, 'import os\n'), ((600, 620), 'cv2.blur', 'cv.blur', (['src', '(3, 3)'], {}), '(src, (3, 3))\n', (607, 620), True, 'import cv2 as cv\n'), ((709, 753), 'cv2.Canny', 'cv.Canny', (['src_gray', 'threshold', '(threshold * 2)'], {}), '(src_gray, thre... |
from __future__ import print_function
import os
import time
import torch
import torchvision.transforms as transforms
from Dataset import DeblurDataset
from torch.utils.data import DataLoader
from utils import *
from network import *
from Dataset import DeblurDataset, RealImage
def test(args):
device = torch.devi... | [
"os.path.exists",
"Dataset.RealImage",
"os.listdir",
"torch.load",
"torch.cuda.device_count",
"torch.cuda.is_available",
"Dataset.DeblurDataset",
"torch.no_grad",
"time.time"
] | [((1967, 1978), 'time.time', 'time.time', ([], {}), '()\n', (1976, 1978), False, 'import time\n'), ((5822, 5833), 'time.time', 'time.time', ([], {}), '()\n', (5831, 5833), False, 'import time\n'), ((1104, 1149), 'torch.load', 'torch.load', (['model_path_G'], {'map_location': 'device'}), '(model_path_G, map_location=dev... |
import csv, sys, os, argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='assign input/output paths for newton decr sample data')
parser.add_argument("-i", "--input", help="newton decrement samples")
parser.add_argument("-o", "--output", help="shifted lambda data")
a... | [
"argparse.ArgumentParser"
] | [((71, 168), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""assign input/output paths for newton decr sample data"""'}), "(description=\n 'assign input/output paths for newton decr sample data')\n", (94, 168), False, 'import csv, sys, os, argparse\n')] |
import platform
import os
if platform.architecture()[0] == '32bit':
os.environ["PYSDL2_DLL_PATH"] = "./SDL2/x86"
else:
os.environ["PYSDL2_DLL_PATH"] = "./SDL2/x64"
import game_framework
from pico2d import *
import start_state
# fill here
open_canvas(1200, 800, True)
game_framework.run(start_state)
close_can... | [
"game_framework.run",
"platform.architecture"
] | [((279, 310), 'game_framework.run', 'game_framework.run', (['start_state'], {}), '(start_state)\n', (297, 310), False, 'import game_framework\n'), ((30, 53), 'platform.architecture', 'platform.architecture', ([], {}), '()\n', (51, 53), False, 'import platform\n')] |
import pickle
import pandas as pd
import os
import sklearn
import numpy as np
from flask import Flask, request, Response
from lightgbm import LGBMClassifier
from class_.FraudDetection import FraudDetection
model = pickle.load(open('model/lgbm.pkl', 'rb')) # loading model
app = Flask(__name__) # initialize API
@app.... | [
"flask.Flask",
"class_.FraudDetection.FraudDetection",
"os.environ.get",
"flask.request.get_json",
"flask.Response",
"pandas.DataFrame"
] | [((281, 296), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (286, 296), False, 'from flask import Flask, request, Response\n'), ((422, 440), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (438, 440), False, 'from flask import Flask, request, Response\n'), ((1608, 1636), 'os.environ.get', ... |
import sys
import os
import numpy as np
import torch
import torch.nn.functional as F
from torch.backends import cudnn
from utils.utils import cast
from utils.utils0 import logging, reset_logging, timeLog, raise_if_absent, add_if_absent_
from .dpcnn import dpcnn
from .prep_text import TextData_Uni, TextData_Lab, TextDa... | [
"utils.utils0.raise_if_absent",
"torch.manual_seed",
"numpy.random.get_state",
"utils.utils0.add_if_absent_",
"numpy.random.set_state",
"utils.utils.cast",
"os.path.exists",
"utils.utils0.timeLog",
"gulf.train_base_model",
"gulf.train_gulf_model",
"gulf.copy_params",
"torch.cuda.is_available",... | [((2349, 2395), 'utils.utils0.raise_if_absent', 'raise_if_absent', (['opt', 'names'], {'who': '"""dpcnn_train"""'}), "(opt, names, who='dpcnn_train')\n", (2364, 2395), False, 'from utils.utils0 import logging, reset_logging, timeLog, raise_if_absent, add_if_absent_\n'), ((2429, 2483), 'utils.utils0.add_if_absent_', 'ad... |
# Pass the search string you want
# It search and download the first image(thumbnail) on imgur.com
# Then it will return the name of the file stored in ./images/full/
import subprocess
import re
def search_image(arg):
out = subprocess.check_output(['scrapy', 'crawl', 'imgur', '-a',
... | [
"subprocess.check_output",
"re.findall"
] | [((242, 358), 'subprocess.check_output', 'subprocess.check_output', (["['scrapy', 'crawl', 'imgur', '-a', 'arg=' + arg]"], {'stderr': 'subprocess.STDOUT', 'cwd': '"""Imgur"""'}), "(['scrapy', 'crawl', 'imgur', '-a', 'arg=' + arg],\n stderr=subprocess.STDOUT, cwd='Imgur')\n", (265, 358), False, 'import subprocess\n')... |