code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import Rhino # type: ignore
import rhinoscriptsyntax as rs
import scriptcontext as sc
import re
from integral_timber_joints.rhino.load import get_process, get_process_artist, process_is_none
from integral_timber_joints.geometry import JointHalfLap, JointNonPlanarLap
from integral_timber_joints.rhino.assembly_artist im... | [
"compas.geometry.Translation.from_vector",
"compas.geometry.Transformation.from_frame",
"integral_timber_joints.rhino.load.get_process",
"integral_timber_joints.rhino.load.get_process_artist",
"compas.geometry.Frame.from_transformation",
"compas.geometry.Vector"
] | [((2264, 2303), 'compas.geometry.Translation.from_vector', 'Translation.from_vector', (['retract_vector'], {}), '(retract_vector)\n', (2287, 2303), False, 'from compas.geometry import Cylinder, Transformation, Translation, Vector, Frame\n'), ((4361, 4398), 'compas.geometry.Transformation.from_frame', 'Transformation.fr... |
# Spider
# WF 2019-07
# WF 2020-01
from flask import Flask, request, render_template, send_from_directory, abort
from flask_restful import Resource, Api
import json
import sys
import time
import yaml
import platform
import os.path
# check if we are running on a raspberry PI
# https://raspberrypi.stackexchange.com/ques... | [
"flask_restful.Api",
"json.load",
"flask.request.form.get",
"flask.Flask",
"adafruit_servokit.ServoKit",
"flask.abort",
"yaml.dump",
"time.sleep",
"json.dumps",
"flask.render_template",
"platform.system"
] | [((824, 880), 'flask.Flask', 'Flask', (['__name__'], {'static_url_path': '""""""', 'static_folder': '"""web"""'}), "(__name__, static_url_path='', static_folder='web')\n", (829, 880), False, 'from flask import Flask, request, render_template, send_from_directory, abort\n'), ((887, 895), 'flask_restful.Api', 'Api', (['a... |
import pygame as pg
import math
class Pgp(object):
def __init__(self, surface, width, height, topleft=None, topright=None,
bottomleft=None, bottomright=None, centre=None,
labelColour=None, drawLine=None):
self.__screen = surface
if width > 300:
self.__... | [
"pygame.quit",
"pygame.draw.line",
"math.sqrt",
"pygame.font.SysFont",
"pygame.draw.rect",
"pygame.display.set_mode",
"pygame.event.get",
"pygame.Rect",
"pygame.init",
"math.log",
"pygame.font.init",
"pygame.display.update",
"pygame.display.set_caption",
"pygame.time.Clock"
] | [((8240, 8249), 'pygame.init', 'pg.init', ([], {}), '()\n', (8247, 8249), True, 'import pygame as pg\n'), ((8254, 8268), 'pygame.font.init', 'pg.font.init', ([], {}), '()\n', (8266, 8268), True, 'import pygame as pg\n'), ((8282, 8315), 'pygame.display.set_mode', 'pg.display.set_mode', (['(1920, 1080)'], {}), '((1920, 1... |
import torch
import torch.nn as nn
from fastprogress import master_bar, progress_bar
from torch.nn.modules.module import Module
from torch.optim import Optimizer
from torchwisdom.core.optim.wrapper import OptimizerWrapper
from torchwisdom.core.utils.data import DatasetCollector
from .base import Trainer
from .helpers ... | [
"torchwisdom.core.optim.wrapper.OptimizerWrapper",
"torch.no_grad",
"fastprogress.progress_bar"
] | [((1299, 1327), 'torchwisdom.core.optim.wrapper.OptimizerWrapper', 'OptimizerWrapper', (['self.model'], {}), '(self.model)\n', (1315, 1327), False, 'from torchwisdom.core.optim.wrapper import OptimizerWrapper\n'), ((2189, 2228), 'fastprogress.progress_bar', 'progress_bar', (['train_loader'], {'parent': 'mbar'}), '(trai... |
from .compat import unittest
import ucl
import sys
class DumpTest(unittest.TestCase):
def test_no_args(self):
with self.assertRaises(TypeError):
ucl.dump()
def test_none(self):
self.assertEqual(ucl.dump(None), None)
def test_null(self):
data = { "a" : None }
va... | [
"ucl.dump"
] | [((170, 180), 'ucl.dump', 'ucl.dump', ([], {}), '()\n', (178, 180), False, 'import ucl\n'), ((232, 246), 'ucl.dump', 'ucl.dump', (['None'], {}), '(None)\n', (240, 246), False, 'import ucl\n'), ((365, 379), 'ucl.dump', 'ucl.dump', (['data'], {}), '(data)\n', (373, 379), False, 'import ucl\n'), ((492, 506), 'ucl.dump', '... |
# -*- coding: utf-8 -*-
# Copyright 2009-2021 <NAME>. All Rights Reserved.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""Provide :class:`OnDup` and related func... | [
"collections.namedtuple"
] | [((875, 909), 'collections.namedtuple', 'namedtuple', (['"""_OnDup"""', '"""key val kv"""'], {}), "('_OnDup', 'key val kv')\n", (885, 909), False, 'from collections import namedtuple\n')] |
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth import authenticate, login
from django.core.serializers import serialize
from django.contrib.auth.models import User
from django.contrib.auth import logout
from django.http import JsonResponse
from django.shortcuts import render
from .models ... | [
"json.loads",
"django.contrib.auth.models.User.objects.get",
"django.core.serializers.serialize",
"django.contrib.auth.models.User.objects.create_user",
"django.http.JsonResponse",
"django.contrib.auth.logout",
"django.contrib.auth.authenticate",
"django.contrib.auth.login"
] | [((1688, 1703), 'django.contrib.auth.logout', 'logout', (['request'], {}), '(request)\n', (1694, 1703), False, 'from django.contrib.auth import logout\n'), ((1715, 1753), 'django.http.JsonResponse', 'JsonResponse', (['"""Logged out"""'], {'safe': '(False)'}), "('Logged out', safe=False)\n", (1727, 1753), False, 'from d... |
import json
import os
import subprocess
import threading
from mysos.common.decorators import synchronized
from .sandbox import Sandbox
from .task_control import TaskControl, TaskControlProvider
from twitter.common import log
from twitter.common.quantity import Amount, Data
import yaml
MEM_FRACTION_FOR_BUFFER_POOL ... | [
"subprocess.Popen",
"yaml.load",
"json.loads",
"os.path.isdir",
"twitter.common.log.warn",
"subprocess.check_output",
"threading.Lock",
"twitter.common.log.info",
"os.environ.get",
"os.path.isfile",
"os.path.join",
"subprocess.check_call"
] | [((564, 585), 'json.loads', 'json.loads', (['task.data'], {}), '(task.data)\n', (574, 585), False, 'import json\n'), ((917, 1002), 'twitter.common.log.info', 'log.info', (["('Allocating %s bytes of memory to MySQL buffer pool' % buffer_pool_size)"], {}), "('Allocating %s bytes of memory to MySQL buffer pool' %\n buf... |
# tests.admin_script_tests
# Use the subprocess module to execute tribe-admin.py for testing.
#
# Author: <NAME> <<EMAIL>>
# Created: Wed Jun 22 15:48:08 2016 -0400
#
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: admin_script_tests.py [6bf9822] <EMAIL> $
"""
Use the subp... | [
"os.path.dirname",
"subprocess.check_output",
"os.path.exists",
"unittest.skip",
"os.path.isfile",
"os.path.join"
] | [((1002, 1037), 'os.path.join', 'os.path.join', (['FIXTURES', '"""test.mbox"""'], {}), "(FIXTURES, 'test.mbox')\n", (1014, 1037), False, 'import os\n'), ((1049, 1088), 'os.path.join', 'os.path.join', (['PROJECT', '"""tribe-admin.py"""'], {}), "(PROJECT, 'tribe-admin.py')\n", (1061, 1088), False, 'import os\n'), ((895, ... |
import pytest
from selenium.webdriver.remote.webdriver import WebDriver
from tests.coverage.web.helper.pages import EditPage
from tests.markers import web # noqa: I100
pytestmark = web
@pytest.fixture()
def edit_page(browser: WebDriver) -> EditPage:
page: EditPage = EditPage(browser, page_id=47)
if not page... | [
"tests.coverage.web.helper.pages.EditPage",
"pytest.fixture"
] | [((190, 206), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (204, 206), False, 'import pytest\n'), ((275, 304), 'tests.coverage.web.helper.pages.EditPage', 'EditPage', (['browser'], {'page_id': '(47)'}), '(browser, page_id=47)\n', (283, 304), False, 'from tests.coverage.web.helper.pages import EditPage\n')] |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# true parameters
c = {
'one': 0.0,
'x1': 0.6,
'x2': 0.2,
'id1': 0.2,
'id2': 0.5,
'pz': 0.2
}
# poisson dampening
pfact = 100
def dataset(N=1_000_000, K1=10, K2=100, seed=89320432):
# init random
st = np.random.Ran... | [
"numpy.linspace",
"matplotlib.pyplot.subplots",
"numpy.exp",
"numpy.random.RandomState"
] | [((307, 334), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (328, 334), True, 'import numpy as np\n'), ((844, 863), 'numpy.exp', 'np.exp', (["df['yhat0']"], {}), "(df['yhat0'])\n", (850, 863), True, 'import numpy as np\n'), ((879, 897), 'numpy.exp', 'np.exp', (["df['yhat']"], {}), "(d... |
import h5py
import numpy as np
import uuid
import yaml
import os, sys
class SaveData:
def __init__(self, logger, data_dir, timestamp):
self.logger = logger
self.data_dir = data_dir
self.timestamp = timestamp
self.dirs = self.data_dir + '/' + timestamp
if not os.path.exists(s... | [
"h5py.File",
"os.makedirs",
"yaml.dump",
"os.path.exists",
"numpy.array",
"sys.exit"
] | [((304, 329), 'os.path.exists', 'os.path.exists', (['self.dirs'], {}), '(self.dirs)\n', (318, 329), False, 'import os, sys\n'), ((343, 365), 'os.makedirs', 'os.makedirs', (['self.dirs'], {}), '(self.dirs)\n', (354, 365), False, 'import os, sys\n'), ((381, 417), 'os.path.exists', 'os.path.exists', (["(self.dirs + '/yaml... |
# Generated by Django 3.2 on 2022-02-15 07:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Apps', '0004_diaries_publish_time'),
]
operations = [
migrations.AlterField(
model_name='diaries',
name='publish_time'... | [
"django.db.models.DateTimeField"
] | [((340, 400), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)', 'verbose_name': '"""发布时间"""'}), "(auto_now_add=True, verbose_name='发布时间')\n", (360, 400), False, 'from django.db import migrations, models\n')] |
#!/usr/bin/env python
import argparse
import os.path as osp
import re
import chainer
from chainer import cuda
import fcn
import numpy as np
import tqdm
def main():
parser = argparse.ArgumentParser()
parser.add_argument('model_file')
parser.add_argument('-g', '--gpu', default=0, type=int,
... | [
"fcn.utils.label_accuracy_score",
"chainer.Variable",
"argparse.ArgumentParser",
"chainer.serializers.load_npz",
"os.path.basename",
"chainer.cuda.get_device",
"chainer.functions.argmax",
"re.match",
"numpy.expand_dims",
"chainer.cuda.to_cpu",
"chainer.no_backprop_mode",
"chainer.cuda.to_gpu",... | [((181, 206), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (204, 206), False, 'import argparse\n'), ((416, 458), 'fcn.datasets.VOC2011ClassSeg', 'fcn.datasets.VOC2011ClassSeg', (['"""seg11valid"""'], {}), "('seg11valid')\n", (444, 458), False, 'import fcn\n'), ((1010, 1062), 'chainer.serializ... |
# Insert @start tag
# A workflow for the iOS text editor Editorial
# Copyright (c) 2017 <NAME>
# Licensed under the MIT License, see LICENSE.txt
# This workflow, when run, prompts the user to select a date. @start(YYYY-MM-DD) is then inserted
# at the cursor, where YYYY-MM-DD is the selected date.
import datetime
imp... | [
"dialogs.date_dialog",
"datetime.timedelta",
"datetime.date.today",
"dialogs.list_dialog"
] | [((792, 883), 'dialogs.list_dialog', 'dialogs.list_dialog', ([], {'title': '"""Choose a start date:"""', 'items': "(readable_dates + [' Other'])"}), "(title='Choose a start date:', items=readable_dates + [\n ' Other'])\n", (811, 883), False, 'import dialogs\n'), ((441, 462), 'datetime.date.today', 'datetime.date... |
import numpy as np
import matplotlib.pyplot as plt
if __name__ == '__main__':
fig = plt.figure()
ax = fig.gca(projection='3d')
x = np.arange(-10, 10, 0.1)
y = np.arange(-10, 10, 0.1)
x, y = np.meshgrid(x, y)
res = 0
for i in range(3):
res = res + np.abs(x * np.sin(x) + 0.1 * x + y *... | [
"matplotlib.pyplot.title",
"numpy.meshgrid",
"matplotlib.pyplot.show",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.arange",
"matplotlib.pyplot.contour",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((89, 101), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (99, 101), True, 'import matplotlib.pyplot as plt\n'), ((144, 167), 'numpy.arange', 'np.arange', (['(-10)', '(10)', '(0.1)'], {}), '(-10, 10, 0.1)\n', (153, 167), True, 'import numpy as np\n'), ((176, 199), 'numpy.arange', 'np.arange', (['(-10)', ... |
# -*- coding: utf-8 -*-
"""
Sources for Person
"""
from __future__ import unicode_literals
import re
from builtins import str
from lxml import html
from ..utils import KinopoiskPage, KinopoiskImagesPage, HEADERS
class PersonCastLink(KinopoiskPage):
"""
Parser of person info in movie cast link
"""
x... | [
"kinopoisk.person.Role.get_parsed",
"kinopoisk.movie.Movie.get_parsed",
"lxml.html.fromstring",
"re.findall",
"builtins.str",
"re.compile"
] | [((1069, 1114), 'kinopoisk.movie.Movie.get_parsed', 'Movie.get_parsed', (['"""career_link"""', 'self.content'], {}), "('career_link', self.content)\n", (1085, 1114), False, 'from kinopoisk.movie import Movie\n'), ((2337, 2366), 'lxml.html.fromstring', 'html.fromstring', (['self.content'], {}), '(self.content)\n', (2352... |
# -*- coding: utf-8 -*-
"""
Test suite for the community-developed Python SDK for interacting with Lacework APIs.
"""
import pytest
from laceworksdk.api.v2.alert_rules import AlertRulesAPI
from tests.api.test_crud_endpoint import CrudEndpoint
# Tests
@pytest.fixture(scope="module")
def api_object(api):
return ... | [
"pytest.fixture"
] | [((257, 287), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (271, 287), False, 'import pytest\n'), ((339, 369), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (353, 369), False, 'import pytest\n'), ((835, 865), 'pytest.fixture', 'p... |
#coding=utf-8
from sklearn.feature_extraction.text import CountVectorizer
import pandas as pd
from collections import Counter
from bidi.algorithm import get_display
import arabic_reshaper
import matplotlib.pyplot as plt
import seaborn as sns
import os
import uuid
def plot_ngram(data, col="not_set_yet", n_gram=2, outp... | [
"pandas.DataFrame",
"sklearn.feature_extraction.text.CountVectorizer",
"uuid.uuid4",
"os.makedirs",
"os.path.exists",
"arabic_reshaper.reshape",
"matplotlib.pyplot.xticks",
"seaborn.set"
] | [((1576, 1597), 'seaborn.set', 'sns.set', ([], {'style': '"""dark"""'}), "(style='dark')\n", (1583, 1597), True, 'import seaborn as sns\n'), ((1710, 1733), 'matplotlib.pyplot.xticks', 'plt.xticks', ([], {'rotation': '(70)'}), '(rotation=70)\n', (1720, 1733), True, 'import matplotlib.pyplot as plt\n'), ((3430, 3451), 's... |
"""
File: models/Config.py
Purpose: Business logic for working with user settings
"""
import os.path as path
from yaml import load, dump
class Config (object):
PATH = path.join(path.dirname(path.dirname(path.abspath(__file__))), "user_config.yaml")
DEFAULTS = {
"mass-spec-precision": 1,
"sig... | [
"os.path.abspath",
"yaml.dump",
"yaml.load"
] | [((1130, 1175), 'yaml.dump', 'dump', (['self', 'uc_yaml'], {'default_flow_style': '(False)'}), '(self, uc_yaml, default_flow_style=False)\n', (1134, 1175), False, 'from yaml import load, dump\n'), ((211, 233), 'os.path.abspath', 'path.abspath', (['__file__'], {}), '(__file__)\n', (223, 233), True, 'import os.path as pa... |
#!/usr/bin/env python
# -*- python -*-
"""This module contains functions to find files of a particular type in the SLAC directory tree"""
from lsst.eo_utils.base.file_utils import FILENAME_FORMATS,\
SLOT_FORMAT_STRING, RAFT_FORMAT_STRING, SUMMARY_FORMAT_STRING
FE55_DEFAULT_FIELDS = dict(testType='fe55')
RAFT_... | [
"lsst.eo_utils.base.file_utils.FILENAME_FORMATS.add_format"
] | [((343, 456), 'lsst.eo_utils.base.file_utils.FILENAME_FORMATS.add_format', 'FILENAME_FORMATS.add_format', (['"""raft_fe55_table"""', 'RAFT_FORMAT_STRING'], {'fileType': '"""tables"""'}), "('raft_fe55_table', RAFT_FORMAT_STRING, fileType\n ='tables', **FE55_DEFAULT_FIELDS)\n", (370, 456), False, 'from lsst.eo_utils.b... |
# SPDX-FileCopyrightText: 2014-2020 <NAME>
#
# SPDX-License-Identifier: MIT
from __future__ import division, print_function
import pytest
import pickle
from collections import OrderedDict
import numpy as np
from symfit import (
Variable, Parameter, Fit, FitResults, Eq, Ge, CallableNumericalModel, Model
)
from sym... | [
"pickle.loads",
"numpy.meshgrid",
"symfit.Parameter",
"symfit.Model",
"numpy.random.seed",
"symfit.Eq",
"symfit.CallableNumericalModel.as_constraint",
"numpy.histogram2d",
"symfit.Fit",
"symfit.distributions.BivariateGaussian",
"numpy.random.multivariate_normal",
"numpy.linspace",
"pytest.ap... | [((761, 783), 'numpy.linspace', 'np.linspace', (['(1)', '(10)', '(10)'], {}), '(1, 10, 10)\n', (772, 783), True, 'import numpy as np\n'), ((832, 846), 'symfit.Parameter', 'Parameter', (['"""a"""'], {}), "('a')\n", (841, 846), False, 'from symfit import Variable, Parameter, Fit, FitResults, Eq, Ge, CallableNumericalMode... |
from seqeval.metrics import accuracy_score
from seqeval.metrics import classification_report
from seqeval.metrics import f1_score
import pandas as pd
import os
import shutil
from Fixer import tagFixer, tagFixer2
def getF1Score(name, variation):
print("Beginning {} {}".format(name, variation))
dfTrue = pd.re... | [
"Fixer.tagFixer2",
"seqeval.metrics.classification_report",
"os.rename",
"seqeval.metrics.f1_score",
"os.listdir"
] | [((734, 758), 'Fixer.tagFixer2', 'tagFixer2', (["dfPred['tag']"], {}), "(dfPred['tag'])\n", (743, 758), False, 'from Fixer import tagFixer, tagFixer2\n'), ((1014, 1051), 'seqeval.metrics.classification_report', 'classification_report', (['y_true', 'y_pred'], {}), '(y_true, y_pred)\n', (1035, 1051), False, 'from seqeval... |
import fanstatic
import js.jquery
library = fanstatic.Library('jquery_cookie', 'resources')
cookie = fanstatic.Resource(
library, 'jquery.cookie.js', depends=[js.jquery.jquery])
| [
"fanstatic.Library",
"fanstatic.Resource"
] | [((45, 92), 'fanstatic.Library', 'fanstatic.Library', (['"""jquery_cookie"""', '"""resources"""'], {}), "('jquery_cookie', 'resources')\n", (62, 92), False, 'import fanstatic\n'), ((103, 178), 'fanstatic.Resource', 'fanstatic.Resource', (['library', '"""jquery.cookie.js"""'], {'depends': '[js.jquery.jquery]'}), "(libra... |
# coding: utf-8
import os
import numpy as np
import matplotlib.pyplot as plt
from scipy.misc import toimage
import pandas as pd
import time
#from sklearn.model_selection import KFold
#from sklearn.model_selection import train_test_split
from keras.datasets import cifar10
from keras.models import Sequential
from keras... | [
"matplotlib.pyplot.title",
"keras.preprocessing.image.ImageDataGenerator",
"pandas.read_csv",
"matplotlib.pyplot.figure",
"os.path.join",
"pandas.DataFrame",
"scipy.misc.toimage",
"keras.datasets.cifar10.load_data",
"matplotlib.pyplot.imshow",
"os.path.exists",
"keras.layers.Flatten",
"time.cl... | [((1581, 1593), 'time.clock', 'time.clock', ([], {}), '()\n', (1591, 1593), False, 'import time\n'), ((1915, 1934), 'keras.datasets.cifar10.load_data', 'cifar10.load_data', ([], {}), '()\n', (1932, 1934), False, 'from keras.datasets import cifar10\n'), ((2142, 2183), 'keras.utils.np_utils.to_categorical', 'np_utils.to_... |
# coding=utf-8
from __future__ import division
from pprint import pprint
import logging
import numpy as np
import onnx
import onnxruntime
import torch
import torch.onnx
import cv2
from utils.image import get_affine_transform
from utils.post_process import ctdet_post_process
from models.decode import mot_decode
device... | [
"onnxruntime.InferenceSession",
"cv2.warpAffine",
"cv2.imread",
"numpy.array",
"torch.cuda.is_available",
"utils.image.get_affine_transform",
"torch.device",
"onnx.checker.check_model",
"models.decode.mot_decode",
"onnx.load",
"cv2.resize",
"torch.from_numpy"
] | [((347, 372), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (370, 372), False, 'import torch\n'), ((323, 343), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (335, 343), False, 'import torch\n'), ((378, 397), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n"... |
# Generated by Django 2.0.7 on 2020-04-11 17:49
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uploads', '0004_auto_20200411_2319'),
]
operations = [
migrations.AddField(
model_name='upload',
nam... | [
"django.db.models.CharField",
"django.db.models.DateTimeField"
] | [((348, 411), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'blank': '(True)', 'default': 'datetime.datetime.now'}), '(blank=True, default=datetime.datetime.now)\n', (368, 411), False, 'from django.db import migrations, models\n'), ((537, 663), 'django.db.models.CharField', 'models.CharField', ([], {'... |
import json
import os
#### generate text descriptions based on the attribute tags of each asin
readpaths = [
['datasets/fashion_iq/image_tag_dataset/tags/asin2attr.dress.train.json', \
'datasets/fashion_iq/image_tag_dataset/tags/asin2attr.shirt.train.json', \
'datasets/fashion_iq/image_tag_dataset/tags/asin2attr... | [
"os.path.join",
"os.listdir"
] | [((1589, 1649), 'os.path.join', 'os.path.join', (['"""datasets"""', 'folder', '"""image_data"""', 'imgfolder[k]'], {}), "('datasets', folder, 'image_data', imgfolder[k])\n", (1601, 1649), False, 'import os\n'), ((1671, 1687), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (1681, 1687), False, 'import os\n'), (... |
import mock
from mayan.apps.common.tests.base import BaseTestCase
from .mixins import CacheTestMixin
class CacheModelTestCase(CacheTestMixin, BaseTestCase):
def test_cache_purge(self):
self._create_test_cache()
self._create_test_cache_partition()
self._create_test_cache_partition_file()
... | [
"mock.patch"
] | [((501, 543), 'mock.patch', 'mock.patch', (['"""django.core.files.File.close"""'], {}), "('django.core.files.File.close')\n", (511, 543), False, 'import mock\n')] |
# -*- coding: utf-8 -*-
""""
Created by @sagnik1511 (https://github.com/sagnik1511).
All rights reserved.
We are taking the data from a specified folder sequence
to a usable directory tree format.
"""
import os
import numpy as np
import shutil as sh
import UNET_utils
train_root = 'train_images/... | [
"os.listdir"
] | [((424, 446), 'os.listdir', 'os.listdir', (['train_root'], {}), '(train_root)\n', (434, 446), False, 'import os\n'), ((600, 621), 'os.listdir', 'os.listdir', (['test_root'], {}), '(test_root)\n', (610, 621), False, 'import os\n')] |
import pytest
from flask import json, url_for
from tests.conftest import create_authorization_header
from tests.db import create_fee
class WhenGettingEventTypes(object):
def it_returns_all_event_types(self, client, sample_event_type, db_session):
response = client.get(
url_for('event_types.... | [
"flask.json.dumps",
"pytest.mark.parametrize",
"flask.url_for",
"tests.conftest.create_authorization_header"
] | [((4277, 4398), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""data"""', "[{'event_type': 'Seminar'}, {'event_type': 'Seminar', 'event_desc':\n 'Seminar test'}]"], {}), "('data', [{'event_type': 'Seminar'}, {'event_type':\n 'Seminar', 'event_desc': 'Seminar test'}])\n", (4300, 4398), False, 'import p... |
import re, codecs, json, time, io, urllib2
class Config():
def __init__(self, configFile=None):
try:
with codecs.open(configFile, encoding="utf-8-sig", mode="r") as configFile:
self.__dict__ = json.load(configFile, encoding="utf-8")
except:
self.input... | [
"json.load",
"codecs.open",
"time.sleep",
"re.findall",
"io.open",
"urllib2.urlopen"
] | [((1196, 1232), 'io.open', 'io.open', (['self.monikers[moniker]', '"""r"""'], {}), "(self.monikers[moniker], 'r')\n", (1203, 1232), False, 'import re, codecs, json, time, io, urllib2\n'), ((2845, 2858), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (2855, 2858), False, 'import re, codecs, json, time, io, urllib2\... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 13 20:37:21 2020
@author: EDSE-dariamck-workspace
"""
#Import the necessary libraries
import os
from email.parser import Parser
rootdir = "/home/EDSE-dariamck-workspace/Enron_dataset/maildir/lay-k/family"
def email_analyse(inputfile, to_email_l... | [
"email.parser.Parser",
"os.walk",
"os.path.join"
] | [((1137, 1153), 'os.walk', 'os.walk', (['rootdir'], {}), '(rootdir)\n', (1144, 1153), False, 'import os\n'), ((473, 481), 'email.parser.Parser', 'Parser', ([], {}), '()\n', (479, 481), False, 'from email.parser import Parser\n'), ((1260, 1293), 'os.path.join', 'os.path.join', (['directory', 'filename'], {}), '(director... |
import argparse
import logging
import sys
from faker import Faker
import numpy as np
import pandas as pd
import user_agents
from ndc.utils import get_device_class, DEVICE_CLASS_NAMES
logger = logging.getLogger(__name__)
def fake_data(n=1000):
fake = Faker()
df = pd.DataFrame(
columns=('device_class... | [
"pandas.DataFrame",
"user_agents.parse",
"argparse.ArgumentParser",
"faker.Faker",
"ndc.utils.get_device_class",
"numpy.random.RandomState",
"argparse.FileType",
"logging.getLogger"
] | [((195, 222), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (212, 222), False, 'import logging\n'), ((259, 266), 'faker.Faker', 'Faker', ([], {}), '()\n', (264, 266), False, 'from faker import Faker\n'), ((276, 352), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "('device_class', ... |
################################################################################
# Copyright (c) 2009-2019, National Research Foundation (Square Kilometre Array)
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy
# of the... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.figtext",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.log10",
"matplotlib.pyplot.xticks",
"katpoint.Antenna"
] | [((858, 921), 'katpoint.Antenna', 'katpoint.Antenna', (['"""KAT7, -30:43:17.34, 21:24:38.46, 1038, 12.0"""'], {}), "('KAT7, -30:43:17.34, 21:24:38.46, 1038, 12.0')\n", (874, 921), False, 'import katpoint\n'), ((949, 979), 'numpy.arange', 'np.arange', (['(900.0)', '(2100.0)', '(10.0)'], {}), '(900.0, 2100.0, 10.0)\n', (... |
#!/usr/bin/env python3
### BSD 2-Clause License
###
### Copyright (c) 2020, lap1sid
### All rights reserved.
###
### Redistribution and use in source and binary forms, with or without
### modification, are permitted provided that the following conditions are met:
###
### 1. Redistributions of source code must retain t... | [
"importlib.import_module",
"time.sleep"
] | [((705, 750), 'importlib.import_module', 'importlib.import_module', (['"""libserenepy.marker"""'], {}), "('libserenepy.marker')\n", (728, 750), False, 'import importlib\n'), ((898, 906), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (903, 906), False, 'from time import sleep\n')] |
"""
pso.py
This code is part of Optimization of Hardware Parameters on a Real-Time Sound
Localization System paper
It contains the implementation of Particle Swarm Optimization, the strategy of
finding the best configuration
Authors:
<NAME>
<NAME>
<NAME>
<NAME>
"""
import numpy as np
import matplotl... | [
"pickle.dump",
"numpy.sum",
"numpy.array_str",
"numpy.ones",
"mle.mle_hls",
"pickle.load",
"numpy.mean",
"numpy.round",
"numpy.zeros_like",
"numpy.random.randn",
"numpy.std",
"os.path.exists",
"mle.randParticle",
"numpy.max",
"mle.arrayMatrix",
"numpy.reshape",
"numpy.linspace",
"i... | [((946, 968), 'numpy.linspace', 'np.linspace', (['(1)', '(10)', '(10)'], {}), '(1, 10, 10)\n', (957, 968), True, 'import numpy as np\n'), ((976, 1021), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(10)'], {'endpoint': '(False)'}), '(0, 2 * np.pi, 10, endpoint=False)\n', (987, 1021), True, 'import numpy as ... |
""""""
"""
Quick Sort:
Runtime:
Worst: O(n^2 )
Average: O(n log(n) )
Best: O(n log(n) )
Memory: O( log(n) )
In place Sorting
Unstable
"""
import sys
class QuickSort:
def partition(self, data, low, high):
pivot = data[high]
i = low # To keep the index of element smaller than pivot
... | [
"sys.stdin.read"
] | [((929, 945), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (943, 945), False, 'import sys\n')] |
import FWCore.ParameterSet.Config as cms
#Track selector
from Validation.RecoMuon.selectors_cff import *
#TrackAssociation
from SimTracker.TrackAssociatorProducers.trackAssociatorByChi2_cfi import *
import SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi
import SimTracker.TrackAssociatorProducers.tr... | [
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.double",
"FWCore.ParameterSet.Config.Sequence",
"FWCore.ParameterSet.Config.untracked.bool",
"FWCore.ParameterSet.Config.vstring",
"FWCore.ParameterSet.Config.bool",
"FWCore.ParameterSet.Config.InputTag",
"Configuration.Eras.Modifier_fas... | [((893, 908), 'FWCore.ParameterSet.Config.bool', 'cms.bool', (['(False)'], {}), '(False)\n', (901, 908), True, 'import FWCore.ParameterSet.Config as cms\n'), ((952, 967), 'FWCore.ParameterSet.Config.bool', 'cms.bool', (['(False)'], {}), '(False)\n', (960, 967), True, 'import FWCore.ParameterSet.Config as cms\n'), ((119... |
import numpy as np
# KERAS: neural network lib
import keras.backend as K
from keras.layers import Input, Dense, Embedding, LSTM, SimpleRNN
from keras.layers import GlobalAveragePooling1D, merge, Flatten
from keras.layers import TimeDistributed
from keras.optimizers import RMSprop, Nadam
from keras.models import Model... | [
"keras.layers.SimpleRNN",
"keras.utils.visualize_util.plot",
"numpy.atleast_3d",
"keras.layers.GlobalAveragePooling1D",
"keras.backend.expand_dims",
"keras.layers.LSTM",
"keras.models.Model",
"keras.optimizers.Nadam",
"numpy.random.randint",
"keras.layers.Dense",
"keras.layers.Embedding",
"ker... | [((1110, 1169), 'keras.utils.visualize_util.plot', 'plot', (['self.model'], {'show_shapes': '(True)', 'to_file': "(exp_id + '.png')"}), "(self.model, show_shapes=True, to_file=exp_id + '.png')\n", (1114, 1169), False, 'from keras.utils.visualize_util import plot\n'), ((1209, 1270), 'keras.layers.Input', 'Input', ([], {... |
import factory
from faker import Faker
from faker.providers import internet, company, job, date_time, lorem, address
from app.models import UserEducation
from app.utils import db
from factories.user_factory import UserFactory
fake = Faker()
fake.add_provider(internet)
fake.add_provider(company)
fake.add_provider(job)... | [
"factory.SubFactory",
"faker.Faker",
"factory.SelfAttribute"
] | [((235, 242), 'faker.Faker', 'Faker', ([], {}), '()\n', (240, 242), False, 'from faker import Faker\n'), ((659, 690), 'factory.SubFactory', 'factory.SubFactory', (['UserFactory'], {}), '(UserFactory)\n', (677, 690), False, 'import factory\n'), ((705, 737), 'factory.SelfAttribute', 'factory.SelfAttribute', (['"""user.id... |
"""Pushserver Flask application."""
import logging.handlers
import os
import sys
from raven.handlers.logging import SentryHandler
from flask import Flask
from werkzeug.utils import import_string
def create_app(name=__name__, mode='development', config=None):
"""Create and initialize the application."""
app =... | [
"os.path.exist",
"flask.Flask",
"werkzeug.utils.import_string",
"raven.handlers.logging.SentryHandler"
] | [((321, 332), 'flask.Flask', 'Flask', (['name'], {}), '(name)\n', (326, 332), False, 'from flask import Flask\n'), ((850, 910), 'raven.handlers.logging.SentryHandler', 'SentryHandler', (["app.config['SENTRY_DSN']"], {'level': 'logging.ERROR'}), "(app.config['SENTRY_DSN'], level=logging.ERROR)\n", (863, 910), False, 'fr... |
import robocrypt
def test_decryption_is_inverse_encryption():
original = b"""Youngblood thinks there's always tomorrow
I miss your touch on nights when I'm hollow
I know you crossed a bridge that I can't follow
Since the love that you left is all that I get
I want you to know that if I can't be close to you
I'll... | [
"robocrypt.decrypt",
"robocrypt.encrypt"
] | [((1184, 1215), 'robocrypt.encrypt', 'robocrypt.encrypt', (['original', 'pw'], {}), '(original, pw)\n', (1201, 1215), False, 'import robocrypt\n'), ((1227, 1259), 'robocrypt.decrypt', 'robocrypt.decrypt', (['encrypted', 'pw'], {}), '(encrypted, pw)\n', (1244, 1259), False, 'import robocrypt\n')] |
# -*- coding: utf-8 -*-
"""This module provides the base for segment wrappers."""
import six
class Composite(object):
"""Part of a segment."""
_content = None
def __init__(self, index=0, max_length=3, required=False):
"""Constructor."""
self.index = index
self.max_length = max_l... | [
"six.with_metaclass"
] | [((1467, 1498), 'six.with_metaclass', 'six.with_metaclass', (['SegmentMeta'], {}), '(SegmentMeta)\n', (1485, 1498), False, 'import six\n')] |
import numpy as np
import h5py
import matplotlib
from matplotlib import colors
import matplotlib.pyplot as plt
import matplotlib.patches as ptch
from matplotlib.artist import setp
from matplotlib.collections import PatchCollection
from matplotlib.lines import Line2D
import os
from shapely.geometry import Point, Polygon... | [
"numpy.sum",
"matplotlib.patches.Rectangle",
"matplotlib.colors.BoundaryNorm",
"os.path.exists",
"matplotlib.patches.Circle",
"matplotlib.pyplot.figure",
"numpy.where",
"numpy.arange",
"numpy.loadtxt",
"matplotlib.pyplot.gca",
"matplotlib.collections.PatchCollection",
"matplotlib.colors.Listed... | [((553, 566), 'matplotlib.pyplot.figure', 'plt.figure', (['(0)'], {}), '(0)\n', (563, 566), True, 'import matplotlib.pyplot as plt\n'), ((612, 650), 'matplotlib.colors.ListedColormap', 'colors.ListedColormap', (["['red', 'blue']"], {}), "(['red', 'blue'])\n", (633, 650), False, 'from matplotlib import colors\n'), ((675... |
import requests
import os
import logging
import pandas as pd
from dataactcore.logging import configure_logging
from dataactcore.interfaces.db import GlobalDB
from dataactcore.config import CONFIG_BROKER
from dataactcore.models.domainModels import DEFC
from dataactvalidator.health_check import create_app
from dataactv... | [
"dataactcore.interfaces.db.GlobalDB.db",
"dataactcore.logging.configure_logging",
"pandas.read_csv",
"dataactvalidator.scripts.loader_utils.clean_data",
"requests.get",
"os.path.join",
"logging.getLogger",
"dataactvalidator.health_check.create_app"
] | [((396, 423), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (413, 423), False, 'import logging\n'), ((492, 578), 'os.path.join', 'os.path.join', (["CONFIG_BROKER['path']", '"""dataactvalidator"""', '"""config"""', '"""def_codes.csv"""'], {}), "(CONFIG_BROKER['path'], 'dataactvalidator', ... |
# -*- coding: utf-8 -*-
from datetime import datetime
NOW = datetime.now()
# 현재 년도, 달, 날짜의 자릿 수가 부족할 시 0을 채워 주는 함수
def format_due(due, length):
if len(due) != length:
due = '0'*(length-len(due)) + due
return due
# 현재 년도, 달, 날짜
CURRENT_DATE = format_due(str(NOW.day), 2)
CURRENT_MONTH = format_due(s... | [
"datetime.datetime.now"
] | [((62, 76), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (74, 76), False, 'from datetime import datetime\n')] |
"""
Scene
- Create a scene, add root and inset if necessary
- add actor method
- special methods
"""
import sys
from pathlib import Path
from typing import List
from vedo import Mesh, Plane, Text2D, Assembly
import pyinspect as pi
from rich import print
from loguru import logger
from myterial import amber,... | [
"brainrender._io.load_mesh_from_file",
"brainrender.atlas.Atlas",
"pyinspect.utils.stringify",
"pyinspect.Report",
"brainrender.actor.Actor",
"brainrender._utils.listify",
"brainrender.actors.Volume",
"brainrender._jupyter.JupyterMixIn.__init__",
"vedo.Text2D",
"brainrender.render.Render.__init__"... | [((1431, 1589), 'loguru.logger.debug', 'logger.debug', (['f"""Creating scene with parameters: root: {root}, atlas_name: \'{atlas_name}\'\', inset: {inset}, screenshots_folder: {screenshots_folder}"""'], {}), '(\n f"Creating scene with parameters: root: {root}, atlas_name: \'{atlas_name}\'\', inset: {inset}, screensh... |
from asyncio import coroutine
from asphalt.core.component import Component
from asphalt.core.context import Context
class TaskQueueComponent(Component):
def __init__(self, jobs: dict=None, context_property: str='scheduler', **scheduler_config):
self.jobs = jobs or {}
self.context_property = conte... | [
"apscheduler.jobstores.mongodb.MongoDBJobStore",
"apscheduler.jobstores.sqlalchemy.SQLAlchemyJobStore"
] | [((1227, 1252), 'apscheduler.jobstores.mongodb.MongoDBJobStore', 'MongoDBJobStore', ([], {}), '(**config)\n', (1242, 1252), False, 'from apscheduler.jobstores.mongodb import MongoDBJobStore\n'), ((1422, 1467), 'apscheduler.jobstores.sqlalchemy.SQLAlchemyJobStore', 'SQLAlchemyJobStore', ([], {'engine': 'database'}), '(e... |
#!/usr/bin/env python3
from migrator import rollback_migrations
rollback_migrations("room")
| [
"migrator.rollback_migrations"
] | [((66, 93), 'migrator.rollback_migrations', 'rollback_migrations', (['"""room"""'], {}), "('room')\n", (85, 93), False, 'from migrator import rollback_migrations\n')] |
#
# Copyright (c) [2021] Huawei Technologies Co.,Ltd.All rights reserved.
#
# OpenArkCompiler is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
#
# http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WA... | [
"os.path.join",
"re.compile"
] | [((601, 651), 're.compile', 're.compile', (['"""^[A-Z]{1,9}[0-9]{3,10}-[a-zA-Z0-9_.]"""'], {}), "('^[A-Z]{1,9}[0-9]{3,10}-[a-zA-Z0-9_.]')\n", (611, 651), False, 'import re\n'), ((670, 706), 're.compile', 're.compile', (['"""^[a-z0-9_]{1,20}_test$"""'], {}), "('^[a-z0-9_]{1,20}_test$')\n", (680, 706), False, 'import re\... |
# Copyright 2017 The KaiJIN 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 applicable ... | [
"gate.config.config_params.Phase",
"gate.config.config_params.LOG",
"gate.config.config_params.NET",
"gate.config.config_base.Configbase.__init__",
"gate.config.config_params.LR",
"gate.config.config_params.OPT",
"gate.config.config_params.Image"
] | [((908, 939), 'gate.config.config_base.Configbase.__init__', 'Configbase.__init__', (['self', 'args'], {}), '(self, args)\n', (927, 939), False, 'from gate.config.config_base import Configbase\n'), ((1222, 1339), 'gate.config.config_params.LOG', 'params.LOG', ([], {'print_invl': '(20)', 'save_summary_invl': '(20)', 'sa... |
import re
class Solution(object):
def diffWaysToCompute(self, input):
"""
:type input: str
:rtype: List[int]
"""
input = re.split(r'(\+|\-|\*)', input)
memo = {}
return self.compute(input, memo)
def compute(self, input, memo):
inputAsStr = str(... | [
"re.split"
] | [((168, 200), 're.split', 're.split', (['"""(\\\\+|\\\\-|\\\\*)"""', 'input'], {}), "('(\\\\+|\\\\-|\\\\*)', input)\n", (176, 200), False, 'import re\n')] |
from django.conf.urls import url
from . import views
app_name = 'django_dvbboxes'
urlpatterns = [
# views.media urls
url(r'media/check/$', views.media, name='media_check'),
url(r'media/search/$', views.media, name='media_search'),
url(r'media/delete/(?P<filename>\w+)/$',
views.media,
n... | [
"django.conf.urls.url"
] | [((127, 180), 'django.conf.urls.url', 'url', (['"""media/check/$"""', 'views.media'], {'name': '"""media_check"""'}), "('media/check/$', views.media, name='media_check')\n", (130, 180), False, 'from django.conf.urls import url\n'), ((187, 242), 'django.conf.urls.url', 'url', (['"""media/search/$"""', 'views.media'], {'... |
# -*- coding: utf-8 -*-
'''Shared functionality for parsing binary data formats.'''
from __future__ import unicode_literals
import datetime
import struct
from UnifiedLog import logger
class BinaryDataFormat(object):
'''Binary data format.'''
def _ReadAPFSTime(self, mac_apfs_time): # Mac APFS timestamp is ... | [
"UnifiedLog.logger.warning",
"struct.unpack",
"datetime.datetime",
"datetime.timedelta",
"UnifiedLog.logger.exception",
"UnifiedLog.logger.error"
] | [((2373, 2406), 'UnifiedLog.logger.error', 'logger.error', (['"""Not a windows sid"""'], {}), "('Not a windows sid')\n", (2385, 2406), False, 'from UnifiedLog import logger\n'), ((2421, 2449), 'struct.unpack', 'struct.unpack', (['"""<B"""', 'data[0]'], {}), "('<B', data[0])\n", (2434, 2449), False, 'import struct\n'), ... |
# Copyright 2017 Intel Corporation.
# Copyright 2017 <NAME> <isaku.yamahata at intel com>
# <isaku.yamahata at gmail com>
# 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 ob... | [
"hacking.checks.docstrings.is_docstring",
"neutron_lib.hacking.checks.factory"
] | [((1794, 1843), 'hacking.checks.docstrings.is_docstring', 'docstrings.is_docstring', (['tokens', 'previous_logical'], {}), '(tokens, previous_logical)\n', (1817, 1843), False, 'from hacking.checks import docstrings\n'), ((2030, 2054), 'neutron_lib.hacking.checks.factory', 'checks.factory', (['register'], {}), '(registe... |
import bs4
import Classes
import Methods
from colors import COLOR_MANAGER
from bs4 import BeautifulSoup, element, Tag
import re as regex #? Used `https://regex101.com/` a lot to verify regex string.
from seleniumwire import webdriver
COLOR = COLOR_MANAGER.TURQUOISE
PAYLOADS_PATH = "./plugins/xsspayloads.txt" # Assumi... | [
"Methods.get_forms",
"re.finditer",
"Classes.CheckResult",
"Classes.PageResult",
"Methods.get_text_inputs",
"Methods.submit_form",
"Classes.CheckResults",
"Methods.get_random_str",
"Methods.fill_input",
"bs4.BeautifulSoup",
"Methods.new_browser"
] | [((7298, 7373), 'Classes.CheckResult', 'Classes.CheckResult', (['XSS_PROBLEM_STR', 'XSS_SOLUTION_STR', 'XSS_EXPLANATION_STR'], {}), '(XSS_PROBLEM_STR, XSS_SOLUTION_STR, XSS_EXPLANATION_STR)\n', (7317, 7373), False, 'import Classes\n'), ((7419, 7519), 'Classes.CheckResult', 'Classes.CheckResult', (['STORED_XSS_PROBLEM_S... |
import sys
import logging
import os
import time
import calendar
LOGGER = logging.getLogger(__name__)
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
def main():
home_dir = os.path.expanduser('~')
check_that_cache_dir_is_removed(home_dir)
check_that_global_tmp_dir_is_empty()
check_vim_info_... | [
"os.path.join",
"logging.basicConfig",
"time.gmtime",
"os.walk",
"os.path.exists",
"os.path.getmtime",
"os.path.expanduser",
"os.listdir",
"logging.getLogger"
] | [((74, 101), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (91, 101), False, 'import logging\n'), ((102, 161), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.DEBUG'}), '(stream=sys.stdout, level=logging.DEBUG)\n', (121, 161), False, 'import ... |
from django.contrib import admin
from .models import Suggestion
# Register your models here.
admin.site.register(Suggestion) | [
"django.contrib.admin.site.register"
] | [((95, 126), 'django.contrib.admin.site.register', 'admin.site.register', (['Suggestion'], {}), '(Suggestion)\n', (114, 126), False, 'from django.contrib import admin\n')] |
import json
import os
# file paths for the settings and the todolist file
home = os.environ['HOME']
jsonfile = '{home}/.tdo/list.json'.format(home=home)
settingsfile = '{home}/.tdo/settings.json'.format(home=home)
def save(todolist):
'''
Dumps the todo lists to the default JSON file, nicely indented and
... | [
"json.dump",
"os.path.dirname",
"json.load"
] | [((460, 501), 'json.dump', 'json.dump', (['todolist', 'backupfile'], {'indent': '(4)'}), '(todolist, backupfile, indent=4)\n', (469, 501), False, 'import json\n'), ((1292, 1332), 'json.dump', 'json.dump', (['settings', 'settingsf'], {'indent': '(4)'}), '(settings, settingsf, indent=4)\n', (1301, 1332), False, 'import j... |
# Assignment: A03: A Pair of Fully Functional Gitty Psychedelic Robotic Turtles
# Purpose: Draws a Tree
######################################################################
# Acknowledgements:
# Original code by: <NAME>
######################################################################
import turtle
def set... | [
"turtle.Screen",
"turtle.Turtle"
] | [((2082, 2097), 'turtle.Turtle', 'turtle.Turtle', ([], {}), '()\n', (2095, 2097), False, 'import turtle\n'), ((2108, 2123), 'turtle.Screen', 'turtle.Screen', ([], {}), '()\n', (2121, 2123), False, 'import turtle\n')] |
# -*- coding: utf-8 -*-
# Copyright © 2012-2014 Zulip, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... | [
"optparse.OptionGroup",
"sys.stdout.write",
"os.path.isfile",
"six.moves.configparser.SafeConfigParser",
"sys.stdout.flush",
"platform.win32_ver",
"platform.release",
"six.iteritems",
"os.path.join",
"six.moves.urllib.parse.urljoin",
"random.randint",
"simplejson.dumps",
"os.path.exists",
... | [((1630, 1657), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1647, 1657), False, 'import logging\n'), ((1777, 1811), 'distutils.version.LooseVersion', 'LooseVersion', (['requests.__version__'], {}), '(requests.__version__)\n', (1789, 1811), False, 'from distutils.version import LooseVe... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-13 03:03
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user_profiles', '0003_auto_20170705_1549'),
]
operati... | [
"django.db.models.CharField",
"django.db.models.TextField",
"django.db.models.EmailField"
] | [((444, 534), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(512)', 'verbose_name': '"""Dirección de Facturación"""'}), "(blank=True, max_length=512, verbose_name=\n 'Dirección de Facturación')\n", (460, 534), False, 'from django.db import migrations, models\n'), ((661, 73... |
def getExt(filename):
return filename.split('.')[len(filename.split('.'))-1].lower()
import os
basename = "slide"
counter = 1
files = os.listdir(".");
for file in files:
if getExt(file) != "py":
os.rename(file, (str(counter)+'slide.'+getExt(file)))
counter+=1
print(counter)
input()
| [
"os.listdir"
] | [((137, 152), 'os.listdir', 'os.listdir', (['"""."""'], {}), "('.')\n", (147, 152), False, 'import os\n')] |
# Generated by Django 3.1 on 2020-08-09 15:20
import datetime
import django.core.validators
import django.utils.timezone
import page_maker.models
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrati... | [
"django.db.models.FileField",
"django.db.models.TextField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.ImageField",
"datetime.datetime",
"django.db.models.DateTimeField"
] | [((313, 370), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (344, 370), False, 'from django.db import migrations, models\n'), ((503, 596), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
def conv_bn(inp, oup, kernel, stride, padding=1):
return nn.Sequential(
nn.Conv2d(inp, oup, kernel, stride, padding, bias=False),
nn.BatchNorm2d(oup),
nn.ReLU(inplace=True))
def conv_1x1... | [
"torch.nn.Dropout",
"torch.nn.ReLU",
"torch.nn.ReLU6",
"torch.nn.init.kaiming_normal_",
"torch.nn.ModuleList",
"torch.nn.Conv2d",
"torch.cat",
"torch.nn.BatchNorm2d",
"torch.nn.init.constant_",
"torch.nn.Linear",
"torch.nn.MaxPool2d",
"torch.nn.AvgPool2d",
"collections.OrderedDict"
] | [((188, 244), 'torch.nn.Conv2d', 'nn.Conv2d', (['inp', 'oup', 'kernel', 'stride', 'padding'], {'bias': '(False)'}), '(inp, oup, kernel, stride, padding, bias=False)\n', (197, 244), True, 'import torch.nn as nn\n'), ((254, 273), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', (['oup'], {}), '(oup)\n', (268, 273), True, 'impor... |
#!/usr/bin/env python3
# -*-coding: utf-8 -*-
#
help = 'モデルとモデルパラメータを利用して推論実行する'
#
import logging
# basicConfig()は、 debug()やinfo()を最初に呼び出す"前"に呼び出すこと
logging.basicConfig(format='%(message)s')
level = logging.INFO
logging.getLogger('Tools').setLevel(level=level)
import cv2
import time
import argparse
import numpy as np... | [
"traceback.print_exc",
"chainer.functions.classification_summary",
"argparse.ArgumentParser",
"logging.basicConfig",
"chainer.serializers.load_npz",
"cv2.cvtColor",
"chainer.cuda.get_device_from_id",
"Tools.func.argsPrint",
"Tools.func.checkModelType",
"time.time",
"Tools.getfunc.jsonData",
"n... | [((150, 191), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(message)s"""'}), "(format='%(message)s')\n", (169, 191), False, 'import logging\n'), ((657, 698), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'help'}), '(description=help)\n', (680, 698), False, 'import argp... |
# Copyright 2022, Google LLC.
#
# 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... | [
"tensorflow.test.main",
"tensorflow_federated.TensorType",
"tensorflow_federated.aggregators.MeanFactory",
"tensorflow_federated.aggregators.SumFactory",
"data_poor_fl.coordinate_aggregators.build_coordinate_aggregator",
"absl.testing.parameterized.named_parameters"
] | [((806, 940), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (["('num_coordinates1', 1)", "('num_coordinates2', 2)", "('num_coordinates3', 3)", "('num_coordinates5', 5)"], {}), "(('num_coordinates1', 1), ('num_coordinates2',\n 2), ('num_coordinates3', 3), ('num_coordinates5', 5))\n"... |
#!/home/evans/python-projects/Django-projects/neighbor/virtual/bin/python3.6
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| [
"django.core.management.execute_from_command_line"
] | [((144, 182), 'django.core.management.execute_from_command_line', 'management.execute_from_command_line', ([], {}), '()\n', (180, 182), False, 'from django.core import management\n')] |
# django rest framework imports
from rest_framework import serializers
# app imports
from .models import Article
class ArticleSerializer(serializers.Serializer):
"""
docstring
"""
title = serializers.CharField(max_length=120)
description = serializers.CharField()
body = serializers.C... | [
"rest_framework.serializers.CharField",
"rest_framework.serializers.IntegerField"
] | [((216, 253), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'max_length': '(120)'}), '(max_length=120)\n', (237, 253), False, 'from rest_framework import serializers\n'), ((272, 295), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {}), '()\n', (293, 295), False, 'from res... |
import urllib.request, urllib.parse, urllib.error
from bs4 import BeautifulSoup
import ssl
import re
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
url = input('Enter - ')
html = urllib.request.urlopen(url, context=ctx).read()
soup = BeautifulSoup(html, 'html.parser')
s... | [
"bs4.BeautifulSoup",
"ssl.create_default_context",
"re.findall"
] | [((108, 136), 'ssl.create_default_context', 'ssl.create_default_context', ([], {}), '()\n', (134, 136), False, 'import ssl\n'), ((283, 317), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (296, 317), False, 'from bs4 import BeautifulSoup\n'), ((399, 425), 're.finda... |
from ariadne import MutationType
from app.data.dev_helpers import case_dev_util
dev_mutation = MutationType()
@dev_mutation.field("resetSeedData")
def reset_seed_data(obj, info):
print('resetting data')
session = info.context['request'].state.db
case_dev_util.delete_all(session)
case_dev_util.add_see... | [
"app.data.dev_helpers.case_dev_util.delete_all",
"app.data.dev_helpers.case_dev_util.add_seed_cases",
"ariadne.MutationType"
] | [((96, 110), 'ariadne.MutationType', 'MutationType', ([], {}), '()\n', (108, 110), False, 'from ariadne import MutationType\n'), ((261, 294), 'app.data.dev_helpers.case_dev_util.delete_all', 'case_dev_util.delete_all', (['session'], {}), '(session)\n', (285, 294), False, 'from app.data.dev_helpers import case_dev_util\... |
#!/usr/bin/env python
"""
Requirements: Python 3 or higher
Antechamber and related AmberTools
OpenBabel (strongly recommended for use with acpype)
acpype (latest version recommended with all its requirements)
Gromacs (Compulsory)
flask (Compulsory)
... | [
"subprocess.run",
"os.remove",
"os.rename",
"os.system",
"time.sleep",
"pathlib.Path",
"glob.glob",
"pathlib.Path.cwd",
"os.path.join",
"os.listdir"
] | [((2449, 2462), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (2459, 2462), False, 'import time\n'), ((3612, 3625), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (3622, 3625), False, 'import time\n'), ((8734, 8747), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (8744, 8747), False, 'import time\n'), (... |
import pickle
from nose.tools import eq_
from .. import russian
from ...datasources import revision_oriented
from ...dependencies import solve
from .util import compare_extraction
BAD = [
"анал",
"бля", "блядь", "блять",
"бомжеград",
"выкипидар", "выкипидары", "выкипидор", "выкипидоры",
"гандон",... | [
"pickle.dumps"
] | [((2860, 2890), 'pickle.dumps', 'pickle.dumps', (['russian.badwords'], {}), '(russian.badwords)\n', (2872, 2890), False, 'import pickle\n'), ((3069, 3100), 'pickle.dumps', 'pickle.dumps', (['russian.informals'], {}), '(russian.informals)\n', (3081, 3100), False, 'import pickle\n'), ((3482, 3514), 'pickle.dumps', 'pickl... |
from azure.kusto.data.request import KustoClient, KustoConnectionStringBuilder
from azure.kusto.data.helpers import dataframe_from_result_table
cluster = "<insert here your cluster name>"
kcsb = KustoConnectionStringBuilder.with_aad_device_authentication(cluster)
client = KustoClient(kcsb)
db = "Samples"
query = ""... | [
"azure.kusto.data.helpers.dataframe_from_result_table",
"azure.kusto.data.request.KustoConnectionStringBuilder.with_aad_device_authentication",
"azure.kusto.data.request.KustoClient"
] | [((197, 265), 'azure.kusto.data.request.KustoConnectionStringBuilder.with_aad_device_authentication', 'KustoConnectionStringBuilder.with_aad_device_authentication', (['cluster'], {}), '(cluster)\n', (256, 265), False, 'from azure.kusto.data.request import KustoClient, KustoConnectionStringBuilder\n'), ((275, 292), 'azu... |
import tensorflow as tf
from keras.preprocessing.sequence import pad_sequences
import numpy as np
import sys
sys.path.insert(1, 'bert_fn')
import modeling, tokenization
import extract_features
import psutil, os
MAXLENGTH = 512
def load_bert_model_tf(layer_ind=10):
'''
Function to load BERT feat... | [
"extract_features.InputExample",
"tensorflow.contrib.tpu.TPUEstimator",
"tensorflow.contrib.tpu.TPUConfig",
"tokenization.FullTokenizer",
"sys.path.insert",
"extract_features.input_fn_builder",
"tokenization.validate_case_matches_checkpoint",
"modeling.BertConfig.from_json_file",
"extract_features.m... | [((113, 142), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""bert_fn"""'], {}), "(1, 'bert_fn')\n", (128, 142), False, 'import sys\n'), ((730, 771), 'os.path.join', 'os.path.join', (['BERT_DIR', '"""bert_model.ckpt"""'], {}), "(BERT_DIR, 'bert_model.ckpt')\n", (742, 771), False, 'import psutil, os\n'), ((791, 838),... |
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import matplotlib
from matplotlib import pyplot as plt
import gensim
from gensim.models import Word2Vec
import random
torch.manual_seed(1)
# import package
import arch_blocks
impor... | [
"matplotlib.pyplot.show",
"training.train_rnn",
"torch.manual_seed",
"arch_blocks.W2VCharLSTM",
"torch.save",
"ner.NerData",
"gensim.models.Word2Vec.load"
] | [((256, 276), 'torch.manual_seed', 'torch.manual_seed', (['(1)'], {}), '(1)\n', (273, 276), False, 'import torch\n'), ((449, 525), 'gensim.models.Word2Vec.load', 'Word2Vec.load', (['"""../models/3j_15e_50D_min1_model/3j_15e_50D_min1_model.model"""'], {}), "('../models/3j_15e_50D_min1_model/3j_15e_50D_min1_model.model')... |
import pytest
import pytz
import pytz_informal
@pytest.mark.parametrize(
("input_value", "expected"),
(
("EST", "America/New_York"),
("EDT", "America/New_York"),
("edt", "America/New_York"),
("Edt", "America/New_York"),
("CST", "America/Chicago"),
("MST", "Amer... | [
"pytest.mark.parametrize",
"pytest.raises",
"pytz_informal.timezone",
"pytz.timezone"
] | [((51, 324), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('input_value', 'expected')", "(('EST', 'America/New_York'), ('EDT', 'America/New_York'), ('edt',\n 'America/New_York'), ('Edt', 'America/New_York'), ('CST',\n 'America/Chicago'), ('MST', 'America/Denver'), ('PDT',\n 'America/Los_Angeles'))"... |
from social_apis.exceptions.social_api_error import SocialAPIError
from social_apis.networks.vkontakte import Vkontakte
try:
vk_api = Vkontakte(access_token="<<vk_access_token>>")
users = vk_api.users_search(q="<NAME>", count=7)
except SocialAPIError as e:
print(e)
| [
"social_apis.networks.vkontakte.Vkontakte"
] | [((139, 184), 'social_apis.networks.vkontakte.Vkontakte', 'Vkontakte', ([], {'access_token': '"""<<vk_access_token>>"""'}), "(access_token='<<vk_access_token>>')\n", (148, 184), False, 'from social_apis.networks.vkontakte import Vkontakte\n')] |
import os
import argparse
import csv
from cwc_io_utils import *
def update_configs_db(configs_db, curriculums, people_pairs):
"""
Args:
configs_db: List of all config info
curriculums: A list of gold config curriculums -- one for each people pair
people_specs: List of people pairs
... | [
"argparse.ArgumentParser"
] | [((1184, 1288), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Update spreadsheet (.csv) DB containing all gold config info"""'}), "(description=\n 'Update spreadsheet (.csv) DB containing all gold config info')\n", (1207, 1288), False, 'import argparse\n')] |
# -*- coding: utf-8 -*-
"""
@author: <EMAIL>
"""
import numpy as np
class FibonacciCalculator:
"""
The class calculates Fibonacci series using varies dynamic programming
algorithms.
"""
def __init__(self):
self.number_of_sum = 0
self.number_of_mul = 0
self.number_of_dict_q... | [
"numpy.dot",
"numpy.array"
] | [((2090, 2116), 'numpy.array', 'np.array', (['[[0, 1], [1, 1]]'], {}), '([[0, 1], [1, 1]])\n', (2098, 2116), True, 'import numpy as np\n'), ((2284, 2354), 'numpy.dot', 'np.dot', (['self.fibonacci_log_dict[n / 2]', 'self.fibonacci_log_dict[n / 2]'], {}), '(self.fibonacci_log_dict[n / 2], self.fibonacci_log_dict[n / 2])\... |
import random
def make_same_random():
""" Make a list of 10 random integers that are the same each time """
numlis = []
random.seed(17) # set the seed from which random numbers are made
for i in range(0,10):
d = random.random()
print(d)
numlis.append(d)
return numlis
... | [
"random.random",
"random.seed"
] | [((133, 148), 'random.seed', 'random.seed', (['(17)'], {}), '(17)\n', (144, 148), False, 'import random\n'), ((244, 259), 'random.random', 'random.random', ([], {}), '()\n', (257, 259), False, 'import random\n')] |
# Generated by Django 3.0.8 on 2020-07-28 15:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('asteroids_comets_meteors', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='asteroidcometmeteorobject',
... | [
"django.db.models.DateField"
] | [((369, 397), 'django.db.models.DateField', 'models.DateField', ([], {'blank': '(True)'}), '(blank=True)\n', (385, 397), False, 'from django.db import migrations, models\n')] |
import itertools
import torch
from scipy.stats import describe
import numpy as np
from src import CONFIG
from src.train import MetaOptimizer
WEIGHT_DECAY = 1e-3
def test():
update_params = False
meta_learner = MetaOptimizer()
model = CONFIG.model_class()
state = None
results = []
for... | [
"matplotlib.pyplot.title",
"scipy.signal.savgol_filter",
"main.proc_flags",
"matplotlib.pyplot.show",
"src.CONFIG.model_class",
"ipdb.set_trace",
"itertools.count",
"src.train.MetaOptimizer",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"torch.isnan",
"numpy.prod"
] | [((226, 241), 'src.train.MetaOptimizer', 'MetaOptimizer', ([], {}), '()\n', (239, 241), False, 'from src.train import MetaOptimizer\n'), ((255, 275), 'src.CONFIG.model_class', 'CONFIG.model_class', ([], {}), '()\n', (273, 275), False, 'from src import CONFIG\n'), ((326, 343), 'itertools.count', 'itertools.count', ([], ... |
"""Types used through mixt and to be used externally."""
from typing import Generic, Sequence, TypeVar, Union
# pylint: disable=invalid-name,pointless-statement
__all__ = ["Choices", "DefaultChoices", "NotProvided", "Number", "Required"]
Number = Union[int, float]
class NotProvided:
"""To be used instead o... | [
"typing.TypeVar"
] | [((526, 549), 'typing.TypeVar', 'TypeVar', (['"""RequiredType"""'], {}), "('RequiredType')\n", (533, 549), False, 'from typing import Generic, Sequence, TypeVar, Union\n')] |
import glob
import shutil
import os
src_dir = "C:\\Users\\kesav\\Downloads\\pics"
dst_dir = "C:\\Users\\kesav\\Downloads\\jpeg"
for jpgfile in glob.iglob(os.path.join(src_dir, "*.jpg")):
if 'L' in jpgfile:
val=jpgfile.replace('_L','1')
os.rename(jpgfile,val)
shutil.copy(val, d... | [
"os.rename",
"os.path.join",
"shutil.copy",
"os.remove"
] | [((155, 185), 'os.path.join', 'os.path.join', (['src_dir', '"""*.jpg"""'], {}), "(src_dir, '*.jpg')\n", (167, 185), False, 'import os\n'), ((564, 594), 'os.path.join', 'os.path.join', (['src_dir', '"""*.png"""'], {}), "(src_dir, '*.png')\n", (576, 594), False, 'import os\n'), ((271, 294), 'os.rename', 'os.rename', (['j... |
import pkgutil
import sys
import inspect
__path__ = pkgutil.extend_path(__path__, __name__)
classes = dict()
for importer, modname, ispkg in pkgutil.walk_packages(path=__path__, prefix=__name__+'.'):
__import__(modname)
for name, obj in inspect.getmembers(sys.modules[modname]):
if inspect.isclass(obj... | [
"inspect.isclass",
"pkgutil.extend_path",
"pkgutil.walk_packages",
"inspect.getmembers"
] | [((54, 93), 'pkgutil.extend_path', 'pkgutil.extend_path', (['__path__', '__name__'], {}), '(__path__, __name__)\n', (73, 93), False, 'import pkgutil\n'), ((144, 203), 'pkgutil.walk_packages', 'pkgutil.walk_packages', ([], {'path': '__path__', 'prefix': "(__name__ + '.')"}), "(path=__path__, prefix=__name__ + '.')\n", (... |
"""Test the commit module."""
import unittest
import datetime
import tempfile
import os
import json
import re
from .s3_mock import MockS3
from .. import commit, util
from ..config import Config, ENV__BUCKET, ENV__BASE_PATH
class CommitTest(unittest.TestCase):
"""Test the commit functions."""
def setUp(self... | [
"json.dump",
"os.unlink",
"datetime.datetime.now",
"re.escape",
"os.path.isfile",
"datetime.timedelta",
"tempfile.mktemp"
] | [((520, 537), 'tempfile.mktemp', 'tempfile.mktemp', ([], {}), '()\n', (535, 537), False, 'import tempfile\n'), ((582, 611), 'os.path.isfile', 'os.path.isfile', (['self.src_file'], {}), '(self.src_file)\n', (596, 611), False, 'import os\n'), ((8551, 8595), 'datetime.datetime.now', 'datetime.datetime.now', (['datetime.ti... |
import pandas as pd
import numpy as np
import re
from sklearn.metrics import confusion_matrix, classification_report, f1_score
path = './results/ws_ssidw_0.txt'
new_csv_name = './results/ws_ssidw_0.csv'
def csv2txt(path, new_csv_name):
with open(path, 'r') as f:
content = f.readlines()
label = []
... | [
"pandas.DataFrame",
"sklearn.metrics.classification_report",
"sklearn.metrics.f1_score",
"re.findall",
"sklearn.metrics.confusion_matrix"
] | [((1347, 1404), 'sklearn.metrics.confusion_matrix', 'confusion_matrix', (["ws_bert['label']", "ws_bert['prediction']"], {}), "(ws_bert['label'], ws_bert['prediction'])\n", (1363, 1404), False, 'from sklearn.metrics import confusion_matrix, classification_report, f1_score\n'), ((1453, 1515), 'sklearn.metrics.classificat... |
from collections import namedtuple
EnvInfo = namedtuple('EnvInfo',
['discount',
'game_score',
'traj_done',
'internal_state'
])
| [
"collections.namedtuple"
] | [((46, 131), 'collections.namedtuple', 'namedtuple', (['"""EnvInfo"""', "['discount', 'game_score', 'traj_done', 'internal_state']"], {}), "('EnvInfo', ['discount', 'game_score', 'traj_done', 'internal_state']\n )\n", (56, 131), False, 'from collections import namedtuple\n')] |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import io
import os
import sys
import json
import tarfile
import zipfile
import hashlib
from .file import abspath
def file_open(filename, mode="rt", encoding="utf-8", **kwargs):
"""Open a file with a compression codec, if necessary, based on the fi... | [
"zipfile.is_zipfile",
"lzma.open",
"hashlib.md5",
"zipfile.ZipFile",
"gzip.open",
"os.path.basename",
"os.walk",
"os.path.isfile",
"os.path.relpath",
"io.open",
"bz2.open",
"os.path.join"
] | [((3078, 3097), 'os.walk', 'os.walk', (['source_dir'], {}), '(source_dir)\n', (3085, 3097), False, 'import os\n'), ((696, 748), 'gzip.open', 'gzip.open', (['f'], {'mode': 'mode', 'encoding': 'encoding'}), '(f, mode=mode, encoding=encoding, **kwargs)\n', (705, 748), False, 'import gzip\n'), ((2890, 2919), 'os.path.join'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Bioindustrial-Park: BioSTEAM's Premier Biorefinery Models and Results
# Copyright (C) 2021-, <NAME> <<EMAIL>>
#
# This module is under the UIUC open-source license. See
# github.com/BioSTEAMDevelopmentGroup/biosteam/blob/master/LICENSE.txt
# for license details.
# Unit... | [
"os.path.isdir",
"os.mkdir",
"os.path.dirname",
"os.path.join"
] | [((434, 459), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (449, 459), False, 'import os\n'), ((475, 508), 'os.path.join', 'os.path.join', (['wwt_path', '"""results"""'], {}), "(wwt_path, 'results')\n", (487, 508), False, 'import os\n'), ((524, 557), 'os.path.join', 'os.path.join', (['wwt_p... |
import threading
from robot.api.logger import BackgroundLogger
logger = BackgroundLogger()
def log_from_main(msg):
logger.info(msg)
def log_from_background(msg, thread=None):
t = threading.Thread(target=logger.info, args=(msg,))
if thread:
t.setName(thread)
t.start()
def log_background_m... | [
"threading.Thread",
"robot.api.logger.BackgroundLogger"
] | [((74, 92), 'robot.api.logger.BackgroundLogger', 'BackgroundLogger', ([], {}), '()\n', (90, 92), False, 'from robot.api.logger import BackgroundLogger\n'), ((193, 242), 'threading.Thread', 'threading.Thread', ([], {'target': 'logger.info', 'args': '(msg,)'}), '(target=logger.info, args=(msg,))\n', (209, 242), False, 'i... |
import FWCore.ParameterSet.Config as cms
import RecoLocalCalo.HcalRecProducers.hfsimplereco_cfi as _mod
hfQIE10Reco = _mod.hfsimplereco.clone(
digiLabel = "simHcalUnsuppressedDigis:HFQIE10DigiCollection",
Subdetector = 'HFQIE10',
firstSample = 2,
samplesToAdd = 1
)
| [
"RecoLocalCalo.HcalRecProducers.hfsimplereco_cfi.hfsimplereco.clone"
] | [((119, 265), 'RecoLocalCalo.HcalRecProducers.hfsimplereco_cfi.hfsimplereco.clone', '_mod.hfsimplereco.clone', ([], {'digiLabel': '"""simHcalUnsuppressedDigis:HFQIE10DigiCollection"""', 'Subdetector': '"""HFQIE10"""', 'firstSample': '(2)', 'samplesToAdd': '(1)'}), "(digiLabel=\n 'simHcalUnsuppressedDigis:HFQIE10Digi... |
__author__ = "<NAME>"
__credits__ = ["<NAME>"]
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__version__ = "0.1"
__license__ = "MIT"
from setuptools import setup
with open("README.md", "r") as fh:
long_description = fh.read()
with open('requirements.txt') as f:
requirements = f.read().splitlines()
setup(
... | [
"setuptools.setup"
] | [((313, 932), 'setuptools.setup', 'setup', ([], {'name': '"""ehyd-tools"""', 'version': '"""0.1dev8"""', 'packages': "['ehyd_tools']", 'url': '"""https://github.com/MarkusPic/ehyd_tools"""', 'license': '"""MIT"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""Various tools for exporting... |
import os
import unittest
import numpy as np
import shutil
from pylipid.plot import plot_koff
from pylipid.func import cal_koff
from pylipid.util import check_dir
class TestPlot(unittest.TestCase):
def setUp(self):
file_dir = os.path.dirname(os.path.abspath(__file__))
self.save_dir = os.path.join(... | [
"unittest.main",
"os.path.abspath",
"numpy.std",
"pylipid.util.check_dir",
"pylipid.func.cal_koff",
"numpy.mean",
"numpy.random.normal",
"shutil.rmtree",
"os.path.join"
] | [((2479, 2494), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2492, 2494), False, 'import unittest\n'), ((307, 342), 'os.path.join', 'os.path.join', (['file_dir', '"""test_plot"""'], {}), "(file_dir, 'test_plot')\n", (319, 342), False, 'import os\n'), ((351, 375), 'pylipid.util.check_dir', 'check_dir', (['self.s... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim :set ft=py:
import blosc
from six.moves import xrange
from .abstract_io import (PlainSource,
CompressedSource,
PlainSink,
CompressedSink,
)
class PlainMemorySou... | [
"blosc.decompress",
"six.moves.xrange"
] | [((1085, 1105), 'six.moves.xrange', 'xrange', (['self.nchunks'], {}), '(self.nchunks)\n', (1091, 1105), False, 'from six.moves import xrange\n'), ((1587, 1615), 'blosc.decompress', 'blosc.decompress', (['compressed'], {}), '(compressed)\n', (1603, 1615), False, 'import blosc\n')] |
# -*- coding: utf-8 -*-
# import six
import numpy as np
import pytest
import sksurgerycore.algorithms.pivot as p
from glob import glob
def test_empty_matrices():
with pytest.raises(TypeError):
p.pivot_calibration(None)
def test_rank_lt_six():
with pytest.raises(ValueError):
file_names = ... | [
"sksurgerycore.algorithms.pivot.pivot_calibration",
"pytest.raises",
"numpy.arange",
"numpy.loadtxt",
"glob.glob",
"numpy.concatenate",
"sksurgerycore.algorithms.pivot.pivot_calibration_with_ransac"
] | [((966, 1003), 'glob.glob', 'glob', (['"""tests/data/PivotCalibration/*"""'], {}), "('tests/data/PivotCalibration/*')\n", (970, 1003), False, 'from glob import glob\n'), ((1068, 1090), 'numpy.concatenate', 'np.concatenate', (['arrays'], {}), '(arrays)\n', (1082, 1090), True, 'import numpy as np\n'), ((1226, 1255), 'sks... |
from blast_ct import models as models
from blast_ct.trainer import losses as losses
import torch.nn
from torch.utils.data.dataloader import DataLoader
from blast_ct.nifti.datasets import PatchWiseNiftiDataset, FullImageToOverlappingPatchesNiftiDataset, worker_init_fn
from blast_ct.nifti.savers import NiftiPatchSaver
fr... | [
"blast_ct.nifti.datasets.PatchWiseNiftiDataset",
"blast_ct.nifti.datasets.FullImageToOverlappingPatchesNiftiDataset",
"blast_ct.trainer.hooks.ModelSaverHook",
"blast_ct.trainer.hooks.NaNLoss",
"blast_ct.nifti.savers.NiftiPatchSaver",
"blast_ct.trainer.metrics.Loss",
"blast_ct.trainer.metrics.Segmentatio... | [((1988, 2480), 'blast_ct.nifti.datasets.PatchWiseNiftiDataset', 'PatchWiseNiftiDataset', ([], {'patch_sampler': 'sampler', 'images_per_epoch': "config['training']['images_per_epoch']", 'patches_per_image': "config['training']['patches_per_image']", 'data_csv_path': 'train_csv_path', 'channels': "config['data']['channe... |
import re
import sys
import hmac
import json
import asyncio
from typing import Any, Dict, Union, Optional, TYPE_CHECKING
import httpx
from nonebot.log import logger
from nonebot.typing import overrides
from nonebot.message import handle_event
from nonebot.adapters import Bot as BaseBot
from nonebot.exception import Re... | [
"nonebot.typing.overrides",
"nonebot.log.logger.opt",
"asyncio.get_event_loop",
"json.dumps",
"nonebot.message.handle_event",
"httpx.AsyncClient",
"nonebot.exception.RequestDenied",
"asyncio.wait_for",
"re.search"
] | [((6654, 6672), 'nonebot.typing.overrides', 'overrides', (['BaseBot'], {}), '(BaseBot)\n', (6663, 6672), False, 'from nonebot.typing import overrides\n'), ((6974, 6992), 'nonebot.typing.overrides', 'overrides', (['BaseBot'], {}), '(BaseBot)\n', (6983, 6992), False, 'from nonebot.typing import overrides\n'), ((8882, 890... |