code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import base_tests as b
import pytest
import requests
import tests_helpers as h
@pytest.fixture(scope="module")
def main_app_url(module_scoped_container_getter):
""" Wait for the api from fastapi_main_app_main to become responsive """
return h.get_app_url(module_scoped_container_getter, "fastapi_main_app_main"... | [
"base_tests.test_presets_was_loaded",
"base_tests.test_main_service_run",
"tests_helpers.get_app_url",
"tests_helpers.init_db",
"pytest.fixture",
"base_tests.test_admin_service_drop",
"requests.get",
"tests_helpers.get_auth_headers"
] | [((82, 112), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (96, 112), False, 'import pytest\n'), ((325, 355), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (339, 355), False, 'import pytest\n'), ((566, 596), 'pytest.fixture', 'pyt... |
#!/usr/local/bin/python
import sys, getopt
import pandas as pd
def usage():
print ('csv_to_html.py -h -i <input_csv> -o <output_html>')
sys.exit(2)
def main(argv):
try:
opts, args = getopt.getopt(argv,"hi:o:",["help","input_csv=","output_html="])
except getopt.GetoptError as err:
print(err)
usage()
sys.e... | [
"pandas.read_csv",
"getopt.getopt",
"sys.exit"
] | [((140, 151), 'sys.exit', 'sys.exit', (['(2)'], {}), '(2)\n', (148, 151), False, 'import sys, getopt\n'), ((614, 636), 'pandas.read_csv', 'pd.read_csv', (['input_csv'], {}), '(input_csv)\n', (625, 636), True, 'import pandas as pd\n'), ((190, 258), 'getopt.getopt', 'getopt.getopt', (['argv', '"""hi:o:"""', "['help', 'in... |
import bs4, requests, threading, datetime
import tkinter as tk
from tkmacosx import Button
from tkinter import messagebox
from functools import partial
class MainApp(tk.Tk):
def __init__(self):
super().__init__()
self.title("Stock Watcher")
self.geometry("600x600+0+0")
self.search... | [
"tkmacosx.Button",
"tkinter.Entry",
"tkinter.messagebox.showinfo",
"datetime.datetime.now",
"requests.get",
"tkinter.Frame",
"bs4.BeautifulSoup",
"tkinter.Label"
] | [((329, 365), 'tkinter.Frame', 'tk.Frame', (['self'], {'width': '(600)', 'height': '(50)'}), '(self, width=600, height=50)\n', (337, 365), True, 'import tkinter as tk\n'), ((387, 436), 'tkinter.Label', 'tk.Label', (['self.search_frame'], {'text': '"""Stock Ticker:"""'}), "(self.search_frame, text='Stock Ticker:')\n", (... |
from ncclient import manager
m = manager.connect(host='10.199.199.250', port='830', username='admin',
password='<PASSWORD>', device_params={'name':'iosxe'}, hostkey_verify=False)
for capability in m.server_capabilities:
print('*'* 50)
print(capability) | [
"ncclient.manager.connect"
] | [((36, 191), 'ncclient.manager.connect', 'manager.connect', ([], {'host': '"""10.199.199.250"""', 'port': '"""830"""', 'username': '"""admin"""', 'password': '"""<PASSWORD>"""', 'device_params': "{'name': 'iosxe'}", 'hostkey_verify': '(False)'}), "(host='10.199.199.250', port='830', username='admin',\n password='<PA... |
#!/usr/bin/env python3
from random import random, choice, seed
from copy import deepcopy
from math import pi
from bruhat.render.sat import Expr, System, Listener
from bruhat.render.front import RGBA, Compound, Translate
from bruhat.render.front import path, style, canvas, color
from bruhat.render.turtle import Turtl... | [
"bruhat.render.sat.System",
"bruhat.render.front.Translate",
"bruhat.render.front.canvas.canvas",
"bruhat.render.turtle.Turtle",
"bruhat.render.front.RGBA",
"bruhat.render.config",
"bruhat.render.front.path.line",
"bruhat.render.front.path.rect"
] | [((22020, 22041), 'bruhat.render.config', 'config', ([], {'text': '"""pdftex"""'}), "(text='pdftex')\n", (22026, 22041), False, 'from bruhat.render import config\n'), ((22619, 22634), 'bruhat.render.front.canvas.canvas', 'canvas.canvas', ([], {}), '()\n', (22632, 22634), False, 'from bruhat.render.front import path, st... |
import os
import subprocess
from telegram import Update
from telegram.ext import CallbackContext
def create_download_list_from_link(link: str, link_type: str, list_path: str):
subprocess.run(
[
'spotdl',
f'--{link_type}',
link,
"--write-to",
lis... | [
"subprocess.run",
"subprocess.Popen",
"os.listdir"
] | [((183, 258), 'subprocess.run', 'subprocess.run', (["['spotdl', f'--{link_type}', link, '--write-to', list_path]"], {}), "(['spotdl', f'--{link_type}', link, '--write-to', list_path])\n", (197, 258), False, 'import subprocess\n'), ((420, 541), 'subprocess.Popen', 'subprocess.Popen', (["['spotdl', '--list', list_path, '... |
# Import
from sudoku import Sudoku
# Backtrack solver class
class BacktrackSolver:
# Constructor
def __init__(self, matrix):
self.sudoku = Sudoku(matrix)
# Find next empty position in board
def nextEmpty(self):
for k in range(81):
if self.sudoku.board[k] == 0:
return k
return 81
... | [
"sudoku.Sudoku"
] | [((148, 162), 'sudoku.Sudoku', 'Sudoku', (['matrix'], {}), '(matrix)\n', (154, 162), False, 'from sudoku import Sudoku\n')] |
from src.model.game import Game
from src.model.human_connections import InitialisePlayer, SavePlayer
from src.model.main import welcoming, blackjack_welcome, blackjack_rule_display
# @click.group()
def blackjack():
welcoming()
player_initialiser = InitialisePlayer()
human_player = player_initialiser.initi... | [
"src.model.main.blackjack_rule_display",
"src.model.human_connections.SavePlayer",
"src.model.main.welcoming",
"src.model.human_connections.InitialisePlayer",
"src.model.game.Game",
"src.model.main.blackjack_welcome"
] | [((221, 232), 'src.model.main.welcoming', 'welcoming', ([], {}), '()\n', (230, 232), False, 'from src.model.main import welcoming, blackjack_welcome, blackjack_rule_display\n'), ((258, 276), 'src.model.human_connections.InitialisePlayer', 'InitialisePlayer', ([], {}), '()\n', (274, 276), False, 'from src.model.human_co... |
"""
Created on 24 Apr 2017
@author: <NAME> (<EMAIL>)
"""
from scs_core.gas.pid.pid import PID
from scs_core.gas.pid.pid_temp_comp import PIDTempComp
# --------------------------------------------------------------------------------------------------------------------
PIDTempComp.init() # must be initialised b... | [
"scs_core.gas.pid.pid_temp_comp.PIDTempComp.init",
"scs_core.gas.pid.pid.PID.init"
] | [((273, 291), 'scs_core.gas.pid.pid_temp_comp.PIDTempComp.init', 'PIDTempComp.init', ([], {}), '()\n', (289, 291), False, 'from scs_core.gas.pid.pid_temp_comp import PIDTempComp\n'), ((334, 344), 'scs_core.gas.pid.pid.PID.init', 'PID.init', ([], {}), '()\n', (342, 344), False, 'from scs_core.gas.pid.pid import PID\n')] |
__all__ = [
"SourceLocation",
"set_location",
"UNKNOWN_LOCATION",
]
from dataclasses import FrozenInstanceError, replace
from typing import Any, NamedTuple, TypeVar
T = TypeVar("T")
class SourceLocation(NamedTuple):
"""Class representing a location within an input string."""
pos: int
linen... | [
"typing.TypeVar",
"dataclasses.replace"
] | [((184, 196), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (191, 196), False, 'from typing import Any, NamedTuple, TypeVar\n'), ((3330, 3388), 'dataclasses.replace', 'replace', (['obj'], {'location': 'location', 'end_location': 'end_location'}), '(obj, location=location, end_location=end_location)\n', (33... |
from bayes_implicit_solvent.utils import remove_top_right_spines
from pickle import load
experiment_number = 5
with open('results/experiment_{}_radii_samples.pkl'.format(experiment_number), 'rb') as f:
radii_samples = load(f)
import matplotlib.pyplot as plt
import numpy as np
log_ps = np.load('results/experim... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.figure",
"bayes_implicit_solvent.utils.remove_top_right_spines",
"pickle.load",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.tight_layout"
... | [((485, 511), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(4, 8)'}), '(figsize=(4, 8))\n', (495, 511), True, 'import matplotlib.pyplot as plt\n'), ((734, 754), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(3)', '(1)', '(1)'], {}), '(3, 1, 1)\n', (745, 754), True, 'import matplotlib.pyplot as plt\n'), ... |
# Copyright 2019-2022 SURF.
# 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, soft... | [
"typing.cast",
"orchestrator.distlock.distlock_manager.DistLockManager",
"structlog.get_logger"
] | [((774, 794), 'structlog.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (784, 794), False, 'from structlog import get_logger\n'), ((2080, 2127), 'typing.cast', 'cast', (['DistLockManager', 'wrapped_distlock_manager'], {}), '(DistLockManager, wrapped_distlock_manager)\n', (2084, 2127), False, 'from typin... |
import pytest
import os
from videohash.videoduration import video_duration
this_dir = os.path.dirname(os.path.realpath(__file__))
def test_video_duration():
video_path = (
this_dir
+ os.path.sep
+ os.path.pardir
+ os.path.sep
+ "assets"
+ os.path.sep
+ "ro... | [
"os.path.realpath",
"videohash.videoduration.video_duration"
] | [((103, 129), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (119, 129), False, 'import os\n'), ((349, 375), 'videohash.videoduration.video_duration', 'video_duration', (['video_path'], {}), '(video_path)\n', (363, 375), False, 'from videohash.videoduration import video_duration\n')] |
#
# Copyright (c) Memfault, Inc.
# See License.txt for details
#
"""
Shim around mflt_build_id to keep the original fw_build_id.py file (this file) working as before.
See mflt-build-id/src/mflt_build_id/__init__.py for actual source code.
"""
import os
import sys
scripts_dir = os.path.dirname(os.path.realpath(__file... | [
"os.path.realpath",
"os.path.join",
"sys.path.insert",
"os.path.exists"
] | [((357, 406), 'os.path.join', 'os.path.join', (['scripts_dir', '"""mflt-build-id"""', '"""src"""'], {}), "(scripts_dir, 'mflt-build-id', 'src')\n", (369, 406), False, 'import os\n'), ((411, 456), 'os.path.exists', 'os.path.exists', (['bundled_mflt_build_id_src_dir'], {}), '(bundled_mflt_build_id_src_dir)\n', (425, 456)... |
import psutil
import time as t # somehow the datetime fucks it up ``
from datetime import datetime
from subprocess import call
from prettytable import PrettyTable
import fcntl
import socket
import struct
from getmac import get_mac_address
#TODO => Add Date and time
def CFMMAIN():
cpufreq = psutil.cpu_freq()
... | [
"netifaces.interfaces",
"psutil.virtual_memory",
"getmac.getmac.get_mac_address",
"psutil.Process",
"psutil.cpu_freq",
"socket.socket",
"platform.uname",
"getmac.get_mac_address",
"time.sleep",
"netifaces.ifaddresses",
"subprocess.call",
"prettytable.PrettyTable",
"psutil.pids",
"psutil.ne... | [((299, 316), 'psutil.cpu_freq', 'psutil.cpu_freq', ([], {}), '()\n', (314, 316), False, 'import psutil\n'), ((475, 492), 'psutil.cpu_freq', 'psutil.cpu_freq', ([], {}), '()\n', (490, 492), False, 'import psutil\n'), ((505, 540), 'prettytable.PrettyTable', 'PrettyTable', (["['CPU USAGE PER CORE']"], {}), "(['CPU USAGE ... |
#!/usr/bin/python
# Write it as a python script for portability
import glob
import os
from subprocess import check_call
version = os.environ['ISTIO_VERSION']
opj = os.path.join
# We don't care about the platform as we only use yaml files
check_call(
[
"curl",
"-o",
"istio.tar.gz",
... | [
"subprocess.check_call"
] | [((480, 521), 'subprocess.check_call', 'check_call', (["['tar', 'xf', 'istio.tar.gz']"], {}), "(['tar', 'xf', 'istio.tar.gz'])\n", (490, 521), False, 'from subprocess import check_call\n'), ((523, 578), 'subprocess.check_call', 'check_call', (["['kubectl', 'create', 'ns', 'istio-system']"], {}), "(['kubectl', 'create',... |
import RPi.GPIO as GPIO
class rgb_strip(object):
def __init__(self, pins, frequency):
GPIO.setmode(GPIO.BCM)
self.__pins = dict()
for set_color, pin in pins.items():
GPIO.setup(pin, GPIO.OUT)
self.__pins['RED'] = GPIO.PWM(pins["red"], frequency)
self.__pins['RED'].start(0)
self.__pins['GREEN']... | [
"RPi.GPIO.setup",
"RPi.GPIO.setmode",
"RPi.GPIO.PWM",
"RPi.GPIO.cleanup"
] | [((92, 114), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (104, 114), True, 'import RPi.GPIO as GPIO\n'), ((235, 267), 'RPi.GPIO.PWM', 'GPIO.PWM', (["pins['red']", 'frequency'], {}), "(pins['red'], frequency)\n", (243, 267), True, 'import RPi.GPIO as GPIO\n'), ((323, 357), 'RPi.GPIO.PWM', 'GP... |
import speech_recognition as sr
from Workspace import *
import os
file_name = 'backup.txt'
def recognizeaudio(return_existing = False, save_current = False):
if return_existing and os.path.exists(os.path.join(os.getcwd(), file_name)):
with open(file_name, 'r') as backup:
line = backup.readl... | [
"os.getcwd",
"speech_recognition.Recognizer",
"speech_recognition.Microphone"
] | [((364, 379), 'speech_recognition.Recognizer', 'sr.Recognizer', ([], {}), '()\n', (377, 379), True, 'import speech_recognition as sr\n'), ((390, 405), 'speech_recognition.Microphone', 'sr.Microphone', ([], {}), '()\n', (403, 405), True, 'import speech_recognition as sr\n'), ((216, 227), 'os.getcwd', 'os.getcwd', ([], {... |
import random
from pypy.module._cffi_backend.handle import CffiHandles
class PseudoWeakRef(object):
_content = 42
def __call__(self):
return self._content
def test_cffi_handles_1():
ch = CffiHandles(None)
expected_content = {}
for i in range(10000):
index = ch.reserve_next_handl... | [
"pypy.module._cffi_backend.handle.CffiHandles"
] | [((212, 229), 'pypy.module._cffi_backend.handle.CffiHandles', 'CffiHandles', (['None'], {}), '(None)\n', (223, 229), False, 'from pypy.module._cffi_backend.handle import CffiHandles\n'), ((678, 695), 'pypy.module._cffi_backend.handle.CffiHandles', 'CffiHandles', (['None'], {}), '(None)\n', (689, 695), False, 'from pypy... |
import shutil
import subprocess
import uuid
from json import JSONDecodeError
from typing import List, Union, Tuple
import requests
import json
import logging
import math
from pathlib import Path
from eppy.modeleditor import IDF
import esoreader
import pandas as pd
import numpy as np
from pandas import Series
from fir... | [
"pandas.DataFrame",
"subprocess.run",
"pandas.MultiIndex.from_tuples",
"shutil.rmtree",
"pandas.read_json",
"pathlib.Path",
"uuid.uuid1",
"requests.get",
"requests.post",
"math.log",
"pandas.concat",
"logging.getLogger"
] | [((528, 555), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (545, 555), False, 'import logging\n'), ((1851, 1895), 'requests.get', 'requests.get', ([], {'url': 'url', 'params': "{'name': name}"}), "(url=url, params={'name': name})\n", (1863, 1895), False, 'import requests\n'), ((2453, 25... |
# -*- coding: utf-8 -*-
"""
Utility functions for the spines versioning sub-package.
"""
#
# Imports
#
import difflib
import inspect
import re
from textwrap import dedent
from types import FunctionType
from typing import Dict
from typing import List
import unicodedata
from ..vendor import autopep8 as _v_autopep8
#... | [
"unicodedata.normalize",
"inspect.getdoc",
"difflib.SequenceMatcher",
"difflib.context_diff",
"inspect.signature",
"inspect.getsource",
"re.sub"
] | [((1314, 1343), 're.sub', 're.sub', (['"""[-\\\\s]+"""', '"""-"""', 'value'], {}), "('[-\\\\s]+', '-', value)\n", (1320, 1343), False, 'import re\n'), ((3311, 3346), 'difflib.SequenceMatcher', 'difflib.SequenceMatcher', (['None', 'a', 'b'], {}), '(None, a, b)\n', (3334, 3346), False, 'import difflib\n'), ((4372, 4394),... |
import scrapy
from product_scraper.items import Product
from scrapy.spiders import SitemapSpider, Rule
class SitemapSpider(SitemapSpider):
name = "sitemap_spider"
sitemap_urls = ['https://www.allrecipes.com/sitemap.xml']
sitemap_rules = [
('/recipe/', 'parse_product')
]
def parse_product(... | [
"product_scraper.items.Product"
] | [((352, 361), 'product_scraper.items.Product', 'Product', ([], {}), '()\n', (359, 361), False, 'from product_scraper.items import Product\n')] |
import numpy as np
from mltk.core.preprocess.audio.audio_feature_generator import AudioFeatureGenerator
from mltk.core.preprocess.audio.audio_feature_generator.tests.data import (
DEFAULT_SETTINGS,
YES_INPUT_AUDIO,
YES_OUTPUT_FEATURES_INT8,
NO_INPUT_AUDIO,
NO_OUTPUT_FEATURES_INT8
)
def test_yes... | [
"numpy.asarray",
"mltk.core.preprocess.audio.audio_feature_generator.AudioFeatureGenerator",
"numpy.array",
"numpy.allclose"
] | [((374, 405), 'mltk.core.preprocess.audio.audio_feature_generator.AudioFeatureGenerator', 'AudioFeatureGenerator', (['settings'], {}), '(settings)\n', (395, 405), False, 'from mltk.core.preprocess.audio.audio_feature_generator import AudioFeatureGenerator\n'), ((419, 462), 'numpy.asarray', 'np.asarray', (['YES_INPUT_AU... |
from nf_common_source.code.services.dataframe_service.dataframe_mergers import left_merge_dataframes
from uniclass_to_nf_ea_com_source.b_code.configurations.common_constants.uniclass_bclearer_constants import \
LINKED_TABLE_UNICLASS_ITEMS_TO_RANKS, UNICLASS_CLASSIFICATION_TYPE_OF_RELATION, OBJECT_NAME_COLUMN_NAME, ... | [
"nf_common_source.code.services.dataframe_service.dataframe_mergers.left_merge_dataframes"
] | [((988, 1402), 'nf_common_source.code.services.dataframe_service.dataframe_mergers.left_merge_dataframes', 'left_merge_dataframes', ([], {'master_dataframe': 'linked_table_uniclass_items_to_ranks', 'master_dataframe_key_columns': '[RELATION_TYPE_NAMES_COLUMN_NAME]', 'merge_suffixes': "['1', '2']", 'foreign_key_datafram... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class kiunet3d(nn.Module): #
def __init__(self, c=4, n=16, num_classes=5):
super(kiunet3d, self).__init__()
# Entry flow
self.encoder1 = nn.Conv3d(c, n, kernel_size=3, padding=1, stride=1, bias=False) # H//2
self... | [
"torch.nn.Conv3d",
"torch.add",
"torch.nn.Upsample",
"torch.nn.init.constant_",
"torch.nn.Softmax",
"torch.rand",
"torch.nn.MaxPool3d",
"torch.nn.init.torch.nn.init.kaiming_normal_"
] | [((6915, 6943), 'torch.rand', 'torch.rand', (['(1)', '(1)', '(32)', '(32)', '(32)'], {}), '(1, 1, 32, 32, 32)\n', (6925, 6943), False, 'import torch\n'), ((236, 299), 'torch.nn.Conv3d', 'nn.Conv3d', (['c', 'n'], {'kernel_size': '(3)', 'padding': '(1)', 'stride': '(1)', 'bias': '(False)'}), '(c, n, kernel_size=3, paddin... |
import os
import subprocess
from pyramid.static import PathSegmentMd5CacheBuster
class GitCacheBuster(PathSegmentMd5CacheBuster):
"""
Assuming your code is installed as a Git checkout, as opposed to as an
egg from an egg repository like PYPI, you can use this cachebuster to
get the current commit's SH... | [
"os.path.abspath",
"subprocess.check_output"
] | [((418, 443), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (433, 443), False, 'import os\n'), ((465, 528), 'subprocess.check_output', 'subprocess.check_output', (["['git', 'rev-parse', 'HEAD']"], {'cwd': 'here'}), "(['git', 'rev-parse', 'HEAD'], cwd=here)\n", (488, 528), False, 'import subp... |
#!/usr/bin/env python3
"""
Implementation of building LSTM model
"""
# 3rd party imports
import pandas as pd
import numpy as np
import random as rn
import datetime as datetime
# model
import tensorflow as tf
from keras.models import Sequential
from keras.layers import LSTM
from keras.layers import Dense
from keras.los... | [
"numpy.random.seed",
"pandas.get_dummies",
"pandas.merge",
"sklearn.model_selection.train_test_split",
"keras.layers.LSTM",
"keras.layers.Dense",
"random.seed",
"numpy.array",
"keras.losses.MeanSquaredLogarithmicError",
"db.model.db.session.query",
"pandas.read_sql_table",
"keras.models.Sequen... | [((3581, 3599), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (3595, 3599), True, 'import numpy as np\n'), ((3604, 3618), 'random.seed', 'rn.seed', (['(12345)'], {}), '(12345)\n', (3611, 3618), True, 'import random as rn\n'), ((652, 701), 'pandas.read_sql_table', 'pd.read_sql_table', (['"""stat"""', ... |
#!/usr/bin/python3
import subprocess
from re import search as re_compile
from sys import stderr
class DHCP():
def __init__(self):
self.leases = []
def fetch(self):
#TODO: This relies on dnsmasq, while there are multiple DHCP server implementation within OpenWrt (mainly odhcpd)
self.le... | [
"subprocess.Popen",
"re.search"
] | [((697, 769), 'subprocess.Popen', 'subprocess.Popen', (['"""/sbin/block info"""'], {'stdout': 'subprocess.PIPE', 'shell': '(True)'}), "('/sbin/block info', stdout=subprocess.PIPE, shell=True)\n", (713, 769), False, 'import subprocess\n'), ((1152, 1219), 're.search', 're_compile', (['(\'LABEL="(%s) *.?".*MOUNT="(.*)"\' ... |
# -*- coding: utf-8 -*-
"""
Created on Thu May 9 13:46:08 2019
@author: <NAME>
"""
from binomialTreePricer import asianOptionBinomialTree
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
uly_names = ['Crude Oil WTI', 'Ethanol', 'Gold', 'Silver', 'Natural Gas']
uly_init = df_uly[uly_na... | [
"pandas.DataFrame",
"binomialTreePricer.asianOptionBinomialTree",
"datetime.datetime.strptime",
"datetime.timedelta",
"numpy.busday_count"
] | [((555, 618), 'pandas.DataFrame', 'pd.DataFrame', (['[[0.3, 0.01, 0.4, 0.1, 0.001]]'], {'columns': 'uly_names'}), '([[0.3, 0.01, 0.4, 0.1, 0.001]], columns=uly_names)\n', (567, 618), True, 'import pandas as pd\n'), ((632, 697), 'pandas.DataFrame', 'pd.DataFrame', (['[[0.01, 0.0001, 1, 0.001, 0.01]]'], {'columns': 'uly_... |
from django.conf import settings
from django.core.exceptions import ValidationError
from mighty.applications.shop.apps import cards_test, ShopConfig
import re
class CBModel:
@property
def readable_cb(self):
return ' '.join([self.cb[i:i+4] for i in range(0, len(self.cb), 4)])
@property
def str_... | [
"re.sub",
"django.core.exceptions.ValidationError",
"mighty.applications.shop.apps.cards_test"
] | [((2165, 2210), 're.sub', 're.sub', (['"""\\\\s+"""', '""""""', 'self.cb'], {'flags': 're.UNICODE'}), "('\\\\s+', '', self.cb, flags=re.UNICODE)\n", (2171, 2210), False, 'import re\n'), ((2088, 2146), 'django.core.exceptions.ValidationError', 'ValidationError', ([], {'code': '"""invalid_iban"""', 'message': '"""invalid... |
import numpy as np
import pytest
import xarray as xr
from pyomeca import Analogs, Markers, Angles, Rototrans
from ._constants import ANALOGS_DATA, MARKERS_DATA, EXPECTED_VALUES
from .utils import is_expected_array
def test_analogs_creation():
dims = ("channel", "time")
array = Analogs()
np.testing.assert... | [
"pyomeca.Markers.from_random_data",
"pyomeca.Markers",
"pyomeca.Rototrans",
"pyomeca.Angles",
"pyomeca.Rototrans.from_random_data",
"pytest.raises",
"pyomeca.Angles.from_random_data",
"xarray.DataArray",
"numpy.eye",
"pyomeca.Analogs.from_random_data",
"pyomeca.Analogs"
] | [((289, 298), 'pyomeca.Analogs', 'Analogs', ([], {}), '()\n', (296, 298), False, 'from pyomeca import Analogs, Markers, Angles, Rototrans\n'), ((403, 431), 'pyomeca.Analogs', 'Analogs', (['ANALOGS_DATA.values'], {}), '(ANALOGS_DATA.values)\n', (410, 431), False, 'from pyomeca import Analogs, Markers, Angles, Rototrans\... |
import ast
expr = """\
class Asdf(object):
def meme(self, x):
return 15
a = Asdf()
x = a.meme(a)
if x:
print x
"""
a1 = ast.parse(expr)
0 | [
"ast.parse"
] | [((141, 156), 'ast.parse', 'ast.parse', (['expr'], {}), '(expr)\n', (150, 156), False, 'import ast\n')] |
import socket
import random
def find_listening_port(port_range=None, host='localhost', socket_type='tcp', default_port=None):
"""Find an open listening port"""
if port_range is None:
port_range = (6000,65534)
if socket_type == 'tcp':
socket_protocol = socket.SOCK_STREAM
elif socket_ty... | [
"socket.socket",
"random.randint"
] | [((676, 720), 'random.randint', 'random.randint', (['port_range[0]', 'port_range[1]'], {}), '(port_range[0], port_range[1])\n', (690, 720), False, 'import random\n'), ((1058, 1104), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket_protocol'], {}), '(socket.AF_INET, socket_protocol)\n', (1071, 1104), False,... |
# Generated by Django 3.0.4 on 2020-03-11 19:35
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | [
"django.db.models.FileField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField"
] | [((247, 304), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (278, 304), False, 'from django.db import migrations, models\n'), ((433, 526), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 29 15:07:58 2018
@author: nce3xin
"""
import torch
import torch.nn as nn
#use_cuda = not hyperparams.no_cuda and torch.cuda.is_available()
#device = torch.device("cuda" if use_cuda else "cpu")
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class ... | [
"torch.nn.GRU",
"torch.nn.RNN",
"torch.cuda.is_available",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.LSTM"
] | [((275, 300), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (298, 300), False, 'import torch\n'), ((1346, 1387), 'torch.nn.Linear', 'nn.Linear', (['self.hiddenNum', 'self.outputDim'], {}), '(self.hiddenNum, self.outputDim)\n', (1355, 1387), True, 'import torch.nn as nn\n'), ((645, 788), 'torch... |
# Generated by Django 3.1.3 on 2020-11-23 16:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('buying', '0004_auto_20201123_1556'),
]
operations = [
migrations.RemoveField(
model_name='item',
name='uuid',
... | [
"django.db.migrations.RemoveField",
"django.db.models.PositiveSmallIntegerField"
] | [((234, 288), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""item"""', 'name': '"""uuid"""'}), "(model_name='item', name='uuid')\n", (256, 288), False, 'from django.db import migrations, models\n'), ((434, 491), 'django.db.models.PositiveSmallIntegerField', 'models.PositiveSmallIn... |
import cv2 as cv
import numpy as np
class FaceMaskAppEngine:
"""
Perform detector which detects faces from input video,
and classifier to classify croped faces to face or mask class
:param config: Is a Config instance which provides necessary parameters.
"""
def __init__(self, config):
... | [
"numpy.multiply",
"libs.classifiers.edgetpu.classifier.Classifier",
"cv2.cvtColor",
"cv2.VideoCapture",
"numpy.shape",
"numpy.array",
"libs.detectors.edgetpu.detector.Detector"
] | [((1691, 1735), 'cv2.cvtColor', 'cv.cvtColor', (['resized_image', 'cv.COLOR_BGR2RGB'], {}), '(resized_image, cv.COLOR_BGR2RGB)\n', (1702, 1735), True, 'import cv2 as cv\n'), ((2826, 2841), 'numpy.array', 'np.array', (['faces'], {}), '(faces)\n', (2834, 2841), True, 'import numpy as np\n'), ((3585, 3611), 'cv2.VideoCapt... |
# Generated by Django 2.1.1 on 2019-03-28 18:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('variants', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='variant',
name='snpeff_func_class',
... | [
"django.db.models.TextField"
] | [((336, 390), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'db_index': '(True)', 'null': '(True)'}), '(blank=True, db_index=True, null=True)\n', (352, 390), False, 'from django.db import migrations, models\n')] |
#!/usr/bin/env python
import itertools
from heapq import heappush, heappop
class PriorityQueue(object):
def __len__(self):
return len(self._pq)
def __iter__(self):
return iter(task for priority, count, task in self._pq)
def __init__(self):
self._pq = []
self.counter = i... | [
"heapq.heappush",
"itertools.count",
"heapq.heappop"
] | [((319, 336), 'itertools.count', 'itertools.count', ([], {}), '()\n', (334, 336), False, 'import itertools\n'), ((601, 626), 'heapq.heappush', 'heappush', (['self._pq', 'entry'], {}), '(self._pq, entry)\n', (609, 626), False, 'from heapq import heappush, heappop\n'), ((853, 870), 'heapq.heappop', 'heappop', (['self._pq... |
import unittest2 as unittest
import numpy as np
from vsm.corpus.util.corpusbuilders import random_corpus
from vsm.model.base import BaseModel
class TestBaseModel(unittest.TestCase):
def setUp(self):
self.c = random_corpus(1000, 50, 6, 100)
self.m = BaseModel(self.c, 'context')
def test_Bas... | [
"tempfile.NamedTemporaryFile",
"os.remove",
"unittest2.TextTestRunner",
"vsm.model.base.BaseModel.load",
"vsm.model.base.BaseModel",
"unittest2.TestLoader",
"vsm.corpus.util.corpusbuilders.random_corpus"
] | [((224, 255), 'vsm.corpus.util.corpusbuilders.random_corpus', 'random_corpus', (['(1000)', '(50)', '(6)', '(100)'], {}), '(1000, 50, 6, 100)\n', (237, 255), False, 'from vsm.corpus.util.corpusbuilders import random_corpus\n'), ((273, 301), 'vsm.model.base.BaseModel', 'BaseModel', (['self.c', '"""context"""'], {}), "(se... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""This module contains the base classes that are used to implement the more specific behaviour."""
import inspect
import six
from cached_property import cached_property
from collections import defaultdict
from copy import copy
from smartloc import Locato... | [
"six.iterkeys",
"inspect.isclass",
"copy.copy",
"collections.defaultdict",
"smartloc.Locator",
"wait_for.wait_for",
"six.wraps",
"six.iteritems",
"six.with_metaclass"
] | [((5075, 5118), 'six.with_metaclass', 'six.with_metaclass', (['WidgetMetaclass', 'object'], {}), '(WidgetMetaclass, object)\n', (5093, 5118), False, 'import six\n'), ((11697, 11738), 'six.with_metaclass', 'six.with_metaclass', (['ViewMetaclass', 'Widget'], {}), '(ViewMetaclass, Widget)\n', (11715, 11738), False, 'impor... |
#!/usr/bin/env python3
from distutils.core import setup
import setuptools
setup(
name='kblab-client',
version='0.0.16a0',
description='KB lab client',
author='<NAME>',
author_email='<EMAIL>',
url="https://github.com/kungbib/kblab",
install_requires = [
'requests',
'pyyaml',... | [
"distutils.core.setup"
] | [((76, 351), 'distutils.core.setup', 'setup', ([], {'name': '"""kblab-client"""', 'version': '"""0.0.16a0"""', 'description': '"""KB lab client"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/kungbib/kblab"""', 'install_requires': "['requests', 'pyyaml', 'lxml', 'htfile']",... |
import inspect
from discord.ext import commands
class PromptCancelled(Exception):
pass
class Context(commands.Context):
def get_config(self):
# Default Config
config = {'prefix': 'm!', 'giveawayrole': None}
if not self.guild:
return config
config.update(self.bot... | [
"inspect.isclass"
] | [((1184, 1210), 'inspect.isclass', 'inspect.isclass', (['converter'], {}), '(converter)\n', (1199, 1210), False, 'import inspect\n')] |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
import pytest
from ..geohex import GeoHex, code2hex
# geohexのテスト座標系一覧
# 本家のgeohexテストが、経度が子午線に近い場合、東経なら西経、西経なら東経に
# 変換したもの相当を計算してしまうバグがあった頃のテストらしく、
# 以下はそれを全部修正している。
# (仮に東経を西経(-180より小さい)、西経を東経(180より大きい)としたときに
# 本家のコードになるかチェックした上で修正している)
geohex_testcases = [
['XM', (3... | [
"pytest.raises"
] | [((41061, 41085), 'pytest.raises', 'pytest.raises', (['TypeError'], {}), '(TypeError)\n', (41074, 41085), False, 'import pytest\n'), ((41127, 41151), 'pytest.raises', 'pytest.raises', (['TypeError'], {}), '(TypeError)\n', (41140, 41151), False, 'import pytest\n'), ((41193, 41217), 'pytest.raises', 'pytest.raises', (['T... |
from .models import Profile
from django.shortcuts import render, redirect
from django.contrib import messages
import pandas as pd
import numpy as np
import sklearn
from sklearn.neighbors import NearestNeighbors
import json
import os
import requests
df = pd.read_csv(
r'C:\\Users\jayit\\Downloads\\RAPID\\MedBay-V1\\... | [
"pandas.read_csv",
"django.contrib.messages.error",
"django.shortcuts.redirect",
"json.dumps",
"sklearn.neighbors.NearestNeighbors",
"django.shortcuts.render",
"requests.post",
"pandas.concat"
] | [((255, 391), 'pandas.read_csv', 'pd.read_csv', (['"""C:\\\\\\\\Users\\\\jayit\\\\\\\\Downloads\\\\\\\\RAPID\\\\\\\\MedBay-V1\\\\\\\\AI DIET PLANNER Microservice\\\\\\\\website\\\\\\\\dataset.csv"""'], {}), "(\n 'C:\\\\\\\\Users\\\\jayit\\\\\\\\Downloads\\\\\\\\RAPID\\\\\\\\MedBay-V1\\\\\\\\AI DIET PLANNER Microserv... |
from django.shortcuts import render
from django.template.loader import render_to_string
# Create your views here.
from django.http import HttpResponse
def test_page(request):
return render(request, "ws_test_page.html") | [
"django.shortcuts.render"
] | [((185, 221), 'django.shortcuts.render', 'render', (['request', '"""ws_test_page.html"""'], {}), "(request, 'ws_test_page.html')\n", (191, 221), False, 'from django.shortcuts import render\n')] |
#! /usr/bin/env python
import os
def main():
if os.path.exists(".dockerignore"):
print(".dockerignore already exists, remove it to proceed")
exit(-1)
with open(".gitignore", "r") as fin, open(".dockerignore", "w") as fout:
fout.write("# This file was automatically generated by ./ci/boot... | [
"os.path.exists"
] | [((53, 84), 'os.path.exists', 'os.path.exists', (['""".dockerignore"""'], {}), "('.dockerignore')\n", (67, 84), False, 'import os\n')] |
from django.http import HttpResponse, JsonResponse
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from rest_framework.parsers import JSONParser
from .models import *
from .serializers import *
# Create your views here.
"""
Method: to post and get the posts
"""
@csrf_exempt
de... | [
"rest_framework.parsers.JSONParser",
"django.http.HttpResponse",
"django.http.JsonResponse"
] | [((501, 542), 'django.http.JsonResponse', 'JsonResponse', (['serializer.data'], {'safe': '(False)'}), '(serializer.data, safe=False)\n', (513, 542), False, 'from django.http import HttpResponse, JsonResponse\n'), ((805, 848), 'django.http.JsonResponse', 'JsonResponse', (['serializer.errors'], {'status': '(400)'}), '(se... |
import unittest
import json
from neo3 import vm, storage
from neo3.contracts import manifest
from .utils import test_engine, test_block
class BlockchainInteropTestCase(unittest.TestCase):
def test_get_height(self):
engine = test_engine(has_container=True, has_snapshot=True)
engine.invoke_syscall_b... | [
"neo3.contracts.manifest.ContractManifest",
"neo3.vm.IntegerStackItem",
"neo3.vm.BigInteger",
"neo3.vm.ByteStringStackItem"
] | [((773, 790), 'neo3.vm.BigInteger', 'vm.BigInteger', (['(-1)'], {}), '(-1)\n', (786, 790), False, 'from neo3 import vm, storage\n'), ((960, 991), 'neo3.vm.ByteStringStackItem', 'vm.ByteStringStackItem', (["b'\\x01'"], {}), "(b'\\x01')\n", (982, 991), False, 'from neo3 import vm, storage\n'), ((1184, 1215), 'neo3.vm.Byt... |
# -*- coding: utf-8 -*-
"""
This module contains tests for tofu.geom in its structured version
"""
# Built-in
import os
import sys
import itertools as itt # for iterating on parameters combinations
import subprocess # for handling bash commands
# Standard
import matplotlib.pyplot as plt
# Make sure t... | [
"sys.path.pop",
"_core._saveload.get_available_output",
"os.remove",
"_core._class_checks.models.get_available_models",
"os.path.dirname",
"sys.path.insert",
"_core._saveload.load",
"matplotlib.pyplot.ion",
"_core.Hub",
"os.path.join",
"os.listdir"
] | [((381, 390), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (388, 390), True, 'import matplotlib.pyplot as plt\n'), ((461, 488), 'os.path.dirname', 'os.path.dirname', (['_PATH_HERE'], {}), '(_PATH_HERE)\n', (476, 488), False, 'import os\n'), ((504, 543), 'os.path.join', 'os.path.join', (['_PATH_HERE', '"""outpu... |
from corm import Storage, Entity, Relationship, RelationType
storage = Storage()
class Address(Entity):
street: str
number: int
class User(Entity):
name: str
address: Address = Relationship(
entity_type=Address,
relation_type=RelationType.PARENT,
)
address = Address({'street':... | [
"corm.Storage",
"corm.Relationship"
] | [((72, 81), 'corm.Storage', 'Storage', ([], {}), '()\n', (79, 81), False, 'from corm import Storage, Entity, Relationship, RelationType\n'), ((198, 266), 'corm.Relationship', 'Relationship', ([], {'entity_type': 'Address', 'relation_type': 'RelationType.PARENT'}), '(entity_type=Address, relation_type=RelationType.PAREN... |
# import library
import configparser
import os
def read_config(cfg_file):
config = None
if cfg_file is not None:
config = configparser.ConfigParser()
if os.path.exists(cfg_file):
config.read(cfg_file)
return config
| [
"configparser.ConfigParser",
"os.path.exists"
] | [((140, 167), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (165, 167), False, 'import configparser\n'), ((179, 203), 'os.path.exists', 'os.path.exists', (['cfg_file'], {}), '(cfg_file)\n', (193, 203), False, 'import os\n')] |
from __future__ import unicode_literals
import dataent
from dataent.model.rename_doc import rename_doc
def execute():
if dataent.db.table_exists("Workflow Action") and not dataent.db.table_exists("Workflow Action Master"):
rename_doc('DocType', 'Workflow Action', 'Workflow Action Master')
dataent.reload_doc('wor... | [
"dataent.db.table_exists",
"dataent.reload_doc",
"dataent.model.rename_doc.rename_doc"
] | [((124, 166), 'dataent.db.table_exists', 'dataent.db.table_exists', (['"""Workflow Action"""'], {}), "('Workflow Action')\n", (147, 166), False, 'import dataent\n'), ((228, 294), 'dataent.model.rename_doc.rename_doc', 'rename_doc', (['"""DocType"""', '"""Workflow Action"""', '"""Workflow Action Master"""'], {}), "('Doc... |
import pysam
import sys
import pandas as pd
def is_split_read(s):
try:
s.get_tag("SA")
except KeyError:
return False
return True
def get_read_map(bam_path, contig_of_interest='NC_007605'):
coordinates = pd.DataFrame()
infile = pysam.AlignmentFile(bam_path, "rb")
for s in infi... | [
"pandas.DataFrame",
"pysam.AlignmentFile",
"pandas.concat"
] | [((238, 252), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (250, 252), True, 'import pandas as pd\n'), ((267, 302), 'pysam.AlignmentFile', 'pysam.AlignmentFile', (['bam_path', '"""rb"""'], {}), "(bam_path, 'rb')\n", (286, 302), False, 'import pysam\n'), ((2821, 2835), 'pandas.DataFrame', 'pd.DataFrame', ([], {... |
"""
TODO (wimax July 2020): I don't see anything in here that indicates that
screams "e2e test", this certainly seems like more of an integration test.
There's nothing here that does anything cross-service.
Perhaps it's just "does it work in AWS?"
"""
from grapl_tests_common.clients.grapl_web_client import GraplWebCli... | [
"grapl_tests_common.clients.grapl_web_client.GraplWebClient"
] | [((452, 468), 'grapl_tests_common.clients.grapl_web_client.GraplWebClient', 'GraplWebClient', ([], {}), '()\n', (466, 468), False, 'from grapl_tests_common.clients.grapl_web_client import GraplWebClient\n'), ((649, 665), 'grapl_tests_common.clients.grapl_web_client.GraplWebClient', 'GraplWebClient', ([], {}), '()\n', (... |
import pyfirmata
import time
from pyfirmata import Arduino, util
import RPi.GPIO as GPIO
import dht11
import time
import datetime
import http.client
import requests
# run by: python3.5 arduino_airtemperature.py
# initialize GPIO for raspberry pi
# New Changes to be made
# Specifically make some changes with regards t... | [
"RPi.GPIO.setmode",
"time.sleep",
"requests.get",
"dht11.DHT11",
"datetime.datetime.now",
"RPi.GPIO.setwarnings"
] | [((338, 361), 'RPi.GPIO.setwarnings', 'GPIO.setwarnings', (['(False)'], {}), '(False)\n', (354, 361), True, 'import RPi.GPIO as GPIO\n'), ((362, 384), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (374, 384), True, 'import RPi.GPIO as GPIO\n'), ((438, 457), 'dht11.DHT11', 'dht11.DHT11', ([], {... |
import pygame, math
pygame.font.init()
font = pygame.font.SysFont('Monotype', 12)
def distTo(fromPos, toPos):
dist = math.sqrt((fromPos[0] - toPos[0]) ** 2 + (fromPos[1] - toPos[1]) ** 2)
return(dist)
def angleTo(fromPos, toPos):
dx = toPos[0] - fromPos[0]
dy = toPos[1] - fromPos[1]
rads = math.atan2(dy,dx)
ra... | [
"pygame.math.Vector2",
"pygame.draw.line",
"math.sqrt",
"math.atan2",
"pygame.font.SysFont",
"pygame.draw.rect",
"pygame.font.init",
"pygame.PixelArray",
"math.degrees"
] | [((21, 39), 'pygame.font.init', 'pygame.font.init', ([], {}), '()\n', (37, 39), False, 'import pygame, math\n'), ((47, 82), 'pygame.font.SysFont', 'pygame.font.SysFont', (['"""Monotype"""', '(12)'], {}), "('Monotype', 12)\n", (66, 82), False, 'import pygame, math\n'), ((120, 190), 'math.sqrt', 'math.sqrt', (['((fromPos... |
import typer
from mltk import cli
@cli.root_cli.command("commander", cls=cli.VariableArgumentParsingCommand)
def silabs_commander_command(ctx: typer.Context):
"""Silab's Commander Utility
This utility allows for accessing a Silab's embedded device via JLink.
For more details issue command: mltk c... | [
"mltk.utils.commander.issue_command",
"mltk.cli.get_logger",
"mltk.cli.root_cli.command",
"mltk.cli.handle_exception"
] | [((40, 113), 'mltk.cli.root_cli.command', 'cli.root_cli.command', (['"""commander"""'], {'cls': 'cli.VariableArgumentParsingCommand'}), "('commander', cls=cli.VariableArgumentParsingCommand)\n", (60, 113), False, 'from mltk import cli\n'), ((521, 537), 'mltk.cli.get_logger', 'cli.get_logger', ([], {}), '()\n', (535, 53... |
"""
Note: do not tweak this code unless you know what you're doing.'
"""
import tensorflow as tf
import json
from init import main
import os
with open('config.json') as f:
_d = json.load(f)
labels = _d['labels']
model = _d['CurrentModel']
model = tf.keras.models.load_model(f'models/{model}')
if __name__ == '__mai... | [
"json.load",
"tensorflow.keras.models.load_model",
"init.main"
] | [((180, 192), 'json.load', 'json.load', (['f'], {}), '(f)\n', (189, 192), False, 'import json\n'), ((253, 298), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['f"""models/{model}"""'], {}), "(f'models/{model}')\n", (279, 298), True, 'import tensorflow as tf\n'), ((327, 367), 'init.main', 'main', ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import yaml
import textfsm
from behave import given, when, then
from netests.protocols.facts import Facts
from netests.converters.facts.arista.api import _arista_facts_api_converter
from netests.converters.facts.arista.ssh import _arista_facts_ssh_converter
fr... | [
"netests.tools.file.open_file",
"netests.converters.facts.iosxr.ssh._iosxr_facts_ssh_converter",
"netests.comparators.facts_compare._compare_facts",
"behave.given",
"netests.converters.facts.juniper.nc._juniper_facts_nc_converter",
"netests.tools.file.open_txt_file_as_bytes",
"netests.converters.facts.n... | [((1794, 1873), 'behave.given', 'given', (['u"""A network protocols named Facts defined in netests/protocols/facts.py"""'], {}), "(u'A network protocols named Facts defined in netests/protocols/facts.py')\n", (1799, 1873), False, 'from behave import given, when, then\n'), ((1943, 2014), 'behave.given', 'given', (['u"""... |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... | [
"numpy.zeros_like",
"numpy.ix_",
"pyscf.lib.diis.DIIS",
"numpy.zeros",
"numpy.transpose",
"numpy.prod",
"inspect.getargspec",
"numpy.reshape",
"numpy.linalg.norm",
"numpy.arange",
"collections.OrderedDict",
"numpy.diag",
"numpy.concatenate",
"numpy.repeat"
] | [((2682, 2707), 'numpy.concatenate', 'numpy.concatenate', (['result'], {}), '(result)\n', (2699, 2707), False, 'import numpy\n'), ((7597, 7626), 'numpy.diag', 'numpy.diag', (["hamiltonian['oo']"], {}), "(hamiltonian['oo'])\n", (7607, 7626), False, 'import numpy\n'), ((7639, 7668), 'numpy.diag', 'numpy.diag', (["hamilto... |
import re
from pathlib import Path
class UsbId:
file = Path(__file__).parent.joinpath('usb.ids')
@staticmethod
def get_usbid_names(vendorid, deviceid=None, interfaceid=None):
vendor = None
device = None
interface = None
with open(UsbId.file, encoding='iso-8859-1') as f:
... | [
"pathlib.Path",
"re.search"
] | [((361, 404), 're.search', 're.search', (['f"""\\\\n{vendorid} (.*?)\\\\n"""', 'text'], {}), "(f'\\\\n{vendorid} (.*?)\\\\n', text)\n", (370, 404), False, 'import re\n'), ((60, 74), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (64, 74), False, 'from pathlib import Path\n')] |
# -*- coding: utf-8 -*-
"""
"""
from __future__ import unicode_literals
import glob
from pathlib import Path
import os
import youtube_dl
import urllib
# FIXME: ganna be duplicated.
class Download(object):
def __init__(self):
pass
def run(self, video_ids: list, output_dir: Path = 'result'):
i... | [
"os.path.exists",
"urllib.request.urlopen",
"youtube_dl.YoutubeDL",
"os.path.split",
"os.path.join"
] | [((322, 348), 'os.path.exists', 'os.path.exists', (['output_dir'], {}), '(output_dir)\n', (336, 348), False, 'import os\n'), ((767, 809), 'os.path.join', 'os.path.join', (['output_dir', '"""%(id)s.%(ext)s"""'], {}), "(output_dir, '%(id)s.%(ext)s')\n", (779, 809), False, 'import os\n'), ((867, 895), 'youtube_dl.YoutubeD... |
from collections import OrderedDict
import os.path as osp
import matplotlib.pyplot as plt
import numpy as np
from rlkit.torch.networks import ConcatMlp
from rlkit.torch.sets import set_vae_trainer as svt
from rlkit.torch.sets import models
from rlkit.torch.sets.discriminator import (
DiscriminatorDataset,
Dis... | [
"matplotlib.pyplot.quiver",
"rlkit.torch.sets.batch_algorithm.BatchTorchAlgorithm",
"rlkit.torch.pytorch_util.from_numpy",
"rlkit.torch.networks.ConcatMlp",
"matplotlib.pyplot.figure",
"numpy.sin",
"rlkit.torch.sets.parallel_algorithms.ParallelAlgorithms",
"rlkit.core.logger.get_snapshot_dir",
"os.p... | [((970, 1000), 'numpy.concatenate', 'np.concatenate', (['[x, y]'], {'axis': '(1)'}), '([x, y], axis=1)\n', (984, 1000), True, 'import numpy as np\n'), ((1061, 1120), 'numpy.random.uniform', 'np.random.uniform', (['xlim[0]', 'xlim[1]'], {'size': '(num_examples, 1)'}), '(xlim[0], xlim[1], size=(num_examples, 1))\n', (107... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "MPZinke"
########################################################################################################################
# #
# cre... | [
"Other.DB.DBFunctions.SELECT_Curtains",
"Other.DB.DBFunctions.__CLOSE__",
"Other.DB.DBFunctions.__CONNECT__",
"Other.Global.tomorrow_00_00",
"Other.Class.ZWidget.ZWidget.__init__",
"System.Option.Option",
"threading.Lock",
"Other.DB.DBFunctions.UPDATE_all_prior_CurtainsEvents_is_activated",
"Other.D... | [((1890, 1928), 'Other.Class.ZWidget.ZWidget.__init__', 'ZWidget.__init__', (['self', '"""System"""', 'self'], {}), "(self, 'System', self)\n", (1906, 1928), False, 'from Other.Class.ZWidget import ZWidget\n'), ((1946, 1952), 'threading.Lock', 'Lock', ([], {}), '()\n', (1950, 1952), False, 'from threading import Lock\n... |
import calendar
#itermonthdaysの戻り値
#書式: d
# d: 指定した月の日付。ただし指定月の前後月の場合は0になる
def itermonthdays(calendar): return calendar.itermonthdays(2017, 9)
for calendar in [calendar.Calendar(firstweekday=0), calendar.Calendar(firstweekday=6)]:
print('-----',calendar,'-----')
print(itermonthdays(calendar))
for weekday ... | [
"calendar.Calendar",
"calendar.itermonthdays"
] | [((113, 144), 'calendar.itermonthdays', 'calendar.itermonthdays', (['(2017)', '(9)'], {}), '(2017, 9)\n', (135, 144), False, 'import calendar\n'), ((162, 195), 'calendar.Calendar', 'calendar.Calendar', ([], {'firstweekday': '(0)'}), '(firstweekday=0)\n', (179, 195), False, 'import calendar\n'), ((197, 230), 'calendar.C... |
import pytest
from gtd.log import Metadata, SyncedMetadata
class TestMetadata(object):
@pytest.fixture
def m(self):
m = Metadata()
m['a'] = 10 # this is overwritten
m['b'] = 'test'
# namescope setitem
with m.name_scope('c'):
m['foo'] = 140
# nest... | [
"gtd.log.Metadata",
"gtd.log.SyncedMetadata"
] | [((139, 149), 'gtd.log.Metadata', 'Metadata', ([], {}), '()\n', (147, 149), False, 'from gtd.log import Metadata, SyncedMetadata\n'), ((1108, 1133), 'gtd.log.SyncedMetadata', 'SyncedMetadata', (['meta_path'], {}), '(meta_path)\n', (1122, 1133), False, 'from gtd.log import Metadata, SyncedMetadata\n'), ((1213, 1238), 'g... |
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import sys
import os
import string
import subprocess
import time
import glob
import re
iteration... | [
"os.path.abspath",
"os.putenv",
"os.path.join",
"os.path.isdir",
"os.popen",
"os.path.exists",
"time.time",
"subprocess.call",
"re.search",
"os.listdir",
"re.sub"
] | [((2656, 2683), 'os.path.exists', 'os.path.exists', (['resultsFile'], {}), '(resultsFile)\n', (2670, 2683), False, 'import os\n'), ((598, 624), 'os.path.abspath', 'os.path.abspath', (['shellExec'], {}), '(shellExec)\n', (613, 624), False, 'import os\n'), ((965, 987), 'os.putenv', 'os.putenv', (['"""MODE"""', '"""0"""']... |
import numpy as np
def avoid_backward_action(action):
## if backward movement is initiated, stop the car
if np.all(action > 0.0):
action[0] = 0.0
action[1] = 0.0
return action
def reward_path_divergence(position_history, pos_ptr, reward_multiplier):
v2 = position_history[pos_ptr] - positio... | [
"numpy.linalg.norm",
"numpy.sum",
"numpy.all"
] | [((114, 134), 'numpy.all', 'np.all', (['(action > 0.0)'], {}), '(action > 0.0)\n', (120, 134), True, 'import numpy as np\n'), ((421, 439), 'numpy.linalg.norm', 'np.linalg.norm', (['v1'], {}), '(v1)\n', (435, 439), True, 'import numpy as np\n'), ((449, 467), 'numpy.linalg.norm', 'np.linalg.norm', (['v2'], {}), '(v2)\n',... |
import pandas as pd
def process_raw_df(df_raw, name='Value', copy=False):
data = df_raw.drop('Total', axis=1).stack()
data = data.rename_axis(['Name', 'Year']).to_frame(name=name)
return data
def printif(msg, verbose=True):
if verbose:
print(msg)
def merge_data(girls_file, boys_file, verbose=... | [
"pandas.read_csv"
] | [((391, 427), 'pandas.read_csv', 'pd.read_csv', (['girls_file'], {'index_col': '(0)'}), '(girls_file, index_col=0)\n', (402, 427), True, 'import pandas as pd\n'), ((480, 515), 'pandas.read_csv', 'pd.read_csv', (['boys_file'], {'index_col': '(0)'}), '(boys_file, index_col=0)\n', (491, 515), True, 'import pandas as pd\n'... |
import numpy as np
from gym import spaces
from brs_envs.base_envs import BaseURDFBulletEnv
from brs_envs.base_envs import parse_collision
from brs_envs.rocket_landing_scene import RocketLandingScene
from brs_envs.martlet9.martlet9_robot import Martlet9Robot
class RocketLanderEnv(BaseURDFBulletEnv):
LANDING_SPEED... | [
"brs_envs.rocket_landing_scene.RocketLandingScene",
"numpy.random.uniform",
"brs_envs.base_envs.BaseURDFBulletEnv.__init__",
"brs_envs.martlet9.martlet9_robot.Martlet9Robot",
"numpy.linalg.norm",
"brs_envs.martlet9.martlet9_robot.Martlet9Robot.describeState",
"brs_envs.base_envs.BaseURDFBulletEnv.reset"... | [((955, 995), 'brs_envs.base_envs.BaseURDFBulletEnv.__init__', 'BaseURDFBulletEnv.__init__', (['self', 'render'], {}), '(self, render)\n', (981, 995), False, 'from brs_envs.base_envs import BaseURDFBulletEnv\n'), ((2750, 2789), 'brs_envs.martlet9.martlet9_robot.Martlet9Robot.describeState', 'Martlet9Robot.describeState... |
import Resources.Usuario.querys_constants as qc
import Resources.Usuario.params_constants as pc
from Utils.crypto import Crypto
from Querys.query import Query
from pymysql import Error
class UsuarioQuery(Query):
def insert_usuario(self, usuario):
usuario[1] = Crypto.get_crypto(usuario[1])
try:
... | [
"Utils.crypto.Crypto.get_crypto"
] | [((275, 304), 'Utils.crypto.Crypto.get_crypto', 'Crypto.get_crypto', (['usuario[1]'], {}), '(usuario[1])\n', (292, 304), False, 'from Utils.crypto import Crypto\n')] |
# -*- coding: utf-8 -*-
"""
Defines a convolutional neural network with residual connections.
Based on the architecture described in:
<NAME>, <NAME>, <NAME>, <NAME>. "Deep residual learning
for image recognition". https://arxiv.org/abs/1512.03385
With batch normalization as described in:
<NAME>, <NAME>. "Batch normal... | [
"tensorflow.nn.softmax",
"tensorflow.metrics.accuracy",
"tensorflow.argmax",
"tensorflow.pad",
"numpy.zeros",
"tensorflow.reduce_mean"
] | [((2294, 2339), 'tensorflow.argmax', 'tf.argmax', (["target_vars['predictions']"], {'axis': '(1)'}), "(target_vars['predictions'], axis=1)\n", (2303, 2339), True, 'import tensorflow as tf\n'), ((2356, 2398), 'tensorflow.argmax', 'tf.argmax', (["out_vars['predictions']"], {'axis': '(1)'}), "(out_vars['predictions'], axi... |
import argparse
import gevent.monkey
from closeio_api import APIError, Client as CloseIO_API
from gevent.pool import Pool
gevent.monkey.patch_all()
parser = argparse.ArgumentParser(
description='Restore an array of deleted leads by ID. This CANNOT restore status changes or call recordings.'
)
parser.add_argument... | [
"argparse.ArgumentParser",
"gevent.pool.Pool",
"closeio_api.Client"
] | [((160, 304), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Restore an array of deleted leads by ID. This CANNOT restore status changes or call recordings."""'}), "(description=\n 'Restore an array of deleted leads by ID. This CANNOT restore status changes or call recordings.'\n )... |
import sys
sys.path.append("./")
import shiftnet_cuda
import numpy as np
import torch
import torch.cuda
def main():
pattern = np.arange(18 * 18).reshape(18, 18)
src_buf = np.zeros((32, 64, 18, 18)).astype(np.float32)
for bnr in range(32):
for ch in range(64):
src_buf[bnr,ch,:,:] = pattern
x_hin = ... | [
"sys.path.append",
"numpy.zeros",
"numpy.arange",
"torch.zeros",
"shiftnet_cuda.moduloshiftgeneric_nchw",
"torch.from_numpy"
] | [((11, 32), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (26, 32), False, 'import sys\n'), ((601, 654), 'shiftnet_cuda.moduloshiftgeneric_nchw', 'shiftnet_cuda.moduloshiftgeneric_nchw', (['x', 'y', '(7)', '(2)', '(-1)'], {}), '(x, y, 7, 2, -1)\n', (638, 654), False, 'import shiftnet_cuda\n'), (... |
# -*- coding: UTF8 -*-
# vim: set expandtab tabstop=2 shiftwidth=2 softtabstop=2 foldmethod=marker: #
import json
def get_config() :
config = {
"RocksdbNodeConfigs": {
"group-a#1": "default",
"group-a#2": "default",
}
}
return json.dumps(config);
| [
"json.dumps"
] | [((255, 273), 'json.dumps', 'json.dumps', (['config'], {}), '(config)\n', (265, 273), False, 'import json\n')] |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from .anchor_head_template import AnchorHeadTemplate
class GradReverse(torch.autograd.Function):
def __init__(self, lambd):
self.lambd = lambd
def forward(self, x):
return x.view_as(x)
def backward(self... | [
"torch.nn.Dropout",
"torch.cat",
"torch.randn",
"torch.nn.ModuleDict",
"torch.arange",
"torch.nn.functional.sigmoid",
"torch.ones",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.Parameter",
"torch.mean",
"torch.nn.Conv2d",
"torch.nn.functional.conv2d",
"torch.mul",
"torch.nn.Sigmoid",
"t... | [((941, 980), 'torch.nn.Parameter', 'nn.Parameter', (['param'], {'requires_grad': '(True)'}), '(param, requires_grad=True)\n', (953, 980), True, 'import torch.nn as nn\n'), ((1096, 1108), 'torch.nn.Sigmoid', 'nn.Sigmoid', ([], {}), '()\n', (1106, 1108), True, 'import torch.nn as nn\n'), ((2171, 2210), 'torch.nn.Paramet... |
"""
------------------------
Flask application configuration module
------------------------
"""
import os
class Config(object):
"""
Parent config class.
"""
API_KEY = os.getenv("API_KEY")
DEBUG = True
TESTING = True
PROPAGATE_EXCEPTIONS = True
JSON_SORT_KEYS = False
JSONIFY_PRETTY... | [
"os.getenv"
] | [((186, 206), 'os.getenv', 'os.getenv', (['"""API_KEY"""'], {}), "('API_KEY')\n", (195, 206), False, 'import os\n')] |
# Tabuu 3.0
# by Phxenix for SSBU Training Grounds
# Version: 9.3.0
# Last Changes: 24 March 2022
# Contact me on Discord: Phxenix#1104
import discord
from discord.ext import commands
import os
import utils.logger
import utils.sqlite
class Tabuu3(commands.Bot):
"""
The bot.
"""
d... | [
"discord.utils.utcnow",
"os.listdir",
"discord.Intents.all"
] | [((1220, 1240), 'os.listdir', 'os.listdir', (['"""./cogs"""'], {}), "('./cogs')\n", (1230, 1240), False, 'import os\n'), ((420, 441), 'discord.Intents.all', 'discord.Intents.all', ([], {}), '()\n', (439, 441), False, 'import discord\n'), ((1796, 1818), 'discord.utils.utcnow', 'discord.utils.utcnow', ([], {}), '()\n', (... |
"""
Script for extracting the ground plane from the KITTI dataset.
We need to determine the ground plane position and orientation in order to be able to reconstruct
points on it, which we are trying to detect.
We will collect all the points on the ground plane from the dataset and then fit a plane to them
with RANSAC... | [
"numpy.meshgrid",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"numpy.sum",
"shared.geometry.t3x1",
"numpy.power",
"numpy.cross",
"os.path.exists",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.asmatrix",
"numpy.arange",
"numpy.array",
"shared.geometry.R3x3_y",
"os.path.join"... | [((2022, 2046), 'numpy.cross', 'np.cross', (['l1', 'l2'], {'axis': '(0)'}), '(l1, l2, axis=0)\n', (2030, 2046), True, 'import numpy as np\n'), ((2129, 2187), 'numpy.asmatrix', 'np.asmatrix', (['[normal[0, 0], normal[1, 0], normal[2, 0], d]'], {}), '([normal[0, 0], normal[1, 0], normal[2, 0], d])\n', (2140, 2187), True,... |
from setuptools import setup, find_packages
install_requires = ['cffi>=1.5.2']
setup(
name='pyVulkan',
version='0.9',
description='vulkan API bindings for Python',
author='bglgwyng',
author_email='<EMAIL>',
packages=find_packages(),
package_data={'': ['*.h']},
install_requires=install_... | [
"setuptools.find_packages"
] | [((242, 257), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (255, 257), False, 'from setuptools import setup, find_packages\n')] |
# showing the list of database
# Hiding user name and password
from getpass import getpass
import config
from mysql.connector import connect,Error
#Making connection with SQL
try:
with connect(
host="localhost",
user=config.username,
password =config.password,
) as connection:
... | [
"mysql.connector.connect"
] | [((190, 263), 'mysql.connector.connect', 'connect', ([], {'host': '"""localhost"""', 'user': 'config.username', 'password': 'config.password'}), "(host='localhost', user=config.username, password=config.password)\n", (197, 263), False, 'from mysql.connector import connect, Error\n')] |
import pytest
from examples.reqres import ReqRes, User, UserDetail
@pytest.fixture
def client():
return ReqRes()
def test_reg_res_client_should_be_able_to_list_users(client: ReqRes):
users = client.users()
assert users.page == 1
assert len(users.data)
def test_reg_res_client_should_be_able_to_get... | [
"examples.reqres.ReqRes"
] | [((111, 119), 'examples.reqres.ReqRes', 'ReqRes', ([], {}), '()\n', (117, 119), False, 'from examples.reqres import ReqRes, User, UserDetail\n')] |
import sys
sys.path.append('C:/Users/dmccloskey-sbrg/Google Drive/SBaaS_base')
from SBaaS_base.postgresql_settings import postgresql_settings
from SBaaS_base.postgresql_orm import postgresql_orm
# read in the settings file
filename = 'C:/Users/dmccloskey-sbrg/Google Drive/SBaaS_base/settings.ini';
pg_settings = postgr... | [
"sys.path.append",
"SBaaS_base.postgresql_orm.postgresql_orm",
"SBaaS_base.postgresql_settings.postgresql_settings",
"SBaaS_quantification.stage01_quantification_MQResultsTable_execute.stage01_quantification_MQResultsTable_execute"
] | [((11, 78), 'sys.path.append', 'sys.path.append', (['"""C:/Users/dmccloskey-sbrg/Google Drive/SBaaS_base"""'], {}), "('C:/Users/dmccloskey-sbrg/Google Drive/SBaaS_base')\n", (26, 78), False, 'import sys\n'), ((314, 343), 'SBaaS_base.postgresql_settings.postgresql_settings', 'postgresql_settings', (['filename'], {}), '(... |
from collections import namedtuple
import torch
import torch.nn as nn
import torch.nn.functional as F
class PatchOverlapEmbeddings(nn.Module):
def __init__(self, input_channels, image_sizes, stride, patch_size, embed_size):
super().__init__()
assert isinstance(
image_sizes, tuple
... | [
"torch.nn.Dropout",
"torch.nn.ReLU",
"torch.nn.ModuleList",
"torch.nn.Conv2d",
"torch.cat",
"torch.nn.functional.softmax",
"torch.nn.LayerNorm",
"torch.nn.GELU",
"torch.nn.BatchNorm2d",
"collections.namedtuple",
"torch.nn.Linear",
"torch.nn.functional.interpolate"
] | [((5968, 6060), 'collections.namedtuple', 'namedtuple', (['"""Patch"""', "['input_channels', 'embed_size', 'patch_size', 'stride', 'padding']"], {}), "('Patch', ['input_channels', 'embed_size', 'patch_size', 'stride',\n 'padding'])\n", (5978, 6060), False, 'from collections import namedtuple\n'), ((822, 972), 'torch... |
import torch
import torch.nn as nn
from deepymod_torch.network import Fitting, Library
class DeepMod(nn.Module):
''' Class based interface for deepmod.'''
def __init__(self, n_in, hidden_dims, n_out, library_function, library_args):
super().__init__()
self.network = self.build_network(n_in, hi... | [
"torch.ones",
"torch.nn.Sequential",
"torch.nn.Tanh",
"deepymod_torch.network.Fitting",
"deepymod_torch.network.Library",
"torch.nn.Linear"
] | [((361, 400), 'deepymod_torch.network.Library', 'Library', (['library_function', 'library_args'], {}), '(library_function, library_args)\n', (368, 400), False, 'from deepymod_torch.network import Fitting, Library\n'), ((1092, 1115), 'torch.nn.Sequential', 'nn.Sequential', (['*network'], {}), '(*network)\n', (1105, 1115... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('tasks/', views.get_tasks, name='get_tasks'),
path('tasks/add/', views.add_task, name='add_task'),
path('about/', views.about, name='about'),
path('tasks/<int:id>/edit', views.edit_task, name... | [
"django.urls.path"
] | [((71, 106), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (75, 106), False, 'from django.urls import path\n'), ((112, 161), 'django.urls.path', 'path', (['"""tasks/"""', 'views.get_tasks'], {'name': '"""get_tasks"""'}), "('tasks/', views.get_task... |
from win32 import win32api, win32gui
def MoveCam(End_coords):
#focus on roblox
Window_title = "File Explorer"
win32gui.SetForegroundWindow(win32gui.FindWindow(None, Window_title))
#move camera
end_x = End_coords[0]+50
end_y = End_coords[1]+50
win32api.SetCursorPos((end_x, end_y))
... | [
"win32.win32gui.FindWindow",
"win32.win32api.SetCursorPos"
] | [((278, 315), 'win32.win32api.SetCursorPos', 'win32api.SetCursorPos', (['(end_x, end_y)'], {}), '((end_x, end_y))\n', (299, 315), False, 'from win32 import win32api, win32gui\n'), ((152, 191), 'win32.win32gui.FindWindow', 'win32gui.FindWindow', (['None', 'Window_title'], {}), '(None, Window_title)\n', (171, 191), False... |
from typing import Tuple, List
import keyboard
import pyautogui
# Enter your mouse locations and corresponding shortcuts to this list
# ((x, y), shortcut)
ls: List[Tuple[Tuple[int, int], str]] = [
((-500, 500), 'ctrl+left windows+alt+page up'),
((960, 540), 'ctrl+left windows+alt+page down'),
((1500, 500)... | [
"pyautogui.dragTo",
"keyboard.wait",
"keyboard.add_hotkey"
] | [((533, 548), 'keyboard.wait', 'keyboard.wait', ([], {}), '()\n', (546, 548), False, 'import keyboard\n'), ((408, 440), 'pyautogui.dragTo', 'pyautogui.dragTo', (['pos[0]', 'pos[1]'], {}), '(pos[0], pos[1])\n', (424, 440), False, 'import pyautogui\n'), ((473, 531), 'keyboard.add_hotkey', 'keyboard.add_hotkey', (['h_name... |
'''
Utilities used in front-end rendering
'''
import os
import urllib
import time
import logging
from operator import itemgetter
from google.appengine.api import memcache
from google.appengine.ext.webapp import template
# My modules
from macro.render.defs import ... | [
"macro.interpret.interpreter.MacroInterpreter",
"macro.render.interpretation.generate_interpret_html",
"macro.data.appengine.savedmacro.SavedMacroOps",
"macro.exceptions.NoInputError",
"google.appengine.api.memcache.add",
"time.time",
"macro.render.interpretation.generate_cmd_html",
"macro.data.appeng... | [((2196, 2213), 'google.appengine.api.memcache.get', 'memcache.get', (['key'], {}), '(key)\n', (2208, 2213), False, 'from google.appengine.api import memcache\n'), ((3915, 3954), 'google.appengine.api.memcache.get', 'memcache.get', (['(MACRO_PROC_KEY % macro_id)'], {}), '(MACRO_PROC_KEY % macro_id)\n', (3927, 3954), Fa... |
from django.test import TestCase
from machina.apps.forum_permission.shortcuts import assign_perm
from machina.core.db.models import get_model
from ashley.factories import ForumFactory, LTIContextFactory, UserFactory
Forum = get_model("forum", "Forum") # pylint: disable=C0103
class ForumRenameTestCase(TestCase):
... | [
"machina.core.db.models.get_model",
"machina.apps.forum_permission.shortcuts.assign_perm",
"ashley.factories.LTIContextFactory",
"ashley.factories.UserFactory",
"ashley.factories.ForumFactory"
] | [((226, 253), 'machina.core.db.models.get_model', 'get_model', (['"""forum"""', '"""Forum"""'], {}), "('forum', 'Forum')\n", (235, 253), False, 'from machina.core.db.models import get_model\n'), ((584, 597), 'ashley.factories.UserFactory', 'UserFactory', ([], {}), '()\n', (595, 597), False, 'from ashley.factories impor... |
from sympy import Eq, Matrix, cancel, expand, fraction, gcd_list, lcm_list, poly, solve, symbols
def sphere(P1, P2, P3, P4):
# return F(x, y, z) such that F(x, y, z) = 0 is the sphere's equation
g, h, j, k, x, y, z = symbols('g, h, j, k, x, y, z')
sphere_eq = Eq(x**2 + y**2 + z**2 + g*x + h*y + j*z + k, 0)... | [
"sympy.symbols",
"sympy.solve",
"sympy.Eq",
"sympy.gcd_list",
"sympy.lcm_list",
"sympy.cancel",
"sympy.Matrix",
"sympy.poly"
] | [((226, 256), 'sympy.symbols', 'symbols', (['"""g, h, j, k, x, y, z"""'], {}), "('g, h, j, k, x, y, z')\n", (233, 256), False, 'from sympy import Eq, Matrix, cancel, expand, fraction, gcd_list, lcm_list, poly, solve, symbols\n'), ((273, 332), 'sympy.Eq', 'Eq', (['(x ** 2 + y ** 2 + z ** 2 + g * x + h * y + j * z + k)',... |
from datetime import datetime as dt, timedelta
def unixtimetotime(time):
time = dt.utcfromtimestamp(time)
time = time + timedelta(hours=0)
return time.strftime('%Y-%m-%d %H:%M:%S')
def fahrtocels(fahr):
return (fahr - 32) / 1.8
def checkjsonkey(data,loc,key,i = 0):
if key in data[loc]:
r... | [
"datetime.datetime.utcfromtimestamp",
"datetime.timedelta"
] | [((85, 110), 'datetime.datetime.utcfromtimestamp', 'dt.utcfromtimestamp', (['time'], {}), '(time)\n', (104, 110), True, 'from datetime import datetime as dt, timedelta\n'), ((129, 147), 'datetime.timedelta', 'timedelta', ([], {'hours': '(0)'}), '(hours=0)\n', (138, 147), False, 'from datetime import datetime as dt, tim... |
import pytest
import numpy as np
from FastDSP.structures import GPUArray
class TestGPUArray:
@classmethod
def setup_class(cls):
cls.rows = 4
cls.cols = 6
cls.array_uint8 = np.ones((cls.rows, cls.cols), dtype=np.uint8)
cls.array_int = np.ones((cls.rows, cls.cols), dtype=np.in... | [
"FastDSP.structures.GPUArray",
"numpy.ones"
] | [((209, 254), 'numpy.ones', 'np.ones', (['(cls.rows, cls.cols)'], {'dtype': 'np.uint8'}), '((cls.rows, cls.cols), dtype=np.uint8)\n', (216, 254), True, 'import numpy as np\n'), ((279, 324), 'numpy.ones', 'np.ones', (['(cls.rows, cls.cols)'], {'dtype': 'np.int32'}), '((cls.rows, cls.cols), dtype=np.int32)\n', (286, 324)... |
"""Add completed uploads
Revision ID: <KEY>
Revises: 065886328b03
Create Date: 2021-02-22 16:42:00.690943
"""
import geoalchemy2
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "065886328b03"
branch_labels = None
depends_on = None
def upgra... | [
"alembic.op.drop_table",
"sqlalchemy.DateTime",
"alembic.op.alter_column",
"sqlalchemy.VARCHAR",
"alembic.op.drop_index",
"alembic.op.create_index",
"alembic.op.f",
"alembic.op.drop_column",
"sqlalchemy.text",
"alembic.op.execute",
"sqlalchemy.String",
"sqlalchemy.BigInteger"
] | [((1008, 1097), 'alembic.op.alter_column', 'op.alter_column', (['"""initiated_uploads"""', '"""user_id"""'], {'new_column_name': '"""initiator_user_id"""'}), "('initiated_uploads', 'user_id', new_column_name=\n 'initiator_user_id')\n", (1023, 1097), False, 'from alembic import op\n'), ((1285, 1538), 'alembic.op.exec... |
import requests
import json
import os
import re
from haystack.utils import export_answers_to_csv
import logging
import subprocess
import time
import pprint
import pandas as pd
from typing import Dict, Any, List
from haystack.document_store.sql import DocumentORM
from collections import defaultdict
## Paths to raw ques... | [
"json.load",
"haystack.document_store.elasticsearch.ElasticsearchDocumentStore",
"haystack.reader.farm.FARMReader",
"haystack.Finder",
"haystack.retriever.sparse.ElasticsearchRetriever",
"os.listdir",
"logging.getLogger"
] | [((858, 885), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (875, 885), False, 'import logging\n'), ((904, 996), 'haystack.document_store.elasticsearch.ElasticsearchDocumentStore', 'ElasticsearchDocumentStore', ([], {'host': '"""localhost"""', 'username': '""""""', 'password': '""""""', ... |
import torch
def torch_fit(f, xdata, ydata, p0=None, rounds=10000, learning_rate=1e-3):
"""Experimental function to fit data with gradient descent like neural networks.
"""
if p0 is None:
# determine number of parameters by inspecting the function
from scipy._lib._util import getargspec_n... | [
"scipy._lib._util.getargspec_no_self",
"torch.optim.Adam",
"torch.randn",
"torch.tensor"
] | [((562, 594), 'torch.tensor', 'torch.tensor', (['xdata'], {'dtype': 'dtype'}), '(xdata, dtype=dtype)\n', (574, 594), False, 'import torch\n'), ((603, 635), 'torch.tensor', 'torch.tensor', (['ydata'], {'dtype': 'dtype'}), '(ydata, dtype=dtype)\n', (615, 635), False, 'import torch\n'), ((805, 844), 'torch.optim.Adam', 't... |
# Generated by Django 2.2.13 on 2020-07-13 16:38
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('standard', '0012_termsindexpage_project_code'),
]
operations = [
migrations.RenameField(
model_name='termsindexpage',
old_n... | [
"django.db.migrations.RenameField"
] | [((238, 338), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""termsindexpage"""', 'old_name': '"""project_code"""', 'new_name': '"""project"""'}), "(model_name='termsindexpage', old_name='project_code',\n new_name='project')\n", (260, 338), False, 'from django.db import migratio... |
from functools import reduce
import re
import os
#clean : clean text by turkish words
def clean(text):
d = { "Ş":"ş", "İ":"i", "Ü":"ü", "Ç":"ç", "Ö":"ö", "Ğ":"ğ", "I":"ı", "Î":"ı", "Û":"u", "Â":"a" , "â":"a" , "î":"ı" , "û":"u" , "ä":"a", "à":"a", "å":"a", "é":"e", "ê":"e", "ë":"e", "è":"e", "ï":"ı", "ì":"ı", "ò":"o... | [
"re.sub",
"os.stat"
] | [((627, 666), 're.sub', 're.sub', (['"""[^a-z0-9\\\\sçışöğü]+"""', '""""""', 'text'], {}), "('[^a-z0-9\\\\sçışöğü]+', '', text)\n", (633, 666), False, 'import re\n'), ((1325, 1344), 'os.stat', 'os.stat', (['"""data.txt"""'], {}), "('data.txt')\n", (1332, 1344), False, 'import os\n')] |
import numpy as np
class MotionExplorer:
"""
Aim at exploring motions, represented as sampled observations of a n-dimensional input vector.
This stream of vectors describe a vector space in which the Mahalanobis distance is used to
assess the distance of new samples to previously seen samples. Everyti... | [
"numpy.dot",
"numpy.ravel",
"numpy.empty",
"numpy.zeros",
"numpy.ones",
"numpy.hstack",
"numpy.sort",
"numpy.mean",
"numpy.array",
"numpy.arange",
"numpy.interp",
"numpy.eye",
"numpy.linalg.pinv",
"numpy.vstack"
] | [((2181, 2222), 'numpy.zeros', 'np.zeros', (['(1, self.inputdim * self.order)'], {}), '((1, self.inputdim * self.order))\n', (2189, 2222), True, 'import numpy as np\n'), ((2240, 2276), 'numpy.zeros', 'np.zeros', (['(self.inputdim * self.order)'], {}), '(self.inputdim * self.order)\n', (2248, 2276), True, 'import numpy ... |