code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/env python3
import os, csv, sys, re
outdir="AF100_8_9_patterns"
if not os.path.exists(outdir):
os.mkdir(outdir)
input="AF100_8_9.v4.snpEff.tab"
if len (sys.argv) > 1:
input = sys.argv[1]
base=os.path.basename(input)
stem=os.path.splitext(base)
outfile = "%s.patterns.tsv" % (stem[0])
print("outfile=... | [
"os.path.exists",
"csv.writer",
"os.path.splitext",
"os.path.join",
"os.mkdir",
"os.path.basename",
"re.sub",
"csv.reader"
] | [((213, 236), 'os.path.basename', 'os.path.basename', (['input'], {}), '(input)\n', (229, 236), False, 'import os, csv, sys, re\n'), ((242, 264), 'os.path.splitext', 'os.path.splitext', (['base'], {}), '(base)\n', (258, 264), False, 'import os, csv, sys, re\n'), ((83, 105), 'os.path.exists', 'os.path.exists', (['outdir... |
"""Utility functions for operating on geometry. See the :class:`Geometry3D`
documentation for the core geometry class.
.. versionadded:: 0.8.6
[functions moved here from :mod:`klampt.model.sensing`]
Working with geometric primitives
=================================
:func:`box` and :func:`sphere` are aliases for... | [
"numpy.cross",
"numpy.linalg.eig",
"numpy.average",
"numpy.left_shift",
"numpy.asarray",
"math.sqrt",
"numpy.column_stack",
"numpy.bitwise_and",
"numpy.array",
"numpy.dot",
"numpy.zeros",
"collections.defaultdict",
"numpy.sum",
"numpy.outer",
"numpy.linalg.norm",
"numpy.argmin",
"war... | [((8307, 8328), 'numpy.array', 'np.array', (['pc.vertices'], {}), '(pc.vertices)\n', (8315, 8328), True, 'import numpy as np\n'), ((10118, 10137), 'numpy.asarray', 'np.asarray', (['normals'], {}), '(normals)\n', (10128, 10137), True, 'import numpy as np\n'), ((11197, 11239), 'numpy.cross', 'np.cross', (['(point2 - poin... |
import pytest
import sys, os
import pandas as pd
import pyDSlib
def test_count_subgroups_in_group():
df = {}
df['subgroup'] = []
df['group'] = []
for color in ['R','G','B']:
slice_ = [i for i in range(3)]
df['subgroup'] = df['subgroup']+ slice_+slice_
df['group'] = df['group'] ... | [
"pyDSlib.summary_tables.count_subgroups_in_group",
"pandas.DataFrame.from_dict"
] | [((365, 391), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['df'], {}), '(df)\n', (387, 391), True, 'import pandas as pd\n'), ((411, 515), 'pyDSlib.summary_tables.count_subgroups_in_group', 'pyDSlib.summary_tables.count_subgroups_in_group', (['df'], {'group_label': '"""group"""', 'sub_group_label': '"""subg... |
#!/usr/bin/env python3
import os
import shutil
from PIL import Image
from random import choice
from string import ascii_lowercase, digits
from typing import *
from subprocess import Popen, PIPE
import yaml
def get_random_string(length: int):
"""Generate a random string."""
result = ""
for _ in range(len... | [
"os.path.exists",
"os.listdir",
"random.choice",
"PIL.Image.open",
"yaml.dump",
"os.rename",
"subprocess.Popen",
"os.path.join",
"os.path.splitext",
"os.path.realpath",
"os.mkdir",
"shutil.rmtree",
"os.remove"
] | [((501, 540), 'os.path.join', 'os.path.join', (['CLIMBING_FOLDER', '"""videos"""'], {}), "(CLIMBING_FOLDER, 'videos')\n", (513, 540), False, 'import os\n'), ((557, 601), 'os.path.join', 'os.path.join', (['CLIMBING_FOLDER', '"""videos.yaml"""'], {}), "(CLIMBING_FOLDER, 'videos.yaml')\n", (569, 601), False, 'import os\n'... |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\sims\university\university_commands.py
# Compiled at: 2020-07-31 03:14:26
# Size of source mod 2**32... | [
"services.venue_service",
"server_commands.argument_helpers.get_optional_target",
"services.get_instance_manager",
"build_buy.get_current_venue",
"sims.university.university_telemetry.UniversityTelemetry.send_university_housing_telemetry",
"situations.situation_guest_list.SituationGuestList",
"sims.loan... | [((3309, 3401), 'server_commands.argument_helpers.get_optional_target', 'get_optional_target', (['opt_sim'], {'target_type': 'OptionalSimInfoParam', '_connection': '_connection'}), '(opt_sim, target_type=OptionalSimInfoParam, _connection=\n _connection)\n', (3328, 3401), False, 'from server_commands.argument_helpers... |
from datetime import datetime
from typing import Iterable, Union
from utils.common import iter_entity_attrs
from utils.jsondict import maybe_value, maybe_string_match
from utils.timestr import latest_from_str_rep, to_datetime
TIME_INDEX_HEADER_NAME = 'Fiware-TimeIndex-Attribute'
MaybeString = Union[str, None]
def _... | [
"datetime.datetime.now",
"utils.common.iter_entity_attrs",
"utils.jsondict.maybe_value"
] | [((582, 627), 'utils.jsondict.maybe_value', 'maybe_value', (['notification', 'attr_name', '"""value"""'], {}), "(notification, attr_name, 'value')\n", (593, 627), False, 'from utils.jsondict import maybe_value, maybe_string_match\n'), ((719, 755), 'utils.jsondict.maybe_value', 'maybe_value', (['notification', 'attr_nam... |
import QbvMath,QbvSystem,copy,TransmissionSelectionAlgorithm,NetworkingEngine
# IPG is not taken into consideration yet.
def Search(System):
KeepSearching = True
while KeepSearching:
result = NetworkingEngine.Networking(System)
NextIteration = SearchMaster(result,Syst... | [
"NetworkingEngine.Networking"
] | [((231, 266), 'NetworkingEngine.Networking', 'NetworkingEngine.Networking', (['System'], {}), '(System)\n', (258, 266), False, 'import QbvMath, QbvSystem, copy, TransmissionSelectionAlgorithm, NetworkingEngine\n')] |
import numpy as np
from wrappa import WrappaObject, WrappaImage
class DSModel:
def __init__(self, **kwargs):
pass
def predict(self, data, **kwargs):
_ = kwargs
# Data is always an array of WrappaObjects
responses = []
for obj in data:
img = obj.image.as_n... | [
"wrappa.WrappaImage.init_from_ndarray",
"numpy.rot90"
] | [((353, 366), 'numpy.rot90', 'np.rot90', (['img'], {}), '(img)\n', (361, 366), True, 'import numpy as np\n'), ((804, 817), 'numpy.rot90', 'np.rot90', (['img'], {}), '(img)\n', (812, 817), True, 'import numpy as np\n'), ((844, 865), 'numpy.rot90', 'np.rot90', (['rotated_img'], {}), '(rotated_img)\n', (852, 865), True, '... |
from DeepTreeAttention.generators import create_training_shp
import os
import pytest
@pytest.fixture()
def testdata():
path = "data/raw/test_with_uid.csv"
field_data_path = "data/raw/2020_vst_december.csv"
shp = create_training_shp.test_split(path, field_data_path)
assert not shp.empty
... | [
"pytest.fixture",
"DeepTreeAttention.generators.create_training_shp.train_test_split",
"DeepTreeAttention.generators.create_training_shp.test_split"
] | [((87, 103), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (101, 103), False, 'import pytest\n'), ((227, 280), 'DeepTreeAttention.generators.create_training_shp.test_split', 'create_training_shp.test_split', (['path', 'field_data_path'], {}), '(path, field_data_path)\n', (257, 280), False, 'from DeepTreeAttenti... |
"""empty message
Revision ID: 852648571a3c
Revises: 27c544cc6a24
Create Date: 2018-12-26 12:01:58.744733
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '852648571a3c'
down_revision = '27c544cc6a24'
branch_labels = None
depends_on = None
def upgrade():
op... | [
"alembic.op.drop_column",
"sqlalchemy.DateTime"
] | [((318, 360), 'alembic.op.drop_column', 'op.drop_column', (['"""Employees"""', '"""Emp_Created"""'], {}), "('Employees', 'Emp_Created')\n", (332, 360), False, 'from alembic import op\n'), ((365, 416), 'alembic.op.drop_column', 'op.drop_column', (['"""Employees_logins"""', '"""Emp_Logged_In"""'], {}), "('Employees_login... |
# from django.core.urlresolvers import reverse
from django.urls import reverse
from django.shortcuts import render, redirect
import json
import os
from django.views.generic import View
from django_redis import get_redis_connection
from users.models import Address
class PlaceOrderView(View):
"""提交订单的视图"""
# 商... | [
"django_redis.get_redis_connection",
"users.models.Address.objects.filter",
"django.urls.reverse"
] | [((937, 968), 'django_redis.get_redis_connection', 'get_redis_connection', (['"""default"""'], {}), "('default')\n", (957, 968), False, 'from django_redis import get_redis_connection\n'), ((595, 615), 'django.urls.reverse', 'reverse', (['"""cart:info"""'], {}), "('cart:info')\n", (602, 615), False, 'from django.urls im... |
"""Tests for package execution."""
import importlib
import unittest
from unittest import mock
class MainTest(unittest.TestCase):
"""Tests for package execution."""
@mock.patch('sys.argv', ['cloudmarker', '-c', '-n'])
def test_main(self):
# Run cloudmarker package with only the default base
... | [
"unittest.mock.patch",
"importlib.import_module"
] | [((178, 229), 'unittest.mock.patch', 'mock.patch', (['"""sys.argv"""', "['cloudmarker', '-c', '-n']"], {}), "('sys.argv', ['cloudmarker', '-c', '-n'])\n", (188, 229), False, 'from unittest import mock\n'), ((397, 444), 'importlib.import_module', 'importlib.import_module', (['"""cloudmarker.__main__"""'], {}), "('cloudm... |
from bisect import bisect_right
from typing import List
from torch.optim import Optimizer
#from torch.optim.lr_scheduler import MultiStepLR
from torch.optim.lr_scheduler import _LRScheduler
#class WarmUpMultiStepLR(MultiStepLR):
class WarmUpMultiStepLR(_LRScheduler):
def __init__(self, optimizer: Optimizer, milest... | [
"bisect.bisect_right"
] | [((973, 1019), 'bisect.bisect_right', 'bisect_right', (['self.milestones', 'self.last_epoch'], {}), '(self.milestones, self.last_epoch)\n', (985, 1019), False, 'from bisect import bisect_right\n')] |
"""
This module defines some plotting functions that are used by the
BALTO GUI app. It should be included in the same directory as
"balto_gui.py" and the corresponding Jupyter notebook.
"""
#------------------------------------------------------------------------
#
# Copyright (C) 2020. <NAME>
#
#-------------------... | [
"numpy.histogram",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.log",
"numpy.invert",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.subplots"... | [((1016, 1055), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {'figsize': '(x_size, y_size)'}), '(1, figsize=(x_size, y_size))\n', (1026, 1055), True, 'import matplotlib.pyplot as plt\n'), ((1631, 1660), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y'], {'marker': 'marker'}), '(x, y, marker=marker)\n', (1639, 16... |
# Copyright (c) 2016-2017 Enproduktion GmbH & Laber's Lab e.U. (FN 394440i, Austria)
# 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 rig... | [
"flask.render_template",
"platform.models.user.User.get_by_login",
"flask.flash",
"platform.app.errorhandler",
"platform.models.forms.UserLogin",
"platform.database.get_db",
"platform.views.errors.ShowErrors"
] | [((2060, 2089), 'platform.app.errorhandler', 'app.errorhandler', (['ServerError'], {}), '(ServerError)\n', (2076, 2089), False, 'from platform import app\n'), ((1575, 1592), 'platform.models.forms.UserLogin', 'forms.UserLogin', ([], {}), '()\n', (1590, 1592), False, 'from platform.models import forms\n'), ((2011, 2051)... |
# -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2018 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Database management for REANA."""
from __future__ import absolute_import
from sqlalchemy ... | [
"sqlalchemy.orm.sessionmaker",
"sqlalchemy_utils.database_exists",
"sqlalchemy.create_engine",
"reana_db.models.Base.metadata.create_all",
"sqlalchemy_utils.create_database"
] | [((570, 608), 'sqlalchemy.create_engine', 'create_engine', (['SQLALCHEMY_DATABASE_URI'], {}), '(SQLALCHEMY_DATABASE_URI)\n', (583, 608), False, 'from sqlalchemy import create_engine\n'), ((634, 694), 'sqlalchemy.orm.sessionmaker', 'sessionmaker', ([], {'autocommit': '(False)', 'autoflush': '(False)', 'bind': 'engine'})... |
from collections import defaultdict
from difflib import unified_diff
from pathlib import Path
from typing import List, Tuple, Dict, Iterator, Iterable, Optional
import click
from robot.api import get_model
from robot.errors import DataError
from robotidy.transformers import load_transformers
from robotidy.utils impor... | [
"robotidy.transformers.load_transformers",
"robotidy.utils.StatementLinesCollector",
"pathlib.Path",
"difflib.unified_diff",
"click.echo",
"collections.defaultdict",
"robotidy.utils.decorate_diff_with_color",
"robot.api.get_model"
] | [((1251, 1303), 'robotidy.transformers.load_transformers', 'load_transformers', (['transformers', 'transformers_config'], {}), '(transformers, transformers_config)\n', (1268, 1303), False, 'from robotidy.transformers import load_transformers\n'), ((2370, 2400), 'robotidy.utils.StatementLinesCollector', 'StatementLinesC... |
import torch.utils.data as data
import os,sys
import numpy as np
import pickle
sys.path.insert(0, '../')
def default_loader(path):
return pickle.load(open(path, 'rb'))
def parse_data(data, cur_num_boxes, w, h, num_boxes):
features, boxes, attn_target, use, objs, atts, att_use = [], [], [], [], [], [], []
... | [
"numpy.zeros",
"sys.path.insert",
"numpy.asarray"
] | [((79, 104), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../"""'], {}), "(0, '../')\n", (94, 104), False, 'import os, sys\n'), ((1988, 2015), 'numpy.zeros', 'np.zeros', (['self.a_vocab_size'], {}), '(self.a_vocab_size)\n', (1996, 2015), True, 'import numpy as np\n'), ((446, 460), 'numpy.asarray', 'np.asarray', (... |
### NOTE: This final will not run!
### The following functions are not included as our model is proprietary.
### The following (self explanatory) functions would need to be implemented in order for this script to interact with a given structural model.
# modify_material_properties_in_structural_FEA_model(Emultiplier)
... | [
"numpy.abs",
"csv.reader"
] | [((2353, 2374), 'csv.reader', 'csv.reader', (['inputfile'], {}), '(inputfile)\n', (2363, 2374), False, 'import csv\n'), ((1336, 1376), 'numpy.abs', 'np.abs', (['(TARGET_FREQS[0] - frequencies[0])'], {}), '(TARGET_FREQS[0] - frequencies[0])\n', (1342, 1376), True, 'import numpy as np\n'), ((1395, 1435), 'numpy.abs', 'np... |
"""Manager and environment for debug purposes."""
import time
from kutana.environment import Environment
from kutana.exceptions import ExitException
from kutana.manager.manager import Manager
from kutana.plugin import Message
class DebugEnvironment(Environment):
"""Environment for :class:`.DebugManager`."""
... | [
"time.time"
] | [((1510, 1521), 'time.time', 'time.time', ([], {}), '()\n', (1519, 1521), False, 'import time\n'), ((1392, 1403), 'time.time', 'time.time', ([], {}), '()\n', (1401, 1403), False, 'import time\n')] |
# -*- coding: utf-8 -*-
# Copyright (2017-2018) Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | [
"collections.OrderedDict"
] | [((2991, 3016), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (3014, 3016), False, 'import collections\n'), ((3083, 3108), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (3106, 3108), False, 'import collections\n'), ((2557, 2582), 'collections.OrderedDict', 'collection... |
import random as r
from collections import deque
# Cellular Automata Method for generating random continent-like elements:
# 1. Fill the first map randomly.
# 2. Create 'water' border.
# 3. Repeatedly create new maps using rules:
# 3.1 Merging 'bays': analyzing neighbors to make them homogeneous.
# 3.2 Removing r... | [
"random.randint"
] | [((616, 632), 'random.randint', 'r.randint', (['(-1)', '(1)'], {}), '(-1, 1)\n', (625, 632), True, 'import random as r\n')] |
#
# Class for current-driven ODE for interface utilisation
#
import pybamm
from .base_utilisation import BaseModel
class CurrentDriven(BaseModel):
"""Current-driven ODE for interface utilisation
Parameters
----------
param : parameter class
The parameters to use for this submodel
domain ... | [
"pybamm.Variable",
"pybamm.min"
] | [((994, 1155), 'pybamm.Variable', 'pybamm.Variable', (['"""Negative electrode interface utilisation variable"""'], {'domain': '"""negative electrode"""', 'auxiliary_domains': "{'secondary': 'current collector'}"}), "('Negative electrode interface utilisation variable', domain\n ='negative electrode', auxiliary_domai... |
import copy, os
import tensorflow as tf
import numpy as np
from lib.tf_ops import shape_list, spacial_shape_list, tf_tensor_stats, tf_norm2, tf_angle_between
from lib.util import load_numpy
from .renderer import Renderer
from .transform import GridTransform
from .vector import GridShape, Vector3
import logging
... | [
"logging.getLogger",
"tensorflow.pad",
"tensorflow.boolean_mask",
"lib.tf_ops.tf_tensor_stats",
"tensorflow.split",
"lib.tf_ops.spacial_shape_list",
"lib.tf_ops.tf_norm2",
"tensorflow.ones_like",
"tensorflow.reduce_mean",
"copy.copy",
"tensorflow.cast",
"numpy.load",
"lib.util.load_numpy",
... | [((329, 357), 'logging.getLogger', 'logging.getLogger', (['"""Structs"""'], {}), "('Structs')\n", (346, 357), False, 'import logging\n'), ((576, 612), 'tensorflow.range', 'tf.range', (['shape[0]'], {'dtype': 'tf.float32'}), '(shape[0], dtype=tf.float32)\n', (584, 612), True, 'import tensorflow as tf\n'), ((614, 650), '... |
import os
from logics.logic import convert_data
INDATA_PATH = os.environ.get('GITHUB_WORKSPACE') + "/data" + "/src"
FILENAME_C_ELEVATION = "country-by-elevation.json"
FILENAME_C_EXPECTANCY = "country-by-life-expectancy.json"
OUTFILE_PATH = 'output/data.json'
if __name__ == '__main__':
convert_data(
infil... | [
"os.environ.get",
"logics.logic.convert_data"
] | [((293, 458), 'logics.logic.convert_data', 'convert_data', ([], {'infile_elv_path': "(INDATA_PATH + '/' + FILENAME_C_ELEVATION)", 'infile_exp_path': "(INDATA_PATH + '/' + FILENAME_C_EXPECTANCY)", 'outfile_path': 'OUTFILE_PATH'}), "(infile_elv_path=INDATA_PATH + '/' + FILENAME_C_ELEVATION,\n infile_exp_path=INDATA_PA... |
from collections import Counter
with open("input", "r") as f:
lines = f.readlines()
lines = [line.strip() for line in lines if line.strip()]
class Node:
def __init__(self, name):
self.name = name
self.is_visited_count = 0
self.connected_nodes = set()
def is_visitable(self, path)... | [
"collections.Counter"
] | [((578, 591), 'collections.Counter', 'Counter', (['path'], {}), '(path)\n', (585, 591), False, 'from collections import Counter\n')] |
#!/usr/bin/python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
# LASER Language-Agnostic SEntence Representations
# is a toolkit to calculate multilingual s... | [
"indexing.SplitOpen",
"re.compile",
"numpy.argsort",
"indexing.IndexTextQuery",
"embed.EncodeTime",
"sys.exit",
"sys.path.append",
"embed.EncodeLoad",
"faiss.normalize_L2",
"argparse.ArgumentParser",
"indexing.IndexLoad",
"numpy.dot",
"numpy.empty",
"indexing.IndexTextOpen",
"collections... | [((817, 855), 'sys.path.append', 'sys.path.append', (["(LASER + '/source/lib')"], {}), "(LASER + '/source/lib')\n", (832, 855), False, 'import sys\n'), ((1080, 1098), 're.compile', 're.compile', (['"""\\\\s+"""'], {}), "('\\\\s+')\n", (1090, 1098), False, 'import re\n'), ((1106, 1148), 'collections.namedtuple', 'namedt... |
import configparser
import os
curPath = os.path.dirname(os.path.realpath(__file__))
cfgPath = os.path.join(curPath, "config.ini")
class ReadConfig:
def __init__(self):
self.cfg = configparser.ConfigParser()
self.cfg.read(cfgPath, encoding='utf-8')
def get_user(self):
return self.cfg.... | [
"os.path.realpath",
"os.path.join",
"configparser.ConfigParser"
] | [((95, 130), 'os.path.join', 'os.path.join', (['curPath', '"""config.ini"""'], {}), "(curPath, 'config.ini')\n", (107, 130), False, 'import os\n'), ((57, 83), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (73, 83), False, 'import os\n'), ((194, 221), 'configparser.ConfigParser', 'configpar... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import List
import numpy as np
import torch
from pytext.models.representations.transformer import (
TransformerLayer,
MultiheadSelfAttention,
)
from pytext.models.roberta import RoBERTaEncoder
from torch... | [
"torch.ops.load_library",
"numpy.sqrt",
"torch.tensor",
"torch.ops.fastertransformer.rebuild_padding",
"torch.ops.fastertransformer.build_mask_remove_padding",
"torch.zeros"
] | [((340, 417), 'torch.ops.load_library', 'torch.ops.load_library', (['"""//pytorch/FasterTransformers3.1:faster_transformers"""'], {}), "('//pytorch/FasterTransformers3.1:faster_transformers')\n", (362, 417), False, 'import torch\n'), ((1939, 1954), 'torch.tensor', 'torch.tensor', (['(0)'], {}), '(0)\n', (1951, 1954), F... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# filename: client.py
# modified: 2019-09-09
from requests.models import Request
from requests.sessions import Session
from requests.cookies import extract_cookies_to_jar
class BaseClient(object):
default_headers = {}
default_client_timeout = 10
def __init_... | [
"requests.sessions.Session",
"requests.cookies.extract_cookies_to_jar"
] | [((533, 542), 'requests.sessions.Session', 'Session', ([], {}), '()\n', (540, 542), False, 'from requests.sessions import Session\n'), ((3020, 3083), 'requests.cookies.extract_cookies_to_jar', 'extract_cookies_to_jar', (['self._session.cookies', 'r.request', 'r.raw'], {}), '(self._session.cookies, r.request, r.raw)\n',... |
from typing import Any
import httpx
import pytest
from fastapi import status
from hw.alexander_sidorov.common import ApiResult
from hw.alexander_sidorov.lesson11.util import get_localhost
@pytest.mark.asyncio
async def test_service_index(asgi_client: httpx.AsyncClient) -> None:
resp: httpx.Response = await asgi... | [
"hw.alexander_sidorov.lesson11.util.get_localhost"
] | [((1662, 1677), 'hw.alexander_sidorov.lesson11.util.get_localhost', 'get_localhost', ([], {}), '()\n', (1675, 1677), False, 'from hw.alexander_sidorov.lesson11.util import get_localhost\n')] |
"""Tests for main module."""
from f8a_report.main import time_to_generate_monthly_report, main
from unittest import mock
class TodayMockClass:
"""Mock class for `today` from datetime module."""
def __init__(self, day):
"""Construct the class and initialize day attribute."""
self.day = day
... | [
"f8a_report.main.time_to_generate_monthly_report",
"unittest.mock.patch",
"f8a_report.main.main"
] | [((607, 685), 'unittest.mock.patch', 'mock.patch', (['"""f8a_report.main.ReportHelper.get_report"""'], {'return_value': '[{}, True]'}), "('f8a_report.main.ReportHelper.get_report', return_value=[{}, True])\n", (617, 685), False, 'from unittest import mock\n'), ((754, 760), 'f8a_report.main.main', 'main', ([], {}), '()\... |
"""プロジェクト構成ファイルを解析して EntityBucket を生成するモジュール"""
import yaml
from dialogapi.server import Server
from dialogapi.server import Endpoint
from dialogapi.entity import Project
from dialogapi.entity import Bot
from dialogapi.entity import AIML
from dialogapi.entity import Set
from dialogapi.entity import Map
from dialogapi... | [
"re.compile",
"dialogapi.entity.Config",
"dialogapi.test.config.Parser",
"dialogapi.entity.Set",
"dialogapi.entity_bucket.ProjectConfig",
"dialogapi.entity.Property",
"dialogapi.entity_bucket.EntityBucket",
"dialogapi.server.Endpoint",
"dialogapi.entity.Map",
"dialogapi.entity_bucket.BotConfig",
... | [((1958, 2002), 're.compile', 're.compile', (['"""\\\\${([a-zA-Z_]+[a-zA-Z0-9_]*)}"""'], {}), "('\\\\${([a-zA-Z_]+[a-zA-Z0-9_]*)}')\n", (1968, 2002), False, 'import re\n'), ((1821, 1858), 'dialogapi.entity_bucket.EntityBucket', 'EntityBucket', ([], {'project_map': 'project_map'}), '(project_map=project_map)\n', (1833, ... |
import warnings
from nose.tools import raises
from webdnn.util.assertion import assert_sequence_type
def test_assert_sequence_type_auto_fix_with_list():
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
v = assert_sequence_type([1.0, 2, 3.0], int, auto_fix=True, war... | [
"warnings.simplefilter",
"warnings.catch_warnings",
"nose.tools.raises",
"webdnn.util.assertion.assert_sequence_type"
] | [((981, 998), 'nose.tools.raises', 'raises', (['TypeError'], {}), '(TypeError)\n', (987, 998), False, 'from nose.tools import raises\n'), ((1048, 1104), 'webdnn.util.assertion.assert_sequence_type', 'assert_sequence_type', (['(1.0, 2, 3.0)', 'int'], {'auto_fix': '(False)'}), '((1.0, 2, 3.0), int, auto_fix=False)\n', (1... |
import numpy as np
from ._base import LinearModel
from ._regularization import REGULARIZE, Regularizer
from utils import batch
class LinearRegression(LinearModel):
"""Linear regression model."""
def __init__(self, regular: REGULARIZE = None):
super().__init__()
if REGULARIZE is not None:
... | [
"numpy.ones",
"utils.batch",
"numpy.power",
"numpy.matmul",
"numpy.isinf"
] | [((1070, 1099), 'utils.batch', 'batch', (['x', 'y', 'self._batch_size'], {}), '(x, y, self._batch_size)\n', (1075, 1099), False, 'from utils import batch\n'), ((2020, 2045), 'numpy.matmul', 'np.matmul', (['x_ext.T', 'x_ext'], {}), '(x_ext.T, x_ext)\n', (2029, 2045), True, 'import numpy as np\n'), ((2073, 2098), 'numpy.... |
from __future__ import print_function
import pytest
import torch
from .runner import get_nn_runners
default_rnns = ['cudnn', 'aten', 'jit', 'jit_premul', 'jit_premul_bias', 'jit_simple',
'jit_multilayer', 'py']
default_cnns = ['resnet18', 'resnet18_jit', 'resnet50', 'resnet50_jit']
all_nets = ... | [
"torch._C._jit_override_can_fuse_on_gpu",
"torch._C._jit_set_profiling_executor",
"torch._C._jit_set_bailout_depth",
"torch._C._jit_set_texpr_fuser_enabled",
"torch.cuda.synchronize",
"pytest.mark.benchmark",
"pytest.fixture",
"torch._C._jit_override_can_fuse_on_cpu",
"torch._C._jit_set_profiling_mo... | [((1680, 1709), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""class"""'}), "(scope='class')\n", (1694, 1709), False, 'import pytest\n'), ((2334, 2442), 'pytest.mark.benchmark', 'pytest.mark.benchmark', ([], {'warmup': '(True)', 'warmup_iterations': '(3)', 'disable_gc': '(True)', 'max_time': '(0.1)', 'group': '... |
"""
The Monitor module contains the Monitor class, the Activity class,
and a collection of constants. Together the elements of the module
help keep a record of activities that have occurred.
Activities fall into two categories: Rider activities and Driver
activities. Each activity also has a description, which is one ... | [
"location.manhattan_distance"
] | [((5516, 5586), 'location.manhattan_distance', 'manhattan_distance', (['activities[i].location', 'activities[i + 1].location'], {}), '(activities[i].location, activities[i + 1].location)\n', (5534, 5586), False, 'from location import manhattan_distance\n'), ((6179, 6253), 'location.manhattan_distance', 'manhattan_dista... |
from amaranth_boards.qmtech_xc7a35t import *
from amaranth_boards.qmtech_xc7a35t import __all__
import warnings
warnings.warn("instead of nmigen_boards.qmtech_xc7a35t, use amaranth_boards.qmtech_xc7a35t",
DeprecationWarning, stacklevel=2) | [
"warnings.warn"
] | [((114, 250), 'warnings.warn', 'warnings.warn', (['"""instead of nmigen_boards.qmtech_xc7a35t, use amaranth_boards.qmtech_xc7a35t"""', 'DeprecationWarning'], {'stacklevel': '(2)'}), "(\n 'instead of nmigen_boards.qmtech_xc7a35t, use amaranth_boards.qmtech_xc7a35t'\n , DeprecationWarning, stacklevel=2)\n", (127, 2... |
"""Test gates defined in `qibo/core/gates.py`."""
import pytest
import numpy as np
from qibo import gates, K
from qibo.config import raise_error
from qibo.tests.utils import random_state, random_density_matrix
def apply_gates(gatelist, nqubits=None, initial_state=None):
if initial_state is None:
state = K... | [
"qibo.gates.Unitary",
"numpy.trace",
"qibo.K.to_numpy",
"numpy.sqrt",
"qibo.gates.CZ",
"qibo.gates.CallbackGate",
"qibo.K.qnp.zeros",
"qibo.gates.KrausChannel",
"qibo.gates.CNOT",
"qibo.gates.U2",
"qibo.tests.utils.random_state",
"qibo.gates.U1",
"qibo.gates.RZ",
"numpy.array",
"qibo.gat... | [((4644, 4692), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""applyx"""', '[True, False]'], {}), "('applyx', [True, False])\n", (4667, 4692), False, 'import pytest\n'), ((6373, 6421), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""applyx"""', '[False, True]'], {}), "('applyx', [False, True])\... |
# tokenizer.py
# <NAME>
# Sun Jan 5 14:39:54 PST 2014
tokens = (
'COMMA', 'FORWARDSLASH', 'LPAREN', 'NAME',
'NUMBER', 'PERIOD', 'PLUS', 'RPAREN',
'SEMICOLON', 'SPACE',
)
# Tokens
t_COMMA = r','
t_FORWARDSLASH = r'/'
t_LPAREN = r'\('
t_NAME = r'[a-zA-Z_][a-zA-Z0-9_-]*'
t_PE... | [
"ply.lex.lex"
] | [((855, 864), 'ply.lex.lex', 'lex.lex', ([], {}), '()\n', (862, 864), True, 'import ply.lex as lex\n')] |
################################################################################
################################################################################
from os.path import exists, abspath, dirname, join
################################################################################
#########################... | [
"os.path.dirname"
] | [((482, 500), 'os.path.dirname', 'dirname', (['file_path'], {}), '(file_path)\n', (489, 500), False, 'from os.path import exists, abspath, dirname, join\n')] |
from __future__ import absolute_import, division, print_function, unicode_literals
from echomesh.util import Log
from echomesh.element import Element
LOGGER = Log.logger(__name__)
class Print(Element.Element):
def __init__(self, parent, description):
super(Print, self).__init__(parent, description)
self.te... | [
"echomesh.util.Log.logger"
] | [((161, 181), 'echomesh.util.Log.logger', 'Log.logger', (['__name__'], {}), '(__name__)\n', (171, 181), False, 'from echomesh.util import Log\n')] |
import os
import configparser
Config = configparser.ConfigParser()
Config.read("settings.ini")
nickname = Config.get('General', 'nickname')
token = Config.get('General', 'token')
userlist = Config.get('General', 'userlist')
graylog = Config.get('General', 'graylog')
def main():
with open('docker-compose.yaml', ... | [
"configparser.ConfigParser"
] | [((40, 67), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (65, 67), False, 'import configparser\n')] |
import yamwapi
import mock
import requests_mock
import unittest
import urllib.parse
class MediaWikiAPITest(unittest.TestCase):
TEST_API_URL = 'http://w.org/api.php'
TEST_USER_AGENT = 'user agent'
def setUp(self):
self._api = yamwapi.MediaWikiAPI(self.TEST_API_URL, self.TEST_USER_AGENT)
def t... | [
"yamwapi.MediaWikiAPI",
"requests_mock.mock",
"mock.patch.object",
"unittest.main",
"mock.MagicMock"
] | [((5484, 5499), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5497, 5499), False, 'import unittest\n'), ((248, 309), 'yamwapi.MediaWikiAPI', 'yamwapi.MediaWikiAPI', (['self.TEST_API_URL', 'self.TEST_USER_AGENT'], {}), '(self.TEST_API_URL, self.TEST_USER_AGENT)\n', (268, 309), False, 'import yamwapi\n'), ((1193, ... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... | [
"pytest.fixture",
"marquez_client.MarquezClient",
"os.environ.clear"
] | [((757, 782), 'pytest.fixture', 'fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (764, 782), False, 'from pytest import fixture\n'), ((804, 822), 'os.environ.clear', 'os.environ.clear', ([], {}), '()\n', (820, 822), False, 'import os\n'), ((872, 887), 'marquez_client.MarquezClient', 'MarquezClient'... |
from __future__ import unicode_literals
from json import dumps
from flask import Blueprint, jsonify, render_template, request
from flask_api.decorators import set_renderers
from flask_api.renderers import JSONRenderer
from core.web.json import to_json, recursive_encoder
api = Blueprint("api", __name__, template_fol... | [
"flask.render_template",
"core.web.api.neighbors.Neighbors.register",
"core.web.json.recursive_encoder",
"core.web.api.analysis.Analysis.register",
"core.web.api.file.File.register",
"flask.jsonify",
"core.web.api.export.ExportTemplate.register",
"json.dumps",
"flask_api.decorators.set_renderers",
... | [((281, 336), 'flask.Blueprint', 'Blueprint', (['"""api"""', '__name__'], {'template_folder': '"""templates"""'}), "('api', __name__, template_folder='templates')\n", (290, 336), False, 'from flask import Blueprint, jsonify, render_template, request\n'), ((687, 714), 'flask_api.decorators.set_renderers', 'set_renderers... |
from chatterbot.trainers import ListTrainer
from chatterbot import ChatBot
from chatterbot.comparisons import levenshtein_distance
from chatterbot.response_selection import get_most_frequent_response
from chatterbot.conversation import Statement
import sqlite3
import pandas as pd
# Create a new instance of a ChatBot
... | [
"chatterbot.ChatBot",
"chatterbot.conversation.Statement"
] | [((327, 750), 'chatterbot.ChatBot', 'ChatBot', (['"""Lara"""'], {'read_only': '(True)', 'storage_adapter': '"""chatterbot.storage.SQLStorageAdapter"""', 'logic_adapters': "[{'import_path': 'chatterbot.logic.BestMatch', 'default_response':\n 'I am sorry, but I do not understand.', 'statement_comparison_function':\n ... |
from datetime import date
from typing import Union
from aiogram.types import CallbackQuery
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
from .base import BaseView
from ..helpers import merge_list
from ..settings import DatepickerSettings
class MonthView(BaseView):
def __init__(self, sett... | [
"datetime.date",
"aiogram.types.InlineKeyboardMarkup"
] | [((2009, 2042), 'aiogram.types.InlineKeyboardMarkup', 'InlineKeyboardMarkup', ([], {'row_width': '(4)'}), '(row_width=4)\n', (2029, 2042), False, 'from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton\n'), ((3086, 3130), 'datetime.date', 'date', (['(_date.year - 1)', '_date.month', '_date.day'], {}), '(_... |
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
import logging
txt = {
"token_not_set": "[-] telegram token not set",
"requests_error": "[-] requests error: {e}",
"method_error": "[-] got an error: {e}",
"method_exception": "[-] got an exception: {e}\n\tdata: {data}"
}
log = logging.ge... | [
"logging.getLogger",
"requests.post"
] | [((310, 337), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (327, 337), False, 'import logging\n'), ((711, 756), 'requests.post', 'requests.post', (['url'], {'data': 'kwargs', 'timeout': '(10.0)'}), '(url, data=kwargs, timeout=10.0)\n', (724, 756), False, 'import requests\n')] |
"""
Experiment for NN4(RI)
Aim: To find the best max_epochs for NN4(*, 1024, 1024, 1024) + RI(k = 3, m = 200)
max_epochs: [22, 24, ... ,98, 140]
Averaging 20 models
Summary
epochs 88 , loss 0.421860471364
Time:3:40:30 on i7-4790k 32G MEM GTX660
I got a different result, epochs 112 loss 0.422868, before I... | [
"pandas.read_csv",
"pylearn2.models.mlp.MLP",
"pylearn2.train.Train",
"sklearn.metrics.log_loss",
"pylearn2.models.mlp.RectifiedLinear",
"pylearn2.models.mlp.Softmax",
"pylearn2.training_algorithms.learning_rule.Momentum",
"pylearn2.datasets.DenseDesignMatrix",
"os.path.exists",
"os.mkdir",
"pan... | [((1384, 1420), 'pandas.read_csv', 'pd.read_csv', (['file_train'], {'index_col': '(0)'}), '(file_train, index_col=0)\n', (1395, 1420), True, 'import pandas as pd\n'), ((1578, 1597), 'sklearn.preprocessing.StandardScaler', 'pp.StandardScaler', ([], {}), '()\n', (1595, 1597), True, 'import sklearn.preprocessing as pp\n')... |
import numpy as np
import pytest
from chainer_chemistry.dataset.preprocessors import wle_util
def test_to_index():
values = ['foo', 'bar', 'buz', 'non-exist']
mols = [['foo', 'bar', 'buz'], ['foo', 'foo'], ['buz', 'bar']]
actual = wle_util.to_index(mols, values)
expect = np.array([np.array([0, 1, 2]... | [
"chainer_chemistry.dataset.preprocessors.wle_util.to_index",
"chainer_chemistry.dataset.preprocessors.wle_util.get_neighbor_representation",
"numpy.swapaxes",
"pytest.mark.parametrize",
"numpy.array",
"numpy.zeros",
"pytest.raises",
"chainer_chemistry.dataset.preprocessors.wle_util.get_focus_node_labe... | [((2575, 2696), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""label, expect"""', "[('a-b', 'a'), ('a-b.c', 'a'), ('aa-b', 'aa'), ('a-', 'a'), ('aa-', 'aa')]"], {}), "('label, expect', [('a-b', 'a'), ('a-b.c', 'a'), (\n 'aa-b', 'aa'), ('a-', 'a'), ('aa-', 'aa')])\n", (2598, 2696), False, 'import pytest\... |
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from fixture.contact import ContactHelper
from fixture.group import GroupHelper
from fixture.session import SessionHelper
class Application:
def __init__(self, browser, base_url):
if browser == "firefox":
... | [
"fixture.session.SessionHelper",
"fixture.contact.ContactHelper",
"fixture.group.GroupHelper"
] | [((1141, 1160), 'fixture.session.SessionHelper', 'SessionHelper', (['self'], {}), '(self)\n', (1154, 1160), False, 'from fixture.session import SessionHelper\n'), ((1182, 1199), 'fixture.group.GroupHelper', 'GroupHelper', (['self'], {}), '(self)\n', (1193, 1199), False, 'from fixture.group import GroupHelper\n'), ((122... |
# Generated by Django 3.0.8 on 2020-07-15 00:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('certificado', '0003_auto_20200714_1516'),
]
operations = [
migrations.AlterField(
model_name='certificado',
name='ca... | [
"django.db.models.CharField"
] | [((352, 413), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(15)', 'verbose_name': '"""Carga horária"""'}), "(max_length=15, verbose_name='Carga horária')\n", (368, 413), False, 'from django.db import migrations, models\n')] |
# -*- coding: utf-8 -*-
# Copyright 2020 <NAME> (@dathudeptrai)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"tensorflow.numpy_function",
"os.path.basename",
"tensorflow_tts.utils.find_files"
] | [((3198, 3260), 'tensorflow.numpy_function', 'tf.numpy_function', (['np.load', "[items['audio_files']]", 'tf.float32'], {}), "(np.load, [items['audio_files']], tf.float32)\n", (3215, 3260), True, 'import tensorflow as tf\n'), ((3275, 3335), 'tensorflow.numpy_function', 'tf.numpy_function', (['np.load', "[items['mel_fil... |
import torch.nn.functional as F
import torch
def onehot(X,num_classes):
ident=torch.eye(num_classes,dtype=int)
X_onehot=ident[X]
return X_onehot
| [
"torch.eye"
] | [((83, 116), 'torch.eye', 'torch.eye', (['num_classes'], {'dtype': 'int'}), '(num_classes, dtype=int)\n', (92, 116), False, 'import torch\n')] |
"""This module is used for preprocessing user inputs before further analysis.
The user utterance is broken into tokens which contain additional information
about the it.
"""
from typing import Text, List, Optional
import string
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
from nltk.tokeni... | [
"nltk.stem.WordNetLemmatizer",
"nltk.corpus.stopwords.words",
"string.punctuation.replace"
] | [((2156, 2182), 'nltk.corpus.stopwords.words', 'stopwords.words', (['"""english"""'], {}), "('english')\n", (2171, 2182), False, 'from nltk.corpus import stopwords\n'), ((2341, 2360), 'nltk.stem.WordNetLemmatizer', 'WordNetLemmatizer', ([], {}), '()\n', (2358, 2360), False, 'from nltk.stem import WordNetLemmatizer\n'),... |
# ///////////////////////////////////////////////////////////////
#
# BY: <NAME>
# PROJECT MADE WITH: Qt Designer and PySide6
# V: 1.0.0
#
# This project can be used freely for all uses, as long as they maintain the
# respective credits only in the Python scripts, any information in the visual
# interface (GUI) can be ... | [
"cli.SEMA",
"numpy.empty",
"pandas.read_excel"
] | [((6071, 6099), 'pandas.read_excel', 'pd.read_excel', (['self.filename'], {}), '(self.filename)\n', (6084, 6099), True, 'import pandas as pd\n'), ((6183, 6215), 'numpy.empty', 'np.empty', (['df[columns2show].shape'], {}), '(df[columns2show].shape)\n', (6191, 6215), True, 'import numpy as np\n'), ((7402, 7431), 'cli.SEM... |
from unittest import TestCase
import numpy as np
import math
from somnium.lattice import LatticeFactory
from scipy.spatial.distance import pdist, squareform
from itertools import combinations, product, compress
from somnium.tests.util import euclidean_distance
class TestRectLattice(TestCase):
def test_dimension(... | [
"numpy.allclose",
"numpy.isclose",
"scipy.spatial.distance.pdist",
"somnium.lattice.LatticeFactory.build",
"itertools.product",
"somnium.tests.util.euclidean_distance",
"itertools.combinations",
"itertools.compress"
] | [((341, 369), 'somnium.lattice.LatticeFactory.build', 'LatticeFactory.build', (['"""rect"""'], {}), "('rect')\n", (361, 369), False, 'from somnium.lattice import LatticeFactory\n'), ((594, 622), 'somnium.lattice.LatticeFactory.build', 'LatticeFactory.build', (['"""rect"""'], {}), "('rect')\n", (614, 622), False, 'from ... |
import tweepy
import datetime
class Twitter():
accessToken = "<KEY>"
accessTokenSecret = "<KEY>"
consumerKey = "<KEY>"
ownerID = "XXXXXXXXXXXXXXXXXXXXXXXX"
consumerKeySecret = "<KEY>"
auth = tweepy.OAuthHandler(consumerKey, consumerKeySecret)
auth.set_access_token(accessToken, accessToken... | [
"datetime.datetime.now",
"tweepy.API",
"tweepy.OAuthHandler"
] | [((218, 269), 'tweepy.OAuthHandler', 'tweepy.OAuthHandler', (['consumerKey', 'consumerKeySecret'], {}), '(consumerKey, consumerKeySecret)\n', (237, 269), False, 'import tweepy\n'), ((338, 354), 'tweepy.API', 'tweepy.API', (['auth'], {}), '(auth)\n', (348, 354), False, 'import tweepy\n'), ((1039, 1062), 'datetime.dateti... |
from __future__ import annotations
import argparse
import asyncio
import functools
import json
import logging
import zlib
import collections
import typing
import inspect
import weakref
import datetime
import threading
import ModuleUpdate
ModuleUpdate.update()
import websockets
import prompt_toolkit
from prompt_tool... | [
"Utils.get_location_name_from_address",
"logging.debug",
"Utils.get_public_ipv4",
"Items.item_table.values",
"inspect.signature",
"time.sleep",
"logging.exception",
"fuzzywuzzy.process.extract",
"logging.info",
"prompt_toolkit.patch_stdout.patch_stdout",
"logging.error",
"argparse.ArgumentPars... | [((241, 262), 'ModuleUpdate.update', 'ModuleUpdate.update', ([], {}), '()\n', (260, 262), False, 'import ModuleUpdate\n'), ((12051, 12080), 'json.dumps', 'json.dumps', (["[['Hint', hints]]"], {}), "([['Hint', hints]])\n", (12061, 12080), False, 'import json\n'), ((12311, 12328), 'json.dumps', 'json.dumps', (['texts'], ... |
from Modules.Importer import Importer
importer = Importer.getInstance()
importer.register('Modules.Power.Module.Power');
| [
"Modules.Importer.Importer.getInstance"
] | [((49, 71), 'Modules.Importer.Importer.getInstance', 'Importer.getInstance', ([], {}), '()\n', (69, 71), False, 'from Modules.Importer import Importer\n')] |
#!/usr/bin/env python
# encoding: utf-8
"""
@version: python.3.6
@author: zhangjiaheng
@software: PyCharm
@time: 2017/9/23 9:21
"""
from test_case.page_obj import login_page,landlord_nav_page,landlord_microshopmanager_page
from models import myunit,function
from time import sleep
import unittest
class TestMicroshopM... | [
"models.function.insert_img",
"test_case.page_obj.landlord_microshopmanager_page.LandlordMicroshopManagerPage",
"test_case.page_obj.landlord_nav_page.LandlordNavPage",
"time.sleep",
"unittest.main",
"test_case.page_obj.login_page.LoginPage"
] | [((1681, 1696), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1694, 1696), False, 'import unittest\n'), ((481, 489), 'time.sleep', 'sleep', (['(2)'], {}), '(2)\n', (486, 489), False, 'from time import sleep\n'), ((567, 575), 'time.sleep', 'sleep', (['(2)'], {}), '(2)\n', (572, 575), False, 'from time import slee... |
from __future__ import print_function
import numpy as np
import sys
import mesh.patch as patch
from util import msg
def init_data(my_data, rp):
""" initialize the HSE problem """
msg.bold("initializing the HSE problem...")
# make sure that we are passed a valid patch object
if not isinstance(my_da... | [
"numpy.exp",
"util.msg.bold",
"sys.exit"
] | [((192, 235), 'util.msg.bold', 'msg.bold', (['"""initializing the HSE problem..."""'], {}), "('initializing the HSE problem...')\n", (200, 235), False, 'from util import msg\n'), ((438, 448), 'sys.exit', 'sys.exit', ([], {}), '()\n', (446, 448), False, 'import sys\n'), ((1309, 1330), 'numpy.exp', 'np.exp', (['(-myg.y[j... |
import sys
import os
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir, 'textrank'))
from summa.preprocessing.textcleaner import get_sentences # Uses textrank's method for extracting sentences.
BASELINE_WORD_COUNT = 100
def baseline(text):
""" Creates a baseline summary to be ... | [
"os.path.realpath",
"summa.preprocessing.textcleaner.get_sentences"
] | [((430, 449), 'summa.preprocessing.textcleaner.get_sentences', 'get_sentences', (['text'], {}), '(text)\n', (443, 449), False, 'from summa.preprocessing.textcleaner import get_sentences\n'), ((67, 93), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (83, 93), False, 'import os\n')] |
from ipykernel.kernelapp import IPKernelApp
from . import BakeryKernel
IPKernelApp.launch_instance(kernel_class=BakeryKernel)
| [
"ipykernel.kernelapp.IPKernelApp.launch_instance"
] | [((72, 126), 'ipykernel.kernelapp.IPKernelApp.launch_instance', 'IPKernelApp.launch_instance', ([], {'kernel_class': 'BakeryKernel'}), '(kernel_class=BakeryKernel)\n', (99, 126), False, 'from ipykernel.kernelapp import IPKernelApp\n')] |
from lleaves.compiler.ast.nodes import DecisionNode, Forest, LeafNode, Tree
from lleaves.compiler.ast.scanner import cat_args_bitmap, scan_model_file
from lleaves.compiler.utils import DecisionType
def _parse_tree_to_ast(tree_struct, cat_bitmap):
n_nodes = len(tree_struct["decision_type"])
leaves = [
... | [
"lleaves.compiler.utils.DecisionType",
"lleaves.compiler.ast.nodes.Tree",
"lleaves.compiler.ast.scanner.cat_args_bitmap",
"lleaves.compiler.ast.nodes.Forest",
"lleaves.compiler.ast.nodes.LeafNode",
"lleaves.compiler.ast.scanner.scan_model_file",
"lleaves.compiler.ast.nodes.DecisionNode"
] | [((2379, 2406), 'lleaves.compiler.ast.scanner.scan_model_file', 'scan_model_file', (['model_path'], {}), '(model_path)\n', (2394, 2406), False, 'from lleaves.compiler.ast.scanner import cat_args_bitmap, scan_model_file\n'), ((2490, 2553), 'lleaves.compiler.ast.scanner.cat_args_bitmap', 'cat_args_bitmap', (["scanned_mod... |
import random
from time import sleep
pc=random.randint(0, 10)
print('Vou pensar em um número entre 0 e 10 tente adivinhar!')
n=int(input('Digite um número: '))
tentativa=1
while n != pc:
if n > pc:
print('Menos...')
else:
print('Mais...')
print('')
n=int(input('Digite novamente: '))
... | [
"random.randint"
] | [((41, 62), 'random.randint', 'random.randint', (['(0)', '(10)'], {}), '(0, 10)\n', (55, 62), False, 'import random\n')] |
#!/usr/bin/env python3
# pylint: disable=logging-not-lazy,subprocess-popen-preexec-fn,consider-using-with
import argparse
import logging
import os
import re
import shutil
import signal
import subprocess
import tempfile
import time
from typing import List, Optional
import requests
MODULE_NAME = 'sample_metadata'
LOCAL... | [
"logging.getLogger",
"time.sleep",
"os.remove",
"re.search",
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"subprocess.Popen",
"os.path.isdir",
"subprocess.check_output",
"os.getpgid",
"requests.get",
"tempfile.mkdtemp",
"shutil.copy",
"logging.basicConfig",
"os.getenv",
... | [((335, 360), 'os.getenv', 'os.getenv', (['"""PORT"""', '"""8000"""'], {}), "('PORT', '8000')\n", (344, 360), False, 'import os\n'), ((479, 519), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (498, 519), False, 'import logging\n'), ((529, 556), 'logging.getLo... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import torch
import torch.nn.functional as F
import spdnn
torch.manual_seed(7)
input = torch.randn(2,3,3,3, requires_grad=True).cuda()
weight = torch.randn(3,3,2,2, requires_grad=True).cuda()
print('input shape: ', input.shape)
print('weights shape: ', weig... | [
"torch.manual_seed",
"torch.nn.functional.conv2d",
"torch.nn.functional.grad.conv2d_weight",
"torch.nn.functional.grad.conv2d_input",
"torch.randn",
"torch.nn.functional.unfold"
] | [((120, 140), 'torch.manual_seed', 'torch.manual_seed', (['(7)'], {}), '(7)\n', (137, 140), False, 'import torch\n'), ((361, 384), 'torch.nn.functional.conv2d', 'F.conv2d', (['input', 'weight'], {}), '(input, weight)\n', (369, 384), True, 'import torch.nn.functional as F\n'), ((577, 631), 'torch.nn.functional.grad.conv... |
"""
A basic generated Great Expectations tap that validates a single batch of data.
Data that is validated is controlled by BatchKwargs, which can be adjusted in
this script.
Data are validated by use of the `ActionListValidationOperator` which is
configured by default. The default configuration of this Validation Op... | [
"great_expectations.DataContext",
"sys.exit"
] | [((646, 798), 'great_expectations.DataContext', 'ge.DataContext', (['"""/private/var/folders/_t/psczkmjd69vf9jz0bblzlzww0000gn/T/pytest-of-taylor/pytest-1812/empty_data_context0/great_expectations"""'], {}), "(\n '/private/var/folders/_t/psczkmjd69vf9jz0bblzlzww0000gn/T/pytest-of-taylor/pytest-1812/empty_data_contex... |
# -*- coding: utf-8 -*-
# @Author: <NAME>
# @Email: <EMAIL>
# @Date: 2018-10-01 20:45:29
# @Last Modified by: <NAME>
# @Last Modified time: 2020-04-29 13:48:58
''' Utilities used across notebooks. '''
import os
import matplotlib
from PySONIC.utils import si_format
from root import dataroot
# Matplotlib parameter... | [
"PySONIC.utils.si_format",
"os.path.isdir",
"os.path.join",
"os.mkdir"
] | [((775, 803), 'os.path.join', 'os.path.join', (['dataroot', 'name'], {}), '(dataroot, name)\n', (787, 803), False, 'import os\n'), ((643, 666), 'os.path.isdir', 'os.path.isdir', (['dataroot'], {}), '(dataroot)\n', (656, 666), False, 'import os\n'), ((815, 836), 'os.path.isdir', 'os.path.isdir', (['subdir'], {}), '(subd... |
"""Google Cloud Speech API sample application using the REST API for batch
processing.
Example usage:
python transcribe.py resources/audio.raw
python transcribe.py gs://cloud-samples-tests/speech/brooklyn.flac
"""
import argparse
from google.cloud import speech_v1
from google.cloud.speech import enums
from g... | [
"google.cloud.speech.types.RecognitionConfig",
"google.cloud.speech_v1.SpeechClient",
"os.path.exists",
"google.oauth2.service_account.Credentials.from_service_account_file",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.join",
"io.open",
"google.cloud.speech.types.RecognitionAudio",
"os.path... | [((546, 617), 'google.oauth2.service_account.Credentials.from_service_account_file', 'service_account.Credentials.from_service_account_file', (['credentials_file'], {}), '(credentials_file)\n', (599, 617), False, 'from google.oauth2 import service_account\n'), ((640, 687), 'google.cloud.speech_v1.SpeechClient', 'speech... |
# This is the script instantiated from GnabarMultiThread.py
import sys
import os
import neuron
startingFreq = int(sys.argv[1])
freqRange = int(sys.argv[2])
processId = int(sys.argv[3])
THIS_FOLDER = os.path.dirname(os.path.abspath(__file__))
my_file = os.path.join(THIS_FOLDER, 'file'+str(processId)+'.csv')
sys.stdou... | [
"os.path.abspath",
"neuron.hoc.HocObject"
] | [((348, 370), 'neuron.hoc.HocObject', 'neuron.hoc.HocObject', ([], {}), '()\n', (368, 370), False, 'import neuron\n'), ((217, 242), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (232, 242), False, 'import os\n')] |
import nbformat
def nb2py(nbfile, pyfile):
nb = nbformat.read(nbfile, as_version=4)
with open(pyfile, mode='wt', encoding='utf-8') as pyf:
for cell in nb.cells:
type = cell.cell_type
if type == 'code':
pyf.write('#%%\n')
pyf.write(cell.source)... | [
"nbformat.read"
] | [((55, 90), 'nbformat.read', 'nbformat.read', (['nbfile'], {'as_version': '(4)'}), '(nbfile, as_version=4)\n', (68, 90), False, 'import nbformat\n')] |
import requests
from crawl_service.crawler.request_executor import RequestExecutorManage
def get_leetcode_csrf_token(session: requests.Session, url: str) -> str:
cookies = RequestExecutorManage.work('leetcode', session.get, url).cookies
csrf_token = None
for cookie in cookies:
if cookie.name == '... | [
"crawl_service.crawler.request_executor.RequestExecutorManage.work"
] | [((179, 235), 'crawl_service.crawler.request_executor.RequestExecutorManage.work', 'RequestExecutorManage.work', (['"""leetcode"""', 'session.get', 'url'], {}), "('leetcode', session.get, url)\n", (205, 235), False, 'from crawl_service.crawler.request_executor import RequestExecutorManage\n')] |
from transportmodels import Transport, TransModel
def example1():
t = Transport()
t.set_supplies([200, 250])
t.set_demands([100, 150, 200])
t.set_cost_matrix([[90, 70, 100], [80, 65, 75]])
t.solve()
print(">>> Example 1: Solve the balanced transportation problem.")
print("solution: ", t.g... | [
"transportmodels.TransModel",
"transportmodels.Transport"
] | [((76, 87), 'transportmodels.Transport', 'Transport', ([], {}), '()\n', (85, 87), False, 'from transportmodels import Transport, TransModel\n'), ((945, 957), 'transportmodels.TransModel', 'TransModel', ([], {}), '()\n', (955, 957), False, 'from transportmodels import Transport, TransModel\n')] |
import sys
from os import path
import PySimpleGUI as _sg
from .. import __version__, USE_DUMMY_SENSOR
from .._lib.misc import find_calibration_file
from .._lib.udp_connection import UDPConnection
from .._lib.types import PollingPriority
from . import settings
from ._run import run as _gui_run
def _group(title, obje... | [
"PySimpleGUI.Save",
"PySimpleGUI.Checkbox",
"PySimpleGUI.Combo",
"PySimpleGUI.Cancel",
"PySimpleGUI.FolderBrowse",
"PySimpleGUI.Text",
"os.path.split",
"PySimpleGUI.PopupError",
"PySimpleGUI.Button",
"os.path.isdir",
"PySimpleGUI.theme",
"PySimpleGUI.InputText",
"PySimpleGUI.Output",
"PySi... | [((10873, 10896), 'PySimpleGUI.theme', '_sg.theme', (['"""DarkBlue14"""'], {}), "('DarkBlue14')\n", (10882, 10896), True, 'import PySimpleGUI as _sg\n'), ((338, 365), 'PySimpleGUI.Frame', '_sg.Frame', (['title', '[objects]'], {}), '(title, [objects])\n', (347, 365), True, 'import PySimpleGUI as _sg\n'), ((439, 476), 'P... |
# coding: utf8
#
import os, requests, webbrowser, selenium, time
from pystray import Icon, Menu, MenuItem
from PIL import Image, ImageDraw
import sys
import pandas as pd
exit()
"""
def callback(icon):
image = Image.new('RGBA', (128,128), (255,255,255,255)) # create new image
percent = 100
while True:
... | [
"pystray.MenuItem",
"PIL.Image.open",
"pystray.Icon"
] | [((944, 961), 'pystray.Icon', 'Icon', (['"""test name"""'], {}), "('test name')\n", (948, 961), False, 'from pystray import Icon, Menu, MenuItem\n'), ((976, 1003), 'PIL.Image.open', 'Image.open', (['"""src/alpha.png"""'], {}), "('src/alpha.png')\n", (986, 1003), False, 'from PIL import Image, ImageDraw\n'), ((1032, 105... |
#
# -*- coding: utf-8 -*-
#
# This file is part of reclass
#
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import copy
import itertools as it
import operator
import pyparsing as pp
from six import iteritems
from six... | [
"itertools.cycle",
"reclass.errors.ParseError",
"reclass.errors.ExpressionError",
"reclass.values.parser_funcs.get_expression_parser",
"reclass.utils.dictpath.DictPath",
"six.iteritems"
] | [((5153, 5189), 'reclass.values.parser_funcs.get_expression_parser', 'parser_funcs.get_expression_parser', ([], {}), '()\n', (5187, 5189), False, 'from reclass.values import parser_funcs\n'), ((7597, 7617), 'six.iteritems', 'iteritems', (['inventory'], {}), '(inventory)\n', (7606, 7617), False, 'from six import iterite... |
import torch
import torchvision
import torch.nn as nn
from torchvision import datasets
from torchvision import transforms
from torchvision.utils import save_image
from torch.autograd import Variable
# Hyper Parameter
batch_size = 100
learning_rate = 3e-4
num_epochs = 200
def to_var(x):
if torch.cuda.is_available(... | [
"torch.nn.Sigmoid",
"torch.nn.Tanh",
"torch.nn.LeakyReLU",
"torch.randn",
"torch.nn.BCELoss",
"torch.cuda.is_available",
"torchvision.datasets.MNIST",
"torch.utils.data.DataLoader",
"torchvision.transforms.Normalize",
"torch.nn.Linear",
"torchvision.transforms.ToTensor",
"torch.autograd.Variab... | [((595, 673), 'torchvision.datasets.MNIST', 'datasets.MNIST', ([], {'root': '"""./data/"""', 'train': '(True)', 'transform': 'transform', 'download': '(True)'}), "(root='./data/', train=True, transform=transform, download=True)\n", (609, 673), False, 'from torchvision import datasets\n'), ((706, 778), 'torch.utils.data... |
# Python access to gpio's via /dev/gpiochip* devices.
# Note gpio state will not be retained when the program exits, use gpio_sysfs
# if you need that.
from __future__ import print_function
import os, fcntl, glob
from ctypes import *
# For debug, dump ctypes.Structure
# def dump(struct):
# bytes=map(ord,memoryvi... | [
"os.close",
"os.open",
"fcntl.ioctl"
] | [((2486, 2535), 'os.open', 'os.open', (["('/dev/gpiochip%d' % self.chip)", 'os.O_RDWR'], {}), "('/dev/gpiochip%d' % self.chip, os.O_RDWR)\n", (2493, 2535), False, 'import os, fcntl, glob\n'), ((4317, 4402), 'fcntl.ioctl', 'fcntl.ioctl', (['self.chipfd', 'GPIO_GET_LINEHANDLE_IOCTL', 'self.gpiohandle_reqest', '(True)'], ... |
'''
This example demonstrates the use of custom enums by:
- Create a custom enum type
- Create an object that contains a variable of this type
'''
import sys
sys.path.insert(0, "..")
try:
from IPython import embed
except ImportError:
import code
def embed():
vars = globals()
vars.upd... | [
"opcua.ua.LocalizedText",
"sys.path.insert",
"IPython.embed",
"code.InteractiveConsole",
"opcua.Server"
] | [((164, 188), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (179, 188), False, 'import sys\n'), ((954, 962), 'opcua.Server', 'Server', ([], {}), '()\n', (960, 962), False, 'from opcua import ua, Server\n'), ((350, 379), 'code.InteractiveConsole', 'code.InteractiveConsole', (['vars'], {... |
"""Create DB, by <NAME>
Create the database for the Tweeps project."""
import sqlite3
from sqlite3 import Error
from config import DB_FILE
def create_dbconnection(db_file):
"""
Create a database connection to the SQLite database specified by db_file
Parameters:
db_file (str): path to database f... | [
"sqlite3.connect"
] | [((422, 446), 'sqlite3.connect', 'sqlite3.connect', (['db_file'], {}), '(db_file)\n', (437, 446), False, 'import sqlite3\n')] |
from flask import json, Response, current_app, request
from flask_restx import Resource, Namespace
from application.utils.utils import get_sentiment
from application.utils.data_transfer_objects import DataTransferObjects
api = Namespace("sentiment", description="Sentiment Analysis")
dtos = DataTransferObjects(api)
@... | [
"application.utils.utils.get_sentiment",
"flask_restx.Namespace",
"application.utils.data_transfer_objects.DataTransferObjects",
"flask.json.dumps",
"flask.current_app.logger.exception",
"flask.request.get_json"
] | [((228, 284), 'flask_restx.Namespace', 'Namespace', (['"""sentiment"""'], {'description': '"""Sentiment Analysis"""'}), "('sentiment', description='Sentiment Analysis')\n", (237, 284), False, 'from flask_restx import Resource, Namespace\n'), ((292, 316), 'application.utils.data_transfer_objects.DataTransferObjects', 'D... |
# Distributed under the MIT License.
# See LICENSE.txt for details.
import numpy as np
from numpy import sqrt, exp, pi
def normal_dot_minus_stress(x, n, beam_width):
n /= np.linalg.norm(n)
r = sqrt(np.linalg.norm(x)**2 - np.dot(x, n)**2)
beam_profile = exp(-(r / beam_width)**2) / pi / beam_width**2
r... | [
"numpy.tensordot",
"numpy.exp",
"numpy.dot",
"numpy.zeros",
"numpy.linalg.norm"
] | [((178, 195), 'numpy.linalg.norm', 'np.linalg.norm', (['n'], {}), '(n)\n', (192, 195), True, 'import numpy as np\n'), ((326, 364), 'numpy.tensordot', 'np.tensordot', (['(-n)', 'beam_profile'], {'axes': '(0)'}), '(-n, beam_profile, axes=0)\n', (338, 364), True, 'import numpy as np\n'), ((436, 447), 'numpy.zeros', 'np.ze... |
# Copyright (c) 2009 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the... | [
"webkitpy.tool.commands.queues.AbstractQueue.begin_work_queue",
"webkitpy.tool.bot.sheriff.Sheriff",
"webkitpy.tool.bot.sheriffircbot.SheriffIRCBot",
"webkitpy.common.system.deprecated_logging.log"
] | [((2128, 2164), 'webkitpy.tool.commands.queues.AbstractQueue.begin_work_queue', 'AbstractQueue.begin_work_queue', (['self'], {}), '(self)\n', (2158, 2164), False, 'from webkitpy.tool.commands.queues import AbstractQueue\n'), ((2189, 2214), 'webkitpy.tool.bot.sheriff.Sheriff', 'Sheriff', (['self._tool', 'self'], {}), '(... |
from struct import unpack
from supyr_struct.field_type_methods import *
from reclaimer.constants import *
def tag_cstring_parser(self, desc, node=None, parent=None, attr_index=None,
rawdata=None, root_offset=0, offset=0, **kwargs):
"""
"""
assert parent is not None and at... | [
"struct.unpack"
] | [((7372, 7416), 'struct.unpack', 'unpack', (['typ.enc', 'rawdata[off:off + typ.size]'], {}), '(typ.enc, rawdata[off:off + typ.size])\n', (7378, 7416), False, 'from struct import unpack\n'), ((7635, 7686), 'struct.unpack', 'unpack', (['typ.little.enc', 'rawdata[off:off + typ.size]'], {}), '(typ.little.enc, rawdata[off:o... |
import numpy as np
import xarray
from numpy.ma.core import default_fill_value
from scipy import ndimage
from enstools.core import check_arguments
from enstools.misc import count_ge
from enstools.core.parallelisation import apply_chunkwise
@check_arguments(units={"pr": "kg m-2 s-1",
"cape": "J ... | [
"enstools.core.check_arguments",
"enstools.misc.count_ge",
"numpy.full_like",
"numpy.ma.masked_equal",
"scipy.ndimage.filters.gaussian_filter",
"numpy.where",
"xarray.DataArray"
] | [((242, 353), 'enstools.core.check_arguments', 'check_arguments', ([], {'units': "{'pr': 'kg m-2 s-1', 'cape': 'J kg-1', 'return_value': 'hour'}", 'shape': "{'pr': 'cape'}"}), "(units={'pr': 'kg m-2 s-1', 'cape': 'J kg-1', 'return_value':\n 'hour'}, shape={'pr': 'cape'})\n", (257, 353), False, 'from enstools.core im... |
from minecraft.networking.packets import Packet
from minecraft.networking.types import (
VarInt, Integer, UnsignedByte, Position, Vector, MutableRecord
)
class BlockChangePacket(Packet):
@staticmethod
def get_id(context):
return 0x0B if context.protocol_version >= 332 else \
0x0C if... | [
"minecraft.networking.types.Integer.read",
"minecraft.networking.types.Vector",
"minecraft.networking.types.VarInt.send",
"minecraft.networking.types.UnsignedByte.read",
"minecraft.networking.types.Integer.send",
"minecraft.networking.types.VarInt.read",
"minecraft.networking.types.UnsignedByte.send"
] | [((3498, 3523), 'minecraft.networking.types.Integer.read', 'Integer.read', (['file_object'], {}), '(file_object)\n', (3510, 3523), False, 'from minecraft.networking.types import VarInt, Integer, UnsignedByte, Position, Vector, MutableRecord\n'), ((3547, 3572), 'minecraft.networking.types.Integer.read', 'Integer.read', ... |
#!/usr/bin/env python
import base64
# from email.mime.text import MIMEText
import re
# import smtplib
import requests
from requests.auth import HTTPBasicAuth
from model import engine, Record
from sqlalchemy.orm import sessionmaker
Session = sessionmaker(bind=engine)
session = Session()
# Setup the log levels.
cl... | [
"sqlalchemy.orm.sessionmaker",
"model.Record",
"requests.auth.HTTPBasicAuth",
"argparse.ArgumentParser",
"requests.get"
] | [((246, 271), 'sqlalchemy.orm.sessionmaker', 'sessionmaker', ([], {'bind': 'engine'}), '(bind=engine)\n', (258, 271), False, 'from sqlalchemy.orm import sessionmaker\n'), ((3059, 3078), 'model.Record', 'Record', (['*theArgList'], {}), '(*theArgList)\n', (3065, 3078), False, 'from model import engine, Record\n'), ((3378... |
#!/usr/bin/env python3
##########################################################
## <NAME> ##
## Copyright (C) 2019 <NAME>, IGTP, Spain ##
##########################################################
"""
Calls multiQC to generate HTML statistics reports.
"""
## useful import... | [
"HCGB.functions.main_functions.printList2file",
"HCGB.functions.system_call_functions.system_call",
"XICRA.config.set_config.get_exe"
] | [((1245, 1305), 'HCGB.functions.main_functions.printList2file', 'functions.main_functions.printList2file', (['pathFile', 'givenList'], {}), '(pathFile, givenList)\n', (1284, 1305), False, 'from HCGB import functions\n'), ((2115, 2144), 'XICRA.config.set_config.get_exe', 'set_config.get_exe', (['"""multiqc"""'], {}), "(... |
import argparse
import json
import pathlib
from datetime import date
import pandas as pd
import yaml
DEFAULT_SCHEMA_NAME = 'ggirc-act.ghg-emissions-report'
DEFAULT_SCHEMA_VERSION = '0.2.1'
DEFAULT_ATTRIBUTES = [
'registration_id',
'facility_name',
'facility_latitude',
'facility_longitude',
'prima... | [
"json.loads",
"argparse.ArgumentParser",
"pandas.read_csv",
"pathlib.Path",
"json.dumps",
"pandas.isna",
"datetime.date.today"
] | [((666, 757), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Parse GHG Emissions CSV to Verified Credentials"""'}), "(description=\n 'Parse GHG Emissions CSV to Verified Credentials')\n", (689, 757), False, 'import argparse\n'), ((2548, 2634), 'pandas.read_csv', 'pd.read_csv', (['csv_... |
import numpy as np
import pandas as pd
from collections import Counter
from sklearn.utils import resample
from tqdm.notebook import tqdm_notebook
import copy
from sklearn.base import is_classifier
class DSClassifier:
"""This classifier is designed to handle unbalanced data.
The classification is based... | [
"numpy.unique",
"sklearn.base.is_classifier",
"collections.Counter",
"sklearn.utils.resample",
"copy.deepcopy",
"pandas.concat"
] | [((2230, 2259), 'sklearn.base.is_classifier', 'is_classifier', (['base_estimator'], {}), '(base_estimator)\n', (2243, 2259), False, 'from sklearn.base import is_classifier\n'), ((4776, 4794), 'numpy.unique', 'np.unique', (['y_train'], {}), '(y_train)\n', (4785, 4794), True, 'import numpy as np\n'), ((2905, 2942), 'pand... |
# Multiple Linear Regression
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('50_Startups.csv')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, -1].values
print(X)
"""
[[165349.2 136897.8 471784.1 'New York']
[162597.... | [
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.OneHotEncoder",
"sklearn.linear_model.LinearRegression",
"numpy.set_printoptions"
] | [((162, 192), 'pandas.read_csv', 'pd.read_csv', (['"""50_Startups.csv"""'], {}), "('50_Startups.csv')\n", (173, 192), True, 'import pandas as pd\n'), ((4969, 5022), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.2)', 'random_state': '(0)'}), '(X, y, test_size=0.2, random_... |
#! /usr/bin/env python
import math, time
import rospy
from std_msgs.msg import Float64
rospy.init_node('cosine_wave')
pub = rospy.Publisher('cos', Float64)
while not rospy.is_shutdown():
msg = Float64()
msg.data = math.cos(4*time.time())
pub.publish(msg)
time.sleep(0.1)
| [
"std_msgs.msg.Float64",
"rospy.is_shutdown",
"rospy.init_node",
"time.sleep",
"rospy.Publisher",
"time.time"
] | [((89, 119), 'rospy.init_node', 'rospy.init_node', (['"""cosine_wave"""'], {}), "('cosine_wave')\n", (104, 119), False, 'import rospy\n'), ((126, 157), 'rospy.Publisher', 'rospy.Publisher', (['"""cos"""', 'Float64'], {}), "('cos', Float64)\n", (141, 157), False, 'import rospy\n'), ((169, 188), 'rospy.is_shutdown', 'ros... |
import pandas as pd
import numpy as np
from sklearn.model_selection import KFold, StratifiedKFold, GroupKFold, TimeSeriesSplit
class Split:
"""
Splits a dataset acording to a given cross validation framework
"""
def __init__(self,
data: pd.DataFrame,
X: list,... | [
"sklearn.model_selection.StratifiedKFold",
"sklearn.model_selection.KFold",
"sklearn.model_selection.GroupKFold"
] | [((2306, 2374), 'sklearn.model_selection.KFold', 'KFold', ([], {'n_splits': 'self.n', 'shuffle': 'self.shuffle', 'random_state': 'self.seed'}), '(n_splits=self.n, shuffle=self.shuffle, random_state=self.seed)\n', (2311, 2374), False, 'from sklearn.model_selection import KFold, StratifiedKFold, GroupKFold, TimeSeriesSpl... |
"""fix_parse_websearch.
Revision ID: <KEY>
Revises: 6<PASSWORD>a<PASSWORD>
Create Date: 2021-11-17 21:23:09.959694
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "6<PASSWORD>a<PASSWORD>"
branch_labels = None
depends_on = None
def upgrade() -> None:
comman... | [
"alembic.op.execute"
] | [((1380, 1399), 'alembic.op.execute', 'op.execute', (['command'], {}), '(command)\n', (1390, 1399), False, 'from alembic import op\n'), ((1431, 1499), 'alembic.op.execute', 'op.execute', (['"""DROP FUNCTION public.parse_websearch(regconfig, text);"""'], {}), "('DROP FUNCTION public.parse_websearch(regconfig, text);')\n... |
import pandas as pd
import matplotlib.pyplot as plt
# Import our data file
stock_prices = pd.read_csv('/data/tesla.csv')
# Print stock_prices DataFrame for review
# print(stock_prices)
# Print using the .describe() method
# print(stock_prices.describe())
# Print the minimum value of Open
# print(stock_prices['Open... | [
"pandas.read_csv",
"matplotlib.pyplot.show"
] | [((91, 121), 'pandas.read_csv', 'pd.read_csv', (['"""/data/tesla.csv"""'], {}), "('/data/tesla.csv')\n", (102, 121), True, 'import pandas as pd\n'), ((524, 534), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (532, 534), True, 'import matplotlib.pyplot as plt\n')] |
from django.conf import settings
import logging
logger = logging.getLogger(__name__)
# : Your facebook app id
FACEBOOK_APP_ID = getattr(settings, 'FACEBOOK_APP_ID', None)
# : Your facebook app secret
FACEBOOK_APP_SECRET = getattr(settings, 'FACEBOOK_APP_SECRET', None)
# : The default scope we should use, note that re... | [
"logging.getLogger"
] | [((58, 85), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (75, 85), False, 'import logging\n')] |
import torch
import numpy as np
import onnx
import os
from onnx2keras import onnx_to_keras, check_torch_keras_error
from relu import LayerReLUTest, FReLUTest
from hard_tanh import LayerHardtanhTest, FHardtanhTest
from leaky_relu import LayerLeakyReLUTest, FLeakyReLUTest
from selu import LayerSELUTest, FSELUTest
from ... | [
"onnx2keras.check_torch_keras_error",
"onnx2keras.onnx_to_keras",
"onnx.load",
"os.unlink",
"numpy.random.uniform",
"torch.FloatTensor",
"torch.onnx.export"
] | [((1717, 1758), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)', '(1, 3, 224, 224)'], {}), '(0, 1, (1, 3, 224, 224))\n', (1734, 1758), True, 'import numpy as np\n'), ((1783, 1810), 'torch.FloatTensor', 'torch.FloatTensor', (['input_np'], {}), '(input_np)\n', (1800, 1810), False, 'import torch\n'), ((1824, 1... |