code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Copyright (C) 2013 Cisco Systems Inc.
# All rights reserved
#$Id: eor_utils.py,v 1.427 2013/06/24 23:56:03 venksrin Exp $
#ident $Source: /cvsroot/eor/systest/lib/eor_utils.py,v $ $Revision: 1.427 $
# Best Pratices for get() functions:
# 1. Use class rex as much as possible for standard regular expressions
# 2. Use... | [
"collections.OrderedDict",
"datetime.datetime.strptime",
"re.match",
"nxapi_utils.NXAPITransport.send_cmd_int",
"socket.inet_aton",
"re.sub",
"re.findall",
"re.search"
] | [((1416, 1460), 'nxapi_utils.NXAPITransport.send_cmd_int', 'NXAPITransport.send_cmd_int', (['cmd', '"""cli_conf"""'], {}), "(cmd, 'cli_conf')\n", (1443, 1460), False, 'from nxapi_utils import NXAPITransport\n'), ((9311, 9336), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (9334, 9336), False, ... |
import random
n1 = str(input('Nome do primeiro Aluno: '))
n2 = str(input('Nome do segundo Aluno: '))
n3 = str(input('Nome do terceiro Aluno: '))
n4 = str(input('Nome do quarto Aluno: '))
lista = [n1,n2,n3,n4]
escolhido = random.choice(lista)
print('O Aluno escolhido foi {} .'.format(escolhido)) | [
"random.choice"
] | [((221, 241), 'random.choice', 'random.choice', (['lista'], {}), '(lista)\n', (234, 241), False, 'import random\n')] |
# SPDX-License-Identifier: BSD-3-Clause
"""
Utility to create a SoftFab results file from PyLint's JSON output.
For SoftFab, 'error' means the test results are incomplete, while 'warning'
means the results are complete but the content has problems. So if PyLint
ran successfully but finds errors in the code it examine... | [
"collections.Counter",
"json.load"
] | [((2112, 2121), 'collections.Counter', 'Counter', ([], {}), '()\n', (2119, 2121), False, 'from collections import Counter\n'), ((1839, 1853), 'json.load', 'json.load', (['inp'], {}), '(inp)\n', (1848, 1853), False, 'import json\n')] |
# Generated by Django 3.2.8 on 2021-11-29 14:33
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('student', '0020_thesorting'),
]
operations = [
migrations.RemoveField(
model_name='classroom',
name='class_The_sorting',
... | [
"django.db.migrations.RemoveField"
] | [((219, 291), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""classroom"""', 'name': '"""class_The_sorting"""'}), "(model_name='classroom', name='class_The_sorting')\n", (241, 291), False, 'from django.db import migrations\n')] |
from providers.spotify.spotify_id import SpotifyId
from providers.entities.playlist import Playlist
from typing import List
from providers.entities.song import Song
from providers.spotify.spotify_playlist_provider import SpotifyPlaylistProvider
def test_search():
spotify_playlist_provider: SpotifyPlaylistProvider... | [
"providers.spotify.spotify_id.SpotifyId"
] | [((399, 434), 'providers.spotify.spotify_id.SpotifyId', 'SpotifyId', (['"""37i9dQZF1DXc4xFsxShkAv"""'], {}), "('37i9dQZF1DXc4xFsxShkAv')\n", (408, 434), False, 'from providers.spotify.spotify_id import SpotifyId\n')] |
from fastapi import FastAPI
from config.settings import settings
from config.middleware import register_middleware
from config.tortoise import register_tortoise
from config.exception import register_exception
from config.routes import register_routes
from core.helpers.responses import responses
def create_app():
ap... | [
"config.routes.register_routes",
"config.exception.register_exception",
"fastapi.FastAPI",
"config.middleware.register_middleware",
"config.tortoise.register_tortoise"
] | [((324, 539), 'fastapi.FastAPI', 'FastAPI', ([], {'title': 'settings.APP_NAME', 'description': 'None', 'version': 'settings.APP_VERSION', 'docs_url': 'None', 'redoc_url': 'f"""{settings.ROOT_PATH}/docs"""', 'openapi_url': 'f"""{settings.ROOT_PATH}/openapi.json"""', 'responses': 'responses'}), "(title=settings.APP_NAME,... |
from registration.models import Participant, College, verificationEmail
from intro.models import IntroReg
from registration.views import generate_password
from django.db.models.signals import post_save
from django.contrib.auth.models import User
from django.template.loader import render_to_string, get_template
from dj... | [
"django.core.mail.EmailMultiAlternatives",
"django.db.models.signals.post_save.disconnect",
"time.sleep",
"portal.models.Participant.objects.all",
"registration.models.Participant.objects.get",
"registration.models.College.objects.get",
"registration.models.College.objects.create",
"registration.model... | [((638, 674), 'django.template.loader.render_to_string', 'render_to_string', (['"""portal/mail.html"""'], {}), "('portal/mail.html')\n", (654, 674), False, 'from django.template.loader import render_to_string, get_template\n'), ((1162, 1230), 'django.db.models.signals.post_save.disconnect', 'post_save.disconnect', ([],... |
"""
網頁截圖工具 (powered by Selenium and Chrome)
1. Facebook
ch = ChromeBrowser()
ch.facebook_shot('https://www.facebook.com/chuck158207/posts/3660883767261064', 'out.png')
2. Twitter
ch = ChromeBrowser()
ch.twitter_shot('https://twitter.com/KamiliaHaraQoo/status/1270284366350958593', 'out.png')
3. 一般網頁... | [
"selenium.webdriver.Chrome",
"selenium.webdriver.ChromeOptions",
"time.sleep",
"pathlib.Path"
] | [((879, 894), 'selenium.webdriver.ChromeOptions', 'ChromeOptions', ([], {}), '()\n', (892, 894), False, 'from selenium.webdriver import Chrome, ChromeOptions\n'), ((1087, 1110), 'selenium.webdriver.Chrome', 'Chrome', ([], {'options': 'options'}), '(options=options)\n', (1093, 1110), False, 'from selenium.webdriver impo... |
import numpy as np
def normalize_orders(image_data, trace, half_window=10, n=100):
"""
:param image_data: numpy.ndarray
:param trace: xwavecal.utils.trace_utils.Trace
:param half_window: int
the number of pixels above an below a diffraction order to try and normalize
:param... | [
"numpy.ones_like",
"numpy.isclose",
"numpy.sort",
"numpy.max",
"numpy.min",
"numpy.arange"
] | [((653, 680), 'numpy.max', 'np.max', (['image_data.shape[0]'], {}), '(image_data.shape[0])\n', (659, 680), True, 'import numpy as np\n'), ((704, 734), 'numpy.arange', 'np.arange', (['image_data.shape[1]'], {}), '(image_data.shape[1])\n', (713, 734), True, 'import numpy as np\n'), ((736, 766), 'numpy.arange', 'np.arange... |
from discord.ext.commands import Cog
from discord.ext.commands import CheckFailure
from discord.ext.commands import command, has_permissions
from discord.ext.menus import MenuPages, ListPageSource
from datetime import datetime, timedelta
from random import randint
from typing import Optional
from discord import Memb... | [
"discord.ext.commands.Cog.listener",
"datetime.datetime.utcnow",
"datetime.timedelta",
"discord.Colour.random",
"datetime.datetime.fromisoformat",
"discord.ext.commands.command",
"random.randint"
] | [((2651, 2781), 'discord.ext.commands.command', 'command', ([], {'name': '"""level"""', 'brief': '"""Displays a user\'s or the caller\'s level"""', 'description': '"""Displays a user\'s or the caller\'s level."""'}), '(name=\'level\', brief="Displays a user\'s or the caller\'s level",\n description="Displays a user\... |
# Generated by Django 2.2.6 on 2021-01-21 16:34
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0001_initial'),
]
operations = [
migrations.DeleteModel(
name='Book',
),
]
| [
"django.db.migrations.DeleteModel"
] | [((213, 248), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""Book"""'}), "(name='Book')\n", (235, 248), False, 'from django.db import migrations\n')] |
"""
a view for a single server. This view must be wrapped in some container,
i.e. window or notebook
"""
# $Id: serverView.py,v 1.32 2002/02/23 19:58:26 ivo Exp $
from gtk import *
from GDK import *
from libglade import *
from string import *
from msgSupport import msgSupport
from genericView import generic... | [
"channelView.channelView",
"msgView.msgView",
"genericView.genericView.__init__",
"queryView.queryView",
"util.casedict",
"util.debug.debug",
"nestable.nestable.__init__"
] | [((960, 1006), 'genericView.genericView.__init__', 'genericView.__init__', (['self', '"""detach_container"""'], {}), "(self, 'detach_container')\n", (980, 1006), False, 'from genericView import genericView\n'), ((1096, 1156), 'nestable.nestable.__init__', 'nestable.__init__', (['self', 'container'], {'state': 'nestable... |
import numpy as np
def init(A, b, c, rank, m):
A_b = A[:, (m-rank):]
A_n = A[:, :(m-rank)]
c_b = c[:, (m-rank):]
c_n = c[:, :(m-rank)]
A_b_inv = np.linalg.pinv(A_b)
b_ = A_b_inv @ b
tmp = c_b @ A_b_inv
ZC = tmp @ A_n - c_n
F = tmp @ b
# Get the Simplex Tabel
T1 = np.vsta... | [
"numpy.linalg.pinv",
"numpy.hstack",
"numpy.argmax",
"numpy.max",
"numpy.vstack",
"numpy.loadtxt",
"numpy.zeros_like"
] | [((168, 187), 'numpy.linalg.pinv', 'np.linalg.pinv', (['A_b'], {}), '(A_b)\n', (182, 187), True, 'import numpy as np\n'), ((313, 343), 'numpy.vstack', 'np.vstack', (['(A_b_inv @ A_n, ZC)'], {}), '((A_b_inv @ A_n, ZC))\n', (322, 343), True, 'import numpy as np\n'), ((398, 416), 'numpy.vstack', 'np.vstack', (['(b_, F)'],... |
import os
import pytest
from jina import Document
from jina.optimizers import FlowOptimizer, EvaluationCallback
from jina.optimizers.flow_runner import SingleFlowRunner
cur_dir = os.path.dirname(os.path.abspath(__file__))
@pytest.fixture
def config(tmpdir):
os.environ['JINA_OPTIMIZER_WORKSPACE_DIR'] = str(tmpd... | [
"os.path.abspath",
"jina.Document",
"os.path.join",
"jina.optimizers.EvaluationCallback"
] | [((198, 223), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (213, 223), False, 'import os\n'), ((374, 412), 'os.path.join', 'os.path.join', (['cur_dir', '"""parameter.yml"""'], {}), "(cur_dir, 'parameter.yml')\n", (386, 412), False, 'import os\n'), ((458, 497), 'os.path.join', 'os.path.join'... |
import unittest
from lib.bonddatabase import BondDatabase
class TestBondDatabase(unittest.TestCase):
def test_open_database(self):
db = BondDatabase()
def test_read_database(self):
db = BondDatabase()
self.assertTrue("sugar-ring" in db.length)
self.assertEqual(db.length["suga... | [
"unittest.main",
"lib.bonddatabase.BondDatabase"
] | [((1063, 1078), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1076, 1078), False, 'import unittest\n'), ((151, 165), 'lib.bonddatabase.BondDatabase', 'BondDatabase', ([], {}), '()\n', (163, 165), False, 'from lib.bonddatabase import BondDatabase\n'), ((214, 228), 'lib.bonddatabase.BondDatabase', 'BondDatabase', ... |
#!/bin/python
import listify_circuits
listify_circuits.optimize_circuits(38, 'reverse') | [
"listify_circuits.optimize_circuits"
] | [((39, 88), 'listify_circuits.optimize_circuits', 'listify_circuits.optimize_circuits', (['(38)', '"""reverse"""'], {}), "(38, 'reverse')\n", (73, 88), False, 'import listify_circuits\n')] |
import glob
from queue import Queue
from threading import Thread
import pandas as pd
import torch
from tqdm import tqdm
import os
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
os.sys.path.insert(0,parentdir)
from training.model import BaselineModel
class ParallelExperimentRunner:
def... | [
"statistics.spatial_opponency.SpatialOpponency",
"torch.load",
"tqdm.tqdm",
"os.path.join",
"os.sys.path.insert",
"os.path.abspath",
"threading.Thread",
"queue.Queue",
"pandas.concat"
] | [((204, 236), 'os.sys.path.insert', 'os.sys.path.insert', (['(0)', 'parentdir'], {}), '(0, parentdir)\n', (222, 236), False, 'import os\n'), ((176, 201), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (191, 201), False, 'import os\n'), ((598, 605), 'queue.Queue', 'Queue', ([], {}), '()\n', (6... |
# -*- coding: utf-8 -*-
#
# @author <NAME>
# @date 1 Feb 2019
import numpy as np
import pandas as pd
import itertools
from sklearn import svm
from data_handling import *
from data_stats import *
# Data paths
proj_dir = '/Users/nikhil/code/git_repos/compare-surf-tools/'
data_dir = proj_dir + 'data/'
demograph_file =... | [
"numpy.mean",
"pandas.merge",
"pandas.read_csv"
] | [((779, 817), 'pandas.read_csv', 'pd.read_csv', (['(data_dir + demograph_file)'], {}), '(data_dir + demograph_file)\n', (790, 817), True, 'import pandas as pd\n'), ((906, 949), 'pandas.read_csv', 'pd.read_csv', (['(data_dir + ants_file)'], {'header': '(2)'}), '(data_dir + ants_file, header=2)\n', (917, 949), True, 'imp... |
import cPickle
import numpy as np
import cv2
repository = []
for i in range(1, 6):
name = 'cifar/data_batch_'+str(i)
with open(name, 'rb') as fo:
data = cPickle.load(fo)
collect = data.get('data')
for j in collect:
red = []
green = []
blue = []
image = []
... | [
"numpy.array",
"cPickle.dump",
"cPickle.load"
] | [((709, 736), 'cPickle.dump', 'cPickle.dump', (['repository', 'f'], {}), '(repository, f)\n', (721, 736), False, 'import cPickle\n'), ((173, 189), 'cPickle.load', 'cPickle.load', (['fo'], {}), '(fo)\n', (185, 189), False, 'import cPickle\n'), ((644, 658), 'numpy.array', 'np.array', (['repo'], {}), '(repo)\n', (652, 658... |
from kafka import KafkaConsumer
import json
from app_logger import App_Logger
class Consumer:
""" Class for Consumer"""
def __init__(self, bootstrap='b-1.demo-cluster-1.9q7lp7.c1.kafka.eu-west-1.amazonaws.com:9092', topic='transc_data'):
""" Initialize consumer with the given bootstrapserver"""
... | [
"app_logger.App_Logger",
"kafka.KafkaConsumer"
] | [((632, 717), 'kafka.KafkaConsumer', 'KafkaConsumer', (['self.topic'], {'group_id': '"""my-group"""', 'bootstrap_servers': 'self.bootstrap'}), "(self.topic, group_id='my-group', bootstrap_servers=self.bootstrap\n )\n", (645, 717), False, 'from kafka import KafkaConsumer\n'), ((399, 411), 'app_logger.App_Logger', 'Ap... |
"""
Contains the text decorations manager
"""
import logging
from pyqode.core.api.manager import Manager
def _logger():
return logging.getLogger(__name__)
class TextDecorationsManager(Manager):
"""
Manages the collection of TextDecoration that have been set on the editor
widget.
"""
def __in... | [
"logging.getLogger"
] | [((133, 160), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (150, 160), False, 'import logging\n')] |
"""
Example for exporting a molecule to an HTML5 file using mogli
"""
import mogli
molecules = mogli.read('examples/dna.xyz')
mogli.BOND_RADIUS = 0.05
mogli.export(molecules[0], 'dna.html', width=1920, height=1080,
bonds_param=1.15, camera=((40, 0, 0),
(0, 0, 0),
... | [
"mogli.read",
"mogli.export"
] | [((96, 126), 'mogli.read', 'mogli.read', (['"""examples/dna.xyz"""'], {}), "('examples/dna.xyz')\n", (106, 126), False, 'import mogli\n'), ((152, 281), 'mogli.export', 'mogli.export', (['molecules[0]', '"""dna.html"""'], {'width': '(1920)', 'height': '(1080)', 'bonds_param': '(1.15)', 'camera': '((40, 0, 0), (0, 0, 0),... |
import csv
import sys
fields = [int(x) - 1 for x in sys.argv[1].split(',')]
for row in csv.reader(sys.stdin):
val = []
for field in fields:
val.append(row[field])
sys.stdout.write(','.join(val) + '\n')
| [
"csv.reader"
] | [((89, 110), 'csv.reader', 'csv.reader', (['sys.stdin'], {}), '(sys.stdin)\n', (99, 110), False, 'import csv\n')] |
#!/usr/bin/env python
# encoding: utf-8
# The MIT License
# Copyright (c) 2019 Ina (<NAME> & <NAME> - http://www.ina.fr/)
# 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 restrictio... | [
"cv2.dnn.blobFromImage",
"keras.preprocessing.image.img_to_array",
"pandas.DataFrame.from_records",
"cv2.warpAffine",
"cv2.dnn.readNetFromTensorflow",
"keras_vggface.vggface.VGGFace",
"dlib.rectangle",
"keras_vggface.utils.preprocess_input",
"dlib.correlation_tracker",
"dlib.shape_predictor",
"c... | [((1953, 1984), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'MP4V'"], {}), "(*'MP4V')\n", (1975, 1984), False, 'import dlib, cv2\n'), ((1995, 2063), 'cv2.VideoWriter', 'cv2.VideoWriter', (['file_name', 'fourcc', 'fps', '(frame_height, frame_width)'], {}), '(file_name, fourcc, fps, (frame_height, frame_width... |
from os.path import join, abspath, dirname
from nose.tools import raises
from indra.statements import Complex, Phosphorylation
from indra.sources import hprd
test_dir = join(abspath(dirname(__file__)), 'hprd_tests_data')
id_file = join(test_dir, 'HPRD_ID_MAPPINGS.txt')
def test_process_complexes():
cplx_file ... | [
"os.path.dirname",
"indra.sources.hprd.process_flat_files",
"os.path.join",
"nose.tools.raises"
] | [((235, 273), 'os.path.join', 'join', (['test_dir', '"""HPRD_ID_MAPPINGS.txt"""'], {}), "(test_dir, 'HPRD_ID_MAPPINGS.txt')\n", (239, 273), False, 'from os.path import join, abspath, dirname\n'), ((3935, 3953), 'nose.tools.raises', 'raises', (['ValueError'], {}), '(ValueError)\n', (3941, 3953), False, 'from nose.tools ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# This file is part of MAVlinkplug.
# MAVlinkplug is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... | [
"os.kill",
"socket.socket",
"subprocess.Popen",
"time.sleep",
"os.path.dirname",
"telnetlib.Telnet"
] | [((2252, 2320), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM', 'socket.IPPROTO_UDP'], {}), '(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)\n', (2265, 2320), False, 'import subprocess, os, signal, telnetlib, time, socket\n'), ((2410, 2478), 'socket.socket', 'socket.socket', (['socket... |
# -*- coding: utf-8 -*-
from typing import List
import ssg
def segment(text: str) -> List[str]:
return ssg.syllable_tokenize(text)
| [
"ssg.syllable_tokenize"
] | [((110, 137), 'ssg.syllable_tokenize', 'ssg.syllable_tokenize', (['text'], {}), '(text)\n', (131, 137), False, 'import ssg\n')] |
import torch as th
import torch.nn as nn
from torch.utils.data import DataLoader
from torch.utils.data import Dataset
import torch.nn.functional as F
import numpy as np
import dgl
import dgl.function as fn
class TreeLSTMCell(nn.Module):
def __init__(self, x_size, h_size):
super(TreeLSTMCell, self).__init_... | [
"torch.tanh",
"torch.nn.Dropout",
"torch.nn.Embedding",
"torch.sigmoid",
"torch.mm",
"torch.chunk",
"torch.sum",
"dgl.prop_nodes_topo",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.functional.softmax",
"torch.cat"
] | [((345, 386), 'torch.nn.Linear', 'nn.Linear', (['x_size', '(3 * h_size)'], {'bias': '(False)'}), '(x_size, 3 * h_size, bias=False)\n', (354, 386), True, 'import torch.nn as nn\n'), ((408, 453), 'torch.nn.Linear', 'nn.Linear', (['(2 * h_size)', '(3 * h_size)'], {'bias': '(False)'}), '(2 * h_size, 3 * h_size, bias=False)... |
#!/usr/bin/env python3
import configparser
import os
import os.path
import shlex
import sys
from subprocess import run
if __name__ == '__main__':
submodule = False
if len(sys.argv) == 2:
if sys.argv[1] != 'submodule':
print('usage: python3 pkg-standalone.py [submodule]')
sys.e... | [
"os.path.exists",
"configparser.ConfigParser",
"os.makedirs",
"shlex.split",
"os.path.join",
"sys.exit"
] | [((363, 390), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (388, 390), False, 'import configparser\n'), ((417, 451), 'os.makedirs', 'os.makedirs', (['"""deps"""'], {'exist_ok': '(True)'}), "('deps', exist_ok=True)\n", (428, 451), False, 'import os\n'), ((569, 595), 'os.path.join', 'os.pat... |
import sys
import cPickle as cp
import random
import numpy as np
import networkx as nx
from tqdm import tqdm
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--save_dir', help='Save directory.')
parser.add_argument('--max_n', type=int, help='Upper bound on graph size.')
parser.add_argument('--mi... | [
"cPickle.dump",
"networkx.disjoint_union",
"random.shuffle",
"argparse.ArgumentParser",
"networkx.connected_component_subgraphs",
"networkx.is_connected",
"numpy.random.randint",
"networkx.number_connected_components",
"networkx.erdos_renyi_graph"
] | [((135, 160), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (158, 160), False, 'import argparse\n'), ((792, 826), 'networkx.erdos_renyi_graph', 'nx.erdos_renyi_graph', ([], {'n': 'cur_n', 'p': 'p'}), '(n=cur_n, p=p)\n', (812, 826), True, 'import networkx as nx\n'), ((893, 914), 'random.shuffle... |
import os
import requests
import logging
from PIL import Image
from io import BytesIO
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
def get_image(link, wid):
path = os.path.join('imagenet', wid)
imgdir_path = Path(path)
if not imgdir_path.exists():
try:
o... | [
"os.path.exists",
"os.makedirs",
"pathlib.Path",
"concurrent.futures.ThreadPoolExecutor",
"os.path.join",
"io.BytesIO",
"requests.get",
"os.path.split",
"os.path.isfile"
] | [((201, 230), 'os.path.join', 'os.path.join', (['"""imagenet"""', 'wid'], {}), "('imagenet', wid)\n", (213, 230), False, 'import os\n'), ((249, 259), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (253, 259), False, 'from pathlib import Path\n'), ((501, 528), 'os.path.join', 'os.path.join', (['path', 'imgname'], {... |
from maze import Maze
m=Maze(10,500,500,"green","Black",2.5)
print("Press any key to exit")
| [
"maze.Maze"
] | [((24, 65), 'maze.Maze', 'Maze', (['(10)', '(500)', '(500)', '"""green"""', '"""Black"""', '(2.5)'], {}), "(10, 500, 500, 'green', 'Black', 2.5)\n", (28, 65), False, 'from maze import Maze\n')] |
"""
Tests with different form input types
"""
from datetime import timedelta
from django.utils import timezone
from importlib import reload
from tests.factories import ShopFactory, TransactionFactory
from tests.market.models import GeneralManager, Item, ShoppingMall, Town
from admin_confirm.tests.helpers import AdminC... | [
"tests.market.models.ShoppingMall.objects.create",
"tests.market.models.Town.objects.create",
"tests.market.models.GeneralManager.objects.create",
"django.utils.timezone.now",
"tests.market.models.Item.objects.count",
"tests.factories.TransactionFactory",
"importlib.reload",
"datetime.timedelta",
"t... | [((1139, 1165), 'importlib.reload', 'reload', (['shoppingmall_admin'], {}), '(shoppingmall_admin)\n', (1145, 1165), False, 'from importlib import reload\n'), ((1174, 1192), 'importlib.reload', 'reload', (['item_admin'], {}), '(item_admin)\n', (1180, 1192), False, 'from importlib import reload\n'), ((2692, 2733), 'tests... |
from typing import Dict, List, Optional, Type
import kubernetes
from kubernetes.client import V1beta1CronJob, V1Deployment
from loguru import logger
from streams_explorer.core.config import settings
from streams_explorer.core.k8s_app import K8sApp, K8sAppDeployment
from streams_explorer.core.node_info_extractor impor... | [
"streams_explorer.extractors.extractor_container.get_sources_sinks",
"kubernetes.config.load_incluster_config",
"loguru.logger.info",
"streams_explorer.core.services.kafkaconnect.KafkaConnect.connectors",
"loguru.logger.debug",
"kubernetes.config.load_kube_config",
"streams_explorer.core.services.datafl... | [((1399, 1445), 'streams_explorer.core.services.dataflow_graph.DataFlowGraph', 'DataFlowGraph', ([], {'metric_provider': 'metric_provider'}), '(metric_provider=metric_provider)\n', (1412, 1445), False, 'from streams_explorer.core.services.dataflow_graph import DataFlowGraph, NodeTypesEnum\n'), ((1651, 1678), 'streams_e... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author : <EMAIL> (liuzhaoci)
# Created : 2017/5/24
'''
read .tac.txt and get instruction lists
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import optimization.BasicBlock.ConstructBasicBloc... | [
"optimization.BasicBlock.ConstructBasicBlock.ConstructBlockList",
"optimization.BasicBlock.DestructBasicBlock.generate_labellist",
"json.dumps",
"optimization.IR_IO.irParser.decode_TAC_list",
"optimization.BasicBlock.DestructBasicBlock.BlockList_to_InstList"
] | [((768, 801), 'optimization.IR_IO.irParser.decode_TAC_list', 'irParser.decode_TAC_list', (['ir_strs'], {}), '(ir_strs)\n', (792, 801), True, 'import optimization.IR_IO.irParser as irParser\n'), ((984, 1033), 'optimization.BasicBlock.ConstructBasicBlock.ConstructBlockList', 'ConstructBasicBlock.ConstructBlockList', (['i... |
#!/usr/bin/env python
# license removed for brevity
import requests
from scapy.all import *
import sys
import os
current_folder = os.path.dirname(os.path.realpath(__file__))
sys.path.append(current_folder)
from modules.IPParser import IPParser
from modules.Sniffer import Sniffer
print("sniffer startin... | [
"os.path.realpath",
"modules.Sniffer.Sniffer",
"sys.path.append"
] | [((183, 214), 'sys.path.append', 'sys.path.append', (['current_folder'], {}), '(current_folder)\n', (198, 214), False, 'import sys\n'), ((341, 405), 'modules.Sniffer.Sniffer', 'Sniffer', ([], {'count': '(-1)', 'filter': '"""arp"""', 'use_show': '(True)', 'use_logger': '(False)'}), "(count=-1, filter='arp', use_show=Tru... |
from autolens import decorator_util
import numpy as np
from autolens.data.array.util import mask_util
@decorator_util.jit()
def centres_from_shape_pixel_scales_and_origin(shape, pixel_scales, origin):
"""Determine the (y,x) arc-second central coordinates of an array from its shape, pixel-scales and origin.
... | [
"numpy.zeros",
"autolens.data.array.util.mask_util.total_sub_pixels_from_mask_and_sub_grid_size",
"autolens.data.array.util.mask_util.total_regular_pixels_from_mask",
"autolens.decorator_util.jit"
] | [((106, 126), 'autolens.decorator_util.jit', 'decorator_util.jit', ([], {}), '()\n', (124, 126), False, 'from autolens import decorator_util\n'), ((1270, 1290), 'autolens.decorator_util.jit', 'decorator_util.jit', ([], {}), '()\n', (1288, 1290), False, 'from autolens import decorator_util\n'), ((3165, 3185), 'autolens.... |
from flask_restful import Resource, request
from flask_jwt import jwt_required, current_identity
import json
import uuid
from common.ret_status import RetStatus
from common.database import db
from common.satree import TreeManager
from model.nodetree import NodeTree, ReqNodeSchema, RspNodeSchema
class TreeRo... | [
"common.ret_status.RetStatus",
"model.nodetree.NodeTree",
"model.nodetree.ReqNodeSchema",
"common.satree.TreeManager",
"flask_jwt.jwt_required",
"flask_restful.request.get_json",
"model.nodetree.RspNodeSchema"
] | [((340, 354), 'flask_jwt.jwt_required', 'jwt_required', ([], {}), '()\n', (352, 354), False, 'from flask_jwt import jwt_required, current_identity\n'), ((798, 812), 'flask_jwt.jwt_required', 'jwt_required', ([], {}), '()\n', (810, 812), False, 'from flask_jwt import jwt_required, current_identity\n'), ((1284, 1298), 'f... |
from math import sin,cos,radians
def compass_to_degrees(compass):
d = { 'E': 90, 'N': 0, 'S': 180, 'W': 270 }
return d[compass]
def compass_offsets(compass_dir):
d = {
'E': ( 1, 0),
'N': ( 0, 1),
'W': (-1, 0),
'S': ( 0,-1),
}
return d[compass_dir]
class Shi... | [
"math.cos",
"math.sin",
"fileinput.input",
"math.radians"
] | [((3412, 3429), 'fileinput.input', 'fileinput.input', ([], {}), '()\n', (3427, 3429), False, 'import fileinput\n'), ((3549, 3566), 'fileinput.input', 'fileinput.input', ([], {}), '()\n', (3564, 3566), False, 'import fileinput\n'), ((2741, 2753), 'math.radians', 'radians', (['num'], {}), '(num)\n', (2748, 2753), False, ... |
from http.server import BaseHTTPRequestHandler
import os
import subprocess
import time
from typing import ClassVar, Dict, List, Optional, Tuple
from onceml.components.base import BaseComponent, BaseExecutor
from onceml.orchestration.Workflow.types import PodContainer
from onceml.types.artifact import Artifact
from once... | [
"onceml.orchestration.Workflow.types.PodContainer",
"os.path.exists",
"os.makedirs",
"threading.Lock",
"onceml.utils.logger.logger.info",
"json.dumps",
"os.path.join",
"time.sleep",
"deprecated.sphinx.deprecated",
"onceml.utils.logger.logger.error",
"os.path.abspath",
"threading.Thread",
"on... | [((4079, 4124), 'deprecated.sphinx.deprecated', 'deprecated', ([], {'reason': '"""not use"""', 'version': '"""0.0.1"""'}), "(reason='not use', version='0.0.1')\n", (4089, 4124), False, 'from deprecated.sphinx import deprecated\n'), ((6547, 6592), 'deprecated.sphinx.deprecated', 'deprecated', ([], {'reason': '"""not use... |
""" Helper module with methods for one-hot sequence encoding and generators to
to enable whole genome iteration """
import h5py
import numpy as np
import tensorflow as tf
from collections import defaultdict
class Sequence:
dic = {
"A": 0,
"T": 1,
"G": 2,
"C": 3
}
""" Meth... | [
"tensorflow.data.Dataset.from_tensors",
"tensorflow.io.parse_single_example",
"tensorflow.io.parse_tensor",
"h5py.File",
"numpy.array",
"numpy.zeros",
"tensorflow.io.FixedLenFeature",
"collections.defaultdict",
"tensorflow.concat",
"numpy.vstack",
"numpy.concatenate"
] | [((3844, 3857), 'collections.defaultdict', 'defaultdict', ([], {}), '()\n', (3855, 3857), False, 'from collections import defaultdict\n'), ((3891, 3927), 'tensorflow.io.FixedLenFeature', 'tf.io.FixedLenFeature', (['[]', 'tf.string'], {}), '([], tf.string)\n', (3912, 3927), True, 'import tensorflow as tf\n'), ((3963, 39... |
"""Components for displaying taxon info"""
import webbrowser
from collections import deque
from logging import getLogger
from typing import Iterator
from pyinaturalist import Taxon
from PySide6.QtCore import QEvent, Qt, QThread, Signal
from PySide6.QtWidgets import QGroupBox, QPushButton
from naturtag.app.style impor... | [
"logging.getLogger",
"PySide6.QtCore.Signal",
"naturtag.widgets.GridLayout",
"naturtag.widgets.TaxonImageWindow",
"collections.deque",
"naturtag.widgets.TaxonList",
"naturtag.app.style.fa_icon",
"PySide6.QtWidgets.QPushButton",
"webbrowser.open",
"naturtag.widgets.HorizontalLayout",
"naturtag.wi... | [((624, 643), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (633, 643), False, 'from logging import getLogger\n'), ((770, 781), 'PySide6.QtCore.Signal', 'Signal', (['int'], {}), '(int)\n', (776, 781), False, 'from PySide6.QtCore import QEvent, Qt, QThread, Signal\n'), ((848, 861), 'PySide6.QtCor... |
from math import ceil
import cocotb
import random
from cocotb.clock import Clock
from cocotb.result import TestSuccess, TestFailure
from cocotb.triggers import RisingEdge
from queue import Queue
from poseidon_python import basic
from cocotb_test import simulator
CASES_NUM = 1 # the number of test cases
BUFFER_SIZE =... | [
"cocotb.test",
"cocotb_test.simulator.run",
"cocotb.triggers.RisingEdge",
"random.random",
"cocotb.clock.Clock",
"queue.Queue",
"random.randint"
] | [((2612, 2663), 'cocotb.test', 'cocotb.test', ([], {'timeout_time': '(100000)', 'timeout_unit': '"""ns"""'}), "(timeout_time=100000, timeout_unit='ns')\n", (2623, 2663), False, 'import cocotb\n'), ((3265, 3459), 'cocotb_test.simulator.run', 'simulator.run', ([], {'verilog_sources': "['../main/verilog/AXI4StreamTransmit... |
import os
import pandas as pd
import plotly.graph_objects as go
class MapMeClass:
""" Class for all Google Location Services functions and properties"""
def __init__(self, filepath):
self.data = self._ReadJson(filepath)
self.data = self._DeriveTimeIntervals(self.data)
self.data = self... | [
"plotly.graph_objects.Layout",
"plotly.graph_objects.Scattermapbox",
"pandas.DataFrame.from_dict",
"plotly.graph_objects.Figure",
"pandas.read_json",
"pandas.to_datetime"
] | [((737, 776), 'pandas.read_json', 'pd.read_json', (['filepath'], {'orient': '"""values"""'}), "(filepath, orient='values')\n", (749, 776), True, 'import pandas as pd\n'), ((847, 880), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['dict_list'], {}), '(dict_list)\n', (869, 880), True, 'import pandas as pd\n')... |
import os
import json
from copy import deepcopy
d = []
with open(os.path.join(os.getcwd(), '.github', 'workflows', 'build-matrix.json')) as json_data:
d.extend(json.load(json_data))
new_data = []
for entry in d:
entry_copy1 = deepcopy(entry)
# entry_copy1['shared'] = "FALSE"
# entry_copy1['libtype'] =... | [
"json.load",
"os.getcwd",
"json.dump",
"copy.deepcopy"
] | [((236, 251), 'copy.deepcopy', 'deepcopy', (['entry'], {}), '(entry)\n', (244, 251), False, 'from copy import deepcopy\n'), ((719, 741), 'json.dump', 'json.dump', (['new_data', 'f'], {}), '(new_data, f)\n', (728, 741), False, 'import json\n'), ((165, 185), 'json.load', 'json.load', (['json_data'], {}), '(json_data)\n',... |
"""
--<NAME>--
This program uses 6 classes to create the bricks / ball / paddle / string 'You are dead'/ string 'Congratulations'.
Control the size / color / initial position / initial speed of ball, paddle, bricks.
Also do mouse listeners to communicate with system.
A blinking message click to start as a prol... | [
"campy.graphics.gobjects.GLabel",
"campy.gui.events.mouse.onmousemoved",
"campy.graphics.gobjects.GRect",
"campy.graphics.gwindow.GWindow",
"campy.graphics.gobjects.GOval",
"campy.gui.events.timer.pause",
"random.random",
"random.randint",
"campy.gui.events.mouse.onmouseclicked"
] | [((1987, 2011), 'campy.graphics.gobjects.GLabel', 'GLabel', (['"""Click to Start"""'], {}), "('Click to Start')\n", (1993, 2011), False, 'from campy.graphics.gobjects import GOval, GRect, GLabel\n'), ((2692, 2720), 'campy.graphics.gobjects.GLabel', 'GLabel', (['"""Congratulations!!!"""'], {}), "('Congratulations!!!')\n... |
# BSD 3-Clause License
#
# Copyright (c) 2021, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list o... | [
"win32gui.SetForegroundWindow",
"win32gui.GetWindowDC",
"threading.Lock",
"win32gui.FindWindow",
"win32api.GetSystemMetrics",
"win32gui.GetClientRect",
"win32ui.CreateDCFromHandle",
"win32gui.ClientToScreen",
"win32gui.ReleaseDC",
"PIL.Image.frombuffer",
"win32ui.CreateBitmap",
"time.time"
] | [((3202, 3208), 'threading.Lock', 'Lock', ([], {}), '()\n', (3206, 3208), False, 'from threading import Lock\n'), ((3490, 3529), 'win32gui.FindWindow', 'win32gui.FindWindow', (['None', '"""Quake Live"""'], {}), "(None, 'Quake Live')\n", (3509, 3529), False, 'import win32gui\n'), ((7774, 7836), 'win32gui.ClientToScreen'... |
import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin
# Imputation of missing values for numerical variables
# by the mode (the value that appears most often in a set of data values).
class ImputerNumericalVariable(BaseEstimator, TransformerMixin):
def __init__(self, var... | [
"numpy.log",
"pandas.concat"
] | [((3572, 3597), 'pandas.concat', 'pd.concat', (['[X, y]'], {'axis': '(1)'}), '([X, y], axis=1)\n', (3581, 3597), True, 'import pandas as pd\n'), ((1605, 1624), 'numpy.log', 'np.log', (['X[variable]'], {}), '(X[variable])\n', (1611, 1624), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*- --------------------------------------------------===#
#
# Copyright 2021 Trovares Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.... | [
"IPython.display.display",
"json.loads",
"IPython.display.Javascript",
"boto3.client",
"ipywidgets.VBox",
"ipywidgets.Dropdown",
"ipywidgets.Label",
"ipywidgets.Button",
"time.sleep",
"ipywidgets.Text",
"xgt.Connection"
] | [((936, 966), 'boto3.client', 'boto3.client', (['"""cloudformation"""'], {}), "('cloudformation')\n", (948, 966), False, 'import boto3, json, time\n'), ((2534, 2548), 'ipywidgets.Text', 'widgets.Text', ([], {}), '()\n', (2546, 2548), True, 'import ipywidgets as widgets\n'), ((2722, 2870), 'ipywidgets.Dropdown', 'widget... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.eager import context
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_shape
from tensorflow.python... | [
"tensorflow.python.ops.state_ops.assign",
"tensorflow.python.ops.array_ops.zeros_like",
"tensorflow.python.ops.array_ops.reshape",
"tensorflow.python.framework.ops.name_scope",
"tensorflow.python.layers.utils.smart_cond",
"tensorflow.python.framework.ops.add_to_collection",
"tensorflow.python.ops.gen_co... | [((18110, 18138), 'tensorflow.python.ops.init_ops.zeros_initializer', 'init_ops.zeros_initializer', ([], {}), '()\n', (18136, 18138), False, 'from tensorflow.python.ops import init_ops\n'), ((18194, 18221), 'tensorflow.python.ops.init_ops.ones_initializer', 'init_ops.ones_initializer', ([], {}), '()\n', (18219, 18221),... |
from typing import Dict, List
import unittest
import requests
import ujson
import cases
class TestClustering(unittest.TestCase):
_endpoint = "http://localhost:5000/api/v1/predict"
def check(self, test_case: Dict[str, str], answer: Dict[str, List[str]]) -> None:
serilized_test_case = ujson.dumps(test_... | [
"unittest.main",
"ujson.dumps",
"requests.post",
"ujson.loads"
] | [((796, 822), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (809, 822), False, 'import unittest\n'), ((303, 325), 'ujson.dumps', 'ujson.dumps', (['test_case'], {}), '(test_case)\n', (314, 325), False, 'import ujson\n'), ((345, 400), 'requests.post', 'requests.post', (['self._endpoint'... |
from flask import Blueprint, render_template, redirect, request, g, session, make_response, flash
import libmfa
import libuser
import libsession
mod_user = Blueprint('mod_user', __name__, template_folder='templates')
@mod_user.route('/login', methods=['GET', 'POST'])
def do_login():
session.pop('username', None... | [
"flask.render_template",
"libsession.create",
"flask.flash",
"libuser.create",
"libuser.password_change",
"libuser.password_complexity",
"flask.request.form.get",
"flask.redirect",
"libmfa.mfa_validate",
"libuser.login",
"flask.session.pop",
"flask.Blueprint",
"libmfa.mfa_is_enabled"
] | [((157, 217), 'flask.Blueprint', 'Blueprint', (['"""mod_user"""', '__name__'], {'template_folder': '"""templates"""'}), "('mod_user', __name__, template_folder='templates')\n", (166, 217), False, 'from flask import Blueprint, render_template, redirect, request, g, session, make_response, flash\n'), ((292, 321), 'flask.... |
import tensorflow as tf
# Taken from https://www.tensorflow.org/guide/eager
# Eager execution works nicely with NumPy. NumPy operations accept tf.Tensor arguments.
# TensorFlow math operations convert Python objects and NumPy arrays to tf.Tensor objects.
# The tf.Tensor.numpy method returns the object's value as a Nu... | [
"numpy.multiply",
"tensorflow.add",
"tensorflow.constant",
"tensorflow.enable_eager_execution"
] | [((333, 360), 'tensorflow.enable_eager_execution', 'tf.enable_eager_execution', ([], {}), '()\n', (358, 360), True, 'import tensorflow as tf\n'), ((365, 394), 'tensorflow.constant', 'tf.constant', (['[[1, 2], [3, 4]]'], {}), '([[1, 2], [3, 4]])\n', (376, 394), True, 'import tensorflow as tf\n'), ((442, 454), 'tensorflo... |
import logging
import numpy
from PIL import Image
from dirs import dest
log = logging.getLogger()
def save_builtin(img, path):
# having blender save was turning the image back to black!
path.parent.mkdir(parents=True, exist_ok=True)
img.filepath = str(path).replace('.png', '-builtinsave.png')
img.fi... | [
"logging.getLogger",
"numpy.array"
] | [((79, 98), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (96, 98), False, 'import logging\n'), ((555, 578), 'numpy.array', 'numpy.array', (['img.pixels'], {}), '(img.pixels)\n', (566, 578), False, 'import numpy\n')] |
# Copyright 2017 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | [
"tensorflow.layers.dense",
"tensorflow.random_normal",
"tensorflow.shape",
"tensorflow.random_normal_initializer",
"tensorflow.exp",
"zhusuan.reuse",
"tensorflow.sqrt",
"tensorflow.matmul",
"tensorflow.reduce_mean",
"tensorflow.cos",
"zhusuan.BayesianNet",
"tensorflow.expand_dims",
"tensorfl... | [((785, 811), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(314159)'], {}), '(314159)\n', (803, 811), True, 'import tensorflow as tf\n'), ((890, 907), 'zhusuan.reuse', 'zs.reuse', (['"""model"""'], {}), "('model')\n", (898, 907), True, 'import zhusuan as zs\n'), ((990, 1023), 'zhusuan.BayesianNet', 'zs.Bayesi... |
import csv
import numpy as np
import pandas as pd
# Removes first few rows of data that don't have actual sensor readings
def trim_csv(in_file_name, out_file_name):
with open(in_file_name, "r") as inp, open(out_file_name, "w") as out:
writer = csv.writer(out)
for row in csv.reader(inp):
... | [
"csv.writer",
"csv.reader",
"pandas.read_csv"
] | [((464, 486), 'pandas.read_csv', 'pd.read_csv', (['file_name'], {}), '(file_name)\n', (475, 486), True, 'import pandas as pd\n'), ((259, 274), 'csv.writer', 'csv.writer', (['out'], {}), '(out)\n', (269, 274), False, 'import csv\n'), ((294, 309), 'csv.reader', 'csv.reader', (['inp'], {}), '(inp)\n', (304, 309), False, '... |
import numpy as np
import matplotlib
matplotlib.use('agg')
from matplotlib import pyplot as plt
from matplotlib import dates as md
from sklearn.linear_model import LinearRegression
from sklearn.svm import SVR
from sklearn.preprocessing import normalize, scale
import sklearn.metrics as metrics
import pickle
import stat_... | [
"configparser.ConfigParser",
"matplotlib.pyplot.ylabel",
"numpy.hstack",
"numpy.column_stack",
"numpy.nanmean",
"pytz.timezone",
"matplotlib.dates.epoch2num",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"os.path.isdir",
"os.mkdir",
"subprocess.call",
"n... | [((37, 58), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (51, 58), False, 'import matplotlib\n'), ((2059, 2069), 'matplotlib.pyplot.ioff', 'plt.ioff', ([], {}), '()\n', (2067, 2069), True, 'from matplotlib import pyplot as plt\n'), ((917, 944), 'configparser.ConfigParser', 'configparser.ConfigP... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (t... | [
"logging.getLogger",
"urlparse.urljoin",
"urlparse.parse_qs",
"re.compile",
"urllib.quote",
"BeautifulSoup.BeautifulSoup",
"allura.lib.helpers.plain2markdown",
"collections.defaultdict",
"allura.model.TroveCategory.query.get",
"forgeimporters.base.File",
"allura.model.ProjectFile.save_image",
... | [((1293, 1320), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1310, 1320), False, 'import logging\n'), ((7209, 7235), 're.compile', 're.compile', (['"""(svn|hg|git)"""'], {}), "('(svn|hg|git)')\n", (7219, 7235), False, 'import re\n'), ((7678, 8301), 'collections.defaultdict', 'defaultdi... |
import psycopg2
from psycopg2.extras import RealDictCursor
from fastapi import FastAPI, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from decouple import config
connection = psycopg2.connect(
user=config("DATABASE_USER"),
password=config("<PASSWORD>"),
host=config("DATABASE_HOST_URL"),
por... | [
"fastapi.FastAPI",
"decouple.config"
] | [((391, 400), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (398, 400), False, 'from fastapi import FastAPI, HTTPException\n'), ((220, 243), 'decouple.config', 'config', (['"""DATABASE_USER"""'], {}), "('DATABASE_USER')\n", (226, 243), False, 'from decouple import config\n'), ((257, 277), 'decouple.config', 'config',... |
from sqlalchemy import Column, Integer, String, Text
from models.models import Base, auto_str
__all__ = ["FilamentType"]
@auto_str
class FilamentType(Base):
FILLAMENTUM = "fillamentum"
PRUSAMENT = "prusament"
__tablename__ = "filament_types"
id = Column(Integer, primary_key=True, nullable=False)
... | [
"sqlalchemy.Column"
] | [((269, 318), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)', 'nullable': '(False)'}), '(Integer, primary_key=True, nullable=False)\n', (275, 318), False, 'from sqlalchemy import Column, Integer, String, Text\n'), ((330, 371), 'sqlalchemy.Column', 'Column', (['Text'], {'nullable': '(False)', 'uni... |
import json
import bson
SPLITTER: str = "[SPLITTER]"
class TraceInfoError(Exception):
pass
class TraceInfo(object):
"""
TODO: 用于实现 open tracing 相关的接口
"""
def __init__(self, identifier: str, trace_id: str = "", span_id: str = "1", meta=None):
"""
identifier 用于作为该 TraceInfo 的当前标识符... | [
"bson.ObjectId",
"json.loads",
"json.dumps"
] | [((2318, 2341), 'json.loads', 'json.loads', (['segments[3]'], {}), '(segments[3])\n', (2328, 2341), False, 'import json\n'), ((1049, 1064), 'bson.ObjectId', 'bson.ObjectId', ([], {}), '()\n', (1062, 1064), False, 'import bson\n'), ((2019, 2040), 'json.dumps', 'json.dumps', (['self.meta'], {}), '(self.meta)\n', (2029, 2... |
# Copyright (c) 2018 Spotify AB
#
# 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, s... | [
"numpy.random.normal",
"numpy.dot",
"random.gauss",
"annoy.AnnoyIndex"
] | [((695, 710), 'numpy.dot', 'numpy.dot', (['a', 'b'], {}), '(a, b)\n', (704, 710), False, 'import numpy\n'), ((934, 954), 'annoy.AnnoyIndex', 'AnnoyIndex', (['f', '"""dot"""'], {}), "(f, 'dot')\n", (944, 954), False, 'from annoy import AnnoyIndex\n'), ((1333, 1353), 'annoy.AnnoyIndex', 'AnnoyIndex', (['f', '"""dot"""'],... |
import random
import jsonpickle
from PIL import Image
from helpers.ProjectHelper import ProjectHelper
jsonpickle.set_preferred_backend('json')
jsonpickle.set_encoder_options('json', ensure_ascii=False, indent=4)
class node_image(object):
def __init__(self, url, w, h):
self.url = url
self.w = w
... | [
"jsonpickle.set_encoder_options",
"PIL.Image.open",
"helpers.ProjectHelper.ProjectHelper.create_data_folder",
"jsonpickle.set_preferred_backend",
"random.randint",
"jsonpickle.encode"
] | [((104, 144), 'jsonpickle.set_preferred_backend', 'jsonpickle.set_preferred_backend', (['"""json"""'], {}), "('json')\n", (136, 144), False, 'import jsonpickle\n'), ((145, 213), 'jsonpickle.set_encoder_options', 'jsonpickle.set_encoder_options', (['"""json"""'], {'ensure_ascii': '(False)', 'indent': '(4)'}), "('json', ... |
import numpy as np
arr_1 = [2, 3, 5, 7, 11]
arr_2 = [13, 17, 19, 23, 29]
arr_3 = np.array([arr_1, arr_2])
print(arr_3)
| [
"numpy.array"
] | [((83, 107), 'numpy.array', 'np.array', (['[arr_1, arr_2]'], {}), '([arr_1, arr_2])\n', (91, 107), True, 'import numpy as np\n')] |
import torch
from torch.optim.optimizer import Optimizer, required
from torch.optim import SGD
class rSGD(SGD):
def __init__(self, params, lr=required, momentum=0, dampening=0,
weight_decay=0, nesterov=False):
super(rSGD, self).__init__(params, lr=lr, momentum=momentum,
... | [
"torch.clone",
"torch.no_grad",
"torch.enable_grad"
] | [((445, 460), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (458, 460), False, 'import torch\n'), ((921, 940), 'torch.enable_grad', 'torch.enable_grad', ([], {}), '()\n', (938, 940), False, 'import torch\n'), ((1720, 1736), 'torch.clone', 'torch.clone', (['d_p'], {}), '(d_p)\n', (1731, 1736), False, 'import torch... |
# -*- coding: utf-8 -*-
'''
@Time : 2021-7月-22 08:47
@Author : <NAME>
@Email : <EMAIL>
@Desc :
删除eclipse生成的文件,清理java工作区
'''
import os
import shutil
target_files=['.classpath','.project','.settings','.vscode','.factorypath','.apt_generated_tests']
def clean_eclipse_file(wp):
subs = os.listdir(wp)... | [
"os.listdir",
"os.path.isdir",
"shutil.rmtree",
"os.path.abspath",
"os.remove"
] | [((306, 320), 'os.listdir', 'os.listdir', (['wp'], {}), '(wp)\n', (316, 320), False, 'import os\n'), ((339, 358), 'os.path.abspath', 'os.path.abspath', (['wp'], {}), '(wp)\n', (354, 358), False, 'import os\n'), ((466, 489), 'os.path.isdir', 'os.path.isdir', (['sub_path'], {}), '(sub_path)\n', (479, 489), False, 'import... |
from reko.cachestore import CacheStore
from reko.cameraman import CameraMan
from reko.rekognition import Rekognition
class Reko(object):
def __init__(self, profile, collection_id):
self.collection_id = collection_id
self._cameraman = CameraMan()
self._cache = CacheStore()
self._rek... | [
"reko.cameraman.CameraMan",
"reko.rekognition.Rekognition",
"reko.cachestore.CacheStore"
] | [((256, 267), 'reko.cameraman.CameraMan', 'CameraMan', ([], {}), '()\n', (265, 267), False, 'from reko.cameraman import CameraMan\n'), ((290, 302), 'reko.cachestore.CacheStore', 'CacheStore', ([], {}), '()\n', (300, 302), False, 'from reko.cachestore import CacheStore\n'), ((331, 351), 'reko.rekognition.Rekognition', '... |
import sqlite3
import pprint
db = sqlite3.connect('jobs.sqlite')
cur = db.cursor()
cur.execute("SELECT name FROM sqlite_master WHERE type='table'")
tables = cur.fetchall()
table = tables[0][0]
print(tables)
print(table)
cur.execute("PRAGMA table_info({})".format(table))
pprint.pprint(cur.fetchall())
cur.execute("S... | [
"sqlite3.connect"
] | [((35, 65), 'sqlite3.connect', 'sqlite3.connect', (['"""jobs.sqlite"""'], {}), "('jobs.sqlite')\n", (50, 65), False, 'import sqlite3\n')] |
# -*- coding: utf-8 -*-
"""
LemonSoap - CLI entry point.
"""
import argparse
import logging
from .scrub import Scrub
from .logger import initialize_logger
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("method",
help="What to do; either 'inspect' or ... | [
"argparse.ArgumentParser"
] | [((198, 223), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (221, 223), False, 'import argparse\n')] |
#!/usr/bin/env python
from json import load
from subprocess import Popen
print("updating cards.json")
p = Popen(["curl", "-s", "https://raw.githubusercontent.com/jonasprobst/hoergrete-rfid/main/cards.json", "-o", "cards.json"])
print("reading file")
with open("cards.json", "r") as file:
cards = load(file)
p... | [
"json.load",
"subprocess.Popen"
] | [((108, 238), 'subprocess.Popen', 'Popen', (["['curl', '-s',\n 'https://raw.githubusercontent.com/jonasprobst/hoergrete-rfid/main/cards.json'\n , '-o', 'cards.json']"], {}), "(['curl', '-s',\n 'https://raw.githubusercontent.com/jonasprobst/hoergrete-rfid/main/cards.json'\n , '-o', 'cards.json'])\n", (113, 2... |
import os
from flask import redirect
from app import create_app
from app.api import api_v1
from waitress import serve
app = create_app(os.getenv('FLASK_CONFIG_TYPE') or 'dev')
app.register_blueprint(api_v1)
@app.route('/')
def root():
return redirect('/v1/test')
if __name__ == '__main__':
host = os.environ.g... | [
"flask.redirect",
"waitress.serve",
"os.environ.get",
"os.getenv"
] | [((248, 268), 'flask.redirect', 'redirect', (['"""/v1/test"""'], {}), "('/v1/test')\n", (256, 268), False, 'from flask import redirect\n'), ((308, 339), 'os.environ.get', 'os.environ.get', (['"""IP"""', '"""0.0.0.0"""'], {}), "('IP', '0.0.0.0')\n", (322, 339), False, 'import os\n'), ((136, 166), 'os.getenv', 'os.getenv... |
from graphql import parse, DocumentNode
def gql(schema: str) -> DocumentNode:
"""
Helper utility to provide help mark up
"""
return parse(schema)
| [
"graphql.parse"
] | [((150, 163), 'graphql.parse', 'parse', (['schema'], {}), '(schema)\n', (155, 163), False, 'from graphql import parse, DocumentNode\n')] |
import unittest
from pstream import AsyncStream
from pstream.errors import InfiniteCollectionError
from tests._async.utils import run_to_completion, expect
from tests.sync.test_stream import expect as expect_s
class TestErrors(unittest.TestCase):
@run_to_completion
@expect(InfiniteCollectionError)
async... | [
"pstream.AsyncStream",
"tests.sync.test_stream.expect",
"tests._async.utils.expect"
] | [((279, 310), 'tests._async.utils.expect', 'expect', (['InfiniteCollectionError'], {}), '(InfiniteCollectionError)\n', (285, 310), False, 'from tests._async.utils import run_to_completion, expect\n'), ((399, 419), 'tests.sync.test_stream.expect', 'expect_s', (['ValueError'], {}), '(ValueError)\n', (407, 419), True, 'fr... |
"""
--- Ångström ---
Ångström Python package setup file.
"""
from setuptools import setup, find_packages
setup(
name="angstrom",
version="0.2.2",
description="Tools for basic molecular operations with minimal-dependency",
author="<NAME>",
author_email="<EMAIL>",
url='https://github.com/kbsezgi... | [
"setuptools.find_packages"
] | [((379, 394), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (392, 394), False, 'from setuptools import setup, find_packages\n')] |
import time
GMT_FORMAT = '%Y-%m-%dT%H:%M:%S.%fGMT'
TIME_ADDITION = 8 * 3600 * 1000
def convert_str_to_timestamp(time_str: str) -> int:
ms = int(time_str.split('.')[1][:3])
return int(time.mktime(time.strptime(time_str, GMT_FORMAT))) * 1000 + TIME_ADDITION + ms
def convert_timestamp_to_str(timestamp: int, ... | [
"time.strptime",
"time.localtime",
"time.strftime",
"time.time"
] | [((362, 394), 'time.localtime', 'time.localtime', (['(timestamp / 1000)'], {}), '(timestamp / 1000)\n', (376, 394), False, 'import time\n'), ((406, 459), 'time.strftime', 'time.strftime', (["(fmt or '%Y-%m-%d %H:%M:%S')", 'time_array'], {}), "(fmt or '%Y-%m-%d %H:%M:%S', time_array)\n", (419, 459), False, 'import time\... |
'''Imports'''
import pygame
pygame.init()
'''Vars'''
WIDTH=1000
HEIGHT=600
FPS=60
i=0
wn=pygame.display.set_mode((WIDTH,HEIGHT))
pygame.display.set_caption("Game Jam Project")
'''Images'''
#Background Images
bg=pygame.image.load('../Assets/background.jpg')
bg=pygame.transform.scale(bg, (WIDTH, HEIGHT))... | [
"pygame.transform.flip",
"pygame.init",
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.mixer.Sound",
"pygame.transform.rotate",
"pygame.display.set_caption",
"pygame.image.load",
"pygame.font.SysFont",
"pygame.transform.scale"
] | [((30, 43), 'pygame.init', 'pygame.init', ([], {}), '()\n', (41, 43), False, 'import pygame\n'), ((99, 139), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(WIDTH, HEIGHT)'], {}), '((WIDTH, HEIGHT))\n', (122, 139), False, 'import pygame\n'), ((140, 186), 'pygame.display.set_caption', 'pygame.display.set_capti... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from .models import UserAccount, Portfolio, Trade
from .forms import UserAccountCreationForm, UserAccountChangeForm
# Register your models here.
admin.site.site_header = "Chad Finance"
admin.site.site_title = "Chad Finan... | [
"django.contrib.admin.site.register"
] | [((1371, 1414), 'django.contrib.admin.site.register', 'admin.site.register', (['UserAccount', 'UserAdmin'], {}), '(UserAccount, UserAdmin)\n', (1390, 1414), False, 'from django.contrib import admin\n'), ((1415, 1445), 'django.contrib.admin.site.register', 'admin.site.register', (['Portfolio'], {}), '(Portfolio)\n', (14... |
'''
Sheet Music to MIDI by
<NAME> (https://github.com/colejagdtiger) and
<NAME> (https://github.com/Zeyu-Li)
Sheet Music to MIDI is a program that transforms
sheet music (svg or png) to a MID file with separate tracks
'''
from Midi_interface.Midi import Midi
# XML decoder for SVG
import xml.etree.ElementTree as ET... | [
"reportlab.graphics.renderPM.drawToFile",
"xml.etree.ElementTree.parse",
"xml.etree.ElementTree.Element",
"xml.etree.ElementTree.ElementTree",
"svglib.svglib.svg2rlg",
"xml.etree.ElementTree.SubElement",
"get_tempo.vision"
] | [((721, 755), 'xml.etree.ElementTree.parse', 'ET.parse', (['f"""input/{file_name}.svg"""'], {}), "(f'input/{file_name}.svg')\n", (729, 755), True, 'import xml.etree.ElementTree as ET\n'), ((1145, 1162), 'xml.etree.ElementTree.Element', 'ET.Element', (['"""svg"""'], {}), "('svg')\n", (1155, 1162), True, 'import xml.etre... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import sea_generator_rpcdesign_pb2 as sea__generator__rpcdesign__pb2
class SEAOnlineTrainingStub(object):
"""Missing associated documentation comment in .p... | [
"grpc.method_handlers_generic_handler",
"grpc.experimental.unary_unary",
"grpc.unary_unary_rpc_method_handler"
] | [((5446, 5541), 'grpc.method_handlers_generic_handler', 'grpc.method_handlers_generic_handler', (['"""seagenerator.SEAOnlineTraining"""', 'rpc_method_handlers'], {}), "('seagenerator.SEAOnlineTraining',\n rpc_method_handlers)\n", (5482, 5541), False, 'import grpc\n'), ((3794, 4039), 'grpc.unary_unary_rpc_method_hand... |
import subprocess
import argparse
from prompt_toolkit import print_formatted_text as print
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
from prompt_toolkit.shortcuts import CompleteStyle
from prompt_toolkit.history import FileHistory
from .bash.history import BashHistoryIndexError, expand_history
f... | [
"prompt_toolkit.print_formatted_text",
"prompt_toolkit.auto_suggest.AutoSuggestFromHistory",
"subprocess.call",
"argparse.ArgumentParser"
] | [((3004, 3021), 'prompt_toolkit.print_formatted_text', 'print', (['"""GoodBye!"""'], {}), "('GoodBye!')\n", (3009, 3021), True, 'from prompt_toolkit import print_formatted_text as print\n'), ((3055, 3080), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3078, 3080), False, 'import argparse\n'),... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"requests.get"
] | [((2562, 2579), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (2574, 2579), False, 'import requests\n')] |
import chainer
import chainer.functions as F
import numpy as np
import argparse
from chainer import cuda, serializers
from pathlib import Path
from model import Generator, Discriminator, VGG, SAGenerator, SAGeneratorWithGuide
from utils import set_optimizer
from dataset import DataLoader, RefineDataset
from evaluation... | [
"chainer.functions.mean_squared_error",
"chainer.functions.relu",
"dataset.RefineDataset",
"argparse.ArgumentParser",
"model.Discriminator",
"chainer.cuda.get_device",
"chainer.functions.concat",
"utils.set_optimizer",
"model.SAGeneratorWithGuide",
"chainer.serializers.save_npz",
"evaluation.Eva... | [((1946, 2036), 'dataset.DataLoader', 'DataLoader', (['data_path', 'sketch_path', 'digi_path'], {'extension': 'extension', 'img_size': 'img_size'}), '(data_path, sketch_path, digi_path, extension=extension, img_size\n =img_size)\n', (1956, 2036), False, 'from dataset import DataLoader, RefineDataset\n'), ((2222, 227... |
import itertools
import torch
class Optimizer(object):
_ARG_MAX_GRAD_NORM = 'max_grad_norm'
def __init__(self, optim, max_grad_norm=0):
self.optimizer = optim
self.max_grad_norm = max_grad_norm
def step(self):
if self.max_grad_norm>0:
params = itertools.chain.from_ite... | [
"itertools.chain.from_iterable",
"torch.nn.utils.clip_grad_norm"
] | [((296, 390), 'itertools.chain.from_iterable', 'itertools.chain.from_iterable', (["[group['params'] for group in self.optimizer.param_groups]"], {}), "([group['params'] for group in self.optimizer.\n param_groups])\n", (325, 390), False, 'import itertools\n'), ((416, 473), 'torch.nn.utils.clip_grad_norm', 'torch.nn.... |
from django.contrib import admin
from flashcard.models import FlashCard
class FlashCardAdmin(admin.ModelAdmin):
fields = ['front', 'back', 'user']
list_display = (
'front', 'back', 'user', 'next_practice', 'times_practiced', 'easy_factor')
admin.site.register(FlashCard, FlashCardAdmin)
| [
"django.contrib.admin.site.register"
] | [((259, 305), 'django.contrib.admin.site.register', 'admin.site.register', (['FlashCard', 'FlashCardAdmin'], {}), '(FlashCard, FlashCardAdmin)\n', (278, 305), False, 'from django.contrib import admin\n')] |
import copy
from collections import OrderedDict
import numpy as np
from .. import definitions as xrsdefs
from .. import scattering as xrsdscat
class Population(object):
def __init__(self,structure,form,settings={},parameters={}):
self.structure = None
self.form = None
self.settings = Or... | [
"collections.OrderedDict",
"copy.copy",
"copy.deepcopy"
] | [((318, 331), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (329, 331), False, 'from collections import OrderedDict\n'), ((359, 372), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (370, 372), False, 'from collections import OrderedDict\n'), ((975, 1003), 'copy.deepcopy', 'copy.deepcopy', (['... |
# -*- coding: utf-8 -*-
import json
import datetime
import requests
import boto3
import time
def initClient(access_key,secret_key,region):
return boto3.client(
'ecs',
aws_access_key_id=access_key,
aws_secret_access_key=secret_key,
region_name=region
)
def createClusterECS(ecsClient,cluserNam... | [
"boto3.client",
"time.sleep"
] | [((151, 259), 'boto3.client', 'boto3.client', (['"""ecs"""'], {'aws_access_key_id': 'access_key', 'aws_secret_access_key': 'secret_key', 'region_name': 'region'}), "('ecs', aws_access_key_id=access_key, aws_secret_access_key=\n secret_key, region_name=region)\n", (163, 259), False, 'import boto3\n'), ((1486, 1500), ... |
# -*- coding:utf-8 -*-
# author: gfjiangly
# time: 2019/5/6 18:40
# e-mail: <EMAIL>
# software: PyCharm
"""
General Dataset Classes
"""
import random
import torch
import torch.utils.data as data
import cv2
import numpy as np
class AnnotationTransform(object):
"""Transforms a ELEVATOR annotation into a Tensor of b... | [
"numpy.array",
"torch.from_numpy",
"cv2.imread",
"numpy.expand_dims"
] | [((3869, 3890), 'cv2.imread', 'cv2.imread', (['img_id[0]'], {}), '(img_id[0])\n', (3879, 3890), False, 'import cv2\n'), ((4260, 4276), 'numpy.array', 'np.array', (['target'], {}), '(target)\n', (4268, 4276), True, 'import numpy as np\n'), ((1086, 1126), 'numpy.array', 'np.array', (['[width, height, width, height]'], {}... |
# %load code/engram_functions.py
# Import dependencies
import xlrd
import numpy as np
from sympy.utilities.iterables import multiset_permutations
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
def permute_optimize_keys(fixed_letters, fixed_letter_indices, open_letter_indices,
... | [
"matplotlib.pyplot.ylabel",
"numpy.argsort",
"numpy.array",
"seaborn.distplot",
"numpy.where",
"matplotlib.pyplot.xlabel",
"numpy.max",
"sympy.utilities.iterables.multiset_permutations",
"numpy.min",
"numpy.ceil",
"numpy.average",
"numpy.size",
"matplotlib.pyplot.title",
"numpy.int",
"ma... | [((3034, 3058), 'numpy.zeros', 'np.zeros', (['(nkeys, nkeys)'], {}), '((nkeys, nkeys))\n', (3042, 3058), True, 'import numpy as np\n'), ((3810, 3840), 'sympy.utilities.iterables.multiset_permutations', 'multiset_permutations', (['letters'], {}), '(letters)\n', (3831, 3840), False, 'from sympy.utilities.iterables import... |
#! /usr/bin/env python3
import pygame
from pygame.locals import *
import logging
import logging.handlers
import os
import subprocess
import sys
import time
import threading
# Local imports
import control
import data
import widgets
PRODUCTION = os.getenv("PRODUCTION")
SCREEN_SIZE=(800,480)
BASE_DIR = os.path.dirnam... | [
"logging.getLogger",
"logging.StreamHandler",
"pygame.event.clear",
"widgets.PowerButton",
"pygame.init",
"control.Control",
"time.sleep",
"widgets.SettingsButton",
"sys.exit",
"widgets.StartStopButton",
"widgets.TimerControl",
"pygame.display.set_mode",
"pygame.display.flip",
"subprocess.... | [((248, 271), 'os.getenv', 'os.getenv', (['"""PRODUCTION"""'], {}), "('PRODUCTION')\n", (257, 271), False, 'import os\n'), ((360, 389), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""img"""'], {}), "(BASE_DIR, 'img')\n", (372, 389), False, 'import os\n'), ((409, 450), 'os.path.join', 'os.path.join', (['IMG_DIR', '""... |
from django import forms
date_options = [('1', 'hourly'), ('24', 'daily'), ('168', 'weekly')]
class WatchThread(forms.Form):
reddit_thread_url = forms.URLField(label='', max_length=500, widget=forms.TextInput(attrs={'placeholder':
'e.g. https://www.reddit.com/r/learnpython/... | [
"django.forms.RadioSelect",
"django.forms.TextInput"
] | [((200, 327), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'placeholder':\n 'e.g. https://www.reddit.com/r/learnpython/comments/5jgbiq/python_oop_series/'\n }"}), "(attrs={'placeholder':\n 'e.g. https://www.reddit.com/r/learnpython/comments/5jgbiq/python_oop_series/'\n })\n", (215, 327), Fa... |
import sys
import numpy as np
import cv2
import RPi.GPIO as GPIO
from TrafficLight import findLight
from carTest import findCar
video = cv2.VideoCapture(0)
success,image = video.read()
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(12,GPIO.OUT)
GPIO.setup(18,GPIO.OUT)
GPIO.setup(13, GPIO.OUT)
while succe... | [
"cv2.imwrite",
"carTest.findCar",
"RPi.GPIO.output",
"RPi.GPIO.setup",
"TrafficLight.findLight",
"RPi.GPIO.setwarnings",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"RPi.GPIO.input",
"RPi.GPIO.setmode"
] | [((138, 157), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (154, 157), False, 'import cv2\n'), ((188, 210), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (200, 210), True, 'import RPi.GPIO as GPIO\n'), ((211, 234), 'RPi.GPIO.setwarnings', 'GPIO.setwarnings', (['(False)'], {}... |
import proto_example
from proto_example.generated.function_a.v1.function_pb2 import Request
def main():
req = Request()
req.descriptions = "hello from python"
res = proto_example.function_a(req)
print("rust response:", res)
if __name__ == '__main__':
main() | [
"proto_example.function_a",
"proto_example.generated.function_a.v1.function_pb2.Request"
] | [((115, 124), 'proto_example.generated.function_a.v1.function_pb2.Request', 'Request', ([], {}), '()\n', (122, 124), False, 'from proto_example.generated.function_a.v1.function_pb2 import Request\n'), ((179, 208), 'proto_example.function_a', 'proto_example.function_a', (['req'], {}), '(req)\n', (203, 208), False, 'impo... |
import numpy as np
import h5py
def get_lightcurve(toi:str):
"""
Extracts TOI light curves from h5 file.
Args:
toi (string): The TOI number (e.g., "101.01").
Returns:
time (numpy array): The phase-folded time from the center-of-transit in days.
flux (numpy array): The phase-folded normalized flux.
"""
hf_t... | [
"h5py.File"
] | [((326, 361), 'h5py.File', 'h5py.File', (['"""2min_SAP_times.h5"""', '"""r"""'], {}), "('2min_SAP_times.h5', 'r')\n", (335, 361), False, 'import h5py\n'), ((373, 409), 'h5py.File', 'h5py.File', (['"""2min_SAP_fluxes.h5"""', '"""r"""'], {}), "('2min_SAP_fluxes.h5', 'r')\n", (382, 409), False, 'import h5py\n')] |
import pytest
from bevel.utils import *
from pandas.testing import assert_frame_equal
@pytest.fixture
def sample_response_data():
a, b, c = 'a', 'b', 'c'
x, y, z = 'x', 'y', 'z'
return pd.DataFrame.from_dict({
'groups_a': [a, a, b, b, b, b, b, c, c, c, c, c],
'groups_x': [x, x, x, x, x, ... | [
"pandas.testing.assert_frame_equal"
] | [((952, 988), 'pandas.testing.assert_frame_equal', 'assert_frame_equal', (['actual', 'expected'], {}), '(actual, expected)\n', (970, 988), False, 'from pandas.testing import assert_frame_equal\n'), ((1572, 1608), 'pandas.testing.assert_frame_equal', 'assert_frame_equal', (['actual', 'expected'], {}), '(actual, expected... |
#!/usr/bin/env python3
# This is free and unencumbered software released into the public domain.
"""Installation script for DRYlib for Python."""
from codecs import open
from os import path
from setuptools import setup, find_packages
from shutil import copyfile
def readfile(*filepath):
with open(path.join(*filepat... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((388, 410), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (400, 410), False, 'from os import path\n'), ((1578, 1604), 'setuptools.find_packages', 'find_packages', ([], {'where': '"""src"""'}), "(where='src')\n", (1591, 1604), False, 'from setuptools import setup, find_packages\n'), ((302, 322... |
"""
TxBlockGen.py
"""
import DSA
from random import *
def satoshi(): # To generate a satoshi amount arbitrarily.
return str(randint(1, 999))
def BeforeSign(p, q, g, payer_b, payee_b): #The Lines of the Transaction to be Signed
transaction = \
"*** Bitcoin transaction ***" + "\n" + \
"S... | [
"DSA.bitGenerator",
"DSA.KeyGen",
"DSA.SignGen"
] | [((750, 769), 'DSA.KeyGen', 'DSA.KeyGen', (['p', 'q', 'g'], {}), '(p, q, g)\n', (760, 769), False, 'import DSA\n'), ((823, 842), 'DSA.KeyGen', 'DSA.KeyGen', (['p', 'q', 'g'], {}), '(p, q, g)\n', (833, 842), False, 'import DSA\n'), ((983, 1034), 'DSA.SignGen', 'DSA.SignGen', (['transaction', 'p', 'q', 'g', 'payer_a', 'p... |
#!/usr/bin/python
#coding=utf-8
import json, os
import sys
from simplified_scrapy.core.utils import appendFile
from simplified_scrapy.core.objstore_base import ObjStoreBase
class ObjStore(ObjStoreBase):
_objFilename = 'data/{}_obj.json'
def __init__(self, name):
self._objFilename = self._objFilename.... | [
"os.path.exists",
"json.dumps",
"simplified_scrapy.core.utils.appendFile",
"os.mkdir"
] | [((349, 372), 'os.path.exists', 'os.path.exists', (['"""data/"""'], {}), "('data/')\n", (363, 372), False, 'import json, os\n'), ((387, 404), 'os.mkdir', 'os.mkdir', (['"""data/"""'], {}), "('data/')\n", (395, 404), False, 'import json, os\n'), ((790, 825), 'simplified_scrapy.core.utils.appendFile', 'appendFile', (['se... |
import os
import warnings
import logging
#---------------------------------------------------------------------------------------------------------------------------------------------------#
###############################################################################################################################... | [
"logging.basicConfig",
"os.path.exists",
"logging.getLogger",
"os.path.splitext",
"os.path.dirname",
"os.mkdir"
] | [((344, 365), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (363, 365), False, 'import logging\n'), ((372, 399), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (389, 399), False, 'import logging\n'), ((2080, 2106), 'os.path.exists', 'os.path.exists', (['output_dir'], {})... |
from megastone import Emulator, ARCH_ARM
emu = Emulator(ARCH_ARM)
segment = emu.mem.allocate(0x1000, 'code')
emu.mem.write_code(segment.address,
"""
MOV R0, 1
ADD R0, R0
ADD R0, R0
ADD R0, R0
""")
emu.add_code_hook(lambda e: print(e.get_curr_insn(), e.regs.r0))
emu.run(count=4, address=segment.addre... | [
"megastone.Emulator"
] | [((49, 67), 'megastone.Emulator', 'Emulator', (['ARCH_ARM'], {}), '(ARCH_ARM)\n', (57, 67), False, 'from megastone import Emulator, ARCH_ARM\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import python_requires
base = python_requires("boost_base/2.0.0@bincrafters/testing")
class BoostTimerConan(base.BoostBaseConan):
name = "boost_timer"
version = "1.70.0"
@property
def boost_build_requires(self):
return ["io"]
| [
"conans.python_requires"
] | [((91, 146), 'conans.python_requires', 'python_requires', (['"""boost_base/2.0.0@bincrafters/testing"""'], {}), "('boost_base/2.0.0@bincrafters/testing')\n", (106, 146), False, 'from conans import python_requires\n')] |