code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import argparse
import joblib
import numpy as np
import pandas as pd
from sklearn.metrics import (balanced_accuracy_score, classification_report,
f1_score, precision_score, recall_score,
roc_auc_score, roc_curve)
from tqdm import tqdm
from utils import _get_su... | [
"sklearn.metrics.balanced_accuracy_score",
"pandas.read_csv",
"sklearn.metrics.classification_report",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"sklearn.metrics.roc_auc_score",
"sklearn.metrics.roc_curve",
"numpy.mean",
"argparse.ArgumentParser",
"numpy.delete",
"numpy.... | [((1211, 1229), 'pandas.DataFrame', 'pd.DataFrame', (['rows'], {}), '(rows)\n', (1223, 1229), True, 'import pandas as pd\n'), ((1355, 1403), 'utils.get_patient_prediction', 'get_patient_prediction', (['test_patient_df', 'dataset'], {}), '(test_patient_df, dataset)\n', (1377, 1403), False, 'from utils import _get_subjec... |
from setuptools import setup, find_packages
setup(
name="mlinspect-demo",
version="1.0.0",
description="Web app that demos the features of `mlinspect`",
url="https://github.com/shubhaguha/mlinspect-demo",
license="Apache License 2.0",
python_requires="==3.8.*",
classifiers=[
"Licen... | [
"setuptools.find_packages"
] | [((491, 506), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (504, 506), False, 'from setuptools import setup, find_packages\n')] |
import sqlite3
import csv
class Database():
"""This is a simple multi use case database class"""
def __init__(self, useMemory=True):
if useMemory:
self.conn = sqlite3.connect(':memory:')
else:
user_input = input("Name of db?\n")
self.conn = sqlite3.connect(f"{user_input}.db")
self.c = s... | [
"csv.writer",
"csv.reader",
"sqlite3.connect"
] | [((176, 203), 'sqlite3.connect', 'sqlite3.connect', (['""":memory:"""'], {}), "(':memory:')\n", (191, 203), False, 'import sqlite3\n'), ((269, 304), 'sqlite3.connect', 'sqlite3.connect', (['f"""{user_input}.db"""'], {}), "(f'{user_input}.db')\n", (284, 304), False, 'import sqlite3\n'), ((2084, 2113), 'csv.writer', 'csv... |
"""
Overview
========
This plugin implements a key-command to format JSON strings. You select
the region containing the JSON then issue the key-command to format it will
print any errors on the status bar.
Key-Commands
============
Namespace: jsonfmt
Mode: EXTRA
Event: <Key-j>
Description: Format the selected JSON ... | [
"subprocess.Popen",
"vyapp.app.root.status.set_msg"
] | [((761, 869), 'subprocess.Popen', 'Popen', (['"""python -m json.tool"""'], {'encoding': 'self.area.charset', 'stdin': 'PIPE', 'stdout': 'PIPE', 'stderr': 'PIPE', 'shell': '(1)'}), "('python -m json.tool', encoding=self.area.charset, stdin=PIPE, stdout\n =PIPE, stderr=PIPE, shell=1)\n", (766, 869), False, 'from subpr... |
import numpy as np
from numba import njit, prange
# consav
from consav import linear_interp # for linear interpolation
from consav import golden_section_search # for optimization in 1D
# local modules
import utility
# a. define objective function
@njit
def obj_bellman(c,m,interp_w,par):
""" evaluate bellman equ... | [
"consav.golden_section_search.optimizer",
"numba.njit",
"numpy.fmin",
"numba.prange",
"consav.linear_interp.interp_1d",
"utility.func"
] | [((616, 635), 'numba.njit', 'njit', ([], {'parallel': '(True)'}), '(parallel=True)\n', (620, 635), False, 'from numba import njit, prange\n'), ((414, 462), 'consav.linear_interp.interp_1d', 'linear_interp.interp_1d', (['par.grid_a', 'interp_w', 'a'], {}), '(par.grid_a, interp_w, a)\n', (437, 462), False, 'from consav i... |
import numpy as np
import random
def random_sys(size=1):
if size > 1:
rd = []
for i in range(size):
rd.append(random.random())
rd = np.array(rd, dtype=np.float32)
return rd
else:
return random.random()
def rand(a=0., b=1.):
"""
... | [
"numpy.array",
"random.random",
"random.shuffle",
"numpy.arange"
] | [((578, 592), 'numpy.arange', 'np.arange', (['num'], {}), '(num)\n', (587, 592), True, 'import numpy as np\n'), ((598, 617), 'random.shuffle', 'random.shuffle', (['slt'], {}), '(slt)\n', (612, 617), False, 'import random\n'), ((187, 217), 'numpy.array', 'np.array', (['rd'], {'dtype': 'np.float32'}), '(rd, dtype=np.floa... |
import os
import importlib
import pkgutil
import inspect
import logging
from submitter.abstracts import Adaptor
from submitter import adaptors
logger = logging.getLogger("submitter." + __name__)
class PluginsGestion(object):
def __init__(self):
logger.debug("init of the Plugin_Gestion")
self.plu... | [
"logging.getLogger",
"inspect.getmembers",
"importlib.import_module",
"pkgutil.walk_packages"
] | [((154, 196), 'logging.getLogger', 'logging.getLogger', (["('submitter.' + __name__)"], {}), "('submitter.' + __name__)\n", (171, 196), False, 'import logging\n'), ((559, 588), 'importlib.import_module', 'importlib.import_module', (['name'], {}), '(name)\n', (582, 588), False, 'import importlib\n'), ((623, 700), 'pkgut... |
# -*- coding: utf-8 -*-
import os
from pyhammer.filters.mstestfilefilter import MsTestFileFilter
from pyhammer.tasks.taskbase import TaskBase
from pyhammer.utils import execProg
class MsTestTask(TaskBase):
"""Cs UnitTest Step"""
def __init__( self, csTestDllPath = "", testSettingsPath = "", baseDir = "", buil... | [
"os.path.dirname",
"os.path.splitext",
"pyhammer.filters.mstestfilefilter.MsTestFileFilter"
] | [((898, 948), 'pyhammer.filters.mstestfilefilter.MsTestFileFilter', 'MsTestFileFilter', (['self.__buildMode', 'self.__exclude'], {}), '(self.__buildMode, self.__exclude)\n', (914, 948), False, 'from pyhammer.filters.mstestfilefilter import MsTestFileFilter\n'), ((1634, 1658), 'os.path.dirname', 'os.path.dirname', (['co... |
import os
from retriever.engines import choose_engine
from retriever.lib.defaults import SCRIPT_WRITE_PATH
from retriever.lib.rdatasets import create_rdataset, update_rdataset_catalog
from retriever.lib.repository import check_for_updates
from retriever.lib.scripts import SCRIPT_LIST, name_matches
from retriever.lib.s... | [
"os.listdir",
"retriever.lib.socrata.create_socrata_dataset",
"retriever.lib.rdatasets.update_rdataset_catalog",
"retriever.lib.scripts.name_matches",
"retriever.lib.socrata.find_socrata_dataset_by_id",
"retriever.lib.scripts.SCRIPT_LIST",
"retriever.lib.rdatasets.create_rdataset",
"retriever.lib.repo... | [((681, 700), 'retriever.engines.choose_engine', 'choose_engine', (['args'], {}), '(args)\n', (694, 700), False, 'from retriever.engines import choose_engine\n'), ((753, 766), 'retriever.lib.scripts.SCRIPT_LIST', 'SCRIPT_LIST', ([], {}), '()\n', (764, 766), False, 'from retriever.lib.scripts import SCRIPT_LIST, name_ma... |
# Generated by Django 2.1.7 on 2019-02-20 21:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api_v1', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='job',
name='priority',
fie... | [
"django.db.models.CharField"
] | [((323, 426), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('3', 'Low'), ('2', 'Medium'), ('1', 'High')]", 'default': '"""L"""', 'max_length': '(1)'}), "(choices=[('3', 'Low'), ('2', 'Medium'), ('1', 'High')],\n default='L', max_length=1)\n", (339, 426), False, 'from django.db import migratio... |
from django.contrib import admin
from .models import Rumor
from django.contrib.auth.models import Group
#Register your models here.
class RegionRumorFilter(admin.SimpleListFilter):
title = 'Region'
parameter_name = 'rumor'
def lookups(self, request, admin):
return [('inRegion','In Region')]
... | [
"django.contrib.admin.site.register",
"django.contrib.auth.models.Group.objects.get"
] | [((814, 852), 'django.contrib.admin.site.register', 'admin.site.register', (['Rumor', 'RumorAdmin'], {}), '(Rumor, RumorAdmin)\n', (833, 852), False, 'from django.contrib import admin\n'), ((376, 412), 'django.contrib.auth.models.Group.objects.get', 'Group.objects.get', ([], {'user': 'request.user'}), '(user=request.us... |
import PIL
import markdown
from django.db import models
from django.utils.text import slugify
# $1 USD in other currencies
TO_USD = {
"EUR": 0.82,
"SGD": 1.33,
"AUD": 1.3,
"USD": 1.0,
"RMB": 6.48,
"INR": 73.0,
"GBP": 0.73,
"CHF": 0.89,
"HKD": 7.75,
"CAD": 1.27
}
CURRENCY_SYMBOL... | [
"django.utils.text.slugify",
"markdown.markdown",
"django.db.models.DateField",
"PIL.Image.open",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.BooleanField",
"django.db.models.ImageField",
"django.db.models.SlugField",
"django.db... | [((629, 669), 'django.db.models.CharField', 'models.CharField', (['"""Name"""'], {'max_length': '(100)'}), "('Name', max_length=100)\n", (645, 669), False, 'from django.db import models\n'), ((686, 744), 'django.db.models.SlugField', 'models.SlugField', (['"""Name Slug"""'], {'max_length': '(100)', 'unique': '(True)'})... |
import os
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"]="0"
import numpy as np
from model import IMSEG
import tensorflow as tf
import h5py
flags = tf.app.flags
flags.DEFINE_integer("epoch", 0, "Epoch to train [0]")
flags.DEFINE_integer("iteration", 0, "Iteration to train. Either epo... | [
"os.path.exists",
"os.makedirs",
"tensorflow.Session",
"model.IMSEG",
"tensorflow.ConfigProto",
"tensorflow.app.run"
] | [((3315, 3331), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (3329, 3331), True, 'import tensorflow as tf\n'), ((4184, 4196), 'tensorflow.app.run', 'tf.app.run', ([], {}), '()\n', (4194, 4196), True, 'import tensorflow as tf\n'), ((3112, 3144), 'os.path.exists', 'os.path.exists', (['FLAGS.sample_dir'],... |
import json
import decimal
from datetime import datetime
# Helper class to convert a DynamoDB item to JSON.
class DecimalEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, decimal.Decimal):
if o % 1 > 0:
return float(o)
else:
return int... | [
"datetime.datetime.fromtimestamp"
] | [((1184, 1215), 'datetime.datetime.fromtimestamp', 'datetime.fromtimestamp', (['item[k]'], {}), '(item[k])\n', (1206, 1215), False, 'from datetime import datetime\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Required ParaPy Modules
from parapy.geom import *
from parapy.core import *
from directories import *
__author__ = "<NAME>"
__all__ = ["FFrame"]
class FFrame(GeomBase):
"""FFrame (Fuselage-Frame) is a class which utilizes a scaled 'unit curve' to define a fuselag... | [
"parapy.gui.display"
] | [((4559, 4584), 'parapy.gui.display', 'display', (['obj'], {'view': '"""left"""'}), "(obj, view='left')\n", (4566, 4584), False, 'from parapy.gui import display\n')] |
import inspect
from typing import Set
from sonosco.common.constants import COLLECTIONS, PRIMITIVES, CLASS_MODULE_FIELD, CLASS_NAME_FIELD, SERIALIZED_FIELD
def get_constructor_args(cls) -> Set[str]:
"""
E.g.
class Bar():
def __init__(self, arg1, arg2):
get_constructor_args(Ba... | [
"inspect.getfullargspec"
] | [((474, 510), 'inspect.getfullargspec', 'inspect.getfullargspec', (['cls.__init__'], {}), '(cls.__init__)\n', (496, 510), False, 'import inspect\n')] |
import librosa
from pydub import AudioSegment
import numpy as np
import os
def match_target_amplitude(sound, target_dBFS=-10):
change_in_dBFS = target_dBFS - sound.dBFS
return sound.apply_gain(change_in_dBFS)
new_folder = 'listening_test'
os.mkdir(new_folder)
walked_os = list(os.walk('.')) # We are going to... | [
"librosa.core.load",
"os.path.join",
"os.mkdir",
"librosa.core.resample",
"os.walk"
] | [((249, 269), 'os.mkdir', 'os.mkdir', (['new_folder'], {}), '(new_folder)\n', (257, 269), False, 'import os\n'), ((288, 300), 'os.walk', 'os.walk', (['"""."""'], {}), "('.')\n", (295, 300), False, 'import os\n'), ((455, 479), 'os.path.join', 'os.path.join', (['path', 'name'], {}), '(path, name)\n', (467, 479), False, '... |
"""
This module reads a file path that is passed in using ActiveDoc.importFile()
and returns a object formatted so that it can be used by grist for a bulk add records action
"""
import logging
import messytables
import openpyxl
import six
from six.moves import zip
import parse_data
from imports import import_utils
l... | [
"logging.getLogger",
"openpyxl.load_workbook",
"messytables.headers_guess",
"messytables.Cell",
"imports.import_utils.get_path",
"six.text_type",
"six.moves.zip"
] | [((325, 352), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (342, 352), False, 'import logging\n'), ((394, 436), 'imports.import_utils.get_path', 'import_utils.get_path', (["file_source['path']"], {}), "(file_source['path'])\n", (415, 436), False, 'from imports import import_utils\n'), (... |
import numpy as np
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
import datetime as dt
from flask import Flask, jsonify
#################################################
# Database Setup
################################... | [
"sqlalchemy.func.count",
"sqlalchemy.func.min",
"flask.Flask",
"sqlalchemy.ext.automap.automap_base",
"sqlalchemy.create_engine",
"sqlalchemy.orm.Session",
"sqlalchemy.func.max",
"datetime.date",
"sqlalchemy.func.avg",
"datetime.timedelta",
"flask.jsonify"
] | [((347, 397), 'sqlalchemy.create_engine', 'create_engine', (['"""sqlite:///Resources/hawaii.sqlite"""'], {}), "('sqlite:///Resources/hawaii.sqlite')\n", (360, 397), False, 'from sqlalchemy import create_engine, func\n'), ((454, 468), 'sqlalchemy.ext.automap.automap_base', 'automap_base', ([], {}), '()\n', (466, 468), F... |
import json, redis, time
neighborhoods = []
crushes = []
file = open('ResultsRedis.geojson', 'w')
r = redis.StrictRedis(host='localhost', port='6379', db=0)
r.flushall()
startdata = time.time()
print(startdata)
with open('Neighborhoods.geojson', encoding='utf-8') as data_file:
test_data = json.load(data_file)
... | [
"json.load",
"time.time",
"redis.StrictRedis"
] | [((105, 159), 'redis.StrictRedis', 'redis.StrictRedis', ([], {'host': '"""localhost"""', 'port': '"""6379"""', 'db': '(0)'}), "(host='localhost', port='6379', db=0)\n", (122, 159), False, 'import json, redis, time\n'), ((186, 197), 'time.time', 'time.time', ([], {}), '()\n', (195, 197), False, 'import json, redis, time... |
#!/usr/bin/python3
# -*- coding: utf8 -*-
# Copyright (c) 2020 Baidu, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... | [
"google.protobuf.json_format.MessageToJson"
] | [((1259, 1315), 'google.protobuf.json_format.MessageToJson', 'MessageToJson', (['program'], {'preserving_proto_field_name': '(True)'}), '(program, preserving_proto_field_name=True)\n', (1272, 1315), False, 'from google.protobuf.json_format import MessageToJson\n')] |
import numpy as np
import scipy.signal
import torch
import torch.nn as nn
from torch.nn.utils.rnn import pad_sequence, pack_padded_sequence, pad_packed_sequence
def combined_shape(length, shape=None):
if shape is None:
return (length,)
return (length, shape) if np.isscalar(shape) else (length, *shape... | [
"numpy.prod",
"torch.nn.ReLU",
"numpy.isscalar",
"torch.nn.Tanh",
"torch.nn.Sequential",
"torch.nn.LSTM",
"torch.nn.utils.rnn.pack_padded_sequence",
"torch.nn.Linear",
"torch.squeeze",
"torch.no_grad",
"torch.nn.Identity",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.cat"
] | [((570, 592), 'torch.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (583, 592), True, 'import torch.nn as nn\n'), ((281, 299), 'numpy.isscalar', 'np.isscalar', (['shape'], {}), '(shape)\n', (292, 299), True, 'import numpy as np\n'), ((1417, 1437), 'torch.squeeze', 'torch.squeeze', (['q', '(-1)'], {}... |
import os
path = os.getcwd()
for root, folders, files in os.walk(path):
basename = os.path.basename(root)
index = "# %s\n\n" % basename
for folder in folders:
index += "* [{0}]({0})\n".format(folder)
for file in files:
if file == '_Sidebar.md' or file == "%s.md" % basename:
... | [
"os.path.exists",
"os.path.join",
"os.path.splitext",
"os.getcwd",
"os.path.dirname",
"os.path.basename",
"os.walk"
] | [((18, 29), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (27, 29), False, 'import os\n'), ((59, 72), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (66, 72), False, 'import os\n'), ((89, 111), 'os.path.basename', 'os.path.basename', (['root'], {}), '(root)\n', (105, 111), False, 'import os\n'), ((513, 546), 'os.path.... |
import argparse
import os
from bs4 import BeautifulSoup
def print_differences(pred_xml, gold_xml):
print(os.path.basename(pred_xml))
sets = []
for thing in [pred_xml, gold_xml]:
soup = BeautifulSoup(open(thing, 'r').read(), 'xml')
items = set()
for tag in soup.find('TAGS').findC... | [
"os.listdir",
"argparse.ArgumentParser",
"os.path.join",
"os.path.isdir",
"os.path.basename"
] | [((847, 872), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (870, 872), False, 'import argparse\n'), ((1078, 1102), 'os.path.isdir', 'os.path.isdir', (['args.pred'], {}), '(args.pred)\n', (1091, 1102), False, 'import os\n'), ((112, 138), 'os.path.basename', 'os.path.basename', (['pred_xml'], {... |
from xpath_helper import xh, filter
def test_and_operator(html_doc):
h1_path = xh.get_element_by_tag("h1", filter.and_operator(
filter.value_contains("motherfudging"), filter.value_contains("website")))
elements = html_doc.xpath(str(h1_path))
assert len(elements) != 0
assert "The " in elements... | [
"xpath_helper.filter.is_empty",
"xpath_helper.filter.value_contains",
"xpath_helper.filter.attribute_less_than_or_equal_to",
"xpath_helper.filter.attribute_contains",
"xpath_helper.filter.attribute_not_equals",
"xpath_helper.filter.value_less_than_or_equal_to",
"xpath_helper.filter.value_not_equals",
... | [((649, 677), 'xpath_helper.filter.has_attribute', 'filter.has_attribute', (['"""Toto"""'], {}), "('Toto')\n", (669, 677), False, 'from xpath_helper import xh, filter\n'), ((692, 728), 'xpath_helper.xh.get_element_by_tag', 'xh.get_element_by_tag', (['"""h1"""', 'aFilter'], {}), "('h1', aFilter)\n", (713, 728), False, '... |
#----------------------------------------------------------------------
# Name: wx.lib.dialogs
# Purpose: ScrolledMessageDialog, MultipleChoiceDialog and
# function wrappers for the common dialogs by <NAME>.
#
# Author: Various
#
# Created: 3-January-2002
# RCS-ID: $Id: dialogs.py ... | [
"wx.ListBox",
"wx.FontDialog",
"wx.DirDialog",
"wx.CheckBox",
"wx.ColourDialog",
"wx.SystemSettings.GetFont",
"wx.MessageDialog",
"wx.Panel",
"wx.Dialog.__init__",
"wx.Frame",
"wx.FontData",
"wx.StaticText",
"wx.TextCtrl",
"wx.TextEntryDialog",
"layoutf.Layoutf",
"wx.Button",
"wx.Std... | [((4991, 5052), 'wx.Dialog', 'wx.Dialog', (['parent', '(-1)', '"""Find"""', 'wx.DefaultPosition', '(380, 120)'], {}), "(parent, -1, 'Find', wx.DefaultPosition, (380, 120))\n", (5000, 5052), False, 'import wx\n'), ((5058, 5103), 'wx.StaticText', 'wx.StaticText', (['dlg', '(-1)', '"""Find what:"""', '(7, 10)'], {}), "(dl... |
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import TensorDataset, DataLoader
from torch.utils.tensorboard import SummaryWriter
import os
import numpy as np
import torch
import sys
from tqdm import tqdm
from tqdm._utils import _term_move_up
import time
torch.manual_seed(0)
np.random.... | [
"torch.nn.ConvTranspose2d",
"torch.manual_seed",
"numpy.random.rand",
"torch.nn.Tanh",
"torch.nn.Sequential",
"numpy.tanh",
"torch.nn.Conv2d",
"torch.tensor",
"numpy.zeros",
"torch.nn.MaxPool2d",
"numpy.random.seed",
"torch.nn.Upsample",
"time.time"
] | [((285, 305), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (302, 305), False, 'import torch\n'), ((310, 327), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (324, 327), True, 'import numpy as np\n'), ((2881, 2910), 'numpy.random.rand', 'np.random.rand', (['(1)', 'N1', 'C1', 'C1'], {... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import argparse
from collections import deque
from unityagents import UnityEnvironment
import matplotlib.pyplot as plt
import numpy as np
import torch
from agent import ActorCriticAgent
from env import ContinuousUnityAgentEnvironment
def ddpg_train(n_episodes=2000, max_t=1... | [
"numpy.mean",
"collections.deque",
"argparse.ArgumentParser",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.any",
"numpy.zeros",
"env.ContinuousUnityAgentEnvironment",
"agent.ActorCriticAgent",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((505, 582), 'env.ContinuousUnityAgentEnvironment', 'ContinuousUnityAgentEnvironment', (['"""./Reacher_Windows_x86_64/Reacher.exe"""', '(True)'], {}), "('./Reacher_Windows_x86_64/Reacher.exe', True)\n", (536, 582), False, 'from env import ContinuousUnityAgentEnvironment\n'), ((655, 709), 'agent.ActorCriticAgent', 'Act... |
import os
import pytest
from torchvision.transforms import Resize, ToTensor
from continuum.datasets import CUB200
from continuum.scenarios import ClassIncremental
DATA_PATH = os.environ.get("CONTINUUM_DATA_PATH")
'''
Test the visualization with instance_class scenario
'''
@pytest.mark.slow
def test_scenario_CUB200_... | [
"torchvision.transforms.Resize",
"torchvision.transforms.ToTensor",
"continuum.datasets.CUB200",
"os.environ.get"
] | [((178, 215), 'os.environ.get', 'os.environ.get', (['"""CONTINUUM_DATA_PATH"""'], {}), "('CONTINUUM_DATA_PATH')\n", (192, 215), False, 'import os\n'), ((354, 399), 'continuum.datasets.CUB200', 'CUB200', (['DATA_PATH'], {'train': '(True)', 'transform': 'None'}), '(DATA_PATH, train=True, transform=None)\n', (360, 399), F... |
import logging
from typing import Optional
from celery import shared_task
from django.contrib.auth import get_user_model
from django.contrib.sitemaps import ping_google
from django.core.mail import send_mail
from getpet import settings
from utils.utils import Datadog
from web.models import Cat, Dog, GetPetRequest, Pe... | [
"logging.getLogger",
"web.models.Shelter.objects.count",
"web.models.UserPetChoice.objects.filter",
"web.models.User.objects.filter",
"web.models.Shelter.objects.all",
"web.models.Dog.available.filter",
"django.contrib.auth.get_user_model",
"django.contrib.sitemaps.ping_google",
"web.models.Pet.obje... | [((373, 400), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (390, 400), False, 'import logging\n'), ((404, 435), 'celery.shared_task', 'shared_task', ([], {'soft_time_limit': '(30)'}), '(soft_time_limit=30)\n', (415, 435), False, 'from celery import shared_task\n'), ((895, 926), 'celery.... |
# -*- coding: utf-8 -*-
# Copyright 2018 ICON Foundation
#
# 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 o... | [
"logging.StreamHandler",
"logging.Formatter",
"functools.wraps",
"os.path.isfile",
"iconsdk.logger.addHandler",
"time.time",
"iconsdk.logger.setLevel"
] | [((1027, 1049), 'os.path.isfile', 'path.isfile', (['file_path'], {}), '(file_path)\n', (1038, 1049), False, 'from os import path\n'), ((1422, 1437), 'logging.StreamHandler', 'StreamHandler', ([], {}), '()\n', (1435, 1437), False, 'from logging import StreamHandler, Formatter\n'), ((1941, 1958), 'logging.Formatter', 'Fo... |
import json
import numpy as np
class CustomEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, np.int32):
return int(obj)
if isinstance(obj, np.int32):
return int(obj)
if isinstance(obj, np.int32):
return int(obj)
if isinstance(o... | [
"json.JSONEncoder.default"
] | [((379, 414), 'json.JSONEncoder.default', 'json.JSONEncoder.default', (['self', 'obj'], {}), '(self, obj)\n', (403, 414), False, 'import json\n')] |
import collections
import os
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db.utils import IntegrityError
from django.test import TestCase
from ..models import Access, AdeConfig, LocalCustomization, Resource
User = get_user_model()
class AdeConfigModelTestCase(TestCase... | [
"os.path.join",
"django.contrib.auth.get_user_model",
"collections.defaultdict"
] | [((264, 280), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (278, 280), False, 'from django.contrib.auth import get_user_model\n'), ((2537, 2566), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (2560, 2566), False, 'import collections\n'), ((3720, 3779), 'o... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"numpy.prod",
"paddle.nn.Pad1D",
"paddle.tanh",
"paddle.transpose",
"paddle.nn.Sequential",
"paddle.nn.functional.interpolate",
"paddle.nn.Conv2D",
"paddle.nn.functional.sigmoid",
"paddle.nn.ReLU",
"paddle.shape",
"paddle.nn.LayerList",
"math.sqrt",
"paddle.nn.Conv1D",
"paddle.chunk",
"p... | [((1965, 2040), 'paddle.nn.functional.interpolate', 'F.interpolate', (['x'], {'scale_factor': '(self.h_scale, self.w_scale)', 'mode': 'self.mode'}), '(x, scale_factor=(self.h_scale, self.w_scale), mode=self.mode)\n', (1978, 2040), True, 'from paddle.nn import functional as F\n'), ((3541, 3555), 'paddle.nn.LayerList', '... |
import json
# Parse GeoJson data
jsdata = """{
"type": "Feature",
"id": "OpenLayers.Feature.Vector_314",
"properties": {
},
"geometry": {
"type": "Point",
"coordinates": [
97.03125,
39.7265625
]
},
"crs": {
"type": "name",
"properties": {
"name": "urn: ogc: def: crs:... | [
"json.loads",
"json.dumps"
] | [((511, 529), 'json.loads', 'json.loads', (['jsdata'], {}), '(jsdata)\n', (521, 529), False, 'import json\n'), ((452, 470), 'json.loads', 'json.loads', (['jsdata'], {}), '(jsdata)\n', (462, 470), False, 'import json\n'), ((536, 554), 'json.dumps', 'json.dumps', (['pydata'], {}), '(pydata)\n', (546, 554), False, 'import... |
from collections import OrderedDict
try:
from unittest import mock
except ImportError:
import mock
import pytest
from graphql.execution.executors.sync import SyncExecutor
from graphql_ws import base, base_sync, constants
@pytest.fixture
def cc():
cc = base.BaseConnectionContext(ws=None)
cc.operatio... | [
"mock.Mock",
"pytest.mark.parametrize",
"graphql_ws.base_sync.BaseSyncSubscriptionServer",
"graphql_ws.base.BaseConnectionContext",
"pytest.raises"
] | [((6336, 6461), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""transport_ws_protocol,expected_type"""', '((False, constants.GQL_DATA), (True, constants.GQL_NEXT))'], {}), "('transport_ws_protocol,expected_type', ((False,\n constants.GQL_DATA), (True, constants.GQL_NEXT)))\n", (6359, 6461), False, 'impor... |
import sys
import time
import io
import picamera
import logging
import socketserver
import threading
from threading import Condition
from http import server
streamRES = "800x600"
recordRES = "1640x1232"
record = False
exposureMode = 'night'
meterMode = 'average'
rotation = 180
captureNumber = 5
captureExposure = ... | [
"time.time",
"picamera.PiCamera",
"time.sleep"
] | [((329, 397), 'picamera.PiCamera', 'picamera.PiCamera', ([], {'resolution': '"""3280x2464"""', 'framerate': 'captureExposure'}), "(resolution='3280x2464', framerate=captureExposure)\n", (346, 397), False, 'import picamera\n'), ((509, 522), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (519, 522), False, 'import t... |
# Generated by Django 3.2.7 on 2021-09-25 17:53
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ProjectManager', '0002_auto_20210926_0047'),
]
operations = [
migrations.AddField(
model_name='... | [
"django.db.models.TextField",
"django.db.models.ForeignKey"
] | [((384, 412), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)'}), '(blank=True)\n', (400, 412), False, 'from django.db import migrations, models\n'), ((531, 656), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'default': 'None', 'null': '(True)', 'on_delete': 'django.db.models.deleti... |
"""module containing the FatigueAnalysis class and
calc_kf for calculating dynamic stress concentration factor
"""
from math import log10
from sympy import sqrt
from me_toolbox.tools import NotInRangeError, print_atributes
from sympy import oo
from me_toolbox.fatigue import FailureCriteria
def calc_kf(q, Kt):
"""... | [
"me_toolbox.fatigue.FailureCriteria.asme_elliptic",
"sympy.sqrt",
"me_toolbox.fatigue.FailureCriteria.gerber",
"me_toolbox.tools.NotInRangeError",
"me_toolbox.fatigue.FailureCriteria.modified_goodman",
"me_toolbox.tools.print_atributes",
"me_toolbox.fatigue.FailureCriteria.soderberg",
"math.log10",
... | [((5974, 6080), 'me_toolbox.fatigue.FailureCriteria.modified_goodman', 'FailureCriteria.modified_goodman', (['ultimate_strength', 'self.Se', 'self.alt_eq_stress', 'self.mean_eq_stress'], {}), '(ultimate_strength, self.Se, self.\n alt_eq_stress, self.mean_eq_stress)\n', (6006, 6080), False, 'from me_toolbox.fatigue i... |
"""empty message
Revision ID: 5fa68bafae72
Revises: <PASSWORD>
Create Date: 2019-11-07 17:32:32.358891
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5fa68bafae72'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
d... | [
"sqlalchemy.ForeignKeyConstraint",
"alembic.op.drop_table",
"sqlalchemy_utils.types.arrow.ArrowType",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Integer",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.String"
] | [((1214, 1244), 'alembic.op.drop_table', 'op.drop_table', (['"""forward_email"""'], {}), "('forward_email')\n", (1227, 1244), False, 'from alembic import op\n'), ((886, 965), 'sqlalchemy.ForeignKeyConstraint', 'sa.ForeignKeyConstraint', (["['gen_email_id']", "['gen_email.id']"], {'ondelete': '"""cascade"""'}), "(['gen_... |
"""The Tesla Wall Charger Director integration."""
import logging
from homeassistant.core import HomeAssistant
from homeassistant.const import CONF_EVENT, CONF_ID, CONF_DEVICE_ID
from twcdirector.device import TWCPeripheral
from .const import (
DOMAIN_EVENT
)
from .device import (
TWCDeviceEntity
)
_LOGGER... | [
"logging.getLogger"
] | [((323, 350), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (340, 350), False, 'import logging\n')] |
#!/usr/bin/python
import optuna
import sys
study_summaries = optuna.study.get_all_study_summaries(storage="sqlite:///" + sys.argv[1])
print(study_summaries[0].n_trials)
print(study_summaries[0].best_trial)
| [
"optuna.study.get_all_study_summaries"
] | [((63, 135), 'optuna.study.get_all_study_summaries', 'optuna.study.get_all_study_summaries', ([], {'storage': "('sqlite:///' + sys.argv[1])"}), "(storage='sqlite:///' + sys.argv[1])\n", (99, 135), False, 'import optuna\n')] |
import errno
import itertools
import os
from collections import Counter
from typing import Any, Dict, List, Optional, Set, Tuple, Union, cast
import numpy as np
from loguru import logger
from tqdm import tqdm
import slp.util.system as system
import slp.util.types as types
from slp.config.nlp import SPECIAL_TOKENS
fro... | [
"loguru.logger.warning",
"slp.util.system.pickle_dump",
"numpy.array",
"os.strerror",
"os.path.exists",
"slp.data.transforms.HuggingFaceTokenizer",
"slp.data.transforms.ToTokenIds",
"numpy.asarray",
"os.path.split",
"itertools.chain.from_iterable",
"slp.util.system.pickle_load",
"slp.util.syst... | [((1924, 1939), 'collections.Counter', 'Counter', (['corpus'], {}), '(corpus)\n', (1931, 1939), False, 'from collections import Counter\n'), ((6681, 6709), 'slp.util.system.timethis', 'system.timethis', ([], {'method': '(True)'}), '(method=True)\n', (6696, 6709), True, 'import slp.util.system as system\n'), ((4549, 458... |
import subprocess
import time
import re
import os
import configparser
import platform
cf = configparser.ConfigParser()
cf.read('Config.ini', encoding="utf-8")
system = platform.system()
if system is "Windows":
find_util = "findstr"
else:
find_util = "grep"
class Adb:
def adbInstall(self,device, apk_path... | [
"os.system",
"platform.system",
"os.popen",
"configparser.ConfigParser"
] | [((92, 119), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (117, 119), False, 'import configparser\n'), ((169, 186), 'platform.system', 'platform.system', ([], {}), '()\n', (184, 186), False, 'import platform\n'), ((606, 632), 'os.popen', 'os.popen', (['"""adb disconnect"""'], {}), "('adb ... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import pickle
import unittest
from math import prod
import numpy as np
import torch
from rlmeta.core.segment_tree import SumSegmentTree, ... | [
"torch.maximum",
"rlmeta.core.segment_tree.SumSegmentTree",
"torch.full",
"pickle.dumps",
"pickle.loads",
"math.prod",
"torch.randint",
"numpy.random.randint",
"torch.tensor",
"unittest.main",
"torch.minimum",
"numpy.random.randn",
"torch.randn",
"torch.arange",
"torch.ones"
] | [((3193, 3208), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3206, 3208), False, 'import unittest\n'), ((493, 515), 'torch.randn', 'torch.randn', (['self.size'], {}), '(self.size)\n', (504, 515), False, 'import torch\n'), ((544, 569), 'rlmeta.core.segment_tree.SumSegmentTree', 'SumSegmentTree', (['self.size'], ... |
import tensorflow as tf
import numpy as np
"""
The file is the implementation of
the VGG-16 neural network
"""
NUM_LABELS = 25
def get_weights(shape, regularizer):
weights = tf.get_variable('weights', shape=shape, initializer=tf.truncated_normal_initializer(stddev=0.1))
if regularizer != None:
tf.ad... | [
"tensorflow.nn.conv2d",
"tensorflow.nn.max_pool",
"tensorflow.variable_scope",
"tensorflow.add",
"tensorflow.truncated_normal_initializer",
"tensorflow.nn.dropout",
"tensorflow.constant_initializer",
"tensorflow.reshape",
"tensorflow.matmul"
] | [((562, 611), 'tensorflow.nn.conv2d', 'tf.nn.conv2d', (['x', 'filters', 'strides'], {'padding': '"""SAME"""'}), "(x, filters, strides, padding='SAME')\n", (574, 611), True, 'import tensorflow as tf\n'), ((673, 737), 'tensorflow.nn.max_pool', 'tf.nn.max_pool', (['x'], {'ksize': 'ksize', 'strides': 'strides', 'padding': ... |
"""Tests for privacy.schema.embed"""
from privacy.schema import embeds
def test_embed_request():
embed_request_obj = embeds.EmbedRequest(token="<PASSWORD>", css="https://www.not_a.url")
assert embed_request_obj.token == "<PASSWORD>"
assert embed_request_obj.css == "https://www.not_a.url"
assert embed_... | [
"privacy.schema.embeds.EmbedRequest"
] | [((123, 191), 'privacy.schema.embeds.EmbedRequest', 'embeds.EmbedRequest', ([], {'token': '"""<PASSWORD>"""', 'css': '"""https://www.not_a.url"""'}), "(token='<PASSWORD>', css='https://www.not_a.url')\n", (142, 191), False, 'from privacy.schema import embeds\n')] |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def dist_comp(df, bins, filepath, cfg):
# Define columns
all_columns = list(df.index.names)
columns_noname = [c for c in all_columns if c != "name"]
columns_nobins = [c for c in all_columns if "bin" not in c]
# Remove under and... | [
"matplotlib.pyplot.close",
"numpy.isnan",
"matplotlib.pyplot.tight_layout",
"numpy.isinf",
"matplotlib.pyplot.subplots"
] | [((1584, 1706), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(2)', 'ncols': '(1)', 'sharex': '"""col"""', 'sharey': '(False)', 'gridspec_kw': "{'height_ratios': [3, 1]}", 'figsize': '(4.8, 6.4)'}), "(nrows=2, ncols=1, sharex='col', sharey=False, gridspec_kw={\n 'height_ratios': [3, 1]}, figsize=(4.8... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-12 14:49
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('formation', '0011_auto_20170412_1548'),
]
operations = [
migrations.AlterFi... | [
"django.db.models.CharField"
] | [((400, 544), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'help_text': '"""An empty name is effectively a non-existant group."""', 'max_length': '(500)', 'verbose_name': '"""Group name"""'}), "(blank=True, help_text=\n 'An empty name is effectively a non-existant group.', max_length=50... |
#!/usr/bin/env python3
import cv2
import sys
import numpy as np
import imutils
from skimage.filters import threshold_local
def vid_to_frames(filename, write=False):
vidcap = cv2.VideoCapture(filename)
success, image = vidcap.read()
count = 0
images = []
while success:
if write:
... | [
"numpy.array",
"cv2.warpPerspective",
"cv2.approxPolyDP",
"cv2.arcLength",
"numpy.diff",
"imutils.grab_contours",
"cv2.VideoWriter_fourcc",
"numpy.argmin",
"cv2.getPerspectiveTransform",
"numpy.argmax",
"cv2.cvtColor",
"cv2.Canny",
"cv2.GaussianBlur",
"cv2.imread",
"cv2.imwrite",
"cv2.... | [((2619, 2647), 'cv2.imread', 'cv2.imread', (["args['template']"], {}), "(args['template'])\n", (2629, 2647), False, 'import cv2\n'), ((180, 206), 'cv2.VideoCapture', 'cv2.VideoCapture', (['filename'], {}), '(filename)\n', (196, 206), False, 'import cv2\n'), ((630, 663), 'numpy.zeros', 'np.zeros', (['(4, 2)'], {'dtype'... |
import torch
import torch.nn as nn
import tensornetwork as tn
import TNModel.simple_mps as simple_mps
import TNModel.simple_peps as simple_peps
from tensornetwork import contractors
from typing import List, Tuple
class MPSLayer(nn.Module):
def __init__(self, hyper_params):
super(MPSLayer, self).__init__()... | [
"tensornetwork.split_node_rq",
"TNModel.simple_peps.simple_peps",
"torch.stack",
"torch.from_numpy",
"torch.nn.Conv2d",
"torch.nn.Parameter",
"TNModel.simple_mps.simple_mps",
"tensornetwork.split_node",
"torch.sum",
"tensornetwork.Node",
"torch.reshape",
"tensornetwork.split_node_qr",
"torch... | [((429, 673), 'TNModel.simple_mps.simple_mps', 'simple_mps.simple_mps', ([], {'nodes': "(hyper_params['rank'] + 1)", 'bond_dim': "hyper_params['bond_dim']", 'phys_dim': "([hyper_params['phys_dim']] * self.single_rank + [hyper_params['labels']] +\n [hyper_params['phys_dim']] * self.single_rank)", 'std': '(0.001)'}), ... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | [
"pulumi.getter",
"pulumi.log.warn",
"pulumi.set",
"pulumi.get"
] | [((2022, 2054), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""binaryData"""'}), "(name='binaryData')\n", (2035, 2054), False, 'import pulumi\n'), ((2166, 2203), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""cloudUpdateTime"""'}), "(name='cloudUpdateTime')\n", (2179, 2203), False, 'import pulumi\n'), ((2327,... |
from functools import lru_cache
from typing import List
class Solution:
def minCostClimbingStairs(self, cost: List[int]) -> int:
N = len(cost)
@lru_cache(None)
def climb(i):
if i == N-1 or i == N-2:
return cost[i]
return min(climb(i+1) , clim... | [
"functools.lru_cache"
] | [((174, 189), 'functools.lru_cache', 'lru_cache', (['None'], {}), '(None)\n', (183, 189), False, 'from functools import lru_cache\n')] |
import time
import board
from SimpleButton import SimpleButton
from RGBButton import RGBButton
from ShotStepper import ShotStepper
from PumpMotor import PumpMotor
from SimpleSwitch import SimpleSwitch
from RunMode import RunMode
enable = True
if not enable:
while True:
print("Code is disabled, please set ... | [
"ShotStepper.ShotStepper",
"PumpMotor.PumpMotor",
"time.sleep",
"SimpleButton.SimpleButton",
"SimpleSwitch.SimpleSwitch",
"RunMode.RunMode",
"RGBButton.RGBButton"
] | [((3113, 3164), 'RGBButton.RGBButton', 'RGBButton', (['board.A1', 'board.D9', 'board.D10', 'board.D11'], {}), '(board.A1, board.D9, board.D10, board.D11)\n', (3122, 3164), False, 'from RGBButton import RGBButton\n'), ((3180, 3202), 'SimpleButton.SimpleButton', 'SimpleButton', (['board.A2'], {}), '(board.A2)\n', (3192, ... |
import time
import redis
from flask import Flask, Response
FLASK_PORT = 5000
REDIS_PORT = 6379
app = Flask(__name__)
cache = redis.Redis(host="redis", port=REDIS_PORT)
def get_hit_count():
try:
return cache.incr("hits")
except redis.exceptions.ConnectionError as exc:
return -1
@app.route("... | [
"redis.Redis",
"flask.Response",
"flask.Flask"
] | [((104, 119), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (109, 119), False, 'from flask import Flask, Response\n'), ((128, 170), 'redis.Redis', 'redis.Redis', ([], {'host': '"""redis"""', 'port': 'REDIS_PORT'}), "(host='redis', port=REDIS_PORT)\n", (139, 170), False, 'import redis\n'), ((348, 433), 'fl... |
import os
from datetime import datetime
from dynaconf import settings
def upload(file):
filename = f"{datetime.now()}-{file.filename}"
dir_path = os.path.dirname(os.path.realpath(__name__))
path = os.path.join(settings.get("UPLOAD_FOLDER"), filename)
file.save(dir_path + path)
return {"filenam... | [
"os.path.realpath",
"datetime.datetime.now",
"dynaconf.settings.get",
"os.remove"
] | [((432, 463), 'os.remove', 'os.remove', (['(dir_path + file.path)'], {}), '(dir_path + file.path)\n', (441, 463), False, 'import os\n'), ((174, 200), 'os.path.realpath', 'os.path.realpath', (['__name__'], {}), '(__name__)\n', (190, 200), False, 'import os\n'), ((226, 255), 'dynaconf.settings.get', 'settings.get', (['""... |
from time import sleep
from pratidarshan import (
pradarshanam,
alert,
get_registry,
lang_code,
AJAY,
sahAyikA,
display_lang_lists,
display_lang_data,
start_thread,
start_file,
update_win,
urlopen,
)
from pystray import MenuItem as item, Menu as menu, Icon as SysTray
from... | [
"pratidarshan.alert",
"PIL.Image.open",
"pratidarshan.update_win",
"pratidarshan.start_file",
"pratidarshan.pradarshanam",
"time.sleep",
"pratidarshan.get_registry",
"kuJjikopalambhan.kuYjikolambhikam",
"pystray.MenuItem",
"pratidarshan.start_thread",
"pratidarshan.sahAyikA"
] | [((14881, 14902), 'kuJjikopalambhan.kuYjikolambhikam', 'kuYjikolambhikam', (['val'], {}), '(val)\n', (14897, 14902), False, 'from kuJjikopalambhan import kuYjikolambhikam\n'), ((468, 490), 'pratidarshan.get_registry', 'get_registry', (['"""sthiti"""'], {}), "('sthiti')\n", (480, 490), False, 'from pratidarshan import p... |
#!/usr/bin/python3
"""
Ad Soyad: <NAME> - (180401117)
"""
import socket, os, sys
ip = '127.0.0.1'
port = 42
class Server:
def __init__(self,addr):
self.server_address = addr
self.cwdir = os.getcwd()+"/"
def connect(self):
try:
print(self.server_address,"üzeriden bağlantı... | [
"os.listdir",
"socket.socket",
"os.getcwd",
"os.path.isfile",
"os.path.isdir",
"sys.exit"
] | [((798, 808), 'sys.exit', 'sys.exit', ([], {}), '()\n', (806, 808), False, 'import socket, os, sys\n'), ((2841, 2863), 'os.listdir', 'os.listdir', (['self.cwdir'], {}), '(self.cwdir)\n', (2851, 2863), False, 'import socket, os, sys\n'), ((212, 223), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (221, 223), False, 'import... |
#!/usr/bin/env python3
import unittest
from dockerfile_parse import DockerfileParser
from tests_functional import DoozerRunnerTestCase
class TestBasicRebase(DoozerRunnerTestCase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def setUp(self):
super().setUp()
d... | [
"unittest.main"
] | [((5457, 5472), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5470, 5472), False, 'import unittest\n')] |
from codelets.graph import Graph
from graphviz import Digraph
import networkx as nx
from collections import defaultdict, namedtuple
class ArchitectureGraph(Graph):
"""
Class for ArchitectureGraph
"""
def __init__(self, old_name=None):
super().__init__()
self._edges = []
# stor... | [
"graphviz.Digraph",
"networkx.MultiDiGraph",
"collections.defaultdict",
"networkx.nx_agraph.to_agraph"
] | [((512, 560), 'networkx.MultiDiGraph', 'nx.MultiDiGraph', ([], {'compound': '(True)', 'concentrate': '(True)'}), '(compound=True, concentrate=True)\n', (527, 560), True, 'import networkx as nx\n'), ((602, 619), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (613, 619), False, 'from collections im... |
import urllib.request,json
from .models import Articles
from .models import Source
from app import app
# Getting api key
api_key = None
# Getting the movie base url
base_url = None
source_url = None
def configure_request(app):
global api_key,base_url,source_url
api_key = app.config['NEWS_API_KEY']
base... | [
"json.loads"
] | [((689, 714), 'json.loads', 'json.loads', (['get_head_data'], {}), '(get_head_data)\n', (699, 714), False, 'import urllib.request, json\n'), ((1989, 2016), 'json.loads', 'json.loads', (['get_source_data'], {}), '(get_source_data)\n', (1999, 2016), False, 'import urllib.request, json\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Balancing imbalanced gene expression datasets
@author: <NAME>
October 29th, 2017
"""
from imblearn.over_sampling import SMOTE
from imblearn.combine import SMOTETomek
from imblearn.under_sampling import NearMiss
from collections import Counter
# Balances a given d... | [
"imblearn.over_sampling.SMOTE",
"imblearn.under_sampling.NearMiss",
"collections.Counter",
"imblearn.combine.SMOTETomek"
] | [((480, 502), 'imblearn.over_sampling.SMOTE', 'SMOTE', ([], {'random_state': '(42)'}), '(random_state=42)\n', (485, 502), False, 'from imblearn.over_sampling import SMOTE\n'), ((565, 592), 'imblearn.combine.SMOTETomek', 'SMOTETomek', ([], {'random_state': '(42)'}), '(random_state=42)\n', (575, 592), False, 'from imblea... |
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class CentralLoggerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("CentralLoggerAI")
def sendMessage(self, todo0, todo1, todo2, todo3):
pass
def... | [
"direct.directnotify.DirectNotifyGlobal.directNotify.newCategory"
] | [((180, 242), 'direct.directnotify.DirectNotifyGlobal.directNotify.newCategory', 'DirectNotifyGlobal.directNotify.newCategory', (['"""CentralLoggerAI"""'], {}), "('CentralLoggerAI')\n", (223, 242), False, 'from direct.directnotify import DirectNotifyGlobal\n')] |
import datetime
import re
from json_tricks import dumps
from flask import jsonify
from flask_restful import reqparse, Resource
from flask_jwt_extended import (create_access_token, create_refresh_token,
get_raw_jwt)
# local imports
from app.bcrypt_instance import Bcrypt
from ..models.a... | [
"app.bcrypt_instance.Bcrypt.check_password_hash",
"flask_jwt_extended.get_raw_jwt",
"flask_restful.reqparse.RequestParser",
"flask_jwt_extended.create_access_token",
"re.match",
"datetime.timedelta"
] | [((550, 574), 'flask_restful.reqparse.RequestParser', 'reqparse.RequestParser', ([], {}), '()\n', (572, 574), False, 'from flask_restful import reqparse, Resource\n'), ((2232, 2256), 'flask_restful.reqparse.RequestParser', 'reqparse.RequestParser', ([], {}), '()\n', (2254, 2256), False, 'from flask_restful import reqpa... |
import os
import sys
import argparse
import numpy
import json
import pprint
import subprocess
import errno
import socket
import serial
import time
from datetime import datetime
from collections import OrderedDict
# IoT2 imports
import iot2_settings
import setup_result_collection
import iot2_measure_static_flash_and_ra... | [
"collections.OrderedDict",
"datetime.datetime.now",
"serial.Serial",
"json.load",
"time.time",
"json.dump"
] | [((3732, 3796), 'serial.Serial', 'serial.Serial', ([], {'port': 'user_port', 'baudrate': '(9600)', 'dsrdtr': '(0)', 'rtscts': '(0)'}), '(port=user_port, baudrate=9600, dsrdtr=0, rtscts=0)\n', (3745, 3796), False, 'import serial\n'), ((4124, 4137), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (4135, 4137)... |
#!/usr/bin/env python
import sys
import roslib; roslib.load_manifest('node_tools')
import rospy
from sensor_msgs.msg import JointState
_publisher = None
def forward_js_topic(data):
global _publisher
_publisher.publish(data)
def connection(source, target):
global _publisher
rospy.Subscriber(source... | [
"rospy.Subscriber",
"rospy.init_node",
"roslib.load_manifest",
"rospy.spin",
"sys.exit",
"rospy.Publisher",
"rospy.loginfo"
] | [((49, 83), 'roslib.load_manifest', 'roslib.load_manifest', (['"""node_tools"""'], {}), "('node_tools')\n", (69, 83), False, 'import roslib\n'), ((297, 351), 'rospy.Subscriber', 'rospy.Subscriber', (['source', 'JointState', 'forward_js_topic'], {}), '(source, JointState, forward_js_topic)\n', (313, 351), False, 'import... |
import os
from django.core import serializers
def read_testdata():
fixture_filename = os.path.join(os.path.dirname(__file__), 'testdata/countries.json')
with open(fixture_filename) as f:
for obj in serializers.deserialize("json", f.read()):
obj.save()
| [
"os.path.dirname"
] | [((106, 131), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (121, 131), False, 'import os\n')] |
import sys
from subprocess import check_output
from six import print_
if sys.version_info > (3,):
long = int
xrange = range
# <<<<<<<<<<<<<<<<<<<<
# Originally taken from
# http://rosettacode.org/wiki/Chinese_remainder_theorem#Python -thanks!
#
# Now taken from:
# https://pypi.python.org/pypi/modint/
#
clas... | [
"six.print_"
] | [((2226, 2264), 'six.print_', 'print_', (["('p = %d ; ret = %d' % (p, ret))"], {}), "('p = %d ; ret = %d' % (p, ret))\n", (2232, 2264), False, 'from six import print_\n')] |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Praise'
db.create_table('staff_directory_praise', (
('id', self.gf(
... | [
"south.db.db.send_create_signal",
"south.db.db.delete_table"
] | [((944, 996), 'south.db.db.send_create_signal', 'db.send_create_signal', (['"""staff_directory"""', "['Praise']"], {}), "('staff_directory', ['Praise'])\n", (965, 996), False, 'from south.db import db\n'), ((1070, 1111), 'south.db.db.delete_table', 'db.delete_table', (['"""staff_directory_praise"""'], {}), "('staff_dir... |
import hashlib
import pathlib
import shutil
import subprocess
import pymedphys._data.upload
import pymedphys._data.zenodo
ROOT = pathlib.Path(__file__).resolve().parent.parent.parent
DOCS_DIR = ROOT.joinpath("docs")
DOCS_BUILD_DIR = DOCS_DIR.joinpath("_build")
DOCS_HTML_BUILD_DIR = DOCS_BUILD_DIR.joinpath("html")
d... | [
"hashlib.md5",
"pathlib.Path"
] | [((1018, 1031), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (1029, 1031), False, 'import hashlib\n'), ((131, 153), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (143, 153), False, 'import pathlib\n')] |
# mypy: ignore-errors
import abc
from typing import Iterator, Mapping, Sequence, Tuple, Optional, List
from typing import TypeVar
from sortedcontainers import SortedDict
E = TypeVar("E") # element
class CumSequence(Sequence[E]):
"""
ABC for Cumulative max/min sequences that efficiently store cumulative min/... | [
"sortedcontainers.SortedDict",
"typing.TypeVar"
] | [((175, 187), 'typing.TypeVar', 'TypeVar', (['"""E"""'], {}), "('E')\n", (182, 187), False, 'from typing import TypeVar\n'), ((3324, 3336), 'sortedcontainers.SortedDict', 'SortedDict', ([], {}), '()\n', (3334, 3336), False, 'from sortedcontainers import SortedDict\n')] |
# encoding: utf-8
'''
@author: season
@contact: <EMAIL>
@file: CSDN_Blog.py
@time: 2019/1/7 10:34
@desc:
'''
import sys
import os
from sqlalchemy import Column, TEXT, String, Integer, DateTime
from sqlalchemy.ext.declarative import declarative_base
# from sqlalchemy.orm import scoped_session, sessionmaker
CURRENT_U... | [
"os.path.join",
"os.path.dirname",
"sqlalchemy.String",
"sqlalchemy.ext.declarative.declarative_base",
"sys.path.append",
"sqlalchemy.Column"
] | [((325, 350), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (340, 350), False, 'import os\n'), ((418, 445), 'sys.path.append', 'sys.path.append', (['PARENT_URL'], {}), '(PARENT_URL)\n', (433, 445), False, 'import sys\n'), ((928, 946), 'sqlalchemy.ext.declarative.declarative_base', 'declarati... |
import sys
import time
import signal
import asyncio
import logging
from cowfish.sqs import SQSWriter
loop = asyncio.get_event_loop()
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
writer = SQSWriter('gyb', region_name='us-west-1')
@writer.async_rpc
async def foo(a):
pass
obj = {
'name': 'gyb',... | [
"logging.basicConfig",
"cowfish.sqs.SQSWriter",
"asyncio.Event",
"asyncio.sleep",
"asyncio.get_event_loop",
"time.time"
] | [((108, 132), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (130, 132), False, 'import asyncio\n'), ((133, 191), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.INFO'}), '(stream=sys.stdout, level=logging.INFO)\n', (152, 191), False, 'import logging\... |
# Here goes all the walls in the scenario
import pygame
from config import *
def walls():
from main import screen
pygame.draw.rect(
screen, colors["Blue_ball"], (0, 0, (SCREEN_WIDTH // 2), WALL_WIDTH)
)
pygame.draw.rect(
screen,
colors["Red_ball"],
((SCREEN_WIDTH // 2)... | [
"pygame.draw.rect"
] | [((125, 213), 'pygame.draw.rect', 'pygame.draw.rect', (['screen', "colors['Blue_ball']", '(0, 0, SCREEN_WIDTH // 2, WALL_WIDTH)'], {}), "(screen, colors['Blue_ball'], (0, 0, SCREEN_WIDTH // 2,\n WALL_WIDTH))\n", (141, 213), False, 'import pygame\n'), ((230, 334), 'pygame.draw.rect', 'pygame.draw.rect', (['screen', "... |
"""
FOTA update tool which is called from the dispatcher during installation
Copyright (C) 2017-2022 Intel Corporation
SPDX-License-Identifier: Apache-2.0
"""
import logging
from abc import ABC, abstractmethod
from typing import Tuple, Dict
from datetime import datetime
from inbm_lib import wmi
from dis... | [
"logging.getLogger",
"inbm_common_lib.dmi.get_dmi_system_info",
"dispatcher.common.dispatcher_state.write_dispatcher_state_to_state_file",
"inbm_common_lib.dmi.manufacturer_check",
"inbm_lib.wmi.wmic_query",
"inbm_common_lib.device_tree.get_device_tree_system_info",
"inbm_common_lib.platform_info.Platfo... | [((756, 783), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (773, 783), False, 'import logging\n'), ((2735, 2795), 'dispatcher.common.dispatcher_state.write_dispatcher_state_to_state_file', 'dispatcher_state.write_dispatcher_state_to_state_file', (['state'], {}), '(state)\n', (2788, 2795... |
from talon import speech_system, Context
from talon.engines.w2l import WebW2lEngine, W2lEngine
from talon.engines.webspeech import WebSpeechEngine
w2l = W2lEngine(model='en_US-conformer', debug=False)
speech_system.add_engine(w2l)
webspeech = WebSpeechEngine()
speech_system.add_engine(webspeech)# set the default engin... | [
"talon.engines.w2l.W2lEngine",
"talon.speech_system.add_engine",
"talon.engines.webspeech.WebSpeechEngine",
"talon.Context"
] | [((154, 201), 'talon.engines.w2l.W2lEngine', 'W2lEngine', ([], {'model': '"""en_US-conformer"""', 'debug': '(False)'}), "(model='en_US-conformer', debug=False)\n", (163, 201), False, 'from talon.engines.w2l import WebW2lEngine, W2lEngine\n'), ((202, 231), 'talon.speech_system.add_engine', 'speech_system.add_engine', ([... |
__author__ = 'Keiran'
from sys import maxsize
def randomize_str(attr, max_len=5):
import random, string
symbols = string.ascii_letters + string.digits + " " * 10
return attr + "".join(random.choice(symbols) for i in range(max_len)).rstrip()
class Group:
def __init__(self, name=None, header=None, foo... | [
"random.choice"
] | [((198, 220), 'random.choice', 'random.choice', (['symbols'], {}), '(symbols)\n', (211, 220), False, 'import random, string\n')] |
from jarbas_hive_mind.slave.terminal import HiveMindTerminal, \
HiveMindTerminalProtocol
from jarbas_hive_mind.message import HiveMessageType, HiveMessage
from jarbas_hive_mind.nodes import HiveMindNodeType
from ovos_utils.log import LOG
from ovos_utils.messagebus import Message, get_mycroft_bus
import json
class... | [
"json.dumps",
"ovos_utils.messagebus.Message",
"ovos_utils.log.LOG.info",
"ovos_utils.messagebus.get_mycroft_bus",
"ovos_utils.log.LOG.error",
"ovos_utils.messagebus.Message.deserialize"
] | [((3795, 3823), 'ovos_utils.log.LOG.info', 'LOG.info', (['"""[BINARY MESSAGE]"""'], {}), "('[BINARY MESSAGE]')\n", (3803, 3823), False, 'from ovos_utils.log import LOG\n'), ((529, 602), 'ovos_utils.messagebus.Message', 'Message', (['"""hive.mind.connected"""', "{'server_id': response.headers['server']}"], {}), "('hive.... |
import asyncio
from concurrent.futures import CancelledError
import itertools
from typing import (
Dict,
FrozenSet,
Iterable,
Set,
Tuple,
Type,
)
from eth_hash.auto import keccak
from eth_utils import (
encode_hex,
to_checksum_address,
ValidationError,
)
from eth_typing import (
... | [
"eth_typing.Hash32",
"eth_utils.ValidationError",
"trinity._utils.timer.Timer",
"eth_utils.to_checksum_address",
"asyncio.Event",
"eth_hash.auto.keccak",
"itertools.count",
"eth_utils.encode_hex",
"trie.HexaryTrie",
"rlp.decode"
] | [((1737, 1760), 'trinity._utils.timer.Timer', 'Timer', ([], {'auto_start': '(False)'}), '(auto_start=False)\n', (1742, 1760), False, 'from trinity._utils.timer import Timer\n'), ((2511, 2525), 'trie.HexaryTrie', 'HexaryTrie', (['db'], {}), '(db)\n', (2521, 2525), False, 'from trie import HexaryTrie\n'), ((20897, 20912)... |
import keyword
print(keyword.iskeyword('as'))
print(keyword.iskeyword('x'))
| [
"keyword.iskeyword"
] | [((21, 44), 'keyword.iskeyword', 'keyword.iskeyword', (['"""as"""'], {}), "('as')\n", (38, 44), False, 'import keyword\n'), ((52, 74), 'keyword.iskeyword', 'keyword.iskeyword', (['"""x"""'], {}), "('x')\n", (69, 74), False, 'import keyword\n')] |
# Generated by Django 4.0.3 on 2022-03-08 10:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0002_rename_email_student_age_remove_student_message_and_more'),
]
operations = [
migrations.AlterField(
model_name='stu... | [
"django.db.models.TextField"
] | [((369, 408), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (385, 408), False, 'from django.db import migrations, models\n')] |
from flask import Blueprint, request, jsonify
from tarcioscope.lib.pi_camera_wrapper import PiCameraWrapper
PICAMERA = PiCameraWrapper()
bp = Blueprint('config', __name__, url_prefix='/')
@bp.route('/config', methods=['GET', 'POST'])
def config():
"""Handles both setting and getting the camera's configuration""... | [
"tarcioscope.lib.pi_camera_wrapper.PiCameraWrapper",
"flask.request.get_json",
"flask.Blueprint"
] | [((121, 138), 'tarcioscope.lib.pi_camera_wrapper.PiCameraWrapper', 'PiCameraWrapper', ([], {}), '()\n', (136, 138), False, 'from tarcioscope.lib.pi_camera_wrapper import PiCameraWrapper\n'), ((145, 190), 'flask.Blueprint', 'Blueprint', (['"""config"""', '__name__'], {'url_prefix': '"""/"""'}), "('config', __name__, url... |
#!/usr/share/ucs-test/runner /usr/bin/py.test -slvv --cov --cov-config=.coveragerc --cov-append --cov-report=
# -*- coding: utf-8 -*-
#
# Copyright 2021 Univention GmbH
#
# https://www.univention.de/
#
# All rights reserved.
#
# The source code of this program is made available
# under the terms of the GNU Affero Gener... | [
"ucsschool.lib.models.user.Student",
"uuid.uuid4",
"datetime.timedelta",
"pytest.mark.parametrize",
"datetime.datetime.now",
"copy.deepcopy",
"pytest.fixture",
"univention.bildungslogin.handlers.MetaDataHandler",
"univention.bildungslogin.handlers.LicenseHandler",
"univention.bildungslogin.handler... | [((1942, 1972), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (1956, 1972), False, 'import pytest\n'), ((2257, 2287), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (2271, 2287), False, 'import pytest\n'), ((3151, 3181), 'pytest.fi... |
"""Unittests for pystein.symbolic.constants module"""
# pylint: disable=protected-access
import pytest
from astropy import constants as astro_constants
from sympy import symbols
from pystein import constants
from pystein.constants import UnitSystem
class TestNaturalUnits:
"""Test Natural Units"""
# TODO thi... | [
"pystein.constants.subs_cgs",
"pystein.constants.subs_natural",
"pystein.constants.ConstantSymbol",
"sympy.symbols",
"pystein.constants._subs_const_values",
"pytest.raises",
"pystein.constants.UnitSystem",
"pystein.constants.subs_si"
] | [((1402, 1445), 'pystein.constants.ConstantSymbol', 'constants.ConstantSymbol', (['astro_constants.e'], {}), '(astro_constants.e)\n', (1426, 1445), False, 'from pystein import constants\n'), ((1458, 1523), 'pystein.constants.ConstantSymbol', 'constants.ConstantSymbol', (['astro_constants.e'], {'is_natural_unit': '(True... |
import time
from typing import Optional, Sequence
class Instances:
def __init__(self):
self.count = 0
# Started time for each replica on the node. The value at index `i` in
# the start time of the `i`th protocol instance
self.started = []
def add(self):
"""
Ad... | [
"time.perf_counter"
] | [((409, 428), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (426, 428), False, 'import time\n')] |
from docx import Document
import aspose.words as aw
from docx.enum.text import WD_BREAK
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.shared import Inches
from volume_meter import *
from docx2pdf import convert
def create_qa(self):
# Table data in a form of list
print(self.qa);
data... | [
"docx.shared.Inches",
"docx2pdf.convert",
"docx.Document"
] | [((976, 1015), 'docx.Document', 'Document', (['"""report/report_template.docx"""'], {}), "('report/report_template.docx')\n", (984, 1015), False, 'from docx import Document\n'), ((5013, 5098), 'docx2pdf.convert', 'convert', (["('C:\\\\Users\\\\vip\\\\Documents\\\\gp-master\\\\\\\\' + uid + '\\\\r' + uid + '.docx')"], {... |
# Authors:
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD 3 clause
"""
Sphere element
"""
# pylint: disable=invalid-name
import logging
# from textwrap import dedent
import numpy as np
from .base import Element
from .utils import distance_ellipsoid
log = logging.getLogger(__name__) # pylint: disab... | [
"logging.getLogger",
"numpy.array",
"numpy.asarray",
"numpy.ones"
] | [((276, 303), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (293, 303), False, 'import logging\n'), ((1591, 1609), 'numpy.asarray', 'np.asarray', (['center'], {}), '(center)\n', (1601, 1609), True, 'import numpy as np\n'), ((2497, 2569), 'numpy.asarray', 'np.asarray', (['[x - self.center... |
# Resumes builds that are in the pipeline directory when the script needs to
# restart. Starts make in the corresponding directories in case they had
# not finished.
from threading import Thread
import logging
from build import Build
from utils import get_build_directories
try:
from config import Config
except Im... | [
"logging.getLogger",
"build.Build",
"build.Build.run",
"utils.get_build_directories",
"threading.Thread"
] | [((376, 417), 'logging.getLogger', 'logging.getLogger', (["('pipeline.' + __name__)"], {}), "('pipeline.' + __name__)\n", (393, 417), False, 'import logging\n'), ((730, 767), 'threading.Thread', 'Thread', ([], {'target': 'resume_worker', 'args': '[]'}), '(target=resume_worker, args=[])\n', (736, 767), False, 'from thre... |
#################################################################################
#-------------------------------------------------------------------------------#
# LAVAKA VOLUME DETERMINATION
#-------------------------------------------------------------------------------#
##################################... | [
"qgis.analysis.QgsRasterCalculatorEntry"
] | [((10495, 10521), 'qgis.analysis.QgsRasterCalculatorEntry', 'QgsRasterCalculatorEntry', ([], {}), '()\n', (10519, 10521), False, 'from qgis.analysis import QgsRasterCalculator, QgsRasterCalculatorEntry\n'), ((11733, 11759), 'qgis.analysis.QgsRasterCalculatorEntry', 'QgsRasterCalculatorEntry', ([], {}), '()\n', (11757, ... |
import sys
import os
class TextFile:
def readFile(self, filename):
with open(os.path.join(sys.path[0], filename), 'r') as f:
lines = f.readlines()
return lines
def removeBlankLines(self, lines):
newLines = {}
count = 0
for idx in lines:
if(lines[... | [
"os.path.join"
] | [((90, 125), 'os.path.join', 'os.path.join', (['sys.path[0]', 'filename'], {}), '(sys.path[0], filename)\n', (102, 125), False, 'import os\n')] |
import unittest
import os
if __name__ == '__main__':
suite = unittest.TestSuite()
loader = unittest.TestLoader()
suite.addTests(loader.discover(os.getcwd()))
# f = open('result_all.txt', 'w')
runner = unittest.TextTestRunner()
runner.run(suite)
# f.close()
| [
"unittest.TestSuite",
"unittest.TextTestRunner",
"unittest.TestLoader",
"os.getcwd"
] | [((66, 86), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (84, 86), False, 'import unittest\n'), ((100, 121), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (119, 121), False, 'import unittest\n'), ((223, 248), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (246... |
""" for signals handlers """
import os
def image_cleaner(sender, instance, *args, **kwargs):
os.remove(instance.foto.file.name) | [
"os.remove"
] | [((99, 133), 'os.remove', 'os.remove', (['instance.foto.file.name'], {}), '(instance.foto.file.name)\n', (108, 133), False, 'import os\n')] |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import time
import unittest
import uiautomator2 as u2
import uiautomator2.ext.ocr as ocr
import random
from utx import *
class TestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.d = u2.connect()
cls.d.set_orientation('natural')
... | [
"unittest.main",
"uiautomator2.connect",
"uiautomator2.plugin_register"
] | [((1910, 1925), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1923, 1925), False, 'import unittest\n'), ((261, 273), 'uiautomator2.connect', 'u2.connect', ([], {}), '()\n', (271, 273), True, 'import uiautomator2 as u2\n'), ((516, 550), 'uiautomator2.plugin_register', 'u2.plugin_register', (['"""ocr"""', 'ocr.OCR... |
"""
plots: functions to plot needed data
=============================================
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import pandas as pd
from math import isnan
import plotly.graph_objects as go
import plotly.express as px
from src.mysettings import label_dic, months_list, code_state, code_coun... | [
"src.helpers.select_data",
"src.helpers.regression_histogram",
"plotly.graph_objects.Indicator",
"plotly.graph_objects.layout.geo.Projection",
"src.helpers.dfadaptDateRange",
"src.helpers.adaptDataframeHistogram",
"src.helpers.regions_of_country",
"plotly.graph_objects.Scatter",
"plotly.graph_object... | [((2272, 2342), 'src.helpers.select_data', 'select_data', (['df', 'countries_list', 'regions_list', 'ages_list', 'genders_list'], {}), '(df, countries_list, regions_list, ages_list, genders_list)\n', (2283, 2342), False, 'from src.helpers import select_data, regions_of_country, dfadaptDateRange, computeDateFormat, regr... |
import cv2
import os
import re
import numpy as np
from multiprocessing import Pool
import pickle
root_folder = './NTURGBD'
rgb_folder = os.path.join(root_folder, './nturgb+d_rgb')
depth_folder = os.path.join(root_folder, './nturgb+d_depth_masked')
skeleton_folder = os.path.join(root_folder, './nturgb+d_skeletons')
ta... | [
"os.path.exists",
"cv2.imwrite",
"os.listdir",
"numpy.random.rand",
"os.makedirs",
"cv2.findHomography",
"re.compile",
"os.path.join",
"re.match",
"numpy.array",
"cv2.warpPerspective",
"numpy.stack",
"multiprocessing.Pool",
"numpy.concatenate"
] | [((137, 180), 'os.path.join', 'os.path.join', (['root_folder', '"""./nturgb+d_rgb"""'], {}), "(root_folder, './nturgb+d_rgb')\n", (149, 180), False, 'import os\n'), ((196, 248), 'os.path.join', 'os.path.join', (['root_folder', '"""./nturgb+d_depth_masked"""'], {}), "(root_folder, './nturgb+d_depth_masked')\n", (208, 24... |
import numpy as np
import hetu as ht
from hetu import gpu_links as gpu_op
def test_adamw():
ctx = ht.gpu(0)
shape = (500,400)
param = np.random.uniform(-10, 10, size=shape).astype(np.float32)
grad = np.random.uniform(-10, 10, size=shape).astype(np.float32)
m = np.random.uniform(-10, 10, size=shape... | [
"hetu.IndexedSlices",
"hetu.gpu",
"numpy.sqrt",
"numpy.power",
"numpy.testing.assert_allclose",
"hetu.array",
"numpy.array",
"numpy.random.randint",
"hetu.gpu_links.adamw_update",
"numpy.random.uniform",
"hetu.gpu_links.lamb_update"
] | [((104, 113), 'hetu.gpu', 'ht.gpu', (['(0)'], {}), '(0)\n', (110, 113), True, 'import hetu as ht\n'), ((664, 684), 'hetu.array', 'ht.array', (['param', 'ctx'], {}), '(param, ctx)\n', (672, 684), True, 'import hetu as ht\n'), ((700, 719), 'hetu.array', 'ht.array', (['grad', 'ctx'], {}), '(grad, ctx)\n', (708, 719), True... |
import unittest
from mnemonic import Mnemonic
from modules.coins import ALL_COINS
from modules.electrum_mods.tux_mods import NetworkLock, serialize_privkey, BIP32Node
TEST_MNEMONIC = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
TEST_PASSPHRASE = "TREZOR"
RECIPIENT_... | [
"modules.coins.ALL_COINS.values",
"mnemonic.Mnemonic",
"modules.electrum_mods.tux_mods.BIP32Node.from_rootseed",
"modules.electrum_mods.tux_mods.NetworkLock"
] | [((821, 840), 'mnemonic.Mnemonic', 'Mnemonic', (['"""english"""'], {}), "('english')\n", (829, 840), False, 'from mnemonic import Mnemonic\n'), ((1123, 1170), 'modules.electrum_mods.tux_mods.BIP32Node.from_rootseed', 'BIP32Node.from_rootseed', (['seed'], {'xtype': '"""standard"""'}), "(seed, xtype='standard')\n", (1146... |
from .util import Interpretable
from collections import namedtuple
from enum import Enum
import fnmatch
import os
import re
class FileEntryField(Interpretable, Enum):
NAME = "name"
SIZE = "size"
MTIME = "mtime"
@classmethod
def dictify(cls, name, size, mtime):
return {
cls.NA... | [
"collections.namedtuple",
"fnmatch.translate",
"os.path.ismount",
"os.statvfs",
"os.scandir",
"os.path.realpath",
"os.path.dirname",
"os.unlink"
] | [((2121, 2175), 'collections.namedtuple', 'namedtuple', (['"""StorageStats"""', "['name', 'total', 'avail']"], {}), "('StorageStats', ['name', 'total', 'avail'])\n", (2131, 2175), False, 'from collections import namedtuple\n'), ((1639, 1658), 'os.scandir', 'os.scandir', (['dirpath'], {}), '(dirpath)\n', (1649, 1658), F... |
import pytest
from service.utils import ServiceUtils
@pytest.mark.parametrize(
("direction", "expected"), (("asc", False), ("desc", True), ("", True),),
)
def test_direction(direction, expected):
api = ServiceUtils.direction(direction)
assert expected == api
@pytest.mark.parametrize(
"param",
(... | [
"pytest.mark.parametrize",
"service.utils.ServiceUtils.direction",
"service.utils.ServiceUtils.handle_param_types"
] | [((57, 157), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('direction', 'expected')", "(('asc', False), ('desc', True), ('', True))"], {}), "(('direction', 'expected'), (('asc', False), ('desc',\n True), ('', True)))\n", (80, 157), False, 'import pytest\n'), ((627, 971), 'pytest.mark.parametrize', 'pytes... |
#!/usr/bin/env python
#
# Copyright (C) 2013 <NAME>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
# This program is distributed in the ... | [
"hamstring.base4Encode",
"argparse.ArgumentParser",
"hamstring.generateHamming"
] | [((726, 794), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate Hamming DNA barcodes"""'}), "(description='Generate Hamming DNA barcodes')\n", (749, 794), False, 'import argparse\n'), ((1273, 1300), 'hamstring.base4Encode', 'hamstring.base4Encode', (['i', '(4)'], {}), '(i, 4)\n', (... |