code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from __future__ import unicode_literals
import copy
import heapq
import math
import numpy
import os
import types
import uuid
from .common import log
from .errors import MoleculeError, PTError, FileError
from .settings import Settings
from ..tools.pdbtools import PDBHandler, PDBRecord
from ..tools.utils import Units, ... | [
"copy.deepcopy",
"heapq.heapify",
"math.sqrt",
"os.path.basename",
"math.floor",
"numpy.identity",
"math.sin",
"heapq.heappop",
"math.acos",
"numpy.array",
"numpy.linalg.norm",
"math.cos",
"numpy.dot"
] | [((22720, 22739), 'copy.deepcopy', 'copy.deepcopy', (['self'], {}), '(self)\n', (22733, 22739), False, 'import copy\n'), ((35178, 35197), 'heapq.heapify', 'heapq.heapify', (['heap'], {}), '(heap)\n', (35191, 35197), False, 'import heapq\n'), ((39008, 39028), 'numpy.linalg.norm', 'numpy.linalg.norm', (['v'], {}), '(v)\n... |
""" User configuration file for IPython
This is a more flexible and safe way to configure ipython than *rc files
(ipythonrc, ipythonrc-pysh etc.)
This file is always imported on ipython startup. You can import the
ipython extensions you need here (see IPython/Extensions directory).
Feel free to edit this file to cus... | [
"config_helper_functions.import_some",
"config_helper_functions.import_modules",
"config_helper_functions.ipython_options"
] | [((892, 933), 'config_helper_functions.ipython_options', 'config_helper_functions.ipython_options', ([], {}), '()\n', (931, 933), False, 'import config_helper_functions\n'), ((1193, 1244), 'config_helper_functions.import_modules', 'config_helper_functions.import_modules', (['"""os sys re"""'], {}), "('os sys re')\n", (... |
""" An executable python script that handles the remember command of the store.
This module runs the remember portion of the command store interaction. It
allows you to query all the stored commands and also delete them if you choose.
"""
import time
from typing import Optional, List
import remember.command_store_lib... | [
"remember.handle_args.setup_args_for_search",
"time.time",
"remember.interactive.display_and_interact_results",
"remember.command_store_lib.load_command_store",
"remember.command_store_lib.start_history_processing",
"remember.command_store_lib.get_file_path"
] | [((598, 621), 'remember.handle_args.setup_args_for_search', 'setup_args_for_search', ([], {}), '()\n', (619, 621), False, 'from remember.handle_args import setup_args_for_search\n'), ((1449, 1486), 'remember.command_store_lib.get_file_path', 'command_store.get_file_path', (['save_dir'], {}), '(save_dir)\n', (1476, 1486... |
from maps.map_actions_lib import text_display, blend_background
from time import sleep
from getch import getch
from monsters import MapMonster
import sys
from colorama import Fore
was_monster_spawned = False
_DEBUG = False
def action1(**kwargs):
global was_monster_spawned
if was_monster_spawned is... | [
"maps.map_actions_lib.text_display",
"maps.map_actions_lib.blend_background",
"monsters.MapMonster",
"sys.exit"
] | [((2508, 2633), 'maps.map_actions_lib.text_display', 'text_display', (['"""I guess I could make a Link to another videogame series from this broken piece of clay..."""'], {}), "(\n 'I guess I could make a Link to another videogame series from this broken piece of clay...'\n , **kwargs)\n", (2520, 2633), False, 'f... |
import pygame
class ImageCache(dict):
def __init__(self):
super().__init__()
self._image_library = {}
def get_image(self, path):
image = self._image_library.get(path)
if image is None:
image = self._load_image(path)
self._image_library[path] = self._lo... | [
"pygame.image.load"
] | [((516, 549), 'pygame.image.load', 'pygame.image.load', (['canonical_path'], {}), '(canonical_path)\n', (533, 549), False, 'import pygame\n')] |
import os, sys
def main(repeat):
for repeat in range(repeat):
for mnist in [0, 1]:
for act_type in ["linkact", "regact", "relu"]:
os.system(
"python3 train.py --mnist %d --act_type %s --use_shakeshake %d --epochs 100" % (
mnist, act_ty... | [
"os.system"
] | [((171, 299), 'os.system', 'os.system', (["('python3 train.py --mnist %d --act_type %s --use_shakeshake %d --epochs 100' %\n (mnist, act_type, 1 - mnist))"], {}), "(\n 'python3 train.py --mnist %d --act_type %s --use_shakeshake %d --epochs 100'\n % (mnist, act_type, 1 - mnist))\n", (180, 299), False, 'import ... |
#!/usr/bin/env python3
import pygame as pg
GROUND_EXPLOSION_Y_NUDGE = 8
class Explosion(pg.sprite.Sprite):
def __init__(self, pos, spritelist, animation_delay, placement="center"):
pg.sprite.Sprite.__init__(self)
self.images = spritelist
self.imageIndex = 0
self.maxImageIndex = len(spritelist)
self.image... | [
"pygame.mask.from_surface",
"pygame.sprite.Sprite.__init__"
] | [((187, 218), 'pygame.sprite.Sprite.__init__', 'pg.sprite.Sprite.__init__', (['self'], {}), '(self)\n', (212, 218), True, 'import pygame as pg\n'), ((366, 398), 'pygame.mask.from_surface', 'pg.mask.from_surface', (['self.image'], {}), '(self.image)\n', (386, 398), True, 'import pygame as pg\n'), ((1279, 1311), 'pygame.... |
class Tester(object):
def __init__(self):
pass
def test(self, func, args, exe_times = 100):
import time
print("[D] ", func, args)
start = time.perf_counter()
for _ in range(exe_times):
func(**args)
end = time.perf_counter()
print("Exe func ", ... | [
"time.perf_counter"
] | [((179, 198), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (196, 198), False, 'import time\n'), ((273, 292), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (290, 292), False, 'import time\n')] |
from serial import Serial, SerialException
from serial.tools import list_ports
from multiprocessing import Process, Queue
from struct import unpack_from, pack
from time import time, sleep
import multiprocessing
pid_byte = {
'T' : 4,
'Q1' : 4,
'Q2' :4,
'pC' : 4
}
man_byte = {
'T' : 4,
'Q1' : 4,... | [
"serial.Serial",
"serial.tools.list_ports.comports",
"time.sleep",
"time.time",
"multiprocessing.Queue",
"multiprocessing.Event",
"multiprocessing.Process.__init__",
"struct.unpack_from"
] | [((831, 853), 'multiprocessing.Process.__init__', 'Process.__init__', (['self'], {}), '(self)\n', (847, 853), False, 'from multiprocessing import Process, Queue\n'), ((875, 898), 'multiprocessing.Event', 'multiprocessing.Event', ([], {}), '()\n', (896, 898), False, 'import multiprocessing\n'), ((1032, 1040), 'serial.Se... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# <NAME>
# <EMAIL>
# MIT license
from sys import argv, exit
from signal import signal, SIGILL, SIGTRAP, SIGINT, SIGHUP, SIGTERM, SIGSEGV
from os import mkfifo, getenv
from time import sleep, strftime, gmtime
from logging.handlers import logging, RotatingFileHandler
from... | [
"logging.handlers.logging.shutdown",
"time.gmtime",
"util.setPidFileAndPipeFile",
"cfg.botCfg",
"util.removePidFile",
"time.sleep",
"logging.handlers.logging.info",
"os.mkfifo",
"util.daemonize",
"cfg.klineAPIIntervals.keys",
"signal.signal",
"notify.ntfTwitter",
"os.getenv",
"sys.exit"
] | [((13794, 13812), 'util.daemonize', 'daemonize', (['argv[1]'], {}), '(argv[1])\n', (13803, 13812), False, 'from util import sigHandler, setPidFileAndPipeFile, removePidFile, daemonize, completeMilliTime\n'), ((13935, 13961), 'signal.signal', 'signal', (['SIGILL', 'sigHandler'], {}), '(SIGILL, sigHandler)\n', (13941, 13... |
"""
Module to run programs on ibex
"""
import numpy as np
import logging
from .executor import Executor
import re
from pathlib import Path
class RunError(Exception):
"""
Class for exceptions
"""
pass
class IbexRun(Executor):
"""
Class to create jobs to run in ibex. When the `run()` method i... | [
"logging.info",
"numpy.floor",
"re.search",
"numpy.ceil"
] | [((3405, 3433), 'numpy.floor', 'np.floor', (['(total_minutes / 60)'], {}), '(total_minutes / 60)\n', (3413, 3433), True, 'import numpy as np\n'), ((3450, 3477), 'numpy.ceil', 'np.ceil', (['(total_minutes % 60)'], {}), '(total_minutes % 60)\n', (3457, 3477), True, 'import numpy as np\n'), ((4668, 4726), 'logging.info', ... |
from sys import stdout
from os import system, get_terminal_size, name as os_name
def clear():
system('cls' if os_name == 'nt' else 'clear')
def time_formatter(tm):
tm = str(tm).replace(':','')
if len(tm) != 6 or not tm.isdigit():
raise ValueError("Incorrect format for time. (H:M:S)")
... | [
"os.system"
] | [((100, 145), 'os.system', 'system', (["('cls' if os_name == 'nt' else 'clear')"], {}), "('cls' if os_name == 'nt' else 'clear')\n", (106, 145), False, 'from os import system, get_terminal_size, name as os_name\n')] |
import json
import requests
from warnings import warn
from typing import Any, Dict, List
from specklepy.api.client import SpeckleClient
from specklepy.api.credentials import Account, get_account_from_token
from specklepy.logging.exceptions import SpeckleException, SpeckleWarning
from specklepy.transports.abstract_tra... | [
"json.loads",
"requests.Session",
"specklepy.api.credentials.get_account_from_token",
"json.dumps",
"specklepy.logging.exceptions.SpeckleException",
"specklepy.logging.exceptions.SpeckleWarning"
] | [((2970, 2988), 'requests.Session', 'requests.Session', ([], {}), '()\n', (2986, 2988), False, 'import requests\n'), ((3895, 4110), 'specklepy.logging.exceptions.SpeckleException', 'SpeckleException', (['"""Getting a single object using `ServerTransport.get_object()` is not implemented. To get an object from the server... |
from ply import lex, yacc
from tcukparser import TCUKParser
class TestCaseLexer(TCUKParser):
def __init__(self):
self.lexer = lex.lex(module=self)
self.parser = yacc.yacc(module=self)
def parse(self, data):
return self.parser.parse(data, lexer=self.lexer)
def parse(data):
t = Tes... | [
"ply.yacc.yacc",
"ply.lex.lex"
] | [((140, 160), 'ply.lex.lex', 'lex.lex', ([], {'module': 'self'}), '(module=self)\n', (147, 160), False, 'from ply import lex, yacc\n'), ((182, 204), 'ply.yacc.yacc', 'yacc.yacc', ([], {'module': 'self'}), '(module=self)\n', (191, 204), False, 'from ply import lex, yacc\n')] |
from basic_functions import *
import csv
from collections import deque
inf = 1000
def table_phase0():
trans_ep = []
with open('trans_ep_phase0.csv', mode='r') as f:
for line in map(str.strip, f):
trans_ep.append([int(i) for i in line.replace('\n', '').split(',')])
trans = []
with ... | [
"csv.writer",
"collections.deque"
] | [((634, 664), 'collections.deque', 'deque', (['[[solved1, solved2, 0]]'], {}), '([[solved1, solved2, 0]])\n', (639, 664), False, 'from collections import deque\n'), ((1578, 1608), 'collections.deque', 'deque', (['[[solved1, solved2, 0]]'], {}), '([[solved1, solved2, 0]])\n', (1583, 1608), False, 'from collections impor... |
#!/usr/bin/python
import sys
import pyrebase
from getpass import getpass
config = { "apiKey": "<KEY>", "authDomain": "my-purchases-bb5f8.firebaseapp.com", "databaseURL": "https://my-purchases-bb5f8.firebaseio.com", "storageBucket": "my-purchases-bb5f8.appspot.com", "serviceAccount": "my-purchases-bb5f8-firebase-... | [
"getpass.getpass",
"pyrebase.initialize_app"
] | [((366, 397), 'pyrebase.initialize_app', 'pyrebase.initialize_app', (['config'], {}), '(config)\n', (389, 397), False, 'import pyrebase\n'), ((950, 971), 'getpass.getpass', 'getpass', (['"""password: """'], {}), "('password: ')\n", (957, 971), False, 'from getpass import getpass\n')] |
#bismillah(starting with the name of ALLAH)
'''alogorithm
1. importing libraries
2. Creating Our First Game Window
3. Changing the Title, Logo and Background Color
4. Adding Images of the gates into Our app
5. Keyboard Input Controls & Key Pressed Event (with mouse drag and drop)
6. Adding Boundaries to Our app
... | [
"pygame.event.get",
"pygame.display.set_mode",
"pygame.init",
"pygame.display.update",
"pygame.image.load"
] | [((572, 585), 'pygame.init', 'pygame.init', ([], {}), '()\n', (583, 585), False, 'import pygame\n'), ((616, 651), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(800, 600)'], {}), '((800, 600))\n', (639, 651), False, 'import pygame\n'), ((672, 701), 'pygame.image.load', 'pygame.image.load', (['"""NAND.png"""'... |
"""RPGStatus - Status Test"""
from io import StringIO
from sys import path
from os.path import realpath
path.insert(0, realpath(f"{__file__}/../../"))
from status import BaseCharacter, Attribute, CharAttribute, setDebug
import unittest
from pprint import pprint
# We don't really need other classes like Attribute, et... | [
"io.StringIO",
"os.path.realpath",
"status.Attribute",
"status.CharAttribute",
"pprint.pprint",
"status.setDebug",
"status.BaseCharacter"
] | [((120, 150), 'os.path.realpath', 'realpath', (['f"""{__file__}/../../"""'], {}), "(f'{__file__}/../../')\n", (128, 150), False, 'from os.path import realpath\n'), ((805, 819), 'status.setDebug', 'setDebug', (['(True)'], {}), '(True)\n', (813, 819), False, 'from status import BaseCharacter, Attribute, CharAttribute, se... |
#
# Copyright(c) 2019 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
import pytest
import os
import sys
import yaml
from IPy import IP
sys.path.append(os.path.join(os.path.dirname(__file__), "../test-framework"))
from core.test_run_utils import TestRun
from api.cas import installer
from api.cas imp... | [
"sys.path.append",
"core.test_run_utils.TestRun.prepare",
"test_wrapper.plugin.cleanup",
"api.cas.casadm.stop_all_caches",
"test_wrapper.plugin.prepare",
"test_utils.os_utils.Udev.enable",
"os.path.dirname",
"api.cas.installer.reinstall_opencas",
"pytest.fixture",
"core.test_run_utils.TestRun.LOGG... | [((477, 505), 'sys.path.append', 'sys.path.append', (['plugins_dir'], {}), '(plugins_dir)\n', (492, 505), False, 'import sys\n'), ((617, 662), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""', 'autouse': '(True)'}), "(scope='session', autouse=True)\n", (631, 662), False, 'import pytest\n'), ((923, 939... |
'''
The projectutils module provides common operations related to data/ai projects
'''
import os
def init_project_structure(root_folder:str = None):
'''Creates the folders to start a the Data/AI Project that leverages Azure MLOps
Skips folder creation if folder already exists.
Args:
root_folder... | [
"os.mkdir",
"os.makedirs",
"os.getcwd",
"os.path.exists",
"os.path.join",
"os.chdir"
] | [((521, 532), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (530, 532), False, 'import os\n'), ((727, 752), 'os.path.exists', 'os.path.exists', (['root_path'], {}), '(root_path)\n', (741, 752), False, 'import os\n'), ((641, 652), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (650, 652), False, 'import os\n'), ((779, 798), ... |
""" UDF is called user define function
UDF is very useful when you want to transform your data frame, and there is no pre-defined
Spark sql functions already available.
To define a spark udf, you have three options:
1. use pyspark.sql.functions.udf, this works for select, withColumn.
udf(lambda_function, return_typ... | [
"pyspark.sql.SparkSession.builder.master",
"pyspark.sql.types.IntegerType",
"pyspark.sql.types.StringType"
] | [((1236, 1249), 'pyspark.sql.types.IntegerType', 'IntegerType', ([], {}), '()\n', (1247, 1249), False, 'from pyspark.sql.types import IntegerType, StringType\n'), ((1336, 1349), 'pyspark.sql.types.IntegerType', 'IntegerType', ([], {}), '()\n', (1347, 1349), False, 'from pyspark.sql.types import IntegerType, StringType\... |
# encoding: utf-8
import pytest
import mongoengine
from functools import partial
from marrow.task.message import Message
from marrow.task.runner import Runner
@pytest.fixture(scope="module", autouse=True)
def connection(request):
"""Automatically connect before testing and discard data after testing."""
connecti... | [
"threading.Thread",
"functools.partial",
"mongoengine.connect",
"marrow.task.runner.Runner",
"pytest.fixture",
"marrow.task.runner.Runner._get_config"
] | [((165, 209), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'autouse': '(True)'}), "(scope='module', autouse=True)\n", (179, 209), False, 'import pytest\n'), ((826, 917), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'params': "['thread', 'process']", 'ids': "['thread', 'proces... |
import os, sys
root_path = os.path.realpath(__file__).split('/evaluate/multipose_keypoint_val.py')[0]
os.chdir(root_path)
sys.path.append(root_path)
from training.batch_processor import batch_processor
from network.posenet import poseNet
from datasets.coco import get_loader
from evaluate.tester import Tester
# Hyper-... | [
"sys.path.append",
"os.path.realpath",
"network.posenet.poseNet",
"evaluate.tester.Tester",
"evaluate.tester.Tester.TestParams",
"os.chdir"
] | [((102, 121), 'os.chdir', 'os.chdir', (['root_path'], {}), '(root_path)\n', (110, 121), False, 'import os, sys\n'), ((122, 148), 'sys.path.append', 'sys.path.append', (['root_path'], {}), '(root_path)\n', (137, 148), False, 'import os, sys\n'), ((565, 584), 'evaluate.tester.Tester.TestParams', 'Tester.TestParams', ([],... |
# coding: utf-8
# In[1]:
import magma as m
m.set_mantle_target("coreir")
import mantle
def DefineShiftRegister(n, init=0, has_ce=False, has_reset=False):
class _ShiftRegister(m.Circuit):
name = 'ShiftRegister_{}_{}_{}_{}'.format(n, init, has_ce, has_reset)
IO = ['I', m.In(m.Bit), 'O', m.Out(m.B... | [
"magma.simulator.coreir_simulator.CoreIRSimulator",
"magma.wireclock",
"magma.waveform.waveform",
"magma.In",
"magma.wire",
"magma.Out",
"mantle.FFs",
"magma.braid",
"magma.ClockInterface",
"magma.set_mantle_target"
] | [((47, 76), 'magma.set_mantle_target', 'm.set_mantle_target', (['"""coreir"""'], {}), "('coreir')\n", (66, 76), True, 'import magma as m\n'), ((1028, 1089), 'magma.simulator.coreir_simulator.CoreIRSimulator', 'CoreIRSimulator', (['ShiftRegisterNCE'], {'clock': 'ShiftRegisterNCE.CLK'}), '(ShiftRegisterNCE, clock=ShiftRe... |
import argparse
import os
import gym
import gym_conservation
import gym_fishing
import gym_climate
import optuna
import torch
from hyperparams_utils import (
sample_a2c_params,
sample_ddpg_params,
sample_ppo_params,
sample_sac_params,
sample_td3_params,
)
from simulate_vec import simulate_mdp_vec
f... | [
"stable_baselines3.common.env_util.make_vec_env",
"gym.make",
"argparse.ArgumentParser",
"simulate_vec.simulate_mdp_vec",
"os.makedirs",
"os.path.exists",
"torch.cuda.is_available",
"torch.cuda.current_device",
"optuna.create_study",
"optuna.samplers.TPESampler"
] | [((514, 539), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (537, 539), False, 'import argparse\n'), ((1802, 1849), 'stable_baselines3.common.env_util.make_vec_env', 'make_vec_env', (['args.env'], {'n_envs': "params['n_envs']"}), "(args.env, n_envs=params['n_envs'])\n", (1814, 1849), False, 'f... |
# SISO program weirdCrashOnSelf.py
# This program is deliberately crafted to enable a certain proof by
# contradiction. Given input string progString representing a python
# program P, weirdCrashOnSelf returns successfully if P(P) causes a
# crash; otherwise, weirdCrashOnSelf crashes.
import utils
from utils import rf... | [
"crashOnSelf.crashOnSelf"
] | [((403, 426), 'crashOnSelf.crashOnSelf', 'crashOnSelf', (['progString'], {}), '(progString)\n', (414, 426), False, 'from crashOnSelf import crashOnSelf\n')] |
from plynx.db.db_object import DBObject, DBObjectField
class InputValue(DBObject):
"""Basic Value of the Input structure."""
FIELDS = {
'node_id': DBObjectField(
type=str,
default='',
is_list=False,
),
'output_id': DBObjectField(
typ... | [
"plynx.db.db_object.DBObjectField"
] | [((166, 216), 'plynx.db.db_object.DBObjectField', 'DBObjectField', ([], {'type': 'str', 'default': '""""""', 'is_list': '(False)'}), "(type=str, default='', is_list=False)\n", (179, 216), False, 'from plynx.db.db_object import DBObject, DBObjectField\n'), ((290, 340), 'plynx.db.db_object.DBObjectField', 'DBObjectField'... |
from sqlalchemy import create_engine
import testing.postgresql
import settings
from sequences import create_sequences
# Launch new PostgreSQL server
Postgres = testing.postgresql.PostgresqlFactory(cache_initialized_db=False)
postgresql = Postgres()
settings.DB_URL = postgresql.url()
engine = create_engine(postgresql.... | [
"sequences.create_sequences"
] | [((327, 351), 'sequences.create_sequences', 'create_sequences', (['engine'], {}), '(engine)\n', (343, 351), False, 'from sequences import create_sequences\n')] |
# encoding: utf-8
"""
@author: loveletter
@contact: <EMAIL>
"""
import torchvision.transforms as T
from .transforms import RandomErasing
def build_transforms(cfg, is_train=True):
normalize_transform = T.Normalize(mean=cfg.INPUT.PIXEL_MEAN, std=cfg.INPUT.PIXEL_STD)
if is_train:
transform_ = T.Compos... | [
"torchvision.transforms.ColorJitter",
"torchvision.transforms.RandomRotation",
"torchvision.transforms.ToTensor",
"torchvision.transforms.Pad",
"torchvision.transforms.Normalize",
"torchvision.transforms.RandomCrop",
"torchvision.transforms.Resize"
] | [((210, 273), 'torchvision.transforms.Normalize', 'T.Normalize', ([], {'mean': 'cfg.INPUT.PIXEL_MEAN', 'std': 'cfg.INPUT.PIXEL_STD'}), '(mean=cfg.INPUT.PIXEL_MEAN, std=cfg.INPUT.PIXEL_STD)\n', (221, 273), True, 'import torchvision.transforms as T\n'), ((336, 366), 'torchvision.transforms.Resize', 'T.Resize', (['cfg.INP... |
from django.conf.urls import include, url
from django.contrib import admin
from accounts import views as accounts_views
from base import views as base_views
admin.autodiscover()
urlpatterns = [
url(r'^accounts/', include('accounts.urls')),
url(r'^contact/', accounts_views.contact, name="contact"),
url(r'^... | [
"django.contrib.admin.autodiscover",
"django.conf.urls.include",
"django.conf.urls.url"
] | [((158, 178), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (176, 178), False, 'from django.contrib import admin\n'), ((250, 306), 'django.conf.urls.url', 'url', (['"""^contact/"""', 'accounts_views.contact'], {'name': '"""contact"""'}), "('^contact/', accounts_views.contact, name='contac... |
import numpy as np
import pandas as pd
import matplotlib
matplotlib.rcParams['text.usetex'] = True
matplotlib.rcParams['pdf.fonttype'] = 42
import matplotlib.pyplot as plt; plt.rcdefaults()
import seaborn as sns
plt.close('all')
plt.rcParams["font.family"] = "serif"
plt.rcParams["font.serif"] = "Times New Roman"
impo... | [
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.close",
"matplotlib.pyplot.rcdefaults",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.savefig"
] | [((174, 190), 'matplotlib.pyplot.rcdefaults', 'plt.rcdefaults', ([], {}), '()\n', (188, 190), True, 'import matplotlib.pyplot as plt\n'), ((214, 230), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (223, 230), True, 'import matplotlib.pyplot as plt\n'), ((1809, 1818), 'matplotlib.pyplot.clf',... |
from Statistics.Proportion import proportion
from Calculator.subtraction import subtraction
from Calculator.multiplication import multiplication
from Calculator.division import division
def var_pop_prop(data):
prob_poss = proportion(data)
prob_imposs = subtraction(prob_poss, 1)
result = multiplication(pro... | [
"Calculator.multiplication.multiplication",
"Statistics.Proportion.proportion",
"Calculator.subtraction.subtraction"
] | [((228, 244), 'Statistics.Proportion.proportion', 'proportion', (['data'], {}), '(data)\n', (238, 244), False, 'from Statistics.Proportion import proportion\n'), ((263, 288), 'Calculator.subtraction.subtraction', 'subtraction', (['prob_poss', '(1)'], {}), '(prob_poss, 1)\n', (274, 288), False, 'from Calculator.subtract... |
#!/usr/bin/env python3
# zip constructorword.zip ConstructorWordGuess/keys.js
# call(["ls", "-l"])
import os
from subprocess import call
zipFileName = "constructorword.zip"
if os.path.exists(zipFileName):
os.remove(zipFileName)
myFolder = "ConstructorWordGuess"
files = ["Letter.js", "Word.js", "index.js", "packa... | [
"os.remove",
"subprocess.call",
"os.path.exists"
] | [((179, 206), 'os.path.exists', 'os.path.exists', (['zipFileName'], {}), '(zipFileName)\n', (193, 206), False, 'import os\n'), ((210, 232), 'os.remove', 'os.remove', (['zipFileName'], {}), '(zipFileName)\n', (219, 232), False, 'import os\n'), ((513, 525), 'subprocess.call', 'call', (['myCall'], {}), '(myCall)\n', (517,... |
"""
Script to investigate quantity of known turbine types assocaited to generators
in WECC base case (or any case).
Input: location of .sav file
"""
import pprint
import os
import subprocess
import signal
import time
import __builtin__
print(os.getcwd())
# workaround for interactive mode runs (Use as required)
#os.ch... | [
"os.getcwd",
"psltdsim.init_PSLF",
"os.chdir"
] | [((378, 443), 'os.chdir', 'os.chdir', (['"""C:\\\\Users\\\\heyth\\\\source\\\\repos\\\\thadhaines\\\\PSLTDSim"""'], {}), "('C:\\\\Users\\\\heyth\\\\source\\\\repos\\\\thadhaines\\\\PSLTDSim')\n", (386, 443), False, 'import os\n'), ((1319, 1350), 'psltdsim.init_PSLF', 'ltd.init_PSLF', (['locations', '(False)'], {}), '(l... |
# -*- coding: utf-8 -
"""Tests of the component module.
SPDX-License-Identifier: MIT
"""
from configparser import NoSectionError
from unittest.mock import MagicMock
import getpass
import os
import keyring
import pytest
from oemof.db import connect
def test_url_with_keyring():
os.chdir(os.path.dirname(__file_... | [
"unittest.mock.MagicMock",
"os.getcwd",
"os.path.dirname",
"configparser.NoSectionError",
"oemof.db.connect.url",
"pytest.raises"
] | [((382, 423), 'unittest.mock.MagicMock', 'MagicMock', ([], {'return_value': '"""super_secure_pw"""'}), "(return_value='super_secure_pw')\n", (391, 423), False, 'from unittest.mock import MagicMock\n'), ((451, 462), 'unittest.mock.MagicMock', 'MagicMock', ([], {}), '()\n', (460, 462), False, 'from unittest.mock import M... |
import upnpclient
import threading
from time import sleep
from ovos_utils.log import LOG
from ovos_utils.xml_helper import xml2dict
from jarbas_hive_mind.slave import HiveMindSlave
from jarbas_hive_mind.slave.terminal import HiveMindTerminal
from jarbas_hive_mind.discovery.zero import ZeroScanner
import requests
clas... | [
"ovos_utils.log.LOG.info",
"jarbas_hive_mind.discovery.zero.ZeroScanner",
"upnpclient.discover",
"ovos_utils.log.LOG.error",
"ovos_utils.xml_helper.xml2dict",
"time.sleep",
"jarbas_hive_mind.HiveMindConnection",
"requests.get",
"ovos_utils.log.LOG.exception"
] | [((4206, 4219), 'jarbas_hive_mind.discovery.zero.ZeroScanner', 'ZeroScanner', ([], {}), '()\n', (4217, 4219), False, 'from jarbas_hive_mind.discovery.zero import ZeroScanner\n'), ((4614, 4654), 'ovos_utils.log.LOG.info', 'LOG.info', (["('UpNp Node Found: ' + node.xml)"], {}), "('UpNp Node Found: ' + node.xml)\n", (4622... |
"""
<NAME>., <NAME>., & <NAME>. 2004, MNRAS, 347, 144
"""
import numpy as np
# Parameters for the Sazonov & Ostriker AGN template
_Alpha = 0.24
_Beta = 1.60
_Gamma = 1.06
_E_1 = 83e3
_K = 0.0041
_E_0 = (_Beta - _Alpha) * _E_1
_A = np.exp(2e3 / _E_1) * 2e3**_Alpha
_B = ((_E_0**(_Beta - _Alpha)) \
* np.exp(-(_Beta ... | [
"numpy.zeros_like",
"numpy.exp"
] | [((233, 254), 'numpy.exp', 'np.exp', (['(2000.0 / _E_1)'], {}), '(2000.0 / _E_1)\n', (239, 254), True, 'import numpy as np\n'), ((305, 330), 'numpy.exp', 'np.exp', (['(-(_Beta - _Alpha))'], {}), '(-(_Beta - _Alpha))\n', (311, 330), True, 'import numpy as np\n'), ((585, 608), 'numpy.exp', 'np.exp', (['(2000.0 / 2000.0)'... |
import cProfile
import optparse
import os
import sys
from scrapy.cmdline import (
garbage_collect,
_get_commands_from_entry_points,
_get_commands_from_module,
_pop_command_name,
_run_print_help,
)
from scrapy.utils.project import get_project_settings, inside_project
import os_scrapy
from .patch im... | [
"scrapy.cmdline._get_commands_from_module",
"scrapy.utils.project.inside_project",
"scrapy.utils.project.get_project_settings",
"scrapy.cmdline.garbage_collect",
"scrapy.cmdline._run_print_help",
"scrapy.cmdline._pop_command_name",
"cProfile.Profile",
"optparse.TitledHelpFormatter",
"scrapy.cmdline.... | [((567, 585), 'cProfile.Profile', 'cProfile.Profile', ([], {}), '()\n', (583, 585), False, 'import cProfile\n'), ((1937, 1992), 'scrapy.cmdline._get_commands_from_module', '_get_commands_from_module', (['"""scrapy.commands"""', 'inproject'], {}), "('scrapy.commands', inproject)\n", (1962, 1992), False, 'from scrapy.cmd... |
#!/usr/bin/python3
"""
Author : <NAME> <<EMAIL>>
MIT License
Copyright (c) 2019 <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 righ... | [
"json.loads",
"logging.basicConfig",
"os.path.join",
"os.getcwd",
"time.gmtime",
"os.path.dirname",
"json.dumps",
"traceback.format_exc",
"requests.get",
"requests.post",
"datetime.datetime.now",
"sys.exit"
] | [((1735, 1825), 'requests.get', 'requests.get', (["(ELK_URL + '/' + MAIN_INDEX + '/' + '_search')"], {'data': 'json_value', 'timeout': '(5)'}), "(ELK_URL + '/' + MAIN_INDEX + '/' + '_search', data=json_value,\n timeout=5)\n", (1747, 1825), False, 'import requests\n'), ((2027, 2050), 'json.loads', 'json.loads', (['re... |
import re
import neo4j_service
import json
FEMALE = [r"(n|N)ữ"]
MALE = [r"(n|N)am", "nam giới"]
AGE = [r"[0-9]{1,4}\s{1,6}tuổi"]
BN_RANGE = [
r"CA BỆNH\s{1,6}[0-9]{1,4} - [0-9]{1,4}",
r"Bệnh nhân\s[0-9]{1,4} - [0-9]{1,4}",
r"Bệnh nhân số\s{1,6}[0-9]{1,4} - [0-9]{1,4}"
]
BNre = [
r"CA BỆNH\s{1,6}[0-9]{1... | [
"json.load",
"neo4j_service.updateBN",
"neo4j_service.createConnectPTVT",
"neo4j_service.createTranspotation",
"neo4j_service.createBN",
"re.findall",
"re.search",
"neo4j_service.createConnect"
] | [((6656, 6668), 'json.load', 'json.load', (['f'], {}), '(f)\n', (6665, 6668), False, 'import json\n'), ((1055, 1080), 're.search', 're.search', (['i', 'text', 'flags'], {}), '(i, text, flags)\n', (1064, 1080), False, 'import re\n'), ((1159, 1184), 're.search', 're.search', (['i', 'text', 'flags'], {}), '(i, text, flags... |
from random import randrange
import pygame
# Define some colors
BLACK = (0, 0, 0,)
WHITE = (255, 255, 255,)
RED = (255, 0, 0,)
BLUE = (0, 0, 255,)
GREEN = (0, 255, 0,)
YELLOW = (255, 255, 0,)
SELECTED_RED = (255, 120, 120,)
SELECTED_BLUE = (120, 120, 255,)
SELECTED_GREEN = (120, 255, 120,)
SELECTED_YE... | [
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.draw.rect",
"pygame.init",
"pygame.display.flip",
"random.randrange",
"pygame.font.Font",
"pygame.mouse.get_pos",
"pygame.display.set_caption",
"pygame.time.Clock"
] | [((1034, 1047), 'pygame.init', 'pygame.init', ([], {}), '()\n', (1045, 1047), False, 'import pygame\n'), ((1058, 1098), 'pygame.font.Font', 'pygame.font.Font', (['"""freesansbold.ttf"""', '(32)'], {}), "('freesansbold.ttf', 32)\n", (1074, 1098), False, 'import pygame\n'), ((1202, 1231), 'pygame.display.set_mode', 'pyga... |
from django.contrib import admin
from guardian.admin import GuardedModelAdmin
from users import models
@admin.register(models.SSHPublicKey)
class SSHPublicKeyAdmin(GuardedModelAdmin):
pass
@admin.register(models.DockerCert)
class DockerCert(GuardedModelAdmin):
pass
@admin.register(models.APIToken)
class ... | [
"django.contrib.admin.register"
] | [((107, 142), 'django.contrib.admin.register', 'admin.register', (['models.SSHPublicKey'], {}), '(models.SSHPublicKey)\n', (121, 142), False, 'from django.contrib import admin\n'), ((199, 232), 'django.contrib.admin.register', 'admin.register', (['models.DockerCert'], {}), '(models.DockerCert)\n', (213, 232), False, 'f... |
import Shared.constants.GameConstants as GameConstants;
import Shared.utility.LogUtility as LogUtility;
from Shared.enums.PlayerTypeEnum import PlayerTypeEnum;
from Werewolf.game.roles.Villager import Villager;
from Werewolf.game.roles.Werewolf import Werewolf;
from Werewolf.game.roles.Seer import Seer;
from Werewolf.... | [
"Shared.utility.LogUtility.Information",
"Shared.utility.LogUtility.CreateGameMessage",
"Shared.utility.LogUtility.Warning",
"random.choice",
"Werewolf.game.roles.Guard.Guard",
"Werewolf.game.roles.Villager.Villager",
"Shared.utility.LogUtility.Error",
"Werewolf.game.roles.Werewolf.Werewolf",
"Werew... | [((2025, 2110), 'Shared.utility.LogUtility.CreateGameMessage', 'LogUtility.CreateGameMessage', (['f"""\n\n\n\t\t\tWerewolves win!{werewolfNames}\n\n"""', 'game'], {}), '(f"""\n\n\n\t\t\tWerewolves win!{werewolfNames}\n\n""",\n game)\n', (2053, 2110), True, 'import Shared.utility.LogUtility as LogUtility\n'), ((2363,... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as models
#from hyptorch.nn import FromPoincare, ToPoincare, HypLinear
import geoopt
c = 1.0
ball = geoopt.PoincareBall(c)
class ToPoincare(torch.nn.Module):
def __init__(self, dim, ball):
super().__init__()
... | [
"torchvision.models.resnet18",
"torch.nn.ReLU",
"torch.nn.init.uniform_",
"torch.zeros",
"torchvision.models.resnet50",
"torch.nn.init.constant_",
"torch.nn.Linear",
"geoopt.PoincareBall",
"torchvision.models.resnet101"
] | [((194, 216), 'geoopt.PoincareBall', 'geoopt.PoincareBall', (['c'], {}), '(c)\n', (213, 216), False, 'import geoopt\n'), ((332, 348), 'torch.zeros', 'torch.zeros', (['dim'], {}), '(dim)\n', (343, 348), False, 'import torch\n'), ((735, 767), 'torchvision.models.resnet18', 'models.resnet18', ([], {'pretrained': '(True)'}... |
import sys, os, glob
import csv
import numpy as np
# declare output path
# INPUT_FOLDER = "../data/eyedry_output/graphs5/original_eyedry_output_5/*IXS"
# OUTPUT_FOLDER = "../data/eyedry_output/graphs5/edited_eyedry_output_5/"
INPUT_FOLDER = sys.argv[1] + '/*IXS'
OUTPUT_FOLDER = sys.argv[2] + '/'
FILES_TO_PROCESS = [... | [
"csv.reader",
"csv.writer",
"os.makedirs",
"os.path.exists",
"glob.glob"
] | [((331, 354), 'glob.glob', 'glob.glob', (['INPUT_FOLDER'], {}), '(INPUT_FOLDER)\n', (340, 354), False, 'import sys, os, glob\n'), ((1748, 1777), 'os.path.exists', 'os.path.exists', (['OUTPUT_FOLDER'], {}), '(OUTPUT_FOLDER)\n', (1762, 1777), False, 'import sys, os, glob\n'), ((1787, 1813), 'os.makedirs', 'os.makedirs', ... |
from flask import Flask, jsonify, abort, make_response
from flask_restful import Api, Resource, reqparse, marshal
from flasgger import swag_from
from flask_jwt_extended import jwt_required, get_jwt_identity
import datetime
from app import db
from models import models
from resources.fields import issues_fields
class... | [
"flask_restful.marshal",
"flasgger.swag_from",
"flask_jwt_extended.get_jwt_identity",
"models.models.Issues.query.filter_by"
] | [((445, 485), 'flasgger.swag_from', 'swag_from', (['"""apidocs/user_issues_get.yml"""'], {}), "('apidocs/user_issues_get.yml')\n", (454, 485), False, 'from flasgger import swag_from\n'), ((522, 540), 'flask_jwt_extended.get_jwt_identity', 'get_jwt_identity', ([], {}), '()\n', (538, 540), False, 'from flask_jwt_extended... |
from __future__ import absolute_import, division, print_function
import collections
import tensorflow as tf
from tensorflow.python.util import nest
from neuralnetworks.las_elements import AttendAndSpellCell
from neuralnetworks.las_elements import DecodingTouple
from neuralnetworks.las_elements import StateTouple
from... | [
"tensorflow.cond",
"tensorflow.Tensor.get_shape",
"neuralnetworks.las_elements.AttendAndSpellCell",
"tensorflow.reshape",
"tensorflow.greater",
"tensorflow.python.util.nest.flatten",
"tensorflow.one_hot",
"tensorflow.gather",
"tensorflow.nn.top_k",
"tensorflow.logical_or",
"tensorflow.TensorShap... | [((371, 379), 'IPython.core.debugger.Tracer', 'Tracer', ([], {}), '()\n', (377, 379), False, 'from IPython.core.debugger import Tracer\n'), ((1203, 1221), 'tensorflow.python.util.nest.flatten', 'nest.flatten', (['self'], {}), '(self)\n', (1215, 1221), False, 'from tensorflow.python.util import nest\n'), ((1348, 1388), ... |
import getpass
from colorama import *
# This is to make sure that when using colorama the color goes back into the original form
init(autoreset = True)
def start_edit(quiz):
while True:
print(Style.BRIGHT + "Welcome to the Quiz Editor!")
print("What do you want to do?\n")
print("1. Ch... | [
"getpass.getpass"
] | [((5087, 5134), 'getpass.getpass', 'getpass.getpass', (['"""Press Enter to go back . . ."""'], {}), "('Press Enter to go back . . .')\n", (5102, 5134), False, 'import getpass\n'), ((3228, 3275), 'getpass.getpass', 'getpass.getpass', (['"""Press Enter to return . . . """'], {}), "('Press Enter to return . . . ')\n", (32... |
#!/usr/bin/python3
import socket
import sys
#up to but not including pushw 0x5c11
shellcode = bytearray(b'\x29\xc0\x31\xdb\x29\xc9\x31\xd2\x29\xf6\x66\xb8\x67\x01\xb3\x02\xb1\x01\xcd\x80\x89\xc3\x52\x52\x52')
bindPort = int(sys.argv[1])
if bindPort < 1 or bindPort > 0xFFFF:
print("Invalid port value!")
exit()
... | [
"socket.htons"
] | [((397, 419), 'socket.htons', 'socket.htons', (['bindPort'], {}), '(bindPort)\n', (409, 419), False, 'import socket\n')] |
from django.contrib import admin
from .models import Order
from .models import content
# Register your models here.
admin.site.register(Order)
admin.site.register(content) | [
"django.contrib.admin.site.register"
] | [((116, 142), 'django.contrib.admin.site.register', 'admin.site.register', (['Order'], {}), '(Order)\n', (135, 142), False, 'from django.contrib import admin\n'), ((143, 171), 'django.contrib.admin.site.register', 'admin.site.register', (['content'], {}), '(content)\n', (162, 171), False, 'from django.contrib import ad... |
# -*- coding: utf-8 -*-
from time import sleep
from json import loads
from kafka import KafkaConsumer
from config import settings
from common import event_emitter
class Consumer(object):
@property
def topic_prefix(self):
return self._topic_prefix
@property
def consumer(self):
retur... | [
"common.event_emitter.EventEmitter",
"config.settings.KAFKA.get",
"time.sleep"
] | [((573, 607), 'config.settings.KAFKA.get', 'settings.KAFKA.get', (['"""topic_prefix"""'], {}), "('topic_prefix')\n", (591, 607), False, 'from config import settings\n'), ((736, 764), 'common.event_emitter.EventEmitter', 'event_emitter.EventEmitter', ([], {}), '()\n', (762, 764), False, 'from common import event_emitter... |
import logging
from typing import Union, Tuple, Dict, List
import torch
from tqdm import tqdm
from data_utils import LabelField
from data_utils import SMARTTOKDataLoader
from model_utils import (
MultitaskTransformerEncoderClassificationModel,
MultitaskBertClassificationModel,
MultitaskLogisticRegressionC... | [
"tqdm.tqdm",
"torch.no_grad",
"logging.getLogger"
] | [((438, 465), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (455, 465), False, 'import logging\n'), ((889, 989), 'tqdm.tqdm', 'tqdm', (['iterator'], {'unit': '""" batches"""', 'desc': 'f"""[EPOCH {curr_epoch}/{max_epochs}]"""', 'leave': '(False)', 'total': '(0)'}), "(iterator, unit=' bat... |
from __future__ import print_function
import re
import os
from pkg_resources import resource_stream
try:
import configparser as ConfigParser
except ImportError:
import ConfigParser
from .Monosaccharide import *
# This line import the package mutually, be careful
from .GlycanFormatter import WURCS20ParseError... | [
"ConfigParser.SafeConfigParser",
"pkg_resources.resource_stream",
"re.search",
"re.compile"
] | [((1138, 1264), 're.compile', 're.compile', (['"""^([0-9a-zA-Z]{3,9})((-\\\\d[abx])(_[0-9?]-[0-9?])?)?((_([0-9?]|[0-9]\\\\|[0-9]|[0-9]-[0-9])(\\\\*[^_]+)?)*)$"""'], {}), "(\n '^([0-9a-zA-Z]{3,9})((-\\\\d[abx])(_[0-9?]-[0-9?])?)?((_([0-9?]|[0-9]\\\\|[0-9]|[0-9]-[0-9])(\\\\*[^_]+)?)*)$'\n )\n", (1148, 1264), False,... |
import os
import sys
import string
import sqlite3
import base64
import random
import time as time_
import datetime
from core.MsgTool import MsgTool as MT
from core.Plugin import Plugin
import jieba
from zhon import hanzi
import wordcloud
"""
在下面加入你自定义的插件,自动加载本文件所有的 Plugin 的子类
只需要写一个 Plugin 的子类,重写 match() 和 handle()... | [
"os.remove",
"jieba.cut",
"core.MsgTool.MsgTool.text",
"os.path.dirname",
"wordcloud.WordCloud",
"datetime.date.today",
"core.MsgTool.MsgTool.at",
"random.random",
"sqlite3.connect",
"core.MsgTool.MsgTool.get_text_from_msg",
"os.path.join"
] | [((409, 434), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (424, 434), False, 'import os\n'), ((449, 484), 'os.path.join', 'os.path.join', (['current_dir', '"""dat.db"""'], {}), "(current_dir, 'dat.db')\n", (461, 484), False, 'import os\n'), ((495, 519), 'sqlite3.connect', 'sqlite3.connect'... |
import shlex
from gunicorn.app.base import BaseApplication
from django.core.management.base import BaseCommand
from django.core.wsgi import get_wsgi_application
class WSGIApplication(BaseApplication):
"""A Gunicorn Application, with logic to parse config passed from the command"""
def __init__(self, options... | [
"django.core.wsgi.get_wsgi_application",
"shlex.split"
] | [((1129, 1151), 'django.core.wsgi.get_wsgi_application', 'get_wsgi_application', ([], {}), '()\n', (1149, 1151), False, 'from django.core.wsgi import get_wsgi_application\n'), ((755, 780), 'shlex.split', 'shlex.split', (['self.options'], {}), '(self.options)\n', (766, 780), False, 'import shlex\n')] |
from __future__ import annotations
import argparse
import dataclasses
import logging
from typing import Dict
from typing import Iterable
from typing import List
from typing import Optional
from typing import Tuple
from typing import Type
from rich.console import Console
from safdie import BaseCommand
from safdie impo... | [
"dataclasses.field",
"safdie.get_entrypoints",
"logging.getLogger"
] | [((396, 423), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (413, 423), False, 'import logging\n'), ((499, 552), 'safdie.get_entrypoints', 'get_entrypoints', (['SOURCE_ENTRYPOINT_NAME', 'SourcePlugin'], {}), '(SOURCE_ENTRYPOINT_NAME, SourcePlugin)\n', (514, 552), False, 'from safdie impo... |
from setuptools import setup, find_packages
try:
description = open("README.md").read()
except:
description = ""
setup(
name="yify-grabber",
version="0.1.0",
description="Command line tool for downloading subtitles from yify",
python_requires='>=3.6',
license="MIT",
author... | [
"setuptools.find_packages"
] | [((516, 531), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (529, 531), False, 'from setuptools import setup, find_packages\n')] |
#!/usr/bin/env python3
#
# =======================================================================
# @file motors.py
# @brief
# @note
#
# Copyright (C) 2020 <NAME> (<EMAIL>)
# =======================================================================
import math
import time
import rclpy
from rclpy.node import N... | [
"rclpy.init",
"rclpy.spin",
"time.time",
"rclpy.shutdown"
] | [((2715, 2736), 'rclpy.init', 'rclpy.init', ([], {'args': 'args'}), '(args=args)\n', (2725, 2736), False, 'import rclpy\n'), ((2765, 2783), 'rclpy.spin', 'rclpy.spin', (['motors'], {}), '(motors)\n', (2775, 2783), False, 'import rclpy\n'), ((2995, 3011), 'rclpy.shutdown', 'rclpy.shutdown', ([], {}), '()\n', (3009, 3011... |
import numpy as np
from ._base import DMPBase, WeightParametersMixin
from ._forcing_term import ForcingTerm
from ._canonical_system import canonical_system_alpha
from ._dmp import dmp_imitate, dmp_open_loop
class DMPWithFinalVelocity(WeightParametersMixin, DMPBase):
"""Dynamical movement primitive (DMP) with fina... | [
"numpy.zeros_like",
"numpy.copy",
"numpy.empty_like",
"numpy.finfo",
"numpy.diff",
"numpy.array",
"numpy.dot",
"numpy.linalg.solve",
"numpy.vstack"
] | [((5868, 6113), 'numpy.array', 'np.array', (['[[1, t0, t02, t03, t04, t05], [0, 1, 2 * t0, 3 * t02, 4 * t03, 5 * t04], [0,\n 0, 2, 6 * t0, 12 * t02, 20 * t03], [1, t1, t12, t13, t14, t15], [0, 1, \n 2 * t1, 3 * t12, 4 * t13, 5 * t14], [0, 0, 2, 6 * t1, 12 * t12, 20 * t13]]'], {}), '([[1, t0, t02, t03, t04, t05], ... |
from enum import Enum, unique
import pdb
import logging
logging.basicConfig(level=logging.CRITICAL)
logging.debug("---debug---")
logging.info("---info---")
logging.warning("---warning---")
logging.error("---error---")
logging.critical("---critical---")
Month = Enum('Month', ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', ... | [
"logging.error",
"logging.debug",
"logging.basicConfig",
"logging.warning",
"enum.Enum",
"logging.info",
"logging.critical"
] | [((57, 100), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.CRITICAL'}), '(level=logging.CRITICAL)\n', (76, 100), False, 'import logging\n'), ((101, 129), 'logging.debug', 'logging.debug', (['"""---debug---"""'], {}), "('---debug---')\n", (114, 129), False, 'import logging\n'), ((130, 156), 'logg... |
## https://www.kaggle.com/meaninglesslives/nested-unet-with-efficientnet-encoder
import tensorflow as tf
from tensorflow import keras
#from efficientnet import EfficientNetB4
from efficientnet.tfkeras import EfficientNetB4
import numpy as np
def convolution_block(x, filters, size, strides=(1,1), padding='sa... | [
"tensorflow.py_function",
"tensorflow.keras.losses.binary_crossentropy",
"tensorflow.keras.backend.sum",
"efficientnet.tfkeras.EfficientNetB4",
"tensorflow.keras.backend.flatten",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.layers.MaxPooling2D",
... | [((1071, 1160), 'efficientnet.tfkeras.EfficientNetB4', 'EfficientNetB4', ([], {'weights': 'imagenet_weights', 'include_top': '(False)', 'input_shape': 'input_shape'}), '(weights=imagenet_weights, include_top=False, input_shape=\n input_shape)\n', (1085, 1160), False, 'from efficientnet.tfkeras import EfficientNetB4\... |
versions = []
import os
import sys
cur_os = sys.platform.lower()
if "win" in cur_os: ## win32 || "cygwin"
user_name = os.getlogin()
path = os.path.sep.join("C:|Users|duduc|AppData|Local|Google|Chrome|User Data".split("|"))
version_file = "Local State"
true = True
false = False
f = open(os.path.join(path.f... | [
"os.getlogin",
"os.popen",
"urllib.request.urlopen",
"sys.platform.lower"
] | [((46, 66), 'sys.platform.lower', 'sys.platform.lower', ([], {}), '()\n', (64, 66), False, 'import sys\n'), ((122, 135), 'os.getlogin', 'os.getlogin', ([], {}), '()\n', (133, 135), False, 'import os\n'), ((514, 557), 'os.popen', 'os.popen', (['"""google-chrome --product-version"""'], {}), "('google-chrome --product-ver... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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 _utilities
from... | [
"pulumi.get",
"pulumi.getter",
"pulumi.ResourceOptions",
"pulumi.set",
"pulumi.log.warn",
"warnings.warn"
] | [((10653, 10831), 'warnings.warn', 'warnings.warn', (['"""Instance is not yet supported by AWS Native, so its creation will currently fail. Please use the classic AWS provider, if possible."""', 'DeprecationWarning'], {}), "(\n 'Instance is not yet supported by AWS Native, so its creation will currently fail. Please... |
#!/usr/bin/env python2.7
from bs4 import BeautifulSoup
from urllib2 import *
import urllib2
import unicodedata
import string
import re
import requests
import gzip
def getTitle(url, rien):
html = requests.get(url)
soup = BeautifulSoup(html, "html.parser")
return soup.title.string
def isStopWord... | [
"unicodedata.normalize",
"unicodedata.category",
"requests.get",
"bs4.BeautifulSoup",
"re.sub"
] | [((214, 231), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (226, 231), False, 'import requests\n'), ((241, 275), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (254, 275), False, 'from bs4 import BeautifulSoup\n'), ((919, 953), 'unicodedata.normalize',... |
#!/usr/bin/env python
"""Plot Q test statistics"""
import argparse
import csv
import math
import matplotlib
import numpy as np
import shutil
import tensorflow.compat.v2 as tf
import b_meson_fit as bmf
tf.enable_v2_behavior()
def read_q_stats(csv_path):
"""Return list of Q stats from file"""
q_list = []
... | [
"numpy.sum",
"matplotlib.pylab.gca",
"numpy.histogram",
"numpy.mean",
"numpy.exp",
"matplotlib.pylab.figure",
"matplotlib.pylab.show",
"matplotlib.pylab.scatter",
"matplotlib.pylab.legend",
"numpy.std",
"shutil.get_terminal_size",
"argparse.HelpFormatter",
"numpy.linspace",
"math.log",
"... | [((203, 226), 'tensorflow.compat.v2.enable_v2_behavior', 'tf.enable_v2_behavior', ([], {}), '()\n', (224, 226), True, 'import tensorflow.compat.v2 as tf\n'), ((757, 783), 'shutil.get_terminal_size', 'shutil.get_terminal_size', ([], {}), '()\n', (781, 783), False, 'import shutil\n'), ((1722, 1752), 'b_meson_fit.Script',... |
# the DeIsTe model, rewritten in AllenNLP
from typing import Optional, Dict
import torch
from allennlp.common import Params
from allennlp.models.model import Model
from allennlp.data import Vocabulary
from allennlp.modules import TextFieldEmbedder, Seq2VecEncoder, FeedForward, TokenEmbedder
from allennlp.nn import Init... | [
"allennlp.nn.InitializerApplicator",
"allennlp.nn.util.weighted_sum",
"allennlp.models.model.Model.register",
"allennlp.nn.util.get_text_field_mask",
"allennlp.modules.FeedForward.from_params",
"allennlp.modules.TextFieldEmbedder.from_params",
"allennlp.nn.util.replace_masked_values",
"torch.nn.CrossE... | [((605, 629), 'allennlp.models.model.Model.register', 'Model.register', (['"""deiste"""'], {}), "('deiste')\n", (619, 629), False, 'from allennlp.models.model import Model\n'), ((1054, 1077), 'allennlp.nn.InitializerApplicator', 'InitializerApplicator', ([], {}), '()\n', (1075, 1077), False, 'from allennlp.nn import In... |
# from socketIO_client import SocketIO, LoggingNamespace
import sys
import socketio
import numpy as np
import math
from random import randrange
sio = socketio.Client()
@sio.on('receive_chaos_output2')
def on_message(msg):
if msg['output'] == tpmclient.tpm.chaosmap():
tpmclient.IsSync = True
prin... | [
"socketio.Client",
"numpy.zeros",
"numpy.hstack",
"math.copysign",
"numpy.random.randint",
"numpy.array",
"random.randrange",
"numpy.dot"
] | [((152, 169), 'socketio.Client', 'socketio.Client', ([], {}), '()\n', (167, 169), False, 'import socketio\n'), ((4404, 4420), 'numpy.zeros', 'np.zeros', (['self.k'], {}), '(self.k)\n', (4412, 4420), True, 'import numpy as np\n'), ((4928, 4947), 'math.copysign', 'math.copysign', (['(1)', 'x'], {}), '(1, x)\n', (4941, 49... |
from datetime import datetime
import os
import ftplib
from cbp.core import logs
import sys
debug_level = 0
'''
Уровень отладки:
0 - не производит отладочный вывод.
1 - производит умеренное количество результатов отладки, обычно одна строка на запрос.
2 - каждая строка, отп... | [
"os.path.isfile",
"os.remove",
"datetime.datetime.now",
"ftplib.FTP"
] | [((529, 543), 'ftplib.FTP', 'ftplib.FTP', (['ip'], {}), '(ip)\n', (539, 543), False, 'import ftplib\n'), ((1368, 1382), 'ftplib.FTP', 'ftplib.FTP', (['ip'], {}), '(ip)\n', (1378, 1382), False, 'import ftplib\n'), ((1323, 1337), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1335, 1337), False, 'from dateti... |
import argparse
import utils
def hyperparam():
parser = argparse.ArgumentParser(description="get hyperparameters for training")
parser.add_argument('root', metavar='root', type=str, help="enter root dir for lane files")
# parser.add_argument('-lr', '--lr', type=float, required=True, help="learning rate")
... | [
"argparse.ArgumentParser"
] | [((61, 132), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""get hyperparameters for training"""'}), "(description='get hyperparameters for training')\n", (84, 132), False, 'import argparse\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('forum', '0003_auto_20160317_2138'),
]... | [
"django.db.models.TextField",
"django.db.migrations.swappable_dependency",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.IntegerField",
"django.db.migrations.AlterModelOptions",
"django.db.models.DateTimeField"
] | [((210, 267), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (241, 267), False, 'from django.db import models, migrations\n'), ((1059, 1245), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([]... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import tensorflow as tf
import numpy as np
from tensorflow.python.training import training_ops
from tensorflow.python.training import slot_creator
logger = logging.getLog... | [
"tensorflow.device",
"tensorflow.global_norm",
"tensorflow.gradients",
"tensorflow.train.AdamOptimizer",
"tensorflow.clip_by_global_norm",
"logging.getLogger"
] | [((306, 347), 'logging.getLogger', 'logging.getLogger', (['"""StRADRL.adam_applier"""'], {}), "('StRADRL.adam_applier')\n", (323, 347), False, 'import logging\n'), ((693, 736), 'tensorflow.train.AdamOptimizer', 'tf.train.AdamOptimizer', (['self._learning_rate'], {}), '(self._learning_rate)\n', (715, 736), True, 'import... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"azure.cli.core.commands.client_factory.get_mgmt_service_client"
] | [((660, 727), 'azure.cli.core.commands.client_factory.get_mgmt_service_client', 'get_mgmt_service_client', (['cli_ctx', 'ContainerRegistryManagementClient'], {}), '(cli_ctx, ContainerRegistryManagementClient)\n', (683, 727), False, 'from azure.cli.core.commands.client_factory import get_mgmt_service_client\n')] |
from whattime import Hemisphere, season_info
# Spring:
def test_is_spring_for_northern_hemisphere(months):
"""Test returns true for spring months on the northern hemisphere"""
assert season_info(months.january, Hemisphere.NORTHERN).is_spring is False
assert season_info(months.february, Hemisphere.NORTHE... | [
"whattime.season_info"
] | [((195, 243), 'whattime.season_info', 'season_info', (['months.january', 'Hemisphere.NORTHERN'], {}), '(months.january, Hemisphere.NORTHERN)\n', (206, 243), False, 'from whattime import Hemisphere, season_info\n'), ((274, 323), 'whattime.season_info', 'season_info', (['months.february', 'Hemisphere.NORTHERN'], {}), '(m... |
import torch
from torch.nn import functional as F
from torch import nn
from pytorch_lightning.core.lightning import LightningModule
from pytorch_lightning import Trainer
from torch.optim import Adam
import pytorch_lightning as pl
import shutil
import os
from os import path
import splitfolders
from pathlib import Path
f... | [
"pytorch_lightning.Trainer",
"encoders_dali.load_encoder",
"argparse.ArgumentParser",
"os.path.isdir",
"torch.nn.BatchNorm1d",
"splitfolders.ratio",
"os.walk",
"pytorch_lightning.loggers.WandbLogger",
"torch.squeeze",
"pathlib.Path",
"pl_bolts.callbacks.ssl_online.SSLOnlineEvaluator",
"torch.n... | [((4913, 4929), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (4927, 4929), False, 'from argparse import ArgumentParser\n'), ((7064, 7112), 'pytorch_lightning.loggers.WandbLogger', 'WandbLogger', ([], {'name': 'log_name', 'project': '"""SpaceForce"""'}), "(name=log_name, project='SpaceForce')\n", (7075... |
import torch
import torch.nn as nn
import numpy as np
def Angular(margin):#angular mc
#https://github.com/ronekko/deep_metric_learning/blob/master/lib/functions/angular_loss.py
return AngularLoss(margin=margin)
class AngularLoss(nn.Module):
def __init__(self,margin):
super(AngularLoss, self).__in... | [
"torch.ones",
"torch.eye",
"numpy.deg2rad"
] | [((557, 580), 'numpy.deg2rad', 'np.deg2rad', (['self.margin'], {}), '(self.margin)\n', (567, 580), True, 'import numpy as np\n'), ((998, 1026), 'torch.ones', 'torch.ones', (['n_pairs', 'n_pairs'], {}), '(n_pairs, n_pairs)\n', (1008, 1026), False, 'import torch\n'), ((1026, 1053), 'torch.eye', 'torch.eye', (['n_pairs', ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test suite for zcomx/modules/my/constants.py
"""
import unittest
from applications.zcomx.modules.my.constants import \
ASCII_CHARACTER, \
ASCII_DESCRIPTION, \
ASCII_FRIENDLY_CODE, \
ASCII_HEX_CODE, \
ASCII_NUMERICAL_CODE, \
... | [
"unittest.main",
"applications.zcomx.modules.my.constants.ascii_lookup"
] | [((2442, 2457), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2455, 2457), False, 'import unittest\n'), ((2076, 2110), 'applications.zcomx.modules.my.constants.ascii_lookup', 'ascii_lookup', (['"""$"""', 'ASCII_CHARACTER'], {}), "('$', ASCII_CHARACTER)\n", (2088, 2110), False, 'from applications.zcomx.modules.my... |
#Library
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import random
import itertools
import doctest
import copy
import math
import wandb
from tqdm import tqdm
from collections import defaultdict
#Node Class
#information set node class definition
class Node:
#1 #Leduc_node_definitions
de... | [
"matplotlib.pyplot.xscale",
"wandb.log",
"matplotlib.pyplot.yscale",
"random.shuffle",
"matplotlib.pyplot.legend",
"itertools.permutations",
"collections.defaultdict",
"numpy.array",
"wandb.save",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"pandas.set_option",
"doctest.testmod"
... | [((32412, 32451), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', 'None'], {}), "('display.max_rows', None)\n", (32425, 32451), True, 'import pandas as pd\n'), ((32957, 32974), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (32972, 32974), False, 'import doctest\n'), ((3162, 3179), 'collectio... |
import torch
import torch.nn as nn
from graph.weights_initializer import weights_init
def decoder_conv(_in, _out):
return nn.Sequential(
nn.Conv2d(_in, _out, kernel_size=3, stride=1, padding=1),
nn.ReLU(inplace=True),
)
class Edge(nn.Module):
def __init__(self):
super(Edge, self... | [
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.cat",
"torch.nn.functional.interpolate",
"torch.nn.Sigmoid"
] | [((152, 208), 'torch.nn.Conv2d', 'nn.Conv2d', (['_in', '_out'], {'kernel_size': '(3)', 'stride': '(1)', 'padding': '(1)'}), '(_in, _out, kernel_size=3, stride=1, padding=1)\n', (161, 208), True, 'import torch.nn as nn\n'), ((218, 239), 'torch.nn.ReLU', 'nn.ReLU', ([], {'inplace': '(True)'}), '(inplace=True)\n', (225, 2... |
#!/usr/bin/env python3
import re
import sys
import subprocess
import os.path as path
from function_to_lexed import BINOPS, UNOPS
BINOPS.update({'+', '-', '*', '/', 'powi'})
UNOPS.update({'neg', "dabs", "datanh"})
ATOMS = {"Integer", "Float", "ConstantInterval", "InputInterval", "PointInterval"}
INFIX = {'+', '-', '... | [
"sys.stdout.write",
"sys.stdin.read",
"re.match",
"function_to_lexed.BINOPS.update",
"re.search",
"function_to_lexed.UNOPS.update",
"os.path.join",
"sys.exit"
] | [((133, 176), 'function_to_lexed.BINOPS.update', 'BINOPS.update', (["{'+', '-', '*', '/', 'powi'}"], {}), "({'+', '-', '*', '/', 'powi'})\n", (146, 176), False, 'from function_to_lexed import BINOPS, UNOPS\n'), ((177, 216), 'function_to_lexed.UNOPS.update', 'UNOPS.update', (["{'neg', 'dabs', 'datanh'}"], {}), "({'neg',... |
import numpy as np
class LossFunction:
@staticmethod
def calculate_cost(expected_value, predicted):
raise NotImplementedError("Should have implemented this!")
@staticmethod
def calculate_cost_gradient(expected_value, outputs, derivative_outputs):
raise NotImplementedError("Should have... | [
"numpy.linalg.norm"
] | [((478, 518), 'numpy.linalg.norm', 'np.linalg.norm', (['(expected_value - outputs)'], {}), '(expected_value - outputs)\n', (492, 518), True, 'import numpy as np\n')] |
import glob
import os
from pathlib import Path
from typing import List
import pytest
import r2pipe
from r2pyapi import R2ByteSearchResult, R2Instruction, R2Seeker, R2SearchRegion
test_bins: List[str] = glob.glob(
os.path.join(os.path.abspath(os.path.splitext(__file__)[0]), "*.bin")
)
@pytest.mark.parametrize("... | [
"r2pyapi.R2Seeker.get_pos",
"r2pyapi.R2ByteSearchResult",
"r2pyapi.R2Seeker.get_search_region",
"r2pyapi.R2Seeker",
"r2pyapi.R2Instruction",
"r2pipe.open",
"r2pyapi.R2Seeker.set_search_region",
"r2pyapi.R2SearchRegion",
"os.path.splitext",
"pytest.mark.parametrize"
] | [((295, 341), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""test_bin"""', 'test_bins'], {}), "('test_bin', test_bins)\n", (318, 341), False, 'import pytest\n'), ((733, 779), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""test_bin"""', 'test_bins'], {}), "('test_bin', test_bins)\n", (756, 779)... |
# ==================================================================================================
# Copyright 2011 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | [
"pytest.raises",
"twitter.common.rpc.finagle.trace.SpanId.from_value",
"twitter.common.rpc.finagle.trace.SpanId"
] | [((1025, 1060), 'pytest.raises', 'pytest.raises', (['SpanId.InvalidSpanId'], {}), '(SpanId.InvalidSpanId)\n', (1038, 1060), False, 'import pytest\n'), ((1066, 1091), 'twitter.common.rpc.finagle.trace.SpanId.from_value', 'SpanId.from_value', (['"""1234"""'], {}), "('1234')\n", (1083, 1091), False, 'from twitter.common.r... |
# Generated by Django 3.2.8 on 2021-10-19 07:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('z_gram', '0005_rename_comment_usercomment'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
name=... | [
"django.db.models.ImageField"
] | [((357, 443), 'django.db.models.ImageField', 'models.ImageField', ([], {'default': '"""images/profile/user.png"""', 'upload_to': '"""images/profile/"""'}), "(default='images/profile/user.png', upload_to=\n 'images/profile/')\n", (374, 443), False, 'from django.db import migrations, models\n')] |
from dataclasses import dataclass
@dataclass
class Pool:
param1: int
@dataclass
class HEPnOS:
pools: list
# metalgpy
import numpy as np
import metalgpy as mpy
rng = np.random.RandomState(42)
Pool_ = mpy.meta(Pool)
HEPnOS_ = mpy.meta(HEPnOS)
max_pools = 5
num_pools = mpy.Int(1, max_pools)
pools = mpy.Li... | [
"metalgpy.Int",
"metalgpy.sample",
"numpy.random.RandomState",
"metalgpy.meta"
] | [((179, 204), 'numpy.random.RandomState', 'np.random.RandomState', (['(42)'], {}), '(42)\n', (200, 204), True, 'import numpy as np\n'), ((214, 228), 'metalgpy.meta', 'mpy.meta', (['Pool'], {}), '(Pool)\n', (222, 228), True, 'import metalgpy as mpy\n'), ((239, 255), 'metalgpy.meta', 'mpy.meta', (['HEPnOS'], {}), '(HEPnO... |
#!/usr/bin/env python
__author__ = "<NAME>"
__copyright__ = "Copyright 2020, The Spark Structured Playground Project"
__credits__ = []
__license__ = "Apache License"
__version__ = "2.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Education Purpose"
import re
import gin
import json
import threading
... | [
"tweepy.auth.OAuthHandler",
"tweepy.streaming.StreamListener.__init__",
"threading.Thread",
"json.loads",
"kafka.KafkaProducer",
"ssp.logger.pretty_print.print_error",
"ssp.utils.ai_key_words.AIKeyWords.ALL.split",
"ssp.utils.ai_key_words.AIKeyWords.POSITIVE.split",
"ssp.logger.pretty_print.print_in... | [((1654, 1683), 'tweepy.streaming.StreamListener.__init__', 'StreamListener.__init__', (['self'], {}), '(self)\n', (1677, 1683), False, 'from tweepy.streaming import StreamListener\n'), ((1740, 1783), 'kafka.KafkaProducer', 'KafkaProducer', ([], {'bootstrap_servers': 'kafka_addr'}), '(bootstrap_servers=kafka_addr)\n', ... |
import argparse
import logging
import re
from traceback import format_exc
from slack_bolt.async_app import AsyncApp
import imagine
from config import VQGAN_ZERORPC_ADDRESS
from secrets import SLACK_BOT_TOKEN, SLACK_SIGNING_SECRET
logging.basicConfig(level=logging.DEBUG)
app = AsyncApp(token=SLACK_BOT_TOKEN, signing... | [
"argparse.ArgumentParser",
"logging.basicConfig",
"imagine.connect",
"imagine.stop",
"imagine.bind",
"traceback.format_exc",
"slack_bolt.async_app.AsyncApp",
"imagine.yield_s3_urls_for_prompt",
"re.compile"
] | [((233, 273), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (252, 273), False, 'import logging\n'), ((281, 349), 'slack_bolt.async_app.AsyncApp', 'AsyncApp', ([], {'token': 'SLACK_BOT_TOKEN', 'signing_secret': 'SLACK_SIGNING_SECRET'}), '(token=SLACK_BOT_TOKEN... |
# -*- coding: utf-8 -*-
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from public.initial import create_app, db
app = create_app('develop') # 'develop'/'produce'
# migrate db at terminal
manager = Manager(app)
Migrate(app, db)
manager.add_command('db', MigrateCommand)
if __name_... | [
"public.initial.create_app",
"flask_script.Manager",
"flask_migrate.Migrate"
] | [((156, 177), 'public.initial.create_app', 'create_app', (['"""develop"""'], {}), "('develop')\n", (166, 177), False, 'from public.initial import create_app, db\n'), ((237, 249), 'flask_script.Manager', 'Manager', (['app'], {}), '(app)\n', (244, 249), False, 'from flask_script import Manager\n'), ((250, 266), 'flask_mi... |
from django.urls import path, include
from . import views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path("", views.index, name="home"),
path("my_photos/", views.my_photos, name="my_photos"),
path(
"my_photos/grant_permission/",
views.my_phot... | [
"django.conf.urls.static.static",
"django.urls.path"
] | [((860, 921), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n', (866, 921), False, 'from django.conf.urls.static import static\n'), ((155, 189), 'django.urls.path', 'path', (['""""""', 'views.index... |
import json
import sys
from pytictoc import TicToc
def main():
DATA_PATH = '/data/AIGC_3rd_2021/GIST_tr2_1000/wav'
OUTPUT_PATH = "output/tr2_devel_1000_est.json"
GT_PATH = '/data/AIGC_3rd_2021/GIST_tr2_1000/tr2_devel_1000.json'
t = TicToc()
t.tic()
import infer_audio
json_out =... | [
"json.dump",
"infer_audio.run_audio_infer",
"metric_audio.main",
"pytictoc.TicToc"
] | [((261, 269), 'pytictoc.TicToc', 'TicToc', ([], {}), '()\n', (267, 269), False, 'from pytictoc import TicToc\n'), ((321, 359), 'infer_audio.run_audio_infer', 'infer_audio.run_audio_infer', (['DATA_PATH'], {}), '(DATA_PATH)\n', (348, 359), False, 'import infer_audio\n'), ((606, 645), 'metric_audio.main', 'metric_audio.m... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "<NAME>"
import gym
import numpy
from gym.spaces.box import Box
__all__ = ["NoisyObservationWrapper", "NoisyActionWrapper"]
class NoisyObservationWrapper(gym.ObservationWrapper):
"""Make observation dynamic by adding noise"""
def __init__(self, en... | [
"gym.spaces.box.Box",
"numpy.random.randint"
] | [((763, 794), 'gym.spaces.box.Box', 'Box', (['(0.0)', '(255.0)', 'self.new_shape'], {}), '(0.0, 255.0, self.new_shape)\n', (766, 794), False, 'from gym.spaces.box import Box\n'), ((1780, 1811), 'gym.spaces.box.Box', 'Box', (['(0.0)', '(255.0)', 'self.new_shape'], {}), '(0.0, 255.0, self.new_shape)\n', (1783, 1811), Fal... |
import numpy as np
DEBUG = True
def py_box_voting_wrapper(IOU_thresh, score_thresh, with_nms):
if with_nms:
def _box_voting(nms_dets, dets):
return box_voting_nms(nms_dets, dets, IOU_thresh, score_thresh)
else:
def _box_voting(dets):
return box_voting(dets, IOU_thresh, ... | [
"numpy.minimum",
"numpy.maximum",
"numpy.sum",
"numpy.zeros",
"numpy.where",
"numpy.array",
"numpy.intersect1d"
] | [((3374, 3401), 'numpy.array', 'np.array', (['keep_fusion_boxes'], {}), '(keep_fusion_boxes)\n', (3382, 3401), True, 'import numpy as np\n'), ((6324, 6351), 'numpy.array', 'np.array', (['keep_fusion_boxes'], {}), '(keep_fusion_boxes)\n', (6332, 6351), True, 'import numpy as np\n'), ((1285, 1318), 'numpy.maximum', 'np.m... |
import sys
if sys.version_info[0] < 3:
from io import BytesIO as stream
else:
from io import StringIO as stream
sys.stdin = stream(sys.stdin.read())
def input(): return sys.stdin.readline().rstrip('\r\n')
"""
Find the MST with the highest costs nodes connected.
This will let us minimize the cost for edge... | [
"sys.stdin.read",
"sys.stdin.readline"
] | [((141, 157), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (155, 157), False, 'import sys\n'), ((181, 201), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (199, 201), False, 'import sys\n')] |
# Written by <NAME>
# see LICENSE.txt for license information
#
# $Id: Encrypter.py 68 2006-04-26 20:14:35Z sgrayban $
#
from cStringIO import StringIO
from binascii import b2a_hex
from socket import error as socketerror
protocol_name = 'BitTorrent protocol'
def toint(s):
return long(b2a_hex(s), 16)
def tobinar... | [
"cStringIO.StringIO",
"binascii.b2a_hex"
] | [((292, 302), 'binascii.b2a_hex', 'b2a_hex', (['s'], {}), '(s)\n', (299, 302), False, 'from binascii import b2a_hex\n'), ((772, 782), 'cStringIO.StringIO', 'StringIO', ([], {}), '()\n', (780, 782), False, 'from cStringIO import StringIO\n')] |
import logging
from django.contrib.contenttypes.models import ContentType
from cinemanio.celery import app
from cinemanio.core.models import Movie, Person
from cinemanio.sites.exceptions import PossibleDuplicate, NothingFound
from cinemanio.sites.wikipedia.models import WikipediaPage
logger = logging.getLogger(__nam... | [
"django.contrib.contenttypes.models.ContentType.objects.get",
"cinemanio.core.models.Movie.objects.get",
"cinemanio.sites.wikipedia.models.WikipediaPage.objects.create_for",
"cinemanio.core.models.Person.objects.get",
"cinemanio.sites.wikipedia.models.WikipediaPage.objects.create_from_list_for",
"logging.... | [((297, 324), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (314, 324), False, 'import logging\n'), ((430, 460), 'cinemanio.core.models.Movie.objects.get', 'Movie.objects.get', ([], {'pk': 'movie_id'}), '(pk=movie_id)\n', (447, 460), False, 'from cinemanio.core.models import Movie, Perso... |
#!/usr/bin/env python3
import pygame
from pygame.locals import *
import random
import sys
def game(start):
# fps do jogo
fps_clock = pygame.time.Clock()
# pixels por quadrado
tilesize = 40
# numero de quadrados na tela
width = 30
height = 15
# configurações do inventário
height_... | [
"pygame.quit",
"pygame.font.Font",
"random.randint",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.mixer.music.play",
"pygame.init",
"pygame.display.update",
"pygame.mixer.music.load",
"pygame.image.load",
"pygame.display.set_caption",
"pygame.time.Clock",
"sys.exit"
] | [((143, 162), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (160, 162), False, 'import pygame\n'), ((1724, 1737), 'pygame.init', 'pygame.init', ([], {}), '()\n', (1735, 1737), False, 'import pygame\n'), ((1793, 1878), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(width * tilesize, height * til... |
import numpy
from dedupe.distance.affinegap import normalizedAffineGapDistance as comparator
def getCentroid(attribute_variants, comparator):
"""
Takes in a list of attribute values for a field,
evaluates the centroid using the comparator,
& returns the centroid (i.e. the 'best' value for the field)
... | [
"dedupe.distance.affinegap.normalizedAffineGapDistance",
"numpy.zeros"
] | [((391, 410), 'numpy.zeros', 'numpy.zeros', (['[n, n]'], {}), '([n, n])\n', (402, 410), False, 'import numpy\n'), ((573, 629), 'dedupe.distance.affinegap.normalizedAffineGapDistance', 'comparator', (['attribute_variants[i]', 'attribute_variants[j]'], {}), '(attribute_variants[i], attribute_variants[j])\n', (583, 629), ... |
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.model_selection import StratifiedKFold
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
from sklearn.linear_model import LogisticRegress... | [
"sklearn.ensemble.RandomForestClassifier",
"sklearn.model_selection.GridSearchCV",
"keras.wrappers.scikit_learn.KerasClassifier",
"sklearn.impute.SimpleImputer",
"sklearn.preprocessing.StandardScaler",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.linear_model.LogisticRegress... | [((570, 616), 'pandas.read_csv', 'pd.read_csv', (['"""lebron_dataset.csv"""'], {'index_col': '(0)'}), "('lebron_dataset.csv', index_col=0)\n", (581, 616), True, 'import pandas as pd\n'), ((759, 825), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.2)', 'stratify': 'y', 'ra... |
### Imports and definitions ###
# pip install tensorflow
import tensorflow as tf
## import tensorflow_datasets as tfds
import numpy as np
# In Google Colab, can change runtime to GPU if desired. If a TensorFlow
# operation has both CPU and GPU implementations, by default the GPU device
# is prioritized when the op... | [
"tensorflow.keras.optimizers.Adadelta",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.MaxPool2D",
"tensorflow.config.get_visible_devices",
"tensorflow.keras.utils.set_random_seed",
"tensorflow.keras.layers.Flatten"
] | [((350, 381), 'tensorflow.config.get_visible_devices', 'tf.config.get_visible_devices', ([], {}), '()\n', (379, 381), True, 'import tensorflow as tf\n'), ((441, 477), 'tensorflow.keras.utils.set_random_seed', 'tf.keras.utils.set_random_seed', (['seed'], {}), '(seed)\n', (471, 477), True, 'import tensorflow as tf\n'), (... |
'''This example demonstrates the use of Convolution1D for text classification.
Gets to 0.89 test accuracy after 2 epochs.
90s/epoch on Intel i5 2.4Ghz CPU.
10s/epoch on Tesla K40 GPU.
'''
from __future__ import print_function
import numpy as np
import keras.callbacks
from keras.preprocessing import sequence
from ke... | [
"example_correctness_test_utils.TrainingHistory",
"keras.layers.Activation",
"keras.preprocessing.sequence.pad_sequences",
"keras.layers.Dropout",
"keras.layers.Conv1D",
"example_correctness_test_utils.StopwatchManager",
"keras.layers.Dense",
"numpy.array",
"keras.layers.Embedding",
"keras.models.... | [((809, 847), 'keras.datasets.imdb.load_data', 'imdb.load_data', ([], {'num_words': 'max_features'}), '(num_words=max_features)\n', (823, 847), False, 'from keras.datasets import imdb\n'), ((1201, 1247), 'keras.preprocessing.sequence.pad_sequences', 'sequence.pad_sequences', (['x_train'], {'maxlen': 'maxlen'}), '(x_tra... |
"""Views."""
from uuid import UUID
from django.core.exceptions import PermissionDenied
from django.utils.translation import gettext_lazy as _
from django.contrib import messages
from django_ticketoffice.models import Ticket
class InvitationMixin:
"Mixin that extracts `invitation` property from request."
@pr... | [
"django.utils.translation.gettext_lazy",
"uuid.UUID",
"django_ticketoffice.models.Ticket.objects.get",
"django.core.exceptions.PermissionDenied"
] | [((599, 639), 'uuid.UUID', 'UUID', (["self.request.session['invitation']"], {}), "(self.request.session['invitation'])\n", (603, 639), False, 'from uuid import UUID\n'), ((1148, 1184), 'django_ticketoffice.models.Ticket.objects.get', 'Ticket.objects.get', ([], {'uuid': 'ticket_uuid'}), '(uuid=ticket_uuid)\n', (1166, 11... |