code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import logging
import fire
from nxontology import NXOntology
from nxontology_data.mesh.mesh import MeshLoader
from nxontology_data.pubchem.classifications import export_all_heirarchies
from nxontology_data.utils import get_output_dir, write_ontology
def write_test_output() -> None:
"""Export an empty test ontol... | [
"logging.basicConfig",
"logging.getLogger",
"fire.Fire",
"nxontology.NXOntology",
"nxontology_data.utils.write_ontology",
"nxontology_data.utils.get_output_dir"
] | [((490, 502), 'nxontology.NXOntology', 'NXOntology', ([], {}), '()\n', (500, 502), False, 'from nxontology import NXOntology\n'), ((544, 575), 'nxontology_data.utils.write_ontology', 'write_ontology', (['nxo', 'output_dir'], {}), '(nxo, output_dir)\n', (558, 575), False, 'from nxontology_data.utils import get_output_di... |
# This script generates the scoring and schema files
# necessary to operationalize your model
from azureml.api.schema.dataTypes import DataTypes
from azureml.api.schema.sampleDefinition import SampleDefinition
from azureml.api.realtime.services import generate_schema
import json
import numpy as np
import os
imp... | [
"PIL.Image.open",
"keras.models.load_model",
"os.makedirs",
"azureml.api.realtime.services.generate_schema",
"io.BytesIO",
"base64.b64decode",
"numpy.argmax",
"numpy.max",
"numpy.array",
"numpy.expand_dims",
"azureml.api.schema.sampleDefinition.SampleDefinition"
] | [((907, 929), 'keras.models.load_model', 'load_model', (['model_name'], {}), '(model_name)\n', (917, 929), False, 'from keras.models import load_model\n'), ((1173, 1205), 'numpy.expand_dims', 'np.expand_dims', (['image_np'], {'axis': '(0)'}), '(image_np, axis=0)\n', (1187, 1205), True, 'import numpy as np\n'), ((1233, ... |
from typing import Any
from talon import Module
mod = Module()
mod.list(
"cursorless_to_raw_selection",
desc="Cursorless modifier that converts its input to a raw selection.",
)
@mod.capture(rule="{user.cursorless_to_raw_selection}")
def cursorless_to_raw_selection(m) -> dict[str, Any]:
return {"type"... | [
"talon.Module"
] | [((56, 64), 'talon.Module', 'Module', ([], {}), '()\n', (62, 64), False, 'from talon import Module\n')] |
from test.BaseCase import BaseCase
class TestDeleteUserGroup(BaseCase):
@BaseCase.login
@BaseCase.grant_access("/user/delete_user_group")
def test_ok(self, token):
self.db.insert({"id": 14, "name": "My GROUP"}, self.db.tables["UserGroup"])
self.db.insert({"group_id": 14, "resource": "RESO... | [
"test.BaseCase.BaseCase.grant_access"
] | [((100, 148), 'test.BaseCase.BaseCase.grant_access', 'BaseCase.grant_access', (['"""/user/delete_user_group"""'], {}), "('/user/delete_user_group')\n", (121, 148), False, 'from test.BaseCase import BaseCase\n'), ((1672, 1720), 'test.BaseCase.BaseCase.grant_access', 'BaseCase.grant_access', (['"""/user/delete_user_group... |
from io import FileIO
import numpy as np
import pandas as pd
from pathlib import Path
from typing import Union, List, Iterable
from .common import open_file, coerce_matrix
def read_mdf(file: Union[str, FileIO, Path], raw: bool = False, tall: bool = False
) -> Union[np.ndarray, pd.DataFrame, pd.Series]:
... | [
"pandas.Series",
"numpy.fromfile",
"pandas.Index",
"numpy.array",
"numpy.zeros",
"pandas.DataFrame"
] | [((1176, 1221), 'numpy.fromfile', 'np.fromfile', (['file_handler', 'np.uint32'], {'count': '(4)'}), '(file_handler, np.uint32, count=4)\n', (1187, 1221), True, 'import numpy as np\n'), ((1520, 1568), 'numpy.fromfile', 'np.fromfile', (['file_handler', 'np.uint32'], {'count': 'ndim'}), '(file_handler, np.uint32, count=nd... |
from django.db import migrations
from corehq.form_processor.models import XFormInstanceSQL, XFormOperationSQL, CaseTransaction
from corehq.sql_db.operations import RawSQLMigration
migrator = RawSQLMigration(('corehq', 'sql_accessors', 'sql_templates'), {
'FORM_STATE_ARCHIVED': XFormInstanceSQL.ARCHIVED,
'FORM... | [
"corehq.sql_db.operations.RawSQLMigration",
"django.db.migrations.RunSQL"
] | [((193, 592), 'corehq.sql_db.operations.RawSQLMigration', 'RawSQLMigration', (["('corehq', 'sql_accessors', 'sql_templates')", "{'FORM_STATE_ARCHIVED': XFormInstanceSQL.ARCHIVED, 'FORM_STATE_NORMAL':\n XFormInstanceSQL.NORMAL, 'FORM_OPERATION_ARCHIVE': XFormOperationSQL.\n ARCHIVE, 'FORM_OPERATION_UNARCHIVE': XFo... |
from deap import base, creator, gp, tools
from deap.gp import PrimitiveTree
from primitive_set import pset
from utils import objective, fitness
def get_toolbox(data):
toolbox = base.Toolbox()
creator.create("FitnessMin", base.Fitness, weights=(-1.0,))
creator.create("Individual", gp.PrimitiveTree, fitness... | [
"deap.creator.create",
"utils.fitness",
"deap.base.Toolbox",
"utils.objective"
] | [((183, 197), 'deap.base.Toolbox', 'base.Toolbox', ([], {}), '()\n', (195, 197), False, 'from deap import base, creator, gp, tools\n'), ((202, 261), 'deap.creator.create', 'creator.create', (['"""FitnessMin"""', 'base.Fitness'], {'weights': '(-1.0,)'}), "('FitnessMin', base.Fitness, weights=(-1.0,))\n", (216, 261), Fal... |
"""
FFG-benchmarks
Copyright (c) 2021-present NAVER Corp.
MIT license
"""
import os
import shutil
from contextlib import contextmanager
from datetime import datetime
import torch
def add_dim_and_reshape(in_tensor, in_dim_idx, out_dims):
in_shape = in_tensor.shape
in_shape_l = in_shape[:in_dim_idx]
in_shap... | [
"os.path.exists",
"datetime.datetime.now",
"os.path.isdir",
"shutil.rmtree",
"torch.zeros",
"torch.arange",
"os.remove"
] | [((1845, 1879), 'torch.zeros', 'torch.zeros', (['batch_size', 'n_experts'], {}), '(batch_size, n_experts)\n', (1856, 1879), False, 'import torch\n'), ((2665, 2684), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (2678, 2684), False, 'import os\n'), ((2694, 2713), 'shutil.rmtree', 'shutil.rmtree', (['path... |
from django.db.models import Count, Q
from django.shortcuts import redirect, render
from django.utils import timezone
from AIST_survey.models import Enquete, Respondent, Question, Choice, Evaluation
def index(request):
if "enquete_id" not in request.session:
return redirect("login")
enquete_id = requ... | [
"django.shortcuts.render",
"AIST_survey.models.Choice.objects.filter",
"AIST_survey.models.Respondent.objects.filter",
"AIST_survey.models.Evaluation.objects.filter",
"django.utils.timezone.now",
"django.utils.timezone.timedelta",
"django.shortcuts.redirect",
"django.db.models.Q",
"AIST_survey.model... | [((451, 498), 'django.shortcuts.render', 'render', (['request', '"""dashboard/index.html"""', 'params'], {}), "(request, 'dashboard/index.html', params)\n", (457, 498), False, 'from django.shortcuts import redirect, render\n'), ((550, 598), 'AIST_survey.models.Respondent.objects.filter', 'Respondent.objects.filter', ([... |
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
import tensorflow as tf
from tensorflow.keras.preprocessing.sequence import pad_sequences
from data_lit import Data_Augmentation
import numpy as np
#physical_devices = tf.config.list_physical_devices('GPU')
#tf.config... | [
"tensorflow.keras.preprocessing.sequence.pad_sequences",
"data_lit.Data_Augmentation",
"numpy.argmax",
"tensorflow.convert_to_tensor",
"tensorflow.expand_dims",
"tensorflow.zeros"
] | [((524, 543), 'data_lit.Data_Augmentation', 'Data_Augmentation', ([], {}), '()\n', (541, 543), False, 'from data_lit import Data_Augmentation\n'), ((1576, 1635), 'tensorflow.keras.preprocessing.sequence.pad_sequences', 'pad_sequences', (['[whole]'], {'maxlen': 'self.max_len', 'padding': '"""post"""'}), "([whole], maxle... |
__author__ = "<NAME>"
__copyright__ = "Copyright 2020"
__version__ = "1.0.1"
__maintainer__ = "Rabaa"
__email__ = "<EMAIL>"
import numpy as np
import sys
## Class: TestParticle
# Functions: Default Constructor, DataDissection, IdentifyResonance, PrintData
class TestParticle:
def __init__(self): # Attributes def... | [
"numpy.genfromtxt",
"numpy.arange",
"numpy.average"
] | [((11684, 11757), 'numpy.genfromtxt', 'np.genfromtxt', (["('tp' + TestParticleSample + '.out')"], {'usecols': '(1)', 'unpack': '(True)'}), "('tp' + TestParticleSample + '.out', usecols=1, unpack=True)\n", (11697, 11757), True, 'import numpy as np\n'), ((1668, 1730), 'numpy.genfromtxt', 'np.genfromtxt', (["('tp' + TestP... |
#!/usr/bin/env python3
import itertools
import os
import sys
import tempfile
import tokenize
from typing import IO, Iterable, List, NamedTuple, Optional, Tuple, cast
import black
__version__ = "1.3.0"
SINGLE_INDENT = " " * 4
class WrapInfo(NamedTuple):
"""Describes the changes made when wrapping text."""
... | [
"black.main",
"itertools.groupby",
"os.getcwd"
] | [((4884, 4925), 'itertools.groupby', 'itertools.groupby', (['lines', 'is_blank_string'], {}), '(lines, is_blank_string)\n', (4901, 4925), False, 'import itertools\n'), ((3412, 3439), 'black.main', 'black.main', ([], {'args': 'black_args'}), '(args=black_args)\n', (3422, 3439), False, 'import black\n'), ((3112, 3123), '... |
#!/usr/bin/env python2
# OpenPOWER Automated Test Project
#
# Contributors Listed Below - COPYRIGHT 2015,2017
# [+] International Business Machines Corp.
#
#
# 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 th... | [
"OpTestLogger.optest_logger_glob.get_logger",
"unittest.TestSuite",
"re.match",
"unittest.SkipTest"
] | [((1455, 1507), 'OpTestLogger.optest_logger_glob.get_logger', 'OpTestLogger.optest_logger_glob.get_logger', (['__name__'], {}), '(__name__)\n', (1497, 1507), False, 'import OpTestLogger\n'), ((1751, 1813), 'unittest.SkipTest', 'unittest.SkipTest', (['"""QEMU/Mambo running so skipping FWTS tests"""'], {}), "('QEMU/Mambo... |
import random
from tkinter import Tk, Frame, Listbox, Button, Label, Scrollbar, VERTICAL, END, SINGLE, NONE, \
StringVar, Radiobutton, Toplevel, N, S, E, W
from tkinter.ttk import Notebook
from project.contact import Contact
import pickle
from project.WheelSpinner.WheelSpinner import WheelSpinner
from project.Phone... | [
"project.contact.Contact",
"pickle.dump",
"random.shuffle",
"project.AlphabetGuesser.AlphabetGuesserInter.AlphabetGuesserInter",
"pickle.load",
"tkinter.Toplevel",
"tkinter.Radiobutton",
"tkinter.StringVar",
"project.PhoneNumber.AddPhoneNumberInter.AddPhoneNumberInter",
"tkinter.Scrollbar",
"tki... | [((27642, 27661), 'project.AlphabetGuesser.create_dictionary.create_dictionary', 'create_dictionary', ([], {}), '()\n', (27659, 27661), False, 'from project.AlphabetGuesser.create_dictionary import create_dictionary\n'), ((27666, 27687), 'project.create_contact_list_pickle.main', 'create_contact_list', ([], {}), '()\n'... |
# MIT License
#
# Copyright (c) 2021 <NAME> and <NAME> and <NAME>
#
# 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... | [
"dataclasses.field"
] | [((2084, 2144), 'dataclasses.field', 'field', ([], {'default': '"""mfcc"""', 'metadata': "{'help': 'Name of dataset.'}"}), "(default='mfcc', metadata={'help': 'Name of dataset.'})\n", (2089, 2144), False, 'from dataclasses import dataclass, field\n'), ((2182, 2247), 'dataclasses.field', 'field', ([], {'default': '(1600... |
"""
Definition of the :class:`~django_dicom.models.header.Header` class.
"""
import os
from typing import Any, List
from dicom_parser.header import Header as DicomHeader
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django_dicom.models.dicom_entity import DicomEntity
from djan... | [
"os.getenv",
"django.db.models.ForeignKey",
"django_dicom.models.managers.header.HeaderManager",
"dicom_parser.header.Header",
"django.db.models.PositiveIntegerField",
"django_dicom.utils.html.Html.admin_link"
] | [((823, 925), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""django_dicom.SequenceOfItems"""'], {'on_delete': 'models.CASCADE', 'blank': '(True)', 'null': '(True)'}), "('django_dicom.SequenceOfItems', on_delete=models.CASCADE,\n blank=True, null=True)\n", (840, 925), False, 'from django.db import models\n... |
#Author: <NAME>
from test_script.test import test_stairs
def stairs(N):
stairs_ = list()
for i in range(1,N+1):
symb = "#"*(i)
empty = " "*(N-i)
stairs_.append(symb + empty)
return stairs_
if __name__ == '__main__':
test_stairs(stairs)
| [
"test_script.test.test_stairs"
] | [((264, 283), 'test_script.test.test_stairs', 'test_stairs', (['stairs'], {}), '(stairs)\n', (275, 283), False, 'from test_script.test import test_stairs\n')] |
from oarepo_model_builder.builder import ModelBuilder
from oarepo_model_builder.outputs.jsonschema import JSONSchemaOutput
from oarepo_model_builder.outputs.mapping import MappingOutput
from oarepo_model_builder.schema import ModelSchema
def test_output_disabled():
builder = ModelBuilder()
schema = ModelSchem... | [
"oarepo_model_builder.schema.ModelSchema",
"oarepo_model_builder.builder.ModelBuilder"
] | [((282, 296), 'oarepo_model_builder.builder.ModelBuilder', 'ModelBuilder', ([], {}), '()\n', (294, 296), False, 'from oarepo_model_builder.builder import ModelBuilder\n'), ((310, 389), 'oarepo_model_builder.schema.ModelSchema', 'ModelSchema', (['""""""', "{'settings': {'plugins': {'output': {'disabled': '__all__'}}}}"]... |
from model import FDI_model
from data import FDI_train_dataset, FDI_val_dataset
from utils import save_opts,mkdirs_now,write_loss_on_tb
import time
import torch.utils.data
import torch.nn.functional as F
import argparse
import os
import tensorboardX
if __name__ == '__main__':
parser = argparse.ArgumentParser()
... | [
"utils.mkdirs_now",
"tensorboardX.SummaryWriter",
"argparse.ArgumentParser",
"utils.save_opts",
"os.path.join",
"model.FDI_model",
"time.time",
"data.FDI_train_dataset",
"data.FDI_val_dataset",
"torch.nn.functional.softmax"
] | [((294, 319), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (317, 319), False, 'import argparse\n'), ((3137, 3189), 'os.path.join', 'os.path.join', (['opts.output_path', 'opts.name', '"""tb_logs"""'], {}), "(opts.output_path, opts.name, 'tb_logs')\n", (3149, 3189), False, 'import os\n'), ((321... |
import numpy as np
import cv2
def draw_bbox(image, x1, y1, x2, y2, caption, color=(203, 232, 0)):
b = np.array([x1, y1, x2, y2]).astype(int)
cv2.rectangle(image, (x1, y1), (x2, y2), color=color, thickness=5)
if caption:
cv2.putText(image, caption, (b[0], b[1] - 10), cv2.FONT_HERSHEY_PLAIN, 1.5, (0... | [
"cv2.rectangle",
"numpy.array",
"cv2.putText"
] | [((150, 216), 'cv2.rectangle', 'cv2.rectangle', (['image', '(x1, y1)', '(x2, y2)'], {'color': 'color', 'thickness': '(5)'}), '(image, (x1, y1), (x2, y2), color=color, thickness=5)\n', (163, 216), False, 'import cv2\n'), ((242, 335), 'cv2.putText', 'cv2.putText', (['image', 'caption', '(b[0], b[1] - 10)', 'cv2.FONT_HERS... |
import os
import signal
import structlog
from flask import Blueprint, request, redirect
from conditional import auth
from conditional.util.auth import get_user
from conditional.util.cache import clear_all_cached_functions
from conditional.util.ldap import _ldap_is_member_of_directorship
from conditional.util.ldap imp... | [
"structlog.get_logger",
"conditional.util.ldap.ldap_get_member.cache_clear",
"conditional.util.ldap.ldap_get_onfloor_members.cache_clear",
"conditional.util.ldap.ldap_is_eval_director",
"conditional.util.cache.clear_all_cached_functions",
"conditional.util.ldap.ldap_get_active_members.cache_clear",
"fla... | [((686, 708), 'structlog.get_logger', 'structlog.get_logger', ([], {}), '()\n', (706, 708), False, 'import structlog\n'), ((720, 751), 'flask.Blueprint', 'Blueprint', (['"""cache_bp"""', '__name__'], {}), "('cache_bp', __name__)\n", (729, 751), False, 'from flask import Blueprint, request, redirect\n'), ((1427, 1455), ... |
import io
import logging
import os
import re
import subprocess
from collections import deque
from contextlib import closing, contextmanager
from urllib.parse import urlparse
from dvc.scheme import Schemes
from dvc.utils import fix_env, tmp_fname
from .base import BaseRemoteTree, RemoteCmdError
from .pool import get_c... | [
"logging.getLogger",
"collections.deque",
"urllib.parse.urlparse",
"os.getenv",
"re.match",
"dvc.utils.fix_env",
"io.TextIOWrapper",
"dvc.utils.tmp_fname"
] | [((340, 367), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (357, 367), False, 'import logging\n'), ((773, 786), 'urllib.parse.urlparse', 'urlparse', (['url'], {}), '(url)\n', (781, 786), False, 'from urllib.parse import urlparse\n'), ((2346, 2359), 'collections.deque', 'deque', (['[root... |
"""
This module exports comfiguration forthe current system
and is imported by the various run_xxx.py scripts
"""
import os
from pathlib import PurePath
#API Setting are needed to sore job details for later reference
API_URL = os.getenv('NZSHM22_TOSHI_API_URL', "http://127.0.0.1:5000/graphql")
API_KEY = os.getenv('... | [
"pathlib.PurePath",
"os.getenv",
"os.getcwd"
] | [((231, 298), 'os.getenv', 'os.getenv', (['"""NZSHM22_TOSHI_API_URL"""', '"""http://127.0.0.1:5000/graphql"""'], {}), "('NZSHM22_TOSHI_API_URL', 'http://127.0.0.1:5000/graphql')\n", (240, 298), False, 'import os\n'), ((309, 347), 'os.getenv', 'os.getenv', (['"""NZSHM22_TOSHI_API_KEY"""', '""""""'], {}), "('NZSHM22_TOSH... |
from LogAnalyzer import Test,TestResult
import DataflashLog
class TestEmpty(Test):
'''test for empty or near-empty logs'''
def __init__(self):
Test.__init__(self)
self.name = "Empty"
def run(self, logdata, verbose):
self.result = TestResult()
self.result.status = TestResult.StatusType.GOOD
# all the... | [
"LogAnalyzer.TestResult",
"LogAnalyzer.Test.__init__",
"DataflashLog.DataflashLogHelper.isLogEmpty"
] | [((150, 169), 'LogAnalyzer.Test.__init__', 'Test.__init__', (['self'], {}), '(self)\n', (163, 169), False, 'from LogAnalyzer import Test, TestResult\n'), ((245, 257), 'LogAnalyzer.TestResult', 'TestResult', ([], {}), '()\n', (255, 257), False, 'from LogAnalyzer import Test, TestResult\n'), ((432, 483), 'DataflashLog.Da... |
import unittest
from repositories.user_repository import UserRepository
class TestUserRepository(unittest.TestCase):
def setUp(self):
self.repository = UserRepository()
self.repository.register("maija", "Ahlie8oh")
def test_register_user(self):
user = self.repository.register("matti", ... | [
"repositories.user_repository.UserRepository"
] | [((165, 181), 'repositories.user_repository.UserRepository', 'UserRepository', ([], {}), '()\n', (179, 181), False, 'from repositories.user_repository import UserRepository\n')] |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from queue import Queue, Full, Empty
import threading
import numpy as np
import torch
from datetime import datetime
fr... | [
"torch.LongTensor",
"torch.from_numpy",
"collections.Counter",
"datetime.datetime.now",
"torch.cuda.is_available",
"collections.defaultdict",
"threading.Thread",
"queue.Queue",
"numpy.isinf",
"torch.FloatTensor"
] | [((5438, 5445), 'queue.Queue', 'Queue', ([], {}), '()\n', (5443, 5445), False, 'from queue import Queue, Full, Empty\n'), ((5838, 5847), 'collections.Counter', 'Counter', ([], {}), '()\n', (5845, 5847), False, 'from collections import deque, Counter, defaultdict, OrderedDict\n'), ((7729, 7743), 'datetime.datetime.now',... |
import typing as tp
from torch.utils.data import DataLoader
import torchvision
import torchvision.transforms as transforms
import pytorch_lightning as pl
def get_datasets(root: str):
transform_train = transforms.Compose([
transforms.RandomCrop(32, padding=4),
transforms.RandomHorizontalFlip(),
... | [
"torchvision.transforms.RandomHorizontalFlip",
"torchvision.transforms.RandomCrop",
"torchvision.datasets.CIFAR10",
"torchvision.transforms.Normalize",
"torch.utils.data.DataLoader",
"torchvision.transforms.ToTensor"
] | [((624, 721), 'torchvision.datasets.CIFAR10', 'torchvision.datasets.CIFAR10', ([], {'root': 'root', 'train': '(True)', 'download': '(True)', 'transform': 'transform_train'}), '(root=root, train=True, download=True,\n transform=transform_train)\n', (652, 721), False, 'import torchvision\n'), ((741, 838), 'torchvision... |
# This file contains code to clean Wiktionary annotations from a string and to
# produce plain text from it, typically for glossary entries but this is also
# called for various other data to produce clean strings.
#
# This file also contains code for cleaning qualifiers for the "tags" field.
#
# Copyright (c) 2018-202... | [
"re.compile",
"html.unescape",
"re.match",
"re.finditer",
"re.sub",
"re.subn"
] | [((2647, 2669), 're.compile', 're.compile', (['clean_rege'], {}), '(clean_rege)\n', (2657, 2669), False, 'import re\n'), ((2861, 2901), 're.compile', 're.compile', (['"""^([-_a-zA-Z0-9\\\\s]+)=(.*)$"""'], {}), "('^([-_a-zA-Z0-9\\\\s]+)=(.*)$')\n", (2871, 2901), False, 'import re\n'), ((9053, 9092), 're.finditer', 're.f... |
#!/usr/bin/env python
#
# BEDOPS
# Copyright (C) 2011-2017 <NAME>, <NAME> and <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 2 of the License, or
# (a... | [
"logging.basicConfig",
"logging.getLogger",
"subprocess.check_output",
"argparse.ArgumentParser",
"os.rename",
"os.path.join",
"sys.stderr.write",
"subprocess.call",
"sys.exit",
"os.walk",
"sys.stdout.write"
] | [((5422, 5485), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': 'name', 'usage': 'usage', 'add_help': '(False)'}), '(prog=name, usage=usage, add_help=False)\n', (5445, 5485), False, 'import argparse\n'), ((16216, 16240), 'os.walk', 'os.walk', (['args.parent_dir'], {}), '(args.parent_dir)\n', (16223,... |
import errno
import hashlib
import os
from insights.util import subproc
def read_in_chunks(file_object, chunk_size=1024):
while True:
data = file_object.read(chunk_size)
if not data:
break
yield data
def touch(fname, times=None):
with open(fname, 'a'):
os.utime(f... | [
"os.path.exists",
"hashlib.sha256",
"insights.util.subproc.call",
"os.makedirs",
"os.utime",
"os.stat"
] | [((1486, 1503), 'insights.util.subproc.call', 'subproc.call', (['cmd'], {}), '(cmd)\n', (1498, 1503), False, 'from insights.util import subproc\n'), ((310, 332), 'os.utime', 'os.utime', (['fname', 'times'], {}), '(fname, times)\n', (318, 332), False, 'import os\n'), ((742, 758), 'hashlib.sha256', 'hashlib.sha256', ([],... |
from __future__ import print_function
import itertools
import numpy as np
import numba.unittest_support as unittest
from numba import types, jit, typeof
from .support import MemoryLeakMixin, TestCase, tag
def getitem_usecase(a, b):
return a[b]
def setitem_usecase(a, idx, b):
a[idx] = b
class TestFancyIn... | [
"numba.unittest_support.main",
"numpy.testing.assert_equal",
"numpy.int16",
"itertools.product",
"numba.jit",
"numpy.bool_",
"numpy.uint16",
"numpy.zeros_like",
"numpy.arange"
] | [((6184, 6199), 'numba.unittest_support.main', 'unittest.main', ([], {}), '()\n', (6197, 6199), True, 'import numba.unittest_support as unittest\n'), ((430, 454), 'numpy.int16', 'np.int16', (['[0, N - 1, -2]'], {}), '([0, N - 1, -2])\n', (438, 454), True, 'import numpy as np\n'), ((1465, 1504), 'itertools.product', 'it... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import pyvultr
import pyvultr.lib
import unittest
from pyvultr.lib.exceptions import *
class TestBaseAPI(unittest.TestCase):
def setUp(self):
self.base_url = "http://httpbin.org/"
self.token = "<PAS... | [
"pyvultr.lib.BaseAPI"
] | [((352, 389), 'pyvultr.lib.BaseAPI', 'pyvultr.lib.BaseAPI', ([], {'token': 'self.token'}), '(token=self.token)\n', (371, 389), False, 'import pyvultr\n')] |
# Copyright 2020 The Magenta Authors.
#
# 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 ... | [
"magenta.models.onsets_frames_transcription.infer_util.labels_to_features_wrapper",
"tensorflow.compat.v1.gfile.GFile",
"magenta.models.onsets_frames_transcription.data.hparams_frames_per_second",
"tensorflow.compat.v1.Session",
"numpy.mean",
"note_seq.protobuf.music_pb2.NoteSequence.FromString",
"six.e... | [((1389, 1475), 'tensorflow.compat.v1.app.flags.DEFINE_string', 'tf.app.flags.DEFINE_string', (['"""master"""', '""""""', '"""Name of the TensorFlow runtime to use."""'], {}), "('master', '',\n 'Name of the TensorFlow runtime to use.')\n", (1415, 1475), True, 'import tensorflow.compat.v1 as tf\n'), ((1499, 1586), 't... |
# utils.py
import pandas as pd
from sklearn.preprocessing import OneHotEncoder
import numpy as np
import os
def extract_tls_info(s):
tls_key_list = ['C', 'ST', 'L', 'O', 'OU', 'CN', 'emailAddress', 'unknown', 'serialNumber']
s = s.split(',')
s = [x.split('/') for x in s]
s = sum(s, [])
res = {}
... | [
"pandas.DataFrame",
"sklearn.preprocessing.OneHotEncoder",
"numpy.array"
] | [((3711, 3801), 'sklearn.preprocessing.OneHotEncoder', 'OneHotEncoder', ([], {'categories': '"""auto"""', 'sparse': '(False)', 'dtype': 'np.int8', 'handle_unknown': '"""ignore"""'}), "(categories='auto', sparse=False, dtype=np.int8,\n handle_unknown='ignore')\n", (3724, 3801), False, 'from sklearn.preprocessing impo... |
#importing the library
#nn requires matrix2d.py and the math module and random module for dependencies
import nn
import random
#create the neural network to solve the XOR problem
#takes an array of arrays for argument
#the 2, 4 and 1 represent two nodes in the input and 4 nodes in the hidden layer and 1 node in the ou... | [
"random.randint",
"nn.NeuralNetwork"
] | [((627, 679), 'nn.NeuralNetwork', 'nn.NeuralNetwork', (['[[2], [4], [1]]'], {'learning_rate': '(0.2)'}), '([[2], [4], [1]], learning_rate=0.2)\n', (643, 679), False, 'import nn\n'), ((1075, 1095), 'random.randint', 'random.randint', (['(0)', '(3)'], {}), '(0, 3)\n', (1089, 1095), False, 'import random\n')] |
import argparse
import os
import sys
from sys import stdout
import mdtraj as md
import numpy as np
import parmed
import simtk.openmm as mm
import simtk.openmm.app as app
import simtk.unit as unit
from openforcefield.topology import Molecule, Topology
from openmmforcefields.generators import SystemGenerator
from perses... | [
"openforcefield.topology.Molecule.from_file",
"os.makedirs",
"argparse.ArgumentParser",
"openmmforcefields.generators.SystemGenerator",
"simtk.openmm.app.Simulation",
"os.path.join",
"openforcefield.topology.Topology.from_molecules",
"numpy.zeros",
"simtk.openmm.LangevinIntegrator",
"simtk.openmm.... | [((665, 690), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (688, 690), False, 'import argparse\n'), ((1420, 1472), 'simtk.openmm.app.ForceField', 'ForceField', (['protein_forcefield', 'solvation_forcefield'], {}), '(protein_forcefield, solvation_forcefield)\n', (1430, 1472), False, 'from simt... |
import h5py as h5
import feather
import pandas as pd
import numpy as np
import os
correlation_files = os.listdir("correlation_folder")
for i in range(0, len(correlation_files)):
print(i)
correlation = pd.read_feather("correlation_folder/"+correlation_files[i])
f = h5.File("h5/"+correlation_files[i].replac... | [
"pandas.read_feather",
"os.listdir",
"matplotlib.pyplot.savefig",
"numpy.corrcoef",
"s3fs.S3FileSystem",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.plot",
"h5py.File",
"multiprocessing.pool.ThreadPool",
"matplotlib.pyplot.close",
"numpy.array",
"numpy.sin",
"matplotlib.pyplot.title",
"... | [((103, 135), 'os.listdir', 'os.listdir', (['"""correlation_folder"""'], {}), "('correlation_folder')\n", (113, 135), False, 'import os\n'), ((901, 912), 'time.time', 'time.time', ([], {}), '()\n', (910, 912), False, 'import time\n'), ((1728, 1739), 'time.time', 'time.time', ([], {}), '()\n', (1737, 1739), False, 'impo... |
import subprocess, glob, os
#
# Input
#
# Path to the main directory
path = '../../src/'
# Compiler options
cx = 'g++'
std = '-std=c++11'
opt = '-O0'
# Common source files
src_files = path + 'three_part_function.cpp'
src_files += ' ' + path + 'four_part_function.cpp'
src_files += ' ' + path + 'utils.cpp'
src_files ... | [
"subprocess.call"
] | [((650, 692), 'subprocess.call', 'subprocess.call', (['[compile_com]'], {'shell': '(True)'}), '([compile_com], shell=True)\n', (665, 692), False, 'import subprocess, glob, os\n'), ((921, 963), 'subprocess.call', 'subprocess.call', (['[compile_com]'], {'shell': '(True)'}), '([compile_com], shell=True)\n', (936, 963), Fa... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import nltk
from nltk import PerceptronTagger
class PosTagger:
def __init__(self, sentence):
"""
Args:
sentence:
"""
self.sentence = sentence
self.tagger = PosTagger.get_tagger()
def pos_tag(self):
"""... | [
"nltk.PerceptronTagger",
"nltk.word_tokenize"
] | [((369, 402), 'nltk.word_tokenize', 'nltk.word_tokenize', (['self.sentence'], {}), '(self.sentence)\n', (387, 402), False, 'import nltk\n'), ((587, 605), 'nltk.PerceptronTagger', 'PerceptronTagger', ([], {}), '()\n', (603, 605), False, 'from nltk import PerceptronTagger\n')] |
import os
import sys
_this_file_path = os.path.abspath(__file__)
_PACKAGE_DIRECTORY = os.path.dirname(os.path.dirname(os.path.dirname(_this_file_path)))
_EXAMPLES_DIRECTORY = os.path.dirname(os.path.dirname(_this_file_path))
_CURRENT_EXAMPLE_DIRECTORY = os.path.dirname(_this_file_path)
def add_modules_to_path():
... | [
"os.path.abspath",
"os.path.dirname",
"os.path.normpath",
"os.path.join"
] | [((41, 66), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (56, 66), False, 'import os\n'), ((256, 288), 'os.path.dirname', 'os.path.dirname', (['_this_file_path'], {}), '(_this_file_path)\n', (271, 288), False, 'import os\n'), ((193, 225), 'os.path.dirname', 'os.path.dirname', (['_this_file_... |
from ovos_utils.enclosure.mark1 import Mark1EnclosureAPI
from ovos_utils import create_loop
from ovos_utils.log import LOG
from ovos_utils.messagebus import get_mycroft_bus
import random
from time import sleep
import collections
import copy
class FaceplateGrid(collections.MutableSequence):
encoded = None
str_... | [
"ovos_utils.create_loop",
"ovos_utils.messagebus.get_mycroft_bus",
"time.sleep",
"ovos_utils.enclosure.mark1.Mark1EnclosureAPI",
"ovos_utils.log.LOG.error",
"copy.deepcopy",
"random.randint"
] | [((461, 488), 'ovos_utils.enclosure.mark1.Mark1EnclosureAPI', 'Mark1EnclosureAPI', (['self.bus'], {}), '(self.bus)\n', (478, 488), False, 'from ovos_utils.enclosure.mark1 import Mark1EnclosureAPI\n'), ((10727, 10751), 'copy.deepcopy', 'copy.deepcopy', (['self.grid'], {}), '(self.grid)\n', (10740, 10751), False, 'import... |
#!/usr/bin/env python3
#
# A PyMol extension script for batch converting objects (originally intended
# to convert into .obj models).
#
def main():
"""main"""
raise RuntimeError('This module should not be executed as a script')
if __name__ =='__main__':
main()
in_pymol = False
try:
... | [
"pymol.cmd.set",
"pymol.cmd.load",
"pymol.cmd.enable",
"pymol.cmd.show",
"pymol.cmd.reinitialize",
"pymol.cmd.delete",
"elfinpy.utilities.make_dir",
"pymol.cmd.disable"
] | [((1032, 1050), 'pymol.cmd.reinitialize', 'cmd.reinitialize', ([], {}), '()\n', (1048, 1050), False, 'from pymol import cmd\n'), ((1355, 1392), 'pymol.cmd.set', 'cmd.set', (['"""auto_show_nonbonded"""', '"""off"""'], {}), "('auto_show_nonbonded', 'off')\n", (1362, 1392), False, 'from pymol import cmd\n'), ((1406, 1444)... |
from __future__ import absolute_import
# Visualization of particles with gravity
# Source: http://enja.org/2010/08/27/adventures-in-opencl-part-2-particles-with-opengl/
import pyopencl as cl # OpenCL - GPU computing interface
mf = cl.mem_flags
from pyopencl.tools import get_gl_sharing_context_properties
from OpenGL.GL... | [
"pyopencl.Buffer",
"pyopencl.Program",
"pyopencl.enqueue_release_gl_objects",
"numpy.random.random_sample",
"pyopencl.get_platforms",
"numpy.float32",
"pyopencl.CommandQueue",
"pyopencl.tools.get_gl_sharing_context_properties",
"numpy.ndarray",
"pyopencl.enqueue_acquire_gl_objects",
"sys.exit",
... | [((4872, 4896), 'pyopencl.CommandQueue', 'cl.CommandQueue', (['context'], {}), '(context)\n', (4887, 4896), True, 'import pyopencl as cl\n'), ((4912, 4969), 'pyopencl.Buffer', 'cl.Buffer', (['context', 'mf.COPY_HOST_PTR'], {'hostbuf': 'np_velocity'}), '(context, mf.COPY_HOST_PTR, hostbuf=np_velocity)\n', (4921, 4969), ... |
from metacash.readers.inbank import InBankCSV
from metacash.readers.metacash import MetaCashCSV
from metacash.configuration import Configuration
import glob
from metacash.transactions import Transactions, TimestampsGapError
import metacash
import tempfile
import os
# chdir to project directory
os.chdir(os.path.dirnam... | [
"metacash.readers.metacash.MetaCashCSV.read",
"metacash.configuration.Configuration",
"metacash.readers.inbank.InBankCSV.read",
"os.path.dirname",
"os.unlink",
"metacash.transactions.Transactions.merge",
"tempfile.mkstemp"
] | [((385, 429), 'metacash.configuration.Configuration', 'Configuration', (['"""fixtures/dataset1/config.py"""'], {}), "('fixtures/dataset1/config.py')\n", (398, 429), False, 'from metacash.configuration import Configuration\n'), ((506, 534), 'metacash.readers.inbank.InBankCSV.read', 'InBankCSV.read', (['pathnames[0]'], {... |
# Generated by Django 3.1.5 on 2021-03-28 15:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('challenge', '0002_map_infra_token'),
]
operations = [
migrations.AddField(
model_name='match',
name='infra_token',
... | [
"django.db.models.CharField"
] | [((337, 392), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(256)', 'null': '(True)'}), '(blank=True, max_length=256, null=True)\n', (353, 392), False, 'from django.db import migrations, models\n')] |
#! /bin/python
import resource
import signal
import multiprocessing
import os
import sys
import time
import tempfile
import psutil
class CpuTimeoutException(Exception):
"""Pynisher exception object returned on a CPU time limit."""
pass
class TimeoutException(Exception):
"""Pynisher exception object ret... | [
"tempfile.TemporaryDirectory",
"signal.signal",
"resource.getrusage",
"multiprocessing.Process",
"psutil.Process",
"os.path.join",
"resource.setrlimit",
"multiprocessing.get_logger",
"signal.alarm",
"multiprocessing.Pipe",
"time.time"
] | [((2778, 2816), 'signal.signal', 'signal.signal', (['signal.SIGALRM', 'handler'], {}), '(signal.SIGALRM, handler)\n', (2791, 2816), False, 'import signal\n'), ((2821, 2859), 'signal.signal', 'signal.signal', (['signal.SIGXCPU', 'handler'], {}), '(signal.SIGXCPU, handler)\n', (2834, 2859), False, 'import signal\n'), ((2... |
import pygame
from pygame.locals import *
import random
import time
pygame.init()
bac = pygame.image.load('lesson11/bac1.png')
screen = pygame.display.set_mode((800, 600))
dd=0
bac = []
font = pygame.font.Font('simhei.ttf', 40)
str1 = '666社会社会大吉大利今晚吃鸡嘤嘤嘤'
str2=font.render(str1, True, (200,200,0))
print(type(str2))
... | [
"pygame.init",
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"time.sleep",
"pygame.image.load",
"pygame.font.Font",
"pygame.display.update"
] | [((70, 83), 'pygame.init', 'pygame.init', ([], {}), '()\n', (81, 83), False, 'import pygame\n'), ((90, 128), 'pygame.image.load', 'pygame.image.load', (['"""lesson11/bac1.png"""'], {}), "('lesson11/bac1.png')\n", (107, 128), False, 'import pygame\n'), ((138, 173), 'pygame.display.set_mode', 'pygame.display.set_mode', (... |
#-*- coding: utf-8 -*-
"""
Usage:
pyd <url> [--hash <value>] [--auth <u> <p] [--version]
Examples:
pyd https://www.python.org/static/img/python-logo.png : Download's the python logo from their homepage
pyd https://www.example.com/... --auth username password : When authentication is required
pyd http... | [
"docopt.docopt",
"pyDownload.main"
] | [((567, 582), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (573, 582), False, 'from docopt import docopt\n'), ((584, 627), 'pyDownload.main', 'pyDownload.main', (['arguments[0]', 'arguments[1]'], {}), '(arguments[0], arguments[1])\n', (599, 627), False, 'import pyDownload\n')] |
# 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.get",
"pulumi.getter",
"pulumi.set",
"pulumi.InvokeOptions",
"pulumi.runtime.invoke"
] | [((1973, 2013), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""appCatalogListings"""'}), "(name='appCatalogListings')\n", (1986, 2013), False, 'import pulumi\n'), ((2260, 2293), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""displayName"""'}), "(name='displayName')\n", (2273, 2293), False, 'import pulumi\n'),... |
# MIT License
#
# Copyright (c) 2016 <NAME> aka kronenthaler
#
# 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... | [
"setuptools.setup"
] | [((1784, 1952), 'setuptools.setup', 'setup', ([], {'name': '__package_name__', 'license': '"""MIT License"""', 'install_requires': "['pbxproj']", 'script_args': "['install', '--user', '--force', '--record', '.uninstall_files']"}), "(name=__package_name__, license='MIT License', install_requires=[\n 'pbxproj'], scrip... |
# Copyright 2019 The dm_control Authors.
#
# 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 i... | [
"dm_control.manipulation.shared.robots.make_arm",
"collections.namedtuple",
"dm_control.manipulation.shared.arenas.Standard",
"dm_control.manipulation.shared.observations.make_options",
"dm_control.manipulation.shared.robots.make_hand",
"itertools.product",
"dm_control.manipulation.shared.registry.add",... | [((1524, 1609), 'collections.namedtuple', 'collections.namedtuple', (['"""_LiftWorkspace"""', "['prop_bbox', 'tcp_bbox', 'arm_offset']"], {}), "('_LiftWorkspace', ['prop_bbox', 'tcp_bbox',\n 'arm_offset'])\n", (1546, 1609), False, 'import collections\n'), ((8425, 8452), 'dm_control.manipulation.shared.registry.add',... |
#!/usr/bin/env python3
# coding: utf-8
from unittest.mock import create_autospec
from slackclient import SlackClient, _channel, _server, _util
from rtmbot.core import RtmBot
from testfixtures import LogCapture
from plugins.chatbot import Reply
def init_rtmbot():
''' Initializes an instance of RTMBot with some d... | [
"testfixtures.LogCapture",
"rtmbot.core.RtmBot",
"plugins.chatbot.Reply",
"unittest.mock.create_autospec"
] | [((351, 459), 'rtmbot.core.RtmBot', 'RtmBot', (["{'SLACK_TOKEN': '<PASSWORD>', 'BASE_PATH': '/tmp/', 'LOGFILE':\n '/tmp/rtmbot.log', 'DEBUG': True}"], {}), "({'SLACK_TOKEN': '<PASSWORD>', 'BASE_PATH': '/tmp/', 'LOGFILE':\n '/tmp/rtmbot.log', 'DEBUG': True})\n", (357, 459), False, 'from rtmbot.core import RtmBot\n... |
"""
Concrete Syntax Tree for Python 3.6+ source code
"""
from cdd.cst_utils import cst_parser, cst_scanner
def cst_parse(source):
"""
Parse Python source lines into a Concrete Syntax Tree
:param source: Python source code
:type source: ```str```
:return: List of `namedtuple`s with at least ("li... | [
"cdd.cst_utils.cst_scanner",
"cdd.cst_utils.cst_parser"
] | [((419, 438), 'cdd.cst_utils.cst_scanner', 'cst_scanner', (['source'], {}), '(source)\n', (430, 438), False, 'from cdd.cst_utils import cst_parser, cst_scanner\n'), ((452, 471), 'cdd.cst_utils.cst_parser', 'cst_parser', (['scanned'], {}), '(scanned)\n', (462, 471), False, 'from cdd.cst_utils import cst_parser, cst_scan... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | [
"msrest.Serializer",
"copy.deepcopy",
"msrest.Deserializer",
"azure.mgmt.core.ARMPipelineClient"
] | [((5579, 5646), 'azure.mgmt.core.ARMPipelineClient', 'ARMPipelineClient', ([], {'base_url': 'base_url', 'config': 'self._config'}), '(base_url=base_url, config=self._config, **kwargs)\n', (5596, 5646), False, 'from azure.mgmt.core import ARMPipelineClient\n'), ((5764, 5789), 'msrest.Serializer', 'Serializer', (['client... |
# coding=utf-8
from setuptools import setup
from setuptools import find_packages
setup(
name="systray",
version="0.1.11",
packages=find_packages(),
) | [
"setuptools.find_packages"
] | [((145, 160), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (158, 160), False, 'from setuptools import find_packages\n')] |
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by <NAME> (<EMAIL>)
# Modified by <NAME> (<EMAIL>)
# ------------------------------------------------------------------------------
from __future__ import absolu... | [
"core.inference.aggregate_results",
"core.group.HeatmapParser",
"argparse.ArgumentParser",
"dataset.HIEDataset.HIEDataset",
"torch.multiprocessing.set_sharing_strategy",
"config.update_config",
"config.check_config",
"fp16_utils.fp16util.network_to_half",
"core.inference.get_multi_stage_outputs",
... | [((1411, 1468), 'torch.multiprocessing.set_sharing_strategy', 'torch.multiprocessing.set_sharing_strategy', (['"""file_system"""'], {}), "('file_system')\n", (1453, 1468), False, 'import torch\n'), ((1536, 1597), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Test keypoints network"""'})... |
import sys
import time
from typing import List
from eth_keys.datatypes import PublicKey
from web3 import Web3
from celo_sdk.contracts.base_wrapper import BaseWrapper
from celo_sdk.celo_account.account import Account
from celo_sdk.celo_account.messages import encode_defunct
from celo_sdk.registry import Registry
from ... | [
"celo_sdk.celo_account.messages.encode_defunct",
"sys.exc_info",
"celo_sdk.utils.hash_utils.hash_message_with_prefix",
"celo_sdk.celo_account.account.Account.recover_hash_to_pub"
] | [((20024, 20079), 'celo_sdk.utils.hash_utils.hash_message_with_prefix', 'hash_utils.hash_message_with_prefix', (['self.web3', 'message'], {}), '(self.web3, message)\n', (20059, 20079), False, 'from celo_sdk.utils import hash_utils\n'), ((20103, 20138), 'celo_sdk.celo_account.messages.encode_defunct', 'encode_defunct', ... |
# https://github.com/Ignas/nose_xunitmp/blob/master/nose_xunitmp.py
"""This plugin provides test results in the standard XUnit XML format."""
import multiprocessing
import codecs
from nose.plugins.base import Plugin
from nose.plugins.xunit import Xunit
from nose.pyversion import force_unicode
class XunitMP(Xunit):
... | [
"nose.plugins.base.Plugin.options",
"nose.plugins.base.Plugin.configure",
"nose.pyversion.force_unicode",
"multiprocessing.Manager",
"codecs.open"
] | [((595, 628), 'nose.plugins.base.Plugin.options', 'Plugin.options', (['self', 'parser', 'env'], {}), '(self, parser, env)\n', (609, 628), False, 'from nose.plugins.base import Plugin\n'), ((1091, 1130), 'nose.plugins.base.Plugin.configure', 'Plugin.configure', (['self', 'options', 'config'], {}), '(self, options, confi... |
from django.contrib import admin
from portfolio.models import Project
class ProjectAdmin(admin.ModelAdmin):
list_display = ('title', 'technology')
search_fields = ['title', 'technology']
fieldsets = [
('Project', {'fields': ['title', 'summary']}),
('Information', {'fields': ['descri... | [
"django.contrib.admin.site.register"
] | [((448, 490), 'django.contrib.admin.site.register', 'admin.site.register', (['Project', 'ProjectAdmin'], {}), '(Project, ProjectAdmin)\n', (467, 490), False, 'from django.contrib import admin\n')] |
import json
import traceback
from dataclasses import dataclass
from datetime import datetime, timedelta, timezone
from pathlib import Path
from typing import Union
from urllib import request as urlreq, parse as urlparse
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
import iterm2
class... | [
"traceback.format_exc",
"datetime.datetime.fromtimestamp",
"pathlib.Path",
"urllib.parse.urlencode",
"iterm2.CheckboxKnob",
"iterm2.run_forever",
"datetime.datetime.now",
"iterm2.StringKnob",
"iterm2.StatusBarComponent",
"json.load",
"datetime.timedelta"
] | [((8579, 8613), 'pathlib.Path', 'Path', (['"""/tmp/iterm-weatherinfo.log"""'], {}), "('/tmp/iterm-weatherinfo.log')\n", (8583, 8613), False, 'from pathlib import Path\n'), ((8652, 8676), 'iterm2.run_forever', 'iterm2.run_forever', (['main'], {}), '(main)\n', (8670, 8676), False, 'import iterm2\n'), ((5534, 5839), 'iter... |
import logging
from django.db import ProgrammingError
from django.core.exceptions import ImproperlyConfigured
from timescale.db.backends.postgis import base_impl
from timescale.db.backends.postgis.schema import TimescaleSchemaEditor
logger = logging.getLogger(__name__)
class DatabaseWrapper(base_impl.backend()):
... | [
"logging.getLogger",
"timescale.db.backends.postgis.base_impl.backend"
] | [((246, 273), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (263, 273), False, 'import logging\n'), ((298, 317), 'timescale.db.backends.postgis.base_impl.backend', 'base_impl.backend', ([], {}), '()\n', (315, 317), False, 'from timescale.db.backends.postgis import base_impl\n')] |
'''
Function:
配置文件
'''
import os
'''字体'''
FONTPATH = os.path.join(os.getcwd(), 'G2/resources/font/font.ttf')
'''图片'''
BULLET_IMAGE_PATHS = {
'up': os.path.join(os.getcwd(), 'G2/resources/images/bullet/bullet_up.png'),
'down': os.path.join(os.getcwd(), 'G2/resources/images/bullet/bullet_down.png'),
... | [
"os.getcwd"
] | [((69, 80), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (78, 80), False, 'import os\n'), ((5308, 5319), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (5317, 5319), False, 'import os\n'), ((170, 181), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (179, 181), False, 'import os\n'), ((256, 267), 'os.getcwd', 'os.getcwd', ([],... |
from random import randint
import time
lista = []
jogos = []
tot = 1
print('-'* 30)
print(' Jogo da mega sena ')
print('-'* 30)
q = int(input('Quantos jogos voce quer que eu sorteie?:'))
while tot <= q:
cont = 0
while True:
num = randint(1, 60)
if num not in lista:
lista.appe... | [
"random.randint",
"time.sleep"
] | [((548, 561), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (558, 561), False, 'import time\n'), ((254, 268), 'random.randint', 'randint', (['(1)', '(60)'], {}), '(1, 60)\n', (261, 268), False, 'from random import randint\n')] |
from __future__ import unicode_literals
import datetime
from dateutil.parser import parse
from django.utils.six import string_types
from django.utils.timezone import pytz
def now_by_tz(tz='US/Central', ignoretz=True):
"""Gets the current datetime object by timezone.
:param tz: is the timezone to get the da... | [
"dateutil.parser.parse",
"datetime.datetime.now",
"django.utils.timezone.pytz.utc.localize",
"django.utils.timezone.pytz.timezone"
] | [((1104, 1129), 'datetime.datetime.now', 'datetime.datetime.now', (['tz'], {}), '(tz)\n', (1125, 1129), False, 'import datetime\n'), ((3006, 3027), 'django.utils.timezone.pytz.utc.localize', 'pytz.utc.localize', (['dt'], {}), '(dt)\n', (3023, 3027), False, 'from django.utils.timezone import pytz\n'), ((995, 1012), 'dja... |
r"""
Base class for polyhedra
"""
# ****************************************************************************
# Copyright (C) 2008 <NAME> <<EMAIL>>
# Copyright (C) 2011 <NAME> <<EMAIL>>
# Copyright (C) 2015 <NAME> <labbe at math.huji.ac.il>
# Copyright (C) 2020 <NAME> <<EMAIL>>
#
# This prog... | [
"sage.matrix.constructor.matrix",
"sage.misc.superseded.deprecated_function_alias",
"sage.geometry.polyhedron.library.polytopes.regular_polygon",
"sage.modules.vector_space_morphism.linear_transformation",
"sage.homology.simplicial_complex.SimplicialComplex",
"sage.rings.all.ZZ.one",
"sage.categories.se... | [((109177, 109206), 'sage.misc.all.cached_method', 'cached_method', ([], {'do_pickle': '(True)'}), '(do_pickle=True)\n', (109190, 109206), False, 'from sage.misc.all import cached_method, prod\n'), ((260000, 260029), 'sage.misc.all.cached_method', 'cached_method', ([], {'do_pickle': '(True)'}), '(do_pickle=True)\n', (2... |
"""Module containing models representing patients and their data.
The Model layer is responsible for the 'business logic' part of the software.
Patients' data is held in an inflammation table (2D array) where each row contains
inflammation data for a single patient taken over a number of days
and each column repres... | [
"numpy.mean",
"numpy.any",
"numpy.max",
"numpy.errstate",
"numpy.isnan",
"numpy.min",
"numpy.loadtxt"
] | [((511, 552), 'numpy.loadtxt', 'np.loadtxt', ([], {'fname': 'filename', 'delimiter': '""","""'}), "(fname=filename, delimiter=',')\n", (521, 552), True, 'import numpy as np\n'), ((735, 756), 'numpy.mean', 'np.mean', (['data'], {'axis': '(0)'}), '(data, axis=0)\n', (742, 756), True, 'import numpy as np\n'), ((928, 948),... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import sys
def debug_info(type, value, tb):
if hasattr(sys, "ps1") or not sys.stderr.isatty():
sys.__exc... | [
"traceback.print_exception",
"pdb.post_mortem",
"sys.__excepthook__",
"sys.stderr.isatty"
] | [((311, 346), 'sys.__excepthook__', 'sys.__excepthook__', (['type', 'value', 'tb'], {}), '(type, value, tb)\n', (329, 346), False, 'import sys\n'), ((410, 452), 'traceback.print_exception', 'traceback.print_exception', (['type', 'value', 'tb'], {}), '(type, value, tb)\n', (435, 452), False, 'import traceback\n'), ((475... |
from dataclasses import dataclass, field
from typing import List, Optional
from virtool_workflow.analysis.library_types import LibraryType
@dataclass
class Sample:
"""A Virtool Sample."""
#: The sample's unique database ID.
id: str
#: A user-selected name.
name: str
#: A user-selected host of... | [
"dataclasses.field"
] | [((928, 962), 'dataclasses.field', 'field', ([], {'default_factory': '(lambda : [])'}), '(default_factory=lambda : [])\n', (933, 962), False, 'from dataclasses import dataclass, field\n')] |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"tvm.call_intrin",
"tvm.const",
"tvm.ir_builder.create",
"tvm.var",
"tvm.ir_pass.VectorizeLoop"
] | [((852, 864), 'tvm.var', 'tvm.var', (['"""n"""'], {}), "('n')\n", (859, 864), False, 'import tvm\n'), ((874, 897), 'tvm.ir_builder.create', 'tvm.ir_builder.create', ([], {}), '()\n', (895, 897), False, 'import tvm\n'), ((1152, 1183), 'tvm.ir_pass.VectorizeLoop', 'tvm.ir_pass.VectorizeLoop', (['stmt'], {}), '(stmt)\n', ... |
# Copyright (c) 2012, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | [
"twisted.python.log.err",
"twisted.python.constants.NamedConstant",
"twisted.python.log.msg",
"twisted.protocols.policies.ProtocolWrapper.__init__",
"zope.interface.implementer",
"struct.pack",
"struct.unpack",
"twisted.protocols.policies.ProtocolWrapper.dataReceived",
"twisted.protocols.policies.Pr... | [((15634, 15677), 'zope.interface.implementer', 'implementer', (['IResource', 'IWebSocketsResource'], {}), '(IResource, IWebSocketsResource)\n', (15645, 15677), False, 'from zope.interface import implementer, Interface\n'), ((3765, 3780), 'twisted.python.constants.NamedConstant', 'NamedConstant', ([], {}), '()\n', (377... |
import numpy as np
# We create a rank 1 ndarray
x = np.array([1,2,3,4])
# We print x
print()
print('x = ', x)
# We apply different mathematical functions to all elements of x
print()
print('EXP(x) =', np.exp(x))
print()
print('SQRT(x) =',np.sqrt(x))
print()
print('POW(x,2) =',np.power(x,2)) # We raise all elements t... | [
"numpy.exp",
"numpy.array",
"numpy.sqrt",
"numpy.power"
] | [((53, 75), 'numpy.array', 'np.array', (['[1, 2, 3, 4]'], {}), '([1, 2, 3, 4])\n', (61, 75), True, 'import numpy as np\n'), ((204, 213), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (210, 213), True, 'import numpy as np\n'), ((241, 251), 'numpy.sqrt', 'np.sqrt', (['x'], {}), '(x)\n', (248, 251), True, 'import numpy as ... |
from js_reimpl_common import run_op_chapter1_chapter2
def run_op(keys, op, **kwargs):
return run_op_chapter1_chapter2("chapter1", None, keys, op, **kwargs)
def create_new(numbers):
return run_op(None, "create_new", array=numbers)
def create_new_broken(numbers):
return run_op(None, "create_new_broken",... | [
"js_reimpl_common.run_op_chapter1_chapter2"
] | [((99, 161), 'js_reimpl_common.run_op_chapter1_chapter2', 'run_op_chapter1_chapter2', (['"""chapter1"""', 'None', 'keys', 'op'], {}), "('chapter1', None, keys, op, **kwargs)\n", (123, 161), False, 'from js_reimpl_common import run_op_chapter1_chapter2\n')] |
from numpy.testing.utils import assert_equal, assert_raises
from nose import with_setup
from nose.plugins.attrib import attr
from brian2 import *
from brian2.devices.device import restore_device
@attr('standalone-compatible')
@with_setup(teardown=restore_device)
def test_poissoninput():
# Test extreme cases and d... | [
"nose.with_setup",
"numpy.testing.utils.assert_equal",
"nose.plugins.attrib.attr"
] | [((198, 227), 'nose.plugins.attrib.attr', 'attr', (['"""standalone-compatible"""'], {}), "('standalone-compatible')\n", (202, 227), False, 'from nose.plugins.attrib import attr\n'), ((229, 264), 'nose.with_setup', 'with_setup', ([], {'teardown': 'restore_device'}), '(teardown=restore_device)\n', (239, 264), False, 'fro... |
from sympy import *
from sympy.solvers.solveset import linsolve
p0 = Symbol("p0", real=True)
p1 = Symbol("p1", real=True)
p2 = Symbol("p2", real=True)
p3 = Symbol("p3", real=True)
p4 = Symbol("p4", real=True)
p5 = Symbol("p5", real=True)
m = {
1: sympify("1 - 2 * 9 ** (-n) + (162 / 43) * (11 / 81) ** n + (96 / 4... | [
"sympy.solvers.solveset.linsolve"
] | [((916, 961), 'sympy.solvers.solveset.linsolve', 'linsolve', (['equations', '(p0, p1, p2, p3, p4, p5)'], {}), '(equations, (p0, p1, p2, p3, p4, p5))\n', (924, 961), False, 'from sympy.solvers.solveset import linsolve\n')] |
from tespy.connections import connection
from tespy.components import source, sink, pipe
from tespy.networks import network
import numpy as np
from matplotlib import pyplot as plt
nw = network(['water'], p_unit='bar', T_unit='C', h_unit='kJ / kg')
# %% components
pi = pipe('pipe')
si = sink('sink')
so = source('sour... | [
"tespy.components.source",
"tespy.components.sink",
"numpy.linspace",
"tespy.components.pipe",
"tespy.networks.network",
"tespy.connections.connection"
] | [((187, 249), 'tespy.networks.network', 'network', (["['water']"], {'p_unit': '"""bar"""', 'T_unit': '"""C"""', 'h_unit': '"""kJ / kg"""'}), "(['water'], p_unit='bar', T_unit='C', h_unit='kJ / kg')\n", (194, 249), False, 'from tespy.networks import network\n'), ((272, 284), 'tespy.components.pipe', 'pipe', (['"""pipe""... |
# Copyright (c) 2017, The MITRE Corporation
# For license information, see the LICENSE.txt file
# This file has two purposes:
# 1. To provide a rough unit test of libtaxii.messages
# 2. To provide examples of how to use libtaxii.messages
import datetime
import io
import sys
import unittest
import warnings
import insp... | [
"libtaxii.messages_11.CollectionInformationResponse.CollectionInformation.PushMethod",
"libtaxii.messages_11.DiscoveryResponse.ServiceInstance",
"libtaxii.messages_11.ContentBlock.from_dict",
"libtaxii.messages_11.CollectionInformationRequest",
"libtaxii.messages_11.ContentBlock",
"libtaxii.messages_11.Co... | [((3389, 3522), 'libtaxii.taxii_default_query.Test', 'tdq.Test', ([], {'capability_id': 'CM_CORE', 'relationship': '"""equals"""', 'parameters': "{'value': 'Test value', 'match_type': 'case_sensitive_string'}"}), "(capability_id=CM_CORE, relationship='equals', parameters={'value':\n 'Test value', 'match_type': 'case... |
import RPi.GPIO as GPIO
import time
Buzzer = 11
CL = [0, 131, 147, 165, 175, 196, 211, 248]
CM = [0, 262, 294, 330, 350, 393, 441, 495]
CH = [0, 525, 589, 661, 700, 786, 882, 990]
song_1 = [ CM[3], CM[5], CM[6], CM[3], CM[2], CM[3], CM[5], CM[6],
CH[1], CM[6], CM[5], CM[1], CM[3], CM[2],... | [
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"RPi.GPIO.output",
"RPi.GPIO.setwarnings",
"time.sleep",
"RPi.GPIO.PWM",
"RPi.GPIO.setmode"
] | [((1371, 1394), 'RPi.GPIO.setwarnings', 'GPIO.setwarnings', (['(False)'], {}), '(False)\n', (1387, 1394), True, 'import RPi.GPIO as GPIO\n'), ((1399, 1423), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BOARD'], {}), '(GPIO.BOARD)\n', (1411, 1423), True, 'import RPi.GPIO as GPIO\n'), ((1436, 1464), 'RPi.GPIO.setup', 'GPI... |
import ctypes
import datetime
import struct
import os
#defines
EVERYTHING_REQUEST_FILE_NAME = 0x00000001
EVERYTHING_REQUEST_PATH = 0x00000002
EVERYTHING_REQUEST_FULL_PATH_AND_FILE_NAME = 0x00000004
EVERYTHING_REQUEST_EXTENSION = 0x00000008
EVERYTHING_REQUEST_SIZE = 0x00000010
EVERYTHING_REQUEST_DATE_CREATED = 0x000000... | [
"ctypes.POINTER",
"ctypes.create_unicode_buffer",
"datetime.datetime.fromtimestamp",
"datetime.datetime.strptime",
"os.path.splitext",
"ctypes.WinDLL",
"os.path.isfile",
"ctypes.wstring_at",
"ctypes.c_ulonglong",
"struct.unpack"
] | [((849, 916), 'ctypes.WinDLL', 'ctypes.WinDLL', (['"""C:\\\\SourceCode\\\\MyLauncher\\\\dlls\\\\Everything64.dll"""'], {}), "('C:\\\\SourceCode\\\\MyLauncher\\\\dlls\\\\Everything64.dll')\n", (862, 916), False, 'import ctypes\n'), ((991, 1025), 'ctypes.POINTER', 'ctypes.POINTER', (['ctypes.c_ulonglong'], {}), '(ctypes.... |
import threading
import time
import pytest
import brownie
def send_and_wait_for_tx():
tx = brownie.accounts[0].transfer(
brownie.accounts[1], "0.1 ether", required_confs=0, silent=True
)
tx.wait(2)
assert tx.confirmations >= 2
assert tx.status == 1
@pytest.fixture
def block_time_networ... | [
"threading.Thread",
"time.sleep"
] | [((1825, 1840), 'time.sleep', 'time.sleep', (['(1.5)'], {}), '(1.5)\n', (1835, 1840), False, 'import time\n'), ((2400, 2415), 'time.sleep', 'time.sleep', (['(3.5)'], {}), '(3.5)\n', (2410, 2415), False, 'import time\n'), ((2573, 2631), 'threading.Thread', 'threading.Thread', ([], {'target': 'send_and_wait_for_tx', 'dae... |
import torch
import torch.nn.functional as F
from torch import nn
from torch_geometric.data import Data # type: ignore
from torch_geometric.nn import GCNConv # type: ignore
class GCN(nn.Module):
def __init__(
self, hidden_channels: int, num_features: int, num_classes: int, dropout: float
) -> None:
... | [
"torch.nn.Dropout",
"torch_geometric.nn.GCNConv",
"torch.nn.functional.relu"
] | [((511, 530), 'torch.nn.Dropout', 'nn.Dropout', (['dropout'], {}), '(dropout)\n', (521, 530), False, 'from torch import nn\n'), ((976, 985), 'torch.nn.functional.relu', 'F.relu', (['x'], {}), '(x)\n', (982, 985), True, 'import torch.nn.functional as F\n'), ((368, 406), 'torch_geometric.nn.GCNConv', 'GCNConv', (['num_fe... |
import pygame as pg
import sys
from collision import *
SCREENSIZE = (500,500)
screen = pg.display.set_mode(SCREENSIZE, pg.DOUBLEBUF|pg.HWACCEL)
v = Vector
p0 = Concave_Poly(v(0,0), [v(-80,0), v(-20,20), v(0,80), v(20,20), v(80,0), v(20,-20), v(0,-80), v(-20,-20)])
p1 = Concave_Poly(v(500,500), [v(-80,0), v(-20,20)... | [
"pygame.draw.polygon",
"sys.exit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.time.Clock"
] | [((89, 147), 'pygame.display.set_mode', 'pg.display.set_mode', (['SCREENSIZE', '(pg.DOUBLEBUF | pg.HWACCEL)'], {}), '(SCREENSIZE, pg.DOUBLEBUF | pg.HWACCEL)\n', (108, 147), True, 'import pygame as pg\n'), ((394, 409), 'pygame.time.Clock', 'pg.time.Clock', ([], {}), '()\n', (407, 409), True, 'import pygame as pg\n'), ((... |
# Generated by Django 3.1.1 on 2020-10-22 19:24
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | [
"django.db.models.OneToOneField",
"django.db.models.UUIDField",
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((259, 316), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (290, 316), False, 'from django.db import migrations, models\n'), ((453, 504), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)'... |
#!/usr/bin/env python
import requests
def request(url):
try:
return requests.get("http://" + url)
except requests.exceptions.ConnectionError:
pass
target_url = input("Enter a website URL link: ")
with open("wordlist1","r") as wordlist_file:
for line in wordlist_file:
word = line... | [
"requests.get"
] | [((83, 112), 'requests.get', 'requests.get', (["('http://' + url)"], {}), "('http://' + url)\n", (95, 112), False, 'import requests\n')] |
# Generated by Django 3.1.2 on 2020-11-28 19:53
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipients', '0025_remove_delivery_container_delivery'),
]
operations = [
migrations.AddField(
model_name='deliv... | [
"datetime.date"
] | [((394, 421), 'datetime.date', 'datetime.date', (['(2020)', '(11)', '(28)'], {}), '(2020, 11, 28)\n', (407, 421), False, 'import datetime\n')] |
import random
import torch
import numpy as np
from torch_geometric.utils import degree, to_undirected
def negative_sampling(edge_index, num_nodes=None, num_neg_samples=None,
force_undirected=False):
num_neg_samples = num_neg_samples or edge_index.size(1)
# Handle '|V|^2 - |E| < |E|' ... | [
"random.sample",
"torch.stack",
"numpy.isin"
] | [((597, 632), 'random.sample', 'random.sample', (['rng', 'num_neg_samples'], {}), '(rng, num_neg_samples)\n', (610, 632), False, 'import random\n'), ((1079, 1109), 'torch.stack', 'torch.stack', (['[row, col]'], {'dim': '(0)'}), '([row, col], dim=0)\n', (1090, 1109), False, 'import torch\n'), ((686, 704), 'numpy.isin', ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os,time,datetime,sys
import numpy as np
import dgcnn
import tensorflow as tf
def round_decimals(val,digits):
factor = float(np.power(10,digits))
return int(val * factor+0.5) / factor
def iteration_f... | [
"tensorflow.local_variables_initializer",
"dgcnn.trainval",
"sys.exit",
"numpy.mean",
"os.path.exists",
"tensorflow.Session",
"os.path.isdir",
"os.mkdir",
"tensorflow.ConfigProto",
"sys.stdout.flush",
"dgcnn.io_factory",
"sys.stderr.write",
"tensorflow.summary.FileWriter",
"time.time",
"... | [((434, 457), 'dgcnn.io_factory', 'dgcnn.io_factory', (['flags'], {}), '(flags)\n', (450, 457), False, 'import dgcnn\n'), ((1547, 1570), 'dgcnn.io_factory', 'dgcnn.io_factory', (['flags'], {}), '(flags)\n', (1563, 1570), False, 'import dgcnn\n'), ((1750, 1771), 'dgcnn.trainval', 'dgcnn.trainval', (['flags'], {}), '(fla... |
import os
from shutil import copyfile
import lxml.etree as etree
os.chdir("../")
operating_system = 'Linux'
target_level_path = '../level_variations/generated_levels/fourth generation'
origin_level_path = '../buildgame/{}/9001_Data/StreamingAssets/Levels/novelty_level_1/type1/Levels/'.format(operating_system)
game_lev... | [
"os.listdir",
"lxml.etree.SubElement",
"lxml.etree.parse",
"os.path.join",
"os.chdir",
"shutil.copyfile",
"lxml.etree.XMLParser"
] | [((66, 81), 'os.chdir', 'os.chdir', (['"""../"""'], {}), "('../')\n", (74, 81), False, 'import os\n'), ((547, 576), 'os.listdir', 'os.listdir', (['target_level_path'], {}), '(target_level_path)\n', (557, 576), False, 'import os\n'), ((640, 669), 'os.listdir', 'os.listdir', (['origin_level_path'], {}), '(origin_level_pa... |
"""Main routines for interacting with an Apple TV."""
import asyncio
from copy import deepcopy
import datetime # noqa
from functools import partial
from ipaddress import IPv4Address
import logging
from typing import List, Optional, Set, Union
import aiohttp
from pyatv import exceptions, interface
from pyatv.const i... | [
"logging.getLogger",
"pyatv.protocols.PROTOCOLS.get",
"ipaddress.IPv4Address",
"pyatv.core.scan.MulticastMdnsScanner",
"functools.partial",
"pyatv.support.http.create_session",
"copy.deepcopy",
"pyatv.exceptions.NoServiceError",
"pyatv.exceptions.DeviceIdMissingError",
"pyatv.protocols.PROTOCOLS.i... | [((541, 568), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (558, 568), False, 'import logging\n'), ((1511, 1528), 'pyatv.protocols.PROTOCOLS.items', 'PROTOCOLS.items', ([], {}), '()\n', (1526, 1528), False, 'from pyatv.protocols import PROTOCOLS\n'), ((2550, 2566), 'copy.deepcopy', 'dee... |
from __future__ import with_statement
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import six
six_classifiers = [
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Intended Audience :: Developers',
'License :: OSI Approved... | [
"distutils.core.setup"
] | [((487, 781), 'distutils.core.setup', 'setup', ([], {'name': '"""six"""', 'version': 'six.__version__', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""http://pypi.python.org/pypi/six/"""', 'py_modules': "['six']", 'description': '"""Python 2 and 3 compatibility utilities"""', 'long_description': ... |
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
NAME = "energyusage"
VERSION = "0.0.13"
DESCRIPTION = "Measuring the environmental impact of computation"
LONG_DESCRIPTION = long_description
LONG_DESCRIPTION_CONTENT_TYPE = 'text/markdown'
URL = "https:/... | [
"setuptools.setup"
] | [((883, 1309), 'setuptools.setup', 'setup', ([], {'name': 'NAME', 'version': 'VERSION', 'description': 'DESCRIPTION', 'long_description': 'LONG_DESCRIPTION', 'long_description_content_type': 'LONG_DESCRIPTION_CONTENT_TYPE', 'url': 'URL', 'author': 'AUTHOR', 'author_email': 'AUTHOR_EMAIL', 'license': 'LICENSE', 'classif... |
#!/usr/bin/env python
#
# Author: <NAME> <<EMAIL>>
#
'''
Some hacky functions
'''
import os, sys
import imp
import tempfile
import shutil
import functools
import itertools
import math
import ctypes
import numpy
import h5py
from pyscf.lib import param
c_double_p = ctypes.POINTER(ctypes.c_double)
c_int_p = ctypes.POIN... | [
"sys.platform.startswith",
"multiprocessing.cpu_count",
"os.fsync",
"numpy.array",
"imp.lock_held",
"itertools.izip",
"numpy.ctypeslib.load_library",
"threading.Thread.join",
"numpy.arange",
"os.remove",
"threading.Thread.__init__",
"os.dup",
"itertools.chain.from_iterable",
"numpy.ctypesl... | [((267, 298), 'ctypes.POINTER', 'ctypes.POINTER', (['ctypes.c_double'], {}), '(ctypes.c_double)\n', (281, 298), False, 'import ctypes\n'), ((309, 337), 'ctypes.POINTER', 'ctypes.POINTER', (['ctypes.c_int'], {}), '(ctypes.c_int)\n', (323, 337), False, 'import ctypes\n'), ((351, 382), 'ctypes.POINTER', 'ctypes.POINTER', ... |
import re
import os
import json
from flask import request, jsonify, render_template, redirect
from app import app, mail, db
from app.models import Subscribers, MJMAlerts, PhishJamsQueue
from app.celery_tasks import celery_functions
from flask_mail import Message
from app.forms import UnsubscribeEmail
from app.api_tas... | [
"app.api_tasks.phishin_api.PhishINAPI",
"flask.render_template",
"app.db.session.commit",
"app.api_tasks.phishnet_api.get_random_jamchart",
"app.forms.UnsubscribeEmail",
"app.models.Subscribers",
"app.models.PhishJamsQueue.query.all",
"app.db.session.add",
"flask.jsonify",
"os.path.exists",
"app... | [((372, 398), 'app.api_tasks.phishnet_api.PhishNetAPI', 'phishnet_api.PhishNetAPI', ([], {}), '()\n', (396, 398), False, 'from app.api_tasks import phishnet_api, phishin_api\n'), ((413, 437), 'app.api_tasks.phishin_api.PhishINAPI', 'phishin_api.PhishINAPI', ([], {}), '()\n', (435, 437), False, 'from app.api_tasks impor... |
import torch
from transformers import GPT2Tokenizer, GPT2LMHeadModel
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
model = GPT2LMHeadModel.from_pretrained('gpt2')
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
prompt_text = """
It was a dark and stormy night.
Dark black crows fluttered from... | [
"transformers.GPT2Tokenizer.from_pretrained",
"torch.cuda.is_available",
"transformers.GPT2LMHeadModel.from_pretrained"
] | [((82, 119), 'transformers.GPT2Tokenizer.from_pretrained', 'GPT2Tokenizer.from_pretrained', (['"""gpt2"""'], {}), "('gpt2')\n", (111, 119), False, 'from transformers import GPT2Tokenizer, GPT2LMHeadModel\n'), ((128, 167), 'transformers.GPT2LMHeadModel.from_pretrained', 'GPT2LMHeadModel.from_pretrained', (['"""gpt2"""']... |
from unittest import TestCase
from tapiriik.services.devices import Device
from tapiriik.services.Decathlon.decathlon import DecathlonService
class StdDeviceTest(TestCase):
def test_fit_manufacturer_with_no_fit_device_return_provided_manufacturer_none_product(self):
undefined_fit_device_and_decathlon_fit_... | [
"tapiriik.services.Decathlon.decathlon.DecathlonService.convertStdDeviceToHubDevice"
] | [((838, 951), 'tapiriik.services.Decathlon.decathlon.DecathlonService.convertStdDeviceToHubDevice', 'DecathlonService.convertStdDeviceToHubDevice', (['undefined_fit_device_and_decathlon_fit_manufacturer_std_device'], {}), '(\n undefined_fit_device_and_decathlon_fit_manufacturer_std_device)\n', (882, 951), False, 'fr... |
import math
import torch
class GeometryLoss:
def __init__(self, pathObj, xyalign=True, parallel=True, smooth_node=True):
self.pathObj = pathObj
self.pathId = pathObj.id
self.get_segments(pathObj)
if xyalign:
self.make_hor_ver_constraints(pathObj)
se... | [
"torch.tensor",
"torch.zeros",
"torch.stack",
"math.atan2"
] | [((1381, 1409), 'torch.stack', 'torch.stack', (['(-t1[1], t1[0])'], {}), '((-t1[1], t1[0]))\n', (1392, 1409), False, 'import torch\n'), ((8700, 8717), 'torch.tensor', 'torch.tensor', (['(0.0)'], {}), '(0.0)\n', (8712, 8717), False, 'import torch\n'), ((6298, 6324), 'math.atan2', 'math.atan2', (['dif[1]', 'dif[0]'], {})... |
import logging
import os
import sys
import pandas as pd
import torch
class Batch_evaluate:
'''
A class to evaluate a function by several batches to save memory.
Sometimes out=func(x) requires a large memory to compute, this class devide x into several batches and combine the outputs.
'''
def __i... | [
"logging.getLogger",
"torch.unique",
"logging.StreamHandler",
"os.path.join",
"torch.cat"
] | [((1822, 1849), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1839, 1849), False, 'import logging\n'), ((2087, 2120), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (2108, 2120), False, 'import logging\n'), ((2913, 2961), 'torch.unique', 'torch... |
import torch
import torch.nn.functional as F
def compas_robustness_loss(x, aggregates, concepts, relevances):
"""Computes Robustness Loss for the Compas data
Formulated by Alvarez-Melis & Jaakkola (2018)
[https://papers.nips.cc/paper/8003-towards-robust-interpretability-with-self-explaining-neural-ne... | [
"torch.abs",
"torch.tensor",
"torch.autograd.grad",
"torch.bmm",
"torch.zeros",
"torch.cat",
"torch.ones"
] | [((3383, 3410), 'torch.cat', 'torch.cat', (['jacobians'], {'dim': '(2)'}), '(jacobians, dim=2)\n', (3392, 3410), False, 'import torch\n'), ((3927, 3954), 'torch.cat', 'torch.cat', (['jacobians'], {'dim': '(2)'}), '(jacobians, dim=2)\n', (3936, 3954), False, 'import torch\n'), ((6775, 6790), 'torch.tensor', 'torch.tenso... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from math import ceil
from typing import Optional, Tuple, Type, cast
from ax.core.parameter import Choi... | [
"ax.utils.common.logger.get_logger",
"math.ceil",
"typing.cast"
] | [((740, 760), 'ax.utils.common.logger.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (750, 760), False, 'from ax.utils.common.logger import get_logger\n'), ((1260, 1278), 'math.ceil', 'ceil', (['(num_arms / 2)'], {}), '(num_arms / 2)\n', (1264, 1278), False, 'from math import ceil\n'), ((2778, 2796), 'm... |
from django import template
import datetime
register = template.Library()
@register.filter
def l2l_dt(now):
if isinstance(now, datetime.datetime):
return now.strftime("%Y-%m-%d %H:%M:%S")
elif isinstance(now, str):
return now.replace("T", " ")
else:
return now
| [
"django.template.Library"
] | [((56, 74), 'django.template.Library', 'template.Library', ([], {}), '()\n', (72, 74), False, 'from django import template\n')] |
# encoding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from datetime import datetime
import math
import time
import tensorflow.python.platform
from tensorflow.python.platform import gfile
import numpy as np
import tensorflow as tf
import cnn_tin... | [
"cnn_tiny_model.inference",
"time.sleep",
"tensorflow.app.run",
"tensorflow.Graph",
"tensorflow.train.Coordinator",
"tensorflow.Session",
"tensorflow.nn.in_top_k",
"tensorflow.trainable_variables",
"tensorflow.get_default_graph",
"tensorflow.train.SummaryWriter",
"tensorflow.train.get_checkpoint... | [((3269, 3281), 'tensorflow.app.run', 'tf.app.run', ([], {}), '()\n', (3279, 3281), True, 'import tensorflow as tf\n'), ((522, 534), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (532, 534), True, 'import tensorflow as tf\n'), ((559, 610), 'tensorflow.train.get_checkpoint_state', 'tf.train.get_checkpoint_state'... |