code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Hass.io Add-on EP-Solar MPPT Tracer MT-5 to MQTT bridge.
This will read a UART serial port connected to a solar charger from EP-Solar,
and pass the values to mqtt.
Author: <NAME> <<EMAIL>>
"""
import json
import logging
import sys
import serial
import time
from urllib.pa... | [
"logging.getLogger",
"logging.StreamHandler",
"urllib.parse.urlparse",
"logging.Formatter",
"paho.mqtt.client.Client",
"json.dumps",
"time.sleep",
"sys.exit",
"json.load",
"time.time"
] | [((385, 412), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (402, 412), False, 'import logging\n'), ((716, 749), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (737, 749), False, 'import logging\n'), ((797, 870), 'logging.Formatter', 'logging.Fo... |
# Copyright 2019 Google LLC. 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 law or a... | [
"tfx.utils.channel.as_channel",
"tfx.utils.types.TfxType",
"tfx.utils.channel.Channel"
] | [((2228, 2256), 'tfx.utils.channel.as_channel', 'channel.as_channel', (['examples'], {}), '(examples)\n', (2246, 2256), False, 'from tfx.utils import channel\n'), ((2275, 2300), 'tfx.utils.channel.as_channel', 'channel.as_channel', (['model'], {}), '(model)\n', (2293, 2300), False, 'from tfx.utils import channel\n'), (... |
import os
from operator import itemgetter
from flask import Flask, jsonify, request
from flask_cors import CORS
from dotenv import load_dotenv, find_dotenv
import telebot
from clickhouse_driver import connect
from model import db, init_db, Alarms, Logs, Settings, Telegram
nodes = {"ns=2;i=9": "pressure"... | [
"model.Settings.query.all",
"flask_cors.CORS",
"flask.Flask",
"model.db.session.commit",
"clickhouse_driver.connect",
"model.db.session.add",
"model.Alarms.query.all",
"model.Logs.query.all",
"operator.itemgetter",
"model.Telegram",
"model.Settings.query.get",
"flask.jsonify",
"flask.request... | [((572, 587), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (577, 587), False, 'from flask import Flask, jsonify, request\n'), ((633, 686), 'flask_cors.CORS', 'CORS', (['application'], {'resources': "{'/*': {'origins': '*'}}"}), "(application, resources={'/*': {'origins': '*'}})\n", (637, 686), False, 'fr... |
from typer import Argument
def check_env(
cmd: str = Argument(metavar="cmd", default=..., help="command name to check",)
):
"""Check the environemnt is okay"""
| [
"typer.Argument"
] | [((59, 125), 'typer.Argument', 'Argument', ([], {'metavar': '"""cmd"""', 'default': '...', 'help': '"""command name to check"""'}), "(metavar='cmd', default=..., help='command name to check')\n", (67, 125), False, 'from typer import Argument\n')] |
import pandas
import time
from sklearn import model_selection
from mini_projects.cat_in_the_dat.citd_constants import TRAINING_DATA_FOLDS, \
TRAINING_DATA
def create_folds():
data_frame = pandas.read_csv(TRAINING_DATA)
data_frame["kfold"] = -1
data_frame = data_frame.sample(frac=1).reset_index(drop=... | [
"sklearn.model_selection.StratifiedKFold",
"time.strftime",
"time.time",
"pandas.read_csv"
] | [((760, 771), 'time.time', 'time.time', ([], {}), '()\n', (769, 771), False, 'import time\n'), ((785, 796), 'time.time', 'time.time', ([], {}), '()\n', (794, 796), False, 'import time\n'), ((199, 229), 'pandas.read_csv', 'pandas.read_csv', (['TRAINING_DATA'], {}), '(TRAINING_DATA)\n', (214, 229), False, 'import pandas\... |
import json
from django.db import models
from django.contrib.auth.models import User, Group
from channels import Group as Channel_Group
from django.shortcuts import get_object_or_404
import os
from django.forms import ModelForm
from django import forms
import binascii
# Create your models here.
class Token(models.Mod... | [
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"os.urandom",
"django.db.models.FileField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((336, 359), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {}), '(User)\n', (353, 359), False, 'from django.db import models\n'), ((372, 421), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(40)', 'primary_key': '(True)'}), '(max_length=40, primary_key=True)\n', (388, 421), Fal... |
""" Interpreter-level implementation of structure, exposing ll-structure
to app-level with apropriate interface
"""
from pypy.interpreter.baseobjspace import W_Root, Wrappable
from pypy.interpreter.gateway import interp2app, ObjSpace
from pypy.interpreter.typedef import interp_attrproperty
from pypy.interpreter.argum... | [
"pypy.rpython.lltypesystem.rffi.CArray",
"pypy.interpreter.typedef.GetSetProperty",
"pypy.rpython.lltypesystem.lltype.typeOf",
"pypy.module._rawffi.interp_rawffi.W_DataInstance.__init__",
"pypy.module._rawffi.interp_rawffi.wrap_value",
"pypy.rlib.libffi.make_struct_ffitype",
"pypy.interpreter.typedef.in... | [((4050, 4086), 'pypy.rpython.lltypesystem.lltype.nullptr', 'lltype.nullptr', (['libffi.FFI_TYPE_P.TO'], {}), '(libffi.FFI_TYPE_P.TO)\n', (4064, 4086), False, 'from pypy.rpython.lltypesystem import lltype, rffi\n'), ((5495, 5552), 'pypy.rpython.lltypesystem.rffi.ptradd', 'rffi.ptradd', (['self.ll_buffer', 'self.shape.l... |
from . import config
import sys, os
from .genelist import genelist as genelist_object
from .location import location
class tfbs_iter:
def __init__(self, filename):
self.oh = open(filename)
def __iter__(self):
"""
This will output a tfbs_iter object
that behaves as a list of ... | [
"os.path.exists",
"os.path.join"
] | [((2544, 2564), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (2558, 2564), False, 'import sys, os\n'), ((3103, 3136), 'os.path.join', 'os.path.join', (['self.path', 'filename'], {}), '(self.path, filename)\n', (3115, 3136), False, 'import sys, os\n'), ((6435, 6521), 'os.path.join', 'os.path.join', ([... |
from setuptools import find_packages, setup
setup(name = 'boids',
version = '1.0.0',
description = '',
author = '<NAME>',
author_email = '<EMAIL>',
maintainer = '<NAME>',
maintainer_email = '<EMAIL>',
url = 'https://github.com/stiebels/',
packages = find_packages(exclude=['*test']),
... | [
"setuptools.find_packages"
] | [((284, 316), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['*test']"}), "(exclude=['*test'])\n", (297, 316), False, 'from setuptools import find_packages, setup\n')] |
# Copyright (c) 2014-2017 <NAME>
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#!/usr/bin/python
import optparse
import itertools
from io import StringIO
import csv
import os
import re
import glob
import math
... | [
"os.path.splitext",
"csv.reader",
"os.getcwd"
] | [((411, 422), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (420, 422), False, 'import os\n'), ((1040, 1065), 'os.path.splitext', 'os.path.splitext', (['csvfile'], {}), '(csvfile)\n', (1056, 1065), False, 'import os\n'), ((1267, 1281), 'csv.reader', 'csv.reader', (['io'], {}), '(io)\n', (1277, 1281), False, 'import csv\n... |
from PIL import Image
import pytesseract
import sys
from pdf2image import convert_from_path
import os
DATASET_DIR = "../../adil-dataset"
TXT_DIR = os.path.join(DATASET_DIR, "txt")
if os.path.exists(TXT_DIR):
print("Folder already exist")
else:
os.mkdir(TXT_DIR)
print("Txt folder created")
for filename in... | [
"os.path.exists",
"os.listdir",
"PIL.Image.open",
"os.path.join",
"os.mkdir",
"os.path.basename",
"pdf2image.convert_from_path"
] | [((148, 180), 'os.path.join', 'os.path.join', (['DATASET_DIR', '"""txt"""'], {}), "(DATASET_DIR, 'txt')\n", (160, 180), False, 'import os\n'), ((185, 208), 'os.path.exists', 'os.path.exists', (['TXT_DIR'], {}), '(TXT_DIR)\n', (199, 208), False, 'import os\n'), ((321, 344), 'os.listdir', 'os.listdir', (['DATASET_DIR'], ... |
import json
import re
from pathlib import Path
from time import sleep
from urllib.parse import urljoin
from urllib.parse import urlparse
from zipfile import ZipFile
from bs4 import BeautifulSoup
from onesecmail import OneSecMail
from onesecmail.validators import FromAddressValidator
from requests import HTTPError
fro... | [
"urllib.parse.urlparse",
"zipfile.ZipFile",
"pathlib.Path",
"re.compile",
"bandcamper.requests.requester.Requester",
"time.sleep",
"bs4.BeautifulSoup",
"onesecmail.validators.FromAddressValidator",
"bandcamper.utils.get_random_filename_template",
"bandcamper.metadata.utils.get_track_output_context... | [((1142, 1202), 're.compile', 're.compile', (['_BANDCAMP_SUBDOMAIN_PATTERN'], {'flags': 're.IGNORECASE'}), '(_BANDCAMP_SUBDOMAIN_PATTERN, flags=re.IGNORECASE)\n', (1152, 1202), False, 'import re\n'), ((1242, 1344), 're.compile', 're.compile', (["('(?:www\\\\.)?' + _BANDCAMP_SUBDOMAIN_PATTERN + '\\\\.bandcamp\\\\.com')"... |
import post_rec
from post_rec.tokenizers import get_tokenizer
from post_rec.alphaservices.HTTPServers.flask_http import AlphaHTTPProxy
from onmt.translate.translation_server import ServerModelError
from flask import jsonify
from post_rec.Utility import getLogger
logger=getLogger(__name__)
STATUS_ERROR = "error"
class... | [
"flask.jsonify",
"post_rec.alphaservices.HTTPServers.flask_http.AlphaHTTPProxy.__init__",
"post_rec.Utility.getLogger",
"post_rec.tokenizers.get_tokenizer"
] | [((271, 290), 'post_rec.Utility.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (280, 290), False, 'from post_rec.Utility import getLogger\n'), ((402, 444), 'post_rec.alphaservices.HTTPServers.flask_http.AlphaHTTPProxy.__init__', 'AlphaHTTPProxy.__init__', (['self', 'config_file'], {}), '(self, config_file... |
import argparse
import csv
import glob
import os
import sys
import time
from datetime import datetime
from pathlib import Path
try:
import streamlit as st
except ModuleNotFoundError:
pass
import torch
import torchvision
import yaml
from omegaconf import OmegaConf
from specvqgan.util import get_ckpt_path
sys... | [
"sys.path.insert",
"streamlit.video",
"streamlit.button",
"specvqgan.util.get_ckpt_path",
"yaml.load",
"soundfile.write",
"streamlit.audio",
"torch.nn.functional.pad",
"streamlit.sidebar.number_input",
"streamlit.header",
"torch.nn.functional.softmax",
"torch.arange",
"os.remove",
"os.path... | [((317, 340), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""."""'], {}), "(0, '.')\n", (332, 340), False, 'import sys\n'), ((640, 665), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (663, 665), False, 'import argparse\n'), ((4989, 5020), 'train.instantiate_from_config', 'instantiate_from_... |
import os
import time
import socket
import random
import tensorflow as tf
from tensorflow.contrib.layers.python import layers as tf_layers
from tensorflow.python.platform import flags
# NOTE: this script is based on https://github.com/cbfinn/maml/blob/master/utils.py
FLAGS = flags.FLAGS
## Image helper
def get_im... | [
"subprocess.check_output",
"random.sample",
"os.listdir",
"random.shuffle",
"time.strftime",
"os.path.join",
"tensorflow.clip_by_value",
"socket.gethostname"
] | [((807, 851), 'tensorflow.clip_by_value', 'tf.clip_by_value', (['grad', 'min_value', 'max_value'], {}), '(grad, min_value, max_value)\n', (823, 851), True, 'import tensorflow as tf\n'), ((1814, 1844), 'time.strftime', 'time.strftime', (['"""%y%m%d_%H%M%S"""'], {}), "('%y%m%d_%H%M%S')\n", (1827, 1844), False, 'import ti... |
from __future__ import division
import os
import time
from shutil import copyfile
from glob import glob
import tensorflow as tf
import numpy as np
# import config
from collections import namedtuple
# from module import *
# from utils import *
# from ops import *
# from metrics import *
import tensorflow_addons as tfa
i... | [
"tensorflow.pad",
"numpy.random.rand",
"numpy.array",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.models.load_model",
"numpy.save",
"matplotlib.pyplot.imshow",
"numpy.mean",
"os.listdir",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.Sequential",
"numpy.asarray",
"numpy.max",
... | [((23309, 23337), 'os.listdir', 'os.listdir', (['directory_path_A'], {}), '(directory_path_A)\n', (23319, 23337), False, 'import os\n'), ((23818, 23846), 'os.listdir', 'os.listdir', (['directory_path_B'], {}), '(directory_path_B)\n', (23828, 23846), False, 'import os\n'), ((25643, 25687), 'os.path.join', 'os.path.join'... |
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# s.bind((socket.gethostname(), nomor port bebas asal tidak kurang dari 1234))
s.bind((socket.gethostname(), 2000))
# s.listen(respon max jika terlalu banyak request yang menumpuk)
s.listen(5)
while True:
clientsocket, address = s.accept()
pr... | [
"socket.gethostname",
"socket.socket"
] | [((19, 68), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (32, 68), False, 'import socket\n'), ((156, 176), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (174, 176), False, 'import socket\n')] |
from __future__ import annotations
import ast
import builtins
import gettext
import json
import os
import re
from functools import cache
from pathlib import Path
from textwrap import indent
import asttokens.util
from asttokens import ASTTokens
from core.runner.utils import is_valid_syntax
translation: gettext.GNUTr... | [
"core.utils.clean_spaces",
"json.loads",
"ast.walk",
"core.runner.utils.is_valid_syntax",
"textwrap.indent",
"pathlib.Path",
"ast.parse",
"ast.get_source_segment",
"os.environ.get",
"re.match",
"asttokens.ASTTokens",
"re.sub",
"re.findall",
"re.search"
] | [((586, 609), 'json.loads', 'json.loads', (['code_blocks'], {}), '(code_blocks)\n', (596, 609), False, 'import json\n'), ((1465, 1501), 'os.environ.get', 'os.environ.get', (['"""CHECK_INLINE_CODES"""'], {}), "('CHECK_INLINE_CODES')\n", (1479, 1501), False, 'import os\n'), ((2146, 2187), 're.sub', 're.sub', (['"""__code... |
#!/usr/bin/env python
import argparse
import json
import os.path as path
import sys
parser = argparse.ArgumentParser()
parser.add_argument('destination')
args = parser.parse_args()
classes = json.load(sys.stdin)
module = args.destination[len('src/'):-len('.elm')].replace('/', '.')
class_ = module.split('.')[-1]
if ... | [
"json.load",
"argparse.ArgumentParser",
"sys.exit"
] | [((94, 119), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (117, 119), False, 'import argparse\n'), ((193, 213), 'json.load', 'json.load', (['sys.stdin'], {}), '(sys.stdin)\n', (202, 213), False, 'import json\n'), ((394, 405), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (402, 405), False, ... |
# Copyright 2016-2020 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
# ReFrame Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
import os
import reframe as rfm
import reframe.utility.sanity as sn
@rfm.parameterized_test(['Cuda'], ['C++'], ['F90'])
cla... | [
"reframe.run_before",
"os.path.join",
"reframe.utility.sanity.assert_found",
"reframe.parameterized_test",
"reframe.utility.sanity.extractsingle"
] | [((266, 316), 'reframe.parameterized_test', 'rfm.parameterized_test', (["['Cuda']", "['C++']", "['F90']"], {}), "(['Cuda'], ['C++'], ['F90'])\n", (288, 316), True, 'import reframe as rfm\n'), ((3673, 3698), 'reframe.run_before', 'rfm.run_before', (['"""compile"""'], {}), "('compile')\n", (3687, 3698), True, 'import ref... |
import random
from transformers import MT5Tokenizer
tokenizer = MT5Tokenizer.from_pretrained("google/mt5-small")
def masking(input_ids, masked):
EOS = 1
ID = 250099
c = 0
prev_index = None
for index in masked:
if prev_index == index - 1:
input_ids[index] = None
else:
... | [
"transformers.MT5Tokenizer.from_pretrained"
] | [((65, 113), 'transformers.MT5Tokenizer.from_pretrained', 'MT5Tokenizer.from_pretrained', (['"""google/mt5-small"""'], {}), "('google/mt5-small')\n", (93, 113), False, 'from transformers import MT5Tokenizer\n'), ((562, 610), 'transformers.MT5Tokenizer.from_pretrained', 'MT5Tokenizer.from_pretrained', (['"""google/mt5-s... |
import wave
import pyaudio
import io
from google.cloud import speech
from google.cloud import translate_v2 as translate
from google.cloud import texttospeech
import vlc
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 22050
CREDENTIALS_PATH = 'credentials.json'
def record_to_file(filename, player, seconds=5... | [
"wave.open",
"google.cloud.texttospeech.AudioConfig",
"google.cloud.speech.SpeechClient.from_service_account_json",
"google.cloud.translate_v2.Client.from_service_account_json",
"google.cloud.texttospeech.TextToSpeechClient.from_service_account_json",
"google.cloud.speech.RecognitionConfig",
"io.open",
... | [((916, 941), 'wave.open', 'wave.open', (['filename', '"""wb"""'], {}), "(filename, 'wb')\n", (925, 941), False, 'import wave\n'), ((1157, 1220), 'google.cloud.speech.SpeechClient.from_service_account_json', 'speech.SpeechClient.from_service_account_json', (['CREDENTIALS_PATH'], {}), '(CREDENTIALS_PATH)\n', (1202, 1220... |
print("""
/$$$$$$$ /$$ /$$ /$$$$$$$ /$$$$$$$ /$$$$$$$$
| $$__ $$ | $$ /$ | $$| $$__ $$| $$__ $$| $$_____/
| $$ \ $$ | $$ /$$$| $$| $$ \ $$| $$ \ $$| $$
| $$$$$$$/ /$$$$$$| $$/$$ $$ $$| $$$$$$$/| $$$$$$$ | $$$$$
| $$__ $$|______/| $$$$_ $$$$| $$____/ | $$__ $$| $$__/
... | [
"argparse.ArgumentParser",
"os.path.isfile",
"os.path.isdir",
"os.mkdir",
"sys.stdout.flush"
] | [((4030, 4048), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (4046, 4048), False, 'import os, sys, random, requests, concurrent.futures\n'), ((4756, 4772), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (4770, 4772), False, 'from argparse import ArgumentParser\n'), ((5212, 5244), 'os.path.i... |
#!/usr/bin/env python3
# Think of an HTML tag name as a class in Python
# Each individual tag is an instance
# HTML tables start with <td> tags
# Webscraping is a process that can be used to automatically extract information from a website
from bs4 import BeautifulSoup
# Store the webpage HTML as a string in the var... | [
"bs4.BeautifulSoup"
] | [((643, 674), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html5lib"""'], {}), "(html, 'html5lib')\n", (656, 674), False, 'from bs4 import BeautifulSoup\n'), ((1600, 1631), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html5lib"""'], {}), "(html, 'html5lib')\n", (1613, 1631), False, 'from bs4 import Beauti... |
# -*- coding: utf-8 -*-
"""The APFS container path specification resolver helper implementation."""
from dfvfs.lib import definitions
from dfvfs.resolver_helpers import manager
from dfvfs.resolver_helpers import resolver_helper
from dfvfs.vfs import apfs_container_file_system
class APFSContainerResolverHelper(resolv... | [
"dfvfs.vfs.apfs_container_file_system.APFSContainerFileSystem"
] | [((676, 744), 'dfvfs.vfs.apfs_container_file_system.APFSContainerFileSystem', 'apfs_container_file_system.APFSContainerFileSystem', (['resolver_context'], {}), '(resolver_context)\n', (726, 744), False, 'from dfvfs.vfs import apfs_container_file_system\n')] |
# Copyright 2016 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | [
"utils.confirm_packing_type",
"os.path.join",
"os.path.realpath",
"tempfile.NamedTemporaryFile",
"utils.gribs_match",
"utils.repack"
] | [((854, 892), 'os.path.join', 'path.join', (['DATA_DIR', '"""grid_simple.grb"""'], {}), "(DATA_DIR, 'grid_simple.grb')\n", (863, 892), False, 'from os import path\n'), ((924, 968), 'os.path.join', 'path.join', (['DATA_DIR', '"""grid_second_order.grb"""'], {}), "(DATA_DIR, 'grid_second_order.grb')\n", (933, 968), False,... |
import gc
from pprint import pprint
import weakref
from Test_CircularReference import Graph, demo, collect_and_show_garbage
gc.set_debug(gc.DEBUG_LEAK)
print('Setting up the cycle')
print()
demo(Graph)
print()
print('Breaking the cycle and cleaning up garbage')
print()
gc.garbage[0].set_next(None)#IndexError: list i... | [
"gc.set_debug",
"Test_CircularReference.demo",
"Test_CircularReference.collect_and_show_garbage"
] | [((125, 152), 'gc.set_debug', 'gc.set_debug', (['gc.DEBUG_LEAK'], {}), '(gc.DEBUG_LEAK)\n', (137, 152), False, 'import gc\n'), ((192, 203), 'Test_CircularReference.demo', 'demo', (['Graph'], {}), '(Graph)\n', (196, 203), False, 'from Test_CircularReference import Graph, demo, collect_and_show_garbage\n'), ((384, 410), ... |
import fitz
import random
from classes.Brief import get_my_brief
from utils.misc.get_file_name_from_path import get_file_name_from_path
from utils.upload.get_ocr_status import get_ocr_status
from utils.cases.get_name_of_case import get_name_of_case
def get_case_data_from_multiple_files(request, amount_of_brief_page... | [
"utils.upload.get_ocr_status.get_ocr_status",
"random.randrange",
"utils.cases.get_name_of_case.get_name_of_case",
"fitz.open",
"classes.Brief.get_my_brief",
"utils.misc.get_file_name_from_path.get_file_name_from_path"
] | [((1248, 1262), 'classes.Brief.get_my_brief', 'get_my_brief', ([], {}), '()\n', (1260, 1262), False, 'from classes.Brief import get_my_brief\n'), ((441, 461), 'fitz.open', 'fitz.open', (['case_path'], {}), '(case_path)\n', (450, 461), False, 'import fitz\n'), ((547, 572), 'utils.upload.get_ocr_status.get_ocr_status', '... |
from sacred import Ingredient
import os
import torch
from schnetpack.md.calculators import SchnetPackCalculator
from schnetpack.md.utils import MDUnits
calculator_ingradient = Ingredient('calculator')
@calculator_ingradient.config
def config():
"""configuration for the calculator ingredient"""
calculator = ... | [
"torch.load",
"os.path.join",
"os.path.isdir",
"sacred.Ingredient",
"schnetpack.md.calculators.SchnetPackCalculator"
] | [((178, 202), 'sacred.Ingredient', 'Ingredient', (['"""calculator"""'], {}), "('calculator')\n", (188, 202), False, 'from sacred import Ingredient\n'), ((643, 668), 'os.path.isdir', 'os.path.isdir', (['model_path'], {}), '(model_path)\n', (656, 668), False, 'import os\n'), ((691, 729), 'os.path.join', 'os.path.join', (... |
# nexss-compiler: blender --background -noaudio -E CYCLES
# Nexss PROGRAMMER - Blender/Python3
# Python 3.7
import platform
import json
import sys
import io
import os
from bpy import context
import bpy
from importlib import import_module
sys.path.append(os.getenv("NEXSS_PACKAGES_PATH") + "\\Nexss\\Lib\\")
import Blen... | [
"bpy.ops.object.editmode_toggle",
"json.loads",
"os.getenv",
"json.dumps",
"bpy.ops.mesh.primitive_plane_add",
"sys.stdin.read"
] | [((401, 417), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (415, 417), False, 'import sys\n'), ((432, 454), 'json.loads', 'json.loads', (['NexssStdin'], {}), '(NexssStdin)\n', (442, 454), False, 'import json\n'), ((980, 1066), 'bpy.ops.mesh.primitive_plane_add', 'bpy.ops.mesh.primitive_plane_add', ([], {'size'... |
from django.core.exceptions import ValidationError
from django.core.validators import URLValidator
def validate_url(value):
url_validator = URLValidator()
value_1_invalid = False
value_2_invalid = False
try:
url_validator(value)
except:
# value_1_invalid = True
# value_2_url = '... | [
"django.core.validators.URLValidator",
"django.core.exceptions.ValidationError"
] | [((145, 159), 'django.core.validators.URLValidator', 'URLValidator', ([], {}), '()\n', (157, 159), False, 'from django.core.validators import URLValidator\n'), ((492, 522), 'django.core.exceptions.ValidationError', 'ValidationError', (['"""Invalid URL"""'], {}), "('Invalid URL')\n", (507, 522), False, 'from django.core... |
#!/usr/bin/env python3
"""This plugin is used to check that db_write calls are working correctly.
"""
from lightning import Plugin, RpcError
import sqlite3
plugin = Plugin()
plugin.sqlite_pre_init_cmds = []
plugin.initted = False
@plugin.init()
def init(configuration, options, plugin):
if not plugin.get_option('... | [
"lightning.RpcError",
"lightning.Plugin"
] | [((166, 174), 'lightning.Plugin', 'Plugin', ([], {}), '()\n', (172, 174), False, 'from lightning import Plugin, RpcError\n'), ((348, 383), 'lightning.RpcError', 'RpcError', (['"""No dblog-file specified"""'], {}), "('No dblog-file specified')\n", (356, 383), False, 'from lightning import Plugin, RpcError\n')] |
from implementations import Graph
graph = Graph()
def check_word(source, target):
counter, i = 0, 0
while i < len(source) and i < len(target):
if source[i] is not target[i]:
counter += 1
i += 1
return counter
def build_vertice_in_graph(source, words):
arr = []
for wor... | [
"implementations.Graph"
] | [((42, 49), 'implementations.Graph', 'Graph', ([], {}), '()\n', (47, 49), False, 'from implementations import Graph\n')] |
import logging
from flask import Blueprint, jsonify, request
from flask_jwt_extended import (
jwt_required,
get_jwt_identity,
get_csrf_token,
current_user,
)
from flask_restplus import Api, Resource, Namespace
from ..errors import UserNotFoundError
from ..messaging import MessageHandler
from ..models.us... | [
"logging.getLogger",
"flask_restplus.Namespace",
"logging.error"
] | [((374, 401), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (391, 401), False, 'import logging\n'), ((413, 464), 'flask_restplus.Namespace', 'Namespace', (['"""users"""'], {'description': '"""Authorization API"""'}), "('users', description='Authorization API')\n", (422, 464), False, 'fro... |
#!/usr/bin/env python3
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# from tensor2tensor.bin import t2t_trainer
# from tensor2tensor.bin import t2t_decoder
import sys
sys.path.append('..')
sys.path.append('../model/')
#import tensorflow as tf
import ar... | [
"tensor2tensor.serving.serving_utils.make_grpc_request_fn",
"argparse.ArgumentParser",
"os.makedirs",
"subprocess.Popen",
"os.path.join",
"tensorflow.logging.set_verbosity",
"os.getcwd",
"os.path.isfile",
"tensor2tensor.utils.registry.problem",
"tensor2tensor.utils.usr_dir.import_usr_dir",
"sys.... | [((234, 255), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (249, 255), False, 'import sys\n'), ((256, 284), 'sys.path.append', 'sys.path.append', (['"""../model/"""'], {}), "('../model/')\n", (271, 284), False, 'import sys\n'), ((809, 933), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ... |
from django.urls import path
from rest_framework.routers import SimpleRouter
from .views import (
UserSignUpViewSet,
UserLoginViewSet,
UpdateUserViewSet,
PhotoUploadViewSet,
LocationViewSet,
AircraftViewSet,
FlightViewSet,
TicketViewSet,
index,
)
router = SimpleRouter()
router.re... | [
"rest_framework.routers.SimpleRouter",
"django.urls.path"
] | [((295, 309), 'rest_framework.routers.SimpleRouter', 'SimpleRouter', ([], {}), '()\n', (307, 309), False, 'from rest_framework.routers import SimpleRouter\n'), ((548, 576), 'django.urls.path', 'path', (['""""""', 'index'], {'name': '"""home"""'}), "('', index, name='home')\n", (552, 576), False, 'from django.urls impor... |
# Generated by Django 3.0.3 on 2020-03-22 22:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('stocks', '0019_auto_20200323_0458'),
]
operations = [
migrations.RemoveField(
model_name='stockin',
name='is_in',
),
... | [
"django.db.migrations.RemoveField"
] | [((225, 283), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""stockin"""', 'name': '"""is_in"""'}), "(model_name='stockin', name='is_in')\n", (247, 283), False, 'from django.db import migrations\n')] |
#-*- coding=utf-8 -*-
from settings import SERVER, DEBUG
from wechat.robot import wechat_server, debug_shell
if __name__ == "__main__":
if DEBUG:
debug_shell()
else:
wechat_server(server=SERVER["mode"], port=SERVER["port"])
| [
"wechat.robot.wechat_server",
"wechat.robot.debug_shell"
] | [((162, 175), 'wechat.robot.debug_shell', 'debug_shell', ([], {}), '()\n', (173, 175), False, 'from wechat.robot import wechat_server, debug_shell\n'), ((194, 251), 'wechat.robot.wechat_server', 'wechat_server', ([], {'server': "SERVER['mode']", 'port': "SERVER['port']"}), "(server=SERVER['mode'], port=SERVER['port'])\... |
import numpy as np
import matplotlib.pyplot as plt
import numpy.fft as nf
from dataset import data_load
feat = 'O3'
def plotfft(arr):
plt.subplot(2, 1, 1)
plt.plot(arr)
plt.subplot(2, 1, 2)
plt.ylim([0,400])
plt.xlim([0,300])
comp_arr = nf.fft(arr)
y2 = nf.ifft(comp_arr).real
freqs ... | [
"matplotlib.pyplot.grid",
"numpy.array",
"numpy.sin",
"matplotlib.pyplot.plot",
"numpy.fft.fft",
"numpy.linspace",
"matplotlib.pyplot.ylim",
"numpy.abs",
"matplotlib.pyplot.savefig",
"dataset.data_load",
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"numpy.fft.ifft",
"matplotlib.pyp... | [((141, 161), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(2)', '(1)', '(1)'], {}), '(2, 1, 1)\n', (152, 161), True, 'import matplotlib.pyplot as plt\n'), ((166, 179), 'matplotlib.pyplot.plot', 'plt.plot', (['arr'], {}), '(arr)\n', (174, 179), True, 'import matplotlib.pyplot as plt\n'), ((184, 204), 'matplotlib.pypl... |
# Copyright (c) 2018 <NAME> <http://www.stefan-marr.de/>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify,... | [
"os.path.exists",
"codecs.open",
"os.remove"
] | [((1555, 1596), 'os.path.exists', 'os.path.exists', (["(self._path + '/build.log')"], {}), "(self._path + '/build.log')\n", (1569, 1596), False, 'import os\n'), ((2825, 2866), 'os.path.exists', 'os.path.exists', (["(self._path + '/build.log')"], {}), "(self._path + '/build.log')\n", (2839, 2866), False, 'import os\n'),... |
from django.shortcuts import render
from .models import Project, TechnologyUsed
# Create your views here.
def Index(request):
o_Projects = Project.objects.all()
a_TechChoices = TechnologyUsed.TechnologyChoices
ctx = {
'o_Projects': o_Projects,
'a_TechChoices': a_TechChoices
}
... | [
"django.shortcuts.render"
] | [((328, 370), 'django.shortcuts.render', 'render', (['request', '"""ProjectsIndex.html"""', 'ctx'], {}), "(request, 'ProjectsIndex.html', ctx)\n", (334, 370), False, 'from django.shortcuts import render\n'), ((500, 543), 'django.shortcuts.render', 'render', (['request', '"""ProjectsDetail.html"""', 'ctx'], {}), "(reque... |
# -*- encoding: utf-8 -*-
#
# Copyright © 2017 Red Hat, Inc.
#
# 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 applica... | [
"subprocess.Popen"
] | [((817, 873), 'subprocess.Popen', 'subprocess.Popen', (["['gnocchi-config-generator']"], {'stdout': 'f'}), "(['gnocchi-config-generator'], stdout=f)\n", (833, 873), False, 'import subprocess\n')] |
import hydra
from hydra.core.config_store import ConfigStore
from omegaconf import OmegaConf
from configs import TrainConfig
from jerex import model, util
cs = ConfigStore.instance()
cs.store(name="train", node=TrainConfig)
@hydra.main(config_name='train', config_path='configs/docred_joint')
def train(cfg: TrainCon... | [
"hydra.main",
"omegaconf.OmegaConf.to_yaml",
"jerex.model.train",
"jerex.util.config_to_abs_paths",
"hydra.core.config_store.ConfigStore.instance"
] | [((162, 184), 'hydra.core.config_store.ConfigStore.instance', 'ConfigStore.instance', ([], {}), '()\n', (182, 184), False, 'from hydra.core.config_store import ConfigStore\n'), ((229, 296), 'hydra.main', 'hydra.main', ([], {'config_name': '"""train"""', 'config_path': '"""configs/docred_joint"""'}), "(config_name='trai... |
from __future__ import division
import numpy as np
import scipy.sparse as sp
import numpy.polynomial.legendre as leg
from scipy.linalg import lu
import scipy.interpolate as intpl
from pymg.collocation_base import CollBase
class CollGaussLegendre(CollBase):
"""
Implements Gauss-Legendre Quadrature by deriving... | [
"numpy.sqrt",
"numpy.linalg.eig",
"numpy.roll",
"scipy.interpolate.splint",
"numpy.diag",
"numpy.argsort",
"numpy.linalg.eigvals",
"numpy.linspace",
"numpy.zeros",
"numpy.array",
"numpy.append",
"numpy.concatenate",
"scipy.sparse.spdiags"
] | [((2538, 2566), 'numpy.linspace', 'np.linspace', (['(1)', '(M - 1)', '(M - 1)'], {}), '(1, M - 1, M - 1)\n', (2549, 2566), True, 'import numpy as np\n'), ((2890, 2913), 'numpy.linalg.eig', 'np.linalg.eig', (['comp_mat'], {}), '(comp_mat)\n', (2903, 2913), True, 'import numpy as np\n'), ((2932, 2952), 'numpy.argsort', '... |
import collections
import pytest
from radon.cli import Config
import radon.complexity as cc_mod
import radon.cli.harvest as harvest
BASE_CONFIG = Config(
exclude='test_[^.]+\.py',
ignore='tests,docs',
)
CC_CONFIG = Config(
order=getattr(cc_mod, 'SCORE'),
no_assert=False,
min='A',
max='F',
... | [
"radon.cli.harvest.Harvester",
"radon.cli.Config",
"radon.cli.harvest.CCHarvester",
"radon.cli.harvest.MIHarvester",
"radon.cli.harvest.RawHarvester",
"pytest.raises"
] | [((150, 204), 'radon.cli.Config', 'Config', ([], {'exclude': '"""test_[^.]+\\\\.py"""', 'ignore': '"""tests,docs"""'}), "(exclude='test_[^.]+\\\\.py', ignore='tests,docs')\n", (156, 204), False, 'from radon.cli import Config\n'), ((462, 482), 'radon.cli.Config', 'Config', ([], {'summary': '(True)'}), '(summary=True)\n'... |
import setuptools
# main project configurations is loaded from setup.cfg by setuptools
assert setuptools.__version__ > '30.3', "setuptools > 30.3 is required"
setuptools.setup()
| [
"setuptools.setup"
] | [((161, 179), 'setuptools.setup', 'setuptools.setup', ([], {}), '()\n', (177, 179), False, 'import setuptools\n')] |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License.
import json
from statistics import mean, harmonic_mean, median, pstdev
from ccf.tx_id import TxID
from loguru import logger as LOG
class TxRates:
def __init__(self, primary):
self.get_histogram = False
... | [
"statistics.mean",
"loguru.logger.info",
"statistics.median",
"statistics.pstdev",
"statistics.harmonic_mean",
"json.dump"
] | [((773, 797), 'statistics.mean', 'mean', (['self.tx_rates_data'], {}), '(self.tx_rates_data)\n', (777, 797), False, 'from statistics import mean, harmonic_mean, median, pstdev\n'), ((836, 869), 'statistics.harmonic_mean', 'harmonic_mean', (['self.tx_rates_data'], {}), '(self.tx_rates_data)\n', (849, 869), False, 'from ... |
import pandas
import numpy as np
char_harmony = pandas.read_csv('char_harmony.csv')
#print(char_harmony)
events_harmony = pandas.read_csv('events_harmony.csv')
#print(events_harmony)
single = [0]*len(events_harmony.index)
group = [0]*len(events_harmony.index)
male_dominated = [0]*len(events_harmony.index)
female_dom... | [
"pandas.read_csv"
] | [((49, 84), 'pandas.read_csv', 'pandas.read_csv', (['"""char_harmony.csv"""'], {}), "('char_harmony.csv')\n", (64, 84), False, 'import pandas\n'), ((124, 161), 'pandas.read_csv', 'pandas.read_csv', (['"""events_harmony.csv"""'], {}), "('events_harmony.csv')\n", (139, 161), False, 'import pandas\n')] |
import argparse
from pathlib import Path
from loguru import logger
from jupyter_ascending._environment import SYNC_EXTENSION
from jupyter_ascending.json_requests import SyncRequest
from jupyter_ascending.logger import setup_logger
from jupyter_ascending.requests.client_lib import request_notebook_command
@logger.ca... | [
"argparse.ArgumentParser",
"loguru.logger.info",
"pathlib.Path",
"jupyter_ascending.logger.setup_logger",
"jupyter_ascending.json_requests.SyncRequest",
"jupyter_ascending.requests.client_lib.request_notebook_command"
] | [((419, 463), 'loguru.logger.info', 'logger.info', (['f"""Syncing File: {file_name}..."""'], {}), "(f'Syncing File: {file_name}...')\n", (430, 463), False, 'from loguru import logger\n'), ((608, 661), 'jupyter_ascending.json_requests.SyncRequest', 'SyncRequest', ([], {'file_name': 'file_name', 'contents': 'raw_result'}... |
"""Tests for traitlets.config.configurable"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import logging
from unittest import TestCase
from pytest import mark
from traitlets.config.application import Application
from traitlets.config.configurable import (
... | [
"logging.getLogger",
"traitlets.traitlets.validate",
"traitlets.traitlets._deprecations_shown.clear",
"traitlets.traitlets.Set",
"traitlets.config.loader.Config",
"traitlets.traitlets.Dict",
"traitlets.traitlets.Integer",
"traitlets.traitlets.Unicode",
"traitlets.config.configurable.Configurable",
... | [((870, 890), 'traitlets.traitlets.Unicode', 'Unicode', (['"""no config"""'], {}), "('no config')\n", (877, 890), False, 'from traitlets.traitlets import CaselessStrEnum, Dict, Enum, Float, FuzzyEnum, Integer, List, Set, Unicode, _deprecations_shown, validate\n'), ((22186, 22218), 'logging.getLogger', 'logging.getLogge... |
from __future__ import absolute_import, division, print_function, with_statement
import sys
from turbo.log import helper_log
from turbo.util import import_object, camel_to_underscore
class _HelperObjectDict(dict):
def __setitem__(self, name, value):
return super(_HelperObjectDict, self).setdefault(nam... | [
"turbo.log.helper_log.error",
"turbo.util.camel_to_underscore",
"sys.exit"
] | [((1009, 1094), 'turbo.log.helper_log.error', 'helper_log.error', (["('module helpers.%s.%s Import Error' % (item, m))"], {'exc_info': '(True)'}), "('module helpers.%s.%s Import Error' % (item, m), exc_info=True\n )\n", (1025, 1094), False, 'from turbo.log import helper_log\n'), ((1139, 1150), 'sys.exit', 'sys.exit'... |
import pandas as pd
from matplotlib import pyplot as plt
import datetime
import pickle
import matplotlib.dates as mdates
# Read the files
dfsonde = pd.read_csv('sonde.txt',
#skiprows= 10,
#header = 11, #use the second row (index 1) as column headings
... | [
"matplotlib.dates.ConciseDateFormatter",
"datetime.datetime",
"pandas.read_csv",
"pickle.dumps",
"matplotlib.dates.DateFormatter",
"numpy.ma.masked_where",
"numpy.array",
"pickle.loads",
"matplotlib.dates.AutoDateLocator",
"matplotlib.pyplot.subplots"
] | [((149, 207), 'pandas.read_csv', 'pd.read_csv', (['"""sonde.txt"""'], {'parse_dates': "{'datetime': [0, 1]}"}), "('sonde.txt', parse_dates={'datetime': [0, 1]})\n", (160, 207), True, 'import pandas as pd\n'), ((558, 625), 'pandas.read_csv', 'pd.read_csv', (['"""datalogCTD_su1.txt"""'], {'parse_dates': "{'datetime': [0,... |
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import seaborn as sns
import math
import re
from ml_pipeline_lch import isolate_categoricals, is_category
def view_dist(df, geo_columns = True, fig_size=(20,15), labels = None):
'''
Plot distributions of non-categorical columns in a g... | [
"seaborn.lmplot",
"ml_pipeline_lch.isolate_categoricals",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"pandas.cut",
"matplotlib.pyplot.subplots",
"re.sub",
"matplotlib.pyplot.title",
"matplotlib.pyplot.get_cmap",
"numpy.zeros_like",
"seaborn.pairplot",
"matplotlib.pyplot.show"
] | [((613, 724), 'ml_pipeline_lch.isolate_categoricals', 'isolate_categoricals', (['df'], {'categoricals_fcn': 'is_category', 'ret_categoricals': '(False)', 'geos_indicator': 'geo_columns'}), '(df, categoricals_fcn=is_category, ret_categoricals=\n False, geos_indicator=geo_columns)\n', (633, 724), False, 'from ml_pipel... |
import torch
import itertools
from syft.common.util import chebyshev_series, chebyshev_polynomials
def test_chebyshev_polynomials():
"""Tests evaluation of chebyshev polynomials"""
sizes = [(1, 10), (3, 5), (3, 5, 10)]
possible_terms = [6, 40]
tolerance = 0.05
for size, terms in itertools.produc... | [
"syft.common.util.chebyshev_series",
"itertools.product",
"torch.Size",
"torch.tensor",
"syft.common.util.chebyshev_polynomials",
"torch.all"
] | [((304, 344), 'itertools.product', 'itertools.product', (['sizes', 'possible_terms'], {}), '(sizes, possible_terms)\n', (321, 344), False, 'import itertools\n'), ((419, 455), 'syft.common.util.chebyshev_polynomials', 'chebyshev_polynomials', (['tensor', 'terms'], {}), '(tensor, terms)\n', (440, 455), False, 'from syft.... |
#!/usr/bin/python3
# Simple Python Fixed-Point Module (SPFPM)
# (C)Copyright 2006-2018, <NAME>
# This file is (C)Copyright 2006-2018, <NAME>
# and is released under the Python-2.4.2 license
# (see http://www.python.org/psf/license),
# it therefore comes with NO WARRANTY, and NO CLAIMS OF FITNESS FOR ANY PURPOSE.
# Ho... | [
"doctest.testmod"
] | [((28114, 28131), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (28129, 28131), False, 'import doctest\n')] |
from time import sleep
import emoji
velocidade = float(input('Velocidade registrada... '))
print('Processando caluculo...')
sleep(2)
if velocidade > 80:
multa = (velocidade - 80)*7
print('Você foi multado em R${}'.format(multa))
else:
print('Velocidede permitida! Diriga com segurança.')
print(emoji.emojize(... | [
"emoji.emojize",
"time.sleep"
] | [((124, 132), 'time.sleep', 'sleep', (['(2)'], {}), '(2)\n', (129, 132), False, 'from time import sleep\n'), ((306, 353), 'emoji.emojize', 'emoji.emojize', (["(':alien:' * 20)"], {'use_aliases': '(True)'}), "(':alien:' * 20, use_aliases=True)\n", (319, 353), False, 'import emoji\n')] |
from abc import abstractmethod
from bxutils import logging
from bxcommon.services.transaction_service import TransactionService
from bxcommon.utils.blockchain_utils.btc.btc_object_hash import Sha256Hash
from bxgateway.services.abstract_block_cleanup_service import AbstractBlockCleanupService
from bxgateway.services.... | [
"bxgateway.messages.btc.inventory_btc_message.GetDataBtcMessage",
"bxutils.logging.get_logger"
] | [((550, 578), 'bxutils.logging.get_logger', 'logging.get_logger', (['__name__'], {}), '(__name__)\n', (568, 578), False, 'from bxutils import logging\n'), ((1987, 2131), 'bxgateway.messages.btc.inventory_btc_message.GetDataBtcMessage', 'GetDataBtcMessage', ([], {'magic': 'self.node.opts.blockchain_net_magic', 'inv_vect... |
from pathlib import Path
from invoke import task
REPO_ROOT = Path(__file__).parent
@task(aliases=["c"])
def clean(c):
with c.cd(str(REPO_ROOT)):
c.run("rm -rf build dist src/*.egg-info", warn=True)
c.run("rm -rf .pytest_cache .tox .coverage", warn=True)
c.run("find . -type d -name __pyc... | [
"invoke.task",
"pathlib.Path"
] | [((89, 108), 'invoke.task', 'task', ([], {'aliases': "['c']"}), "(aliases=['c'])\n", (93, 108), False, 'from invoke import task\n'), ((416, 435), 'invoke.task', 'task', ([], {'aliases': "['l']"}), "(aliases=['l'])\n", (420, 435), False, 'from invoke import task\n'), ((884, 903), 'invoke.task', 'task', ([], {'aliases': ... |
import shlex
import subprocess
import sys
from datetime import datetime
from django.core.management.base import BaseCommand
from django.utils import autoreload
class Command(BaseCommand):
help = 'Starts a Celery worker for development.'
# Validation is called explicitly each time the server is reloaded.
... | [
"shlex.split",
"django.utils.autoreload.run_with_reloader",
"datetime.datetime.now",
"django.utils.autoreload.raise_last_exception",
"sys.exit"
] | [((1329, 1362), 'django.utils.autoreload.raise_last_exception', 'autoreload.raise_last_exception', ([], {}), '()\n', (1360, 1362), False, 'from django.utils import autoreload\n'), ((421, 473), 'shlex.split', 'shlex.split', (['f"""celery worker -q -l info -A {app} -B"""'], {}), "(f'celery worker -q -l info -A {app} -B')... |
from multiprocessing.pool import Pool
from itertools import repeat
import pandas as pd
import numpy as np
def get_composers(res):
"""
Get the composers for the given track.
**Parameters**
- `res`: string composer names for each track within charts
**Returns**
A dictionary of composers ... | [
"multiprocessing.pool.Pool",
"pandas.DataFrame",
"pandas.concat",
"pandas.to_datetime",
"itertools.repeat"
] | [((8847, 8878), 'pandas.DataFrame', 'pd.DataFrame', (['parsed'], {'index': '[0]'}), '(parsed, index=[0])\n', (8859, 8878), True, 'import pandas as pd\n'), ((13037, 13082), 'pandas.concat', 'pd.concat', (['data'], {'ignore_index': '(True)', 'sort': '(True)'}), '(data, ignore_index=True, sort=True)\n', (13046, 13082), Tr... |
from typing import Dict, List, Union
import pandas as pd
import numpy as np
import random
import matplotlib.pyplot as plt
import dill
from pathlib import Path
from pysentimiento import create_analyzer
from lime.lime_text import LimeTextExplainer
from pysentimiento.analyzer import AnalyzerOutput
def sort_sentiment(res... | [
"lime.lime_text.LimeTextExplainer",
"pathlib.Path",
"numpy.array",
"pysentimiento.create_analyzer",
"random.random",
"matplotlib.pyplot.show"
] | [((1055, 1094), 'pysentimiento.create_analyzer', 'create_analyzer', (['"""sentiment"""'], {'lang': '"""en"""'}), "('sentiment', lang='en')\n", (1070, 1094), False, 'from pysentimiento import create_analyzer\n'), ((1292, 1329), 'lime.lime_text.LimeTextExplainer', 'LimeTextExplainer', ([], {'class_names': 'labels'}), '(c... |
# Copyright 2018 The TensorFlow 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 applica... | [
"tensorflow.python.keras.engine.training_utils.check_num_samples",
"tensorflow.python.keras.callbacks.BaseLogger",
"tensorflow.python.keras.backend.is_sparse",
"tensorflow.python.keras.engine.training_utils.batch_shuffle",
"tensorflow.python.keras.utils.generic_utils.make_batches",
"tensorflow.python.kera... | [((5206, 5295), 'tensorflow.python.keras.engine.training_utils.check_num_samples', 'training_utils.check_num_samples', (['ins', 'batch_size', 'steps_per_epoch', '"""steps_per_epoch"""'], {}), "(ins, batch_size, steps_per_epoch,\n 'steps_per_epoch')\n", (5238, 5295), False, 'from tensorflow.python.keras.engine import... |
# -*- coding: utf-8 -*-
# @Time : 20.05.21 09:29
# @Author : sing_sd
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams.update({'font.size': 12})
def main():
plot_prediction_rg_left_right_center()
# plot_uncertainties_rg_left_right_center()
def plot_prediction_rg_left_righ... | [
"pandas.read_csv",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.rcParams.update",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((144, 182), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 12}"], {}), "({'font.size': 12})\n", (163, 182), True, 'import matplotlib.pyplot as plt\n'), ((348, 392), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)'], {'sharex': '(True)', 'figsize': '(8, 6)'}), '(1, sharex=True, figsi... |
import sqlite3
from sqlite3 import Error
#create connection to database#
def create_connection(db_file):
try:
conn = sqlite3.connect(db_file)
return conn
except Error as e:
print(e)
return None
# create table function #
def create_table(conn, create_table_sql):
try:
... | [
"sqlite3.connect"
] | [((134, 158), 'sqlite3.connect', 'sqlite3.connect', (['db_file'], {}), '(db_file)\n', (149, 158), False, 'import sqlite3\n')] |
#!/usr/bin/env python3
# Sort the sequences by quality (percentage of number of N bases not called, descending) and by length (descending).
# The best sequence is the longest one, with no uncalled bases.
import os
import sys
import gzip
#import xxhash # Faster library
import hashlib
def open_gzipsafe(path_file):
... | [
"gzip.open"
] | [((364, 390), 'gzip.open', 'gzip.open', (['path_file', '"""rt"""'], {}), "(path_file, 'rt')\n", (373, 390), False, 'import gzip\n')] |
import json
import collections
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from ui_res.json_win import Ui_MainWindow
class QJsonTreeItem(object):
def __init__(self, parent=None):
self._parent = parent
self._key = ""
... | [
"json.load",
"PyQt5.QtCore.QModelIndex",
"PyQt5.QtWidgets.QApplication"
] | [((8934, 8966), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (8956, 8966), False, 'from PyQt5 import QtWidgets, QtCore\n'), ((4961, 4981), 'PyQt5.QtCore.QModelIndex', 'QtCore.QModelIndex', ([], {}), '()\n', (4979, 4981), False, 'from PyQt5 import QtWidgets, QtCore\n'), (... |
import sys
import rpyc
import unittest
is_py3 = sys.version_info >= (3,)
class Meta(type):
def __hash__(self):
return 4321
Base = Meta('Base', (object,), {})
class Foo(Base):
def __hash__(self):
return 1234
class Bar(Foo):
pass
class Mux(Foo):
def __eq__(self, other):
retu... | [
"unittest.main",
"rpyc.classic.connect_thread"
] | [((1877, 1892), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1890, 1892), False, 'import unittest\n'), ((417, 446), 'rpyc.classic.connect_thread', 'rpyc.classic.connect_thread', ([], {}), '()\n', (444, 446), False, 'import rpyc\n')] |
# -*- coding: utf-8 -*-
# Copyright 2018 Alibaba Cloud Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | [
"alibabacloud.utils.client_supports._list_available_client_services",
"alibabacloud.client.ClientConfig",
"alibabacloud.credentials.provider.DefaultChainedCredentialsProvider",
"alibabacloud.exceptions.ClientException",
"alibabacloud.utils.client_supports._list_available_resource_services",
"alibabacloud.... | [((1835, 1868), 'alibabacloud.utils.client_supports._list_available_client_services', '_list_available_client_services', ([], {}), '()\n', (1866, 1868), False, 'from alibabacloud.utils.client_supports import _list_available_client_services, _list_available_resource_services\n'), ((4402, 4454), 'alibabacloud.client.Clie... |
from random import randint
N = 1000
def simulate(N):
K = 0
car_choice = randint(1, 3)
for i in range(N):
my_choice = randint(1, 3)
if my_choice == car_choice:
monte_choice = randint(1, 3)
while monte_choice == car_choice:
monte_choice = randint(1... | [
"random.randint"
] | [((83, 96), 'random.randint', 'randint', (['(1)', '(3)'], {}), '(1, 3)\n', (90, 96), False, 'from random import randint\n'), ((141, 154), 'random.randint', 'randint', (['(1)', '(3)'], {}), '(1, 3)\n', (148, 154), False, 'from random import randint\n'), ((219, 232), 'random.randint', 'randint', (['(1)', '(3)'], {}), '(1... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Copyright (c) 2021 <NAME>--GUÉZÉNEC
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 ... | [
"time.sleep"
] | [((1905, 1918), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1915, 1918), False, 'import time\n')] |
"""Runs the backend."""
import sys
import classifier
import object_detector
def main(argv):
image = b'asdf'
screen = object_detector.DetectScreen(image)
what_is_on_the_screen = classifier.ClassifyScreen(screen)
print('got screen type', what_is_on_the_screen)
if __name__ == '__main__':
main(sys.argv)
| [
"object_detector.DetectScreen",
"classifier.ClassifyScreen"
] | [((124, 159), 'object_detector.DetectScreen', 'object_detector.DetectScreen', (['image'], {}), '(image)\n', (152, 159), False, 'import object_detector\n'), ((186, 219), 'classifier.ClassifyScreen', 'classifier.ClassifyScreen', (['screen'], {}), '(screen)\n', (211, 219), False, 'import classifier\n')] |
import ptf
from ptf.base_tests import BaseTest
from ptf import testutils
class TestParamsGet(BaseTest):
def setUp(self):
BaseTest.setUp(self)
def runTest(self):
params = testutils.test_params_get(default=None)
if params is None:
print(">>>None")
else:
fo... | [
"ptf.testutils.test_params_get",
"ptf.base_tests.BaseTest.setUp",
"ptf.testutils.test_param_get"
] | [((134, 154), 'ptf.base_tests.BaseTest.setUp', 'BaseTest.setUp', (['self'], {}), '(self)\n', (148, 154), False, 'from ptf.base_tests import BaseTest\n'), ((196, 235), 'ptf.testutils.test_params_get', 'testutils.test_params_get', ([], {'default': 'None'}), '(default=None)\n', (221, 235), False, 'from ptf import testutil... |
# coding: utf-8
"""OTP TOTP"""
from __future__ import unicode_literals
import os
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.twofactor.hotp import HOTP
from cryptography.hazmat.primitives.hashes import SHA1
key = os.urandom(20)
def generate_htop(length=6, salt=0):
... | [
"os.urandom",
"cryptography.hazmat.primitives.hashes.SHA1",
"cryptography.hazmat.backends.default_backend"
] | [((266, 280), 'os.urandom', 'os.urandom', (['(20)'], {}), '(20)\n', (276, 280), False, 'import os\n'), ((349, 355), 'cryptography.hazmat.primitives.hashes.SHA1', 'SHA1', ([], {}), '()\n', (353, 355), False, 'from cryptography.hazmat.primitives.hashes import SHA1\n'), ((365, 382), 'cryptography.hazmat.backends.default_b... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-03-23 19:54
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_countries.fields
import openedx.core.djangoapps.xmodule_django.models
class Migrat... | [
"django.db.models.OneToOneField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((397, 454), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (428, 454), False, 'from django.db import migrations, models\n'), ((638, 731), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""
Update test_table.rst with test metadata
"""
import ast
import os
from pathlib import Path
from typing import Dict, List, TextIO
from doc_generator import ( # type: ignore
TESTS,
ClassVisitor,
FuncVisitor,
extract_metadata,... | [
"doc_generator.load_path",
"pathlib.Path",
"doc_generator.FuncVisitor",
"ast.parse",
"doc_generator.ClassVisitor",
"os.walk"
] | [((351, 365), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (355, 365), False, 'from pathlib import Path\n'), ((4156, 4172), 'doc_generator.load_path', 'load_path', (['TESTS'], {}), '(TESTS)\n', (4165, 4172), False, 'from doc_generator import TESTS, ClassVisitor, FuncVisitor, extract_metadata, load_path\n... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This file is part of CbM (https://github.com/ec-jrc/cbm).
# Author : <NAME>
# Credits : GTCAP Team
# Copyright : 2021 European Commission, Joint Research Centre
# License : 3-Clause BSD
import os
import glob
from ipywidgets import (Text, Label, HBox, VBox, Layo... | [
"ipywidgets.HBox",
"src.ipycbm.utils.config.get_value",
"src.ipycbm.plugins.foi.foi_proc.proc",
"os.makedirs",
"ipywidgets.Label",
"ipywidgets.Button",
"src.ipycbm.plugins.foi.foi_proc_v2.proc",
"ipywidgets.Output",
"ipywidgets.Text",
"src.ipycbm.utils.settings.direct_conn",
"src.ipycbm.ui_proc.... | [((855, 863), 'ipywidgets.Output', 'Output', ([], {}), '()\n', (861, 863), False, 'from ipywidgets import Text, Label, HBox, VBox, Layout, Tab, Dropdown, ToggleButtons, Output, SelectMultiple, HTML, Button, FileUpload, Checkbox, Accordion, IntText, RadioButtons\n'), ((951, 1207), 'ipywidgets.HTML', 'HTML', ([], {'value... |
import webbrowser
class Movie(object):
"""This class represents movies entity, created to storage all information
related."""
def __init__(self):
""" Inits the movie instance."""
self.data = []
self._visits = 0
@property
def title(self):
"""Gets the title for a mo... | [
"webbrowser.open"
] | [((5923, 5964), 'webbrowser.open', 'webbrowser.open', (['self.trailer_youtube_url'], {}), '(self.trailer_youtube_url)\n', (5938, 5964), False, 'import webbrowser\n')] |
from copy import deepcopy
import logging
import os
import pickle
from bids.layout import BIDSImageFile
from bids.layout.writing import build_path as bids_build_path
import nibabel as nib
import numpy as np
import pandas as pd
import pytest
from rtCommon.bidsCommon import (
BIDS_DIR_PATH_PATTERN,
BIDS_FILE_PAT... | [
"logging.getLogger",
"nibabel.load",
"pickle.dumps",
"copy.deepcopy",
"pickle.loads",
"os.remove",
"rtCommon.bidsArchive.BidsArchive",
"tests.common.isValidBidsArchive",
"numpy.where",
"bids.layout.writing.build_path",
"pandas.DataFrame",
"numpy.allclose",
"rtCommon.bidsCommon.metadataFromPr... | [((628, 655), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (645, 655), False, 'import logging\n'), ((5059, 5114), 'rtCommon.bidsCommon.metadataFromProtocolName', 'metadataFromProtocolName', (["imageMetadata['ProtocolName']"], {}), "(imageMetadata['ProtocolName'])\n", (5083, 5114), False... |
import os
import sys
from datetime import timedelta
from django.utils.translation import ugettext_lazy as _
# -----------------------------------------------------------------------------------
# Sets TESTING to True if this configuration is read during a unit test
# --------------------------------------------------... | [
"os.path.dirname",
"datetime.timedelta",
"django.utils.translation.ugettext_lazy",
"os.path.join"
] | [((6989, 7030), 'os.path.join', 'os.path.join', (['PROJECT_DIR', '"""../resources"""'], {}), "(PROJECT_DIR, '../resources')\n", (7001, 7030), False, 'import os\n'), ((7106, 7147), 'os.path.join', 'os.path.join', (['PROJECT_DIR', '"""../testfiles"""'], {}), "(PROJECT_DIR, '../testfiles')\n", (7118, 7147), False, 'import... |
import logging
import pyipmi
import pyipmi.interfaces
from ocs_ci.ocs import constants, defaults
from ocs_ci.ocs.constants import VM_POWERED_OFF, VM_POWERED_ON
from ocs_ci.ocs.exceptions import UnexpectedBehaviour
from ocs_ci.ocs.node import wait_for_nodes_status, get_worker_nodes, get_master_nodes
from ocs_ci.ocs.oc... | [
"logging.getLogger",
"ocs_ci.ocs.ocp.wait_for_cluster_connectivity",
"ocs_ci.utility.utils.exec_cmd",
"ocs_ci.ocs.node.get_master_nodes",
"ocs_ci.ocs.exceptions.UnexpectedBehaviour",
"ocs_ci.ocs.node.get_worker_nodes",
"pyipmi.interfaces.create_interface",
"ocs_ci.utility.utils.load_auth_config",
"p... | [((450, 477), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (467, 477), False, 'import logging\n'), ((1048, 1144), 'pyipmi.interfaces.create_interface', 'pyipmi.interfaces.create_interface', (['"""ipmitool"""'], {'interface_type': 'defaults.IPMI_INTERFACE_TYPE'}), "('ipmitool', interface... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import numpy as np
from scipy.ndimage.interpolation import map_coordinates
from scipy.ndimage.filters import gaussian_filter
def flip(imagelist, axis=1):
"""Randoml... | [
"numpy.random.normal",
"numpy.flip",
"numpy.reshape",
"numpy.random.rand",
"scipy.ndimage.filters.gaussian_filter",
"scipy.ndimage.interpolation.map_coordinates",
"numpy.random.random",
"numpy.ones",
"numpy.floor",
"numpy.array",
"numpy.random.randint",
"numpy.argwhere",
"numpy.zeros",
"nu... | [((877, 896), 'numpy.random.random', 'np.random.random', (['(1)'], {}), '(1)\n', (893, 896), True, 'import numpy as np\n'), ((1494, 1564), 'numpy.random.normal', 'np.random.normal', (['(0)', 'sigma', '([1] * (image.ndim - 1) + [image.shape[-1]])'], {}), '(0, sigma, [1] * (image.ndim - 1) + [image.shape[-1]])\n', (1510,... |
from __future__ import print_function
import numpy as np
from scipy.optimize import minimize
import scipy.special
from tqdm import tqdm
from amico.util import get_verbose
# Kaden's functionals
def F_norm_Diff_K(E0,Signal,sigma_diff):
# ------- SMT functional
sig2 = sigma_diff**2.0
F_norm = np.sum( ( Si... | [
"numpy.sqrt",
"scipy.optimize.minimize",
"numpy.array",
"numpy.zeros",
"amico.util.get_verbose"
] | [((456, 472), 'numpy.array', 'np.array', (['F_norm'], {}), '(F_norm)\n', (464, 472), True, 'import numpy as np\n'), ((521, 533), 'numpy.array', 'np.array', (['E0'], {}), '(E0)\n', (529, 533), True, 'import numpy as np\n'), ((572, 599), 'numpy.sqrt', 'np.sqrt', (['(np.pi * sig2 / 2.0)'], {}), '(np.pi * sig2 / 2.0)\n', (... |
# Copyright 2020 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
from PB.go.chromium.org.luci.buildbucket.proto import common as common_pb2
PYTHON_VERSION_COMPATIBILITY = 'PY2+3'
DEPS = [
'milo',
]
def Ru... | [
"PB.go.chromium.org.luci.buildbucket.proto.common.GitilesCommit"
] | [((394, 528), 'PB.go.chromium.org.luci.buildbucket.proto.common.GitilesCommit', 'common_pb2.GitilesCommit', ([], {'host': '"""chromium.googlesource.com"""', 'project': '"""chromium/src"""', 'id': '"""51634e6bffd3c4f521645a40c721430721153711"""'}), "(host='chromium.googlesource.com', project=\n 'chromium/src', id='51... |
# Author: <NAME> (<EMAIL>)
import random, sys
if len (sys.argv) > 1:
seed = int (sys.argv[1])
else:
seed = random.randrange (2 ** 30)
random.seed (seed)
n = 5000
s = ''
for i in range (n):
s += chr (random.randrange (2) + ord ('0'))
sys.stdout.write (s + '\n')
| [
"random.randrange",
"random.seed",
"sys.stdout.write"
] | [((137, 154), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (148, 154), False, 'import random, sys\n'), ((238, 264), 'sys.stdout.write', 'sys.stdout.write', (["(s + '\\n')"], {}), "(s + '\\n')\n", (254, 264), False, 'import random, sys\n'), ((110, 135), 'random.randrange', 'random.randrange', (['(2 ** 30)']... |
from django.forms import ChoiceField
from django.utils.html import format_html
from django.utils.translation import ugettext_lazy as _
from cms.plugin_pool import plugin_pool
from entangled.forms import EntangledModelFormMixin
from cmsplugin_cascade.plugin_base import CascadePluginBase, TransparentContainer
class Si... | [
"django.utils.html.format_html",
"django.utils.translation.ugettext_lazy",
"cms.plugin_pool.plugin_pool.register_plugin"
] | [((1551, 1599), 'cms.plugin_pool.plugin_pool.register_plugin', 'plugin_pool.register_plugin', (['SimpleWrapperPlugin'], {}), '(SimpleWrapperPlugin)\n', (1578, 1599), False, 'from cms.plugin_pool import plugin_pool\n'), ((846, 865), 'django.utils.translation.ugettext_lazy', '_', (['"""Simple Wrapper"""'], {}), "('Simple... |
'''
Created by <NAME> 2020
# Read in WAV file into Python Class
sound1 = AudioProcessing('input.wav')
# Set the speed of the audio
sound1.set_audio_speed(0.5)
# Set the pitch of the audio
sound1.set_audio_pitch(2)
# Reverse the content of the audio
sound1.set_reverse()
# Add an echo to the audio
sound1.... | [
"numpy.hanning",
"numpy.abs",
"scipy.signal.filtfilt",
"numpy.fft.fft",
"scipy.signal.butter",
"numpy.angle",
"numpy.exp",
"numpy.array",
"numpy.zeros",
"scipy.io.wavfile.read",
"random.randint"
] | [((4956, 4979), 'random.randint', 'random.randint', (['(50)', '(200)'], {}), '(50, 200)\n', (4970, 4979), False, 'import random\n'), ((4990, 5017), 'random.randint', 'random.randint', (['(3000)', '(10000)'], {}), '(3000, 10000)\n', (5004, 5017), False, 'import random\n'), ((5030, 5053), 'random.randint', 'random.randin... |
import rules
from django.core.exceptions import PermissionDenied
def ensure_rule(rule, *args):
if not rules.test_rule(rule, *args):
raise PermissionDenied
def ensure_user_has_permission(user, target, permission):
if not user.has_perm(permission, target):
raise PermissionDenied
| [
"rules.test_rule"
] | [((108, 136), 'rules.test_rule', 'rules.test_rule', (['rule', '*args'], {}), '(rule, *args)\n', (123, 136), False, 'import rules\n')] |
import csv
import re
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from PIL import Image
import pandas as pd
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.layouts import gridplot
from bokeh.models import (BasicTicker, Circle, ColumnDataSource, DataRange1d,... | [
"bokeh.models.Circle",
"matplotlib.pyplot.savefig",
"pandas.DataFrame",
"bokeh.models.Grid",
"bokeh.layouts.gridplot",
"seaborn.set_style",
"numpy.array",
"bokeh.models.LinearAxis",
"bokeh.models.PanTool",
"seaborn.violinplot",
"bokeh.models.BasicTicker",
"bokeh.models.Plot",
"bokeh.document... | [((853, 869), 'numpy.array', 'np.array', (['scores'], {}), '(scores)\n', (861, 869), True, 'import numpy as np\n'), ((1398, 1413), 'bokeh.layouts.gridplot', 'gridplot', (['plots'], {}), '(plots)\n', (1406, 1413), False, 'from bokeh.layouts import gridplot\n'), ((1425, 1435), 'bokeh.document.Document', 'Document', ([], ... |
"""Control of an AVR over Telnet."""
import asyncio
import telnetlib3
from typing import Any, List, MutableMapping, Optional, Type
from .enums import InputSource, Power, SurroundMode
class AvrError(Exception):
"""Base class for all errors returned from an AVR."""
pass
class DisconnectedError(AvrError):
... | [
"telnetlib3.open_connection",
"asyncio.wait_for"
] | [((645, 706), 'telnetlib3.open_connection', 'telnetlib3.open_connection', (['host'], {'port': 'port', 'encoding': '"""ascii"""'}), "(host, port=port, encoding='ascii')\n", (671, 706), False, 'import telnetlib3\n'), ((5796, 5833), 'asyncio.wait_for', 'asyncio.wait_for', (['coro', 'self._timeout'], {}), '(coro, self._tim... |
"""Unit tests for src/response_parser.py."""
import os
import sys
import pytest
sys.path.append(os.path.join(os.getcwd(), "src"))
from response_parser import ( # noqa
clean_domain,
clean_response,
clean_travel_info,
clean_walkscore,
)
sample_one = {
"type": "PropertyListing",
"listing":... | [
"response_parser.clean_domain",
"response_parser.clean_response",
"response_parser.clean_walkscore",
"os.getcwd",
"pytest.mark.parametrize",
"response_parser.clean_travel_info"
] | [((15596, 17570), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""sample_search_result, expected"""', '[(sample_one, {\'listing\': {\'id\': 2016359058, \'listing_slug\':\n \'footscray-vic-3011-2016359058\', \'price\': \'Contact agent\', \'address\': {\n \'displayable_address\': \'Footscray\', \'postco... |
import time
import unittest
import numpy as np
from collections import defaultdict
from sklearn.datasets import make_classification, make_regression
from sklearn.metrics import f1_score
from sklearn.model_selection import KFold
from sklearn.svm import SVC
from ITMO_FS.ensembles.measure_based import *
from ITMO_FS.ens... | [
"numpy.mean",
"sklearn.svm.SVC",
"sklearn.datasets.make_regression",
"sklearn.metrics.f1_score",
"numpy.array",
"collections.defaultdict",
"numpy.std",
"unittest.main",
"sklearn.model_selection.KFold",
"time.time",
"sklearn.datasets.make_classification"
] | [((456, 528), 'sklearn.datasets.make_classification', 'make_classification', ([], {'n_features': '(2000)', 'n_informative': '(100)', 'n_redundant': '(500)'}), '(n_features=2000, n_informative=100, n_redundant=500)\n', (475, 528), False, 'from sklearn.datasets import make_classification, make_regression\n'), ((555, 645)... |
# coding=utf-8
from OTLMOW.OTLModel.Datatypes.KeuzelijstField import KeuzelijstField
from OTLMOW.OTLModel.Datatypes.KeuzelijstWaarde import KeuzelijstWaarde
# Generated with OTLEnumerationCreator. To modify: extend, do not edit
class KlOntvangerToepassing(KeuzelijstField):
"""Keuzelijst met modelnamen voor Ontvan... | [
"OTLMOW.OTLModel.Datatypes.KeuzelijstWaarde.KeuzelijstWaarde"
] | [((704, 857), 'OTLMOW.OTLModel.Datatypes.KeuzelijstWaarde.KeuzelijstWaarde', 'KeuzelijstWaarde', ([], {'invulwaarde': '"""GPRS"""', 'label': '"""GPRS"""', 'objectUri': '"""https://wegenenverkeer.data.vlaanderen.be/id/concept/KlOntvangerToepassing/GPRS"""'}), "(invulwaarde='GPRS', label='GPRS', objectUri=\n 'https://... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('years', '000... | [
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((239, 296), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (270, 296), False, 'from django.db import models, migrations\n'), ((461, 554), 'django.db.models.AutoField', 'models.AutoField', ([], {'verbose_name': '"""ID"... |
import torch
import os
import math
import numpy as np
from copy import deepcopy
from pycls.core.config import cfg
import pycls.utils.distributed as du
from tqdm import tqdm
class AdversarySampler:
def __init__(self, budget):
self.budget = budget
self.cuda_id = torch.cuda.current_device()
def ... | [
"torch.from_numpy",
"torch.min",
"numpy.argsort",
"numpy.arange",
"numpy.dot",
"numpy.empty",
"numpy.concatenate",
"numpy.min",
"torch.cuda.current_device",
"numpy.argmax",
"torch.transpose",
"torch.reshape",
"torch.cat",
"os.makedirs",
"torch.stack",
"tqdm.tqdm",
"os.path.join",
"... | [((5994, 6009), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (6007, 6009), False, 'import torch\n'), ((11991, 12006), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (12004, 12006), False, 'import torch\n'), ((283, 310), 'torch.cuda.current_device', 'torch.cuda.current_device', ([], {}), '()\n', (308, 310), ... |
from os.path import join
import cv2
import numpy as np
from PIL import Image
from torch.utils import data
def prepare_image_PIL(im):
im = im[:,:,::-1] - np.zeros_like(im) # rgb to bgr
im -= np.array((104.00698793,116.66876762,122.67891434))
im = np.transpose(im, (2, 0, 1)) # (H x W x C) to (C x H x W)
... | [
"numpy.logical_and",
"os.path.join",
"numpy.squeeze",
"numpy.array",
"numpy.transpose",
"numpy.zeros_like"
] | [((201, 253), 'numpy.array', 'np.array', (['(104.00698793, 116.66876762, 122.67891434)'], {}), '((104.00698793, 116.66876762, 122.67891434))\n', (209, 253), True, 'import numpy as np\n'), ((261, 288), 'numpy.transpose', 'np.transpose', (['im', '(2, 0, 1)'], {}), '(im, (2, 0, 1))\n', (273, 288), True, 'import numpy as n... |
import copy
import time
import json
import logging
log = logging.getLogger(__name__)
import torch
from optim import lbfgs_modified
import config as cfg
def store_checkpoint(checkpoint_file, state, optimizer, current_epoch, current_loss,\
verbosity=0):
r"""
:param checkpoint_file: target file
:param sta... | [
"logging.getLogger",
"torch.load",
"json.dumps",
"time.perf_counter",
"optim.lbfgs_modified.LBFGS_MOD",
"copy.deepcopy",
"torch.no_grad"
] | [((57, 84), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (74, 84), False, 'import logging\n'), ((2642, 2949), 'optim.lbfgs_modified.LBFGS_MOD', 'lbfgs_modified.LBFGS_MOD', (['parameters'], {'max_iter': 'opt_args.max_iter_per_epoch', 'lr': 'opt_args.lr', 'tolerance_grad': 'opt_args.toler... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# standard modules
import logging
# extra modules
dependencies_missing = False
try:
import requests
except ImportError:
dependencies_missing = True
from metasploit import module
metadata = {
'name': 'Python Module Example',
'description': '''
P... | [
"logging.error",
"metasploit.module.run"
] | [((1796, 1821), 'metasploit.module.run', 'module.run', (['metadata', 'run'], {}), '(metadata, run)\n', (1806, 1821), False, 'from metasploit import module\n'), ((1300, 1373), 'logging.error', 'logging.error', (['"""Module dependency (requests) is missing, cannot continue"""'], {}), "('Module dependency (requests) is mi... |
# Generated by Django 2.2.8 on 2019-12-29 22:07
from django.db import migrations
def move_excluded_items_to_payload(apps, schema_editor):
if schema_editor.connection.alias != 'default':
return
# Traverse the scheduled actions and move the exclude_items field from
# the object field to the payloa... | [
"django.db.migrations.RunPython"
] | [((755, 807), 'django.db.migrations.RunPython', 'migrations.RunPython', (['move_excluded_items_to_payload'], {}), '(move_excluded_items_to_payload)\n', (775, 807), False, 'from django.db import migrations\n')] |
#! /usr/bin/env python
# -*- mode: python; coding: utf-8 -*
# Copyright (c) 2019 <NAME>, <NAME>
# Licensed under the 2-clause BSD License
"""Code for plotting EoR Limits."""
import glob
import os
import copy
import yaml
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cmx
import matplotlib.c... | [
"matplotlib.pyplot.grid",
"numpy.log10",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.fill_between",
"numpy.argsort",
"numpy.array",
"copy.deepcopy",
"numpy.nanmin",
"eor_limits.process_mesinger_2016.get_mesinger_2016_line",
"numpy.repeat",
"argparse.ArgumentParser",
"numpy.where",
"matplo... | [((12492, 12536), 'matplotlib.cm.ScalarMappable', 'cmx.ScalarMappable', ([], {'norm': 'norm', 'cmap': 'colormap'}), '(norm=norm, cmap=colormap)\n', (12510, 12536), True, 'import matplotlib.cm as cmx\n'), ((12648, 12691), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(fig_width, fig_height)'}), '(figsize=(... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Meeko preparation
#
import os
import sys
from collections import OrderedDict
import warnings
from rdkit import Chem
from .molsetup import OBMoleculeSetup
from .molsetup import RDKitMoleculeSetup
from .atomtyper import AtomTyper
from .bondtyper import BondTyperLegacy
... | [
"warnings.warn"
] | [((2589, 2698), 'warnings.warn', 'warnings.warn', (['"""keep_equivalent_rings=False ignored because keep_chorded_rings=True"""', 'RuntimeWarning'], {}), "(\n 'keep_equivalent_rings=False ignored because keep_chorded_rings=True',\n RuntimeWarning)\n", (2602, 2698), False, 'import warnings\n')] |