code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""
MIT License
Copyright (c) 2022 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... | [
"logging.getLogger",
"logging.StreamHandler",
"argparse.ArgumentParser",
"logging.Formatter",
"parse_dictionary.parse",
"wordlepy.main"
] | [((1740, 1787), 'parse_dictionary.parse', 'parse_dictionary.parse', (['dictionary_path', 'length'], {}), '(dictionary_path, length)\n', (1762, 1787), False, 'import parse_dictionary\n'), ((3118, 3251), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Test the wordle solution algorithm"""',... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by <NAME> and <NAME>.
JRC biomass Project.
Unit D1 Bioeconomy.
"""
# Built-in modules #
# Third party modules #
import pandas
# First party modules #
from autopaths.auto_paths import AutoPaths
from plumbing.cache import property_cached
###################... | [
"autopaths.auto_paths.AutoPaths"
] | [((1103, 1150), 'autopaths.auto_paths.AutoPaths', 'AutoPaths', (['self.parent.data_dir', 'self.all_paths'], {}), '(self.parent.data_dir, self.all_paths)\n', (1112, 1150), False, 'from autopaths.auto_paths import AutoPaths\n')] |
import numpy as np
from Weno import *
import Numfluxes as NF
from RK3TVD import *
import numba as nb
import time
import socket
size=1000
L=1.0
dt=0.8/size
T=1.
def init(X):
h=L/size
for i in range(0,size):
if i>size//8 and i<size//2+size//8:
X[i]=1.-2*(i-size//8)*h/L;
else:
... | [
"socket.gethostname",
"numpy.empty",
"numpy.savetxt",
"time.time"
] | [((348, 362), 'numpy.empty', 'np.empty', (['size'], {}), '(size)\n', (356, 362), True, 'import numpy as np\n'), ((369, 383), 'numpy.empty', 'np.empty', (['size'], {}), '(size)\n', (377, 383), True, 'import numpy as np\n'), ((394, 415), 'numpy.savetxt', 'np.savetxt', (['"""gp0"""', 'In'], {}), "('gp0', In)\n", (404, 415... |
# -*- coding: utf-8 -*-
"""
renoir.parsing.stack
--------------------
Provides stack helpers for templates parsing.
:copyright: 2014 <NAME>
:license: BSD-3-Clause
"""
import uuid
from collections import namedtuple
from pathlib import Path
from .contents import Content, Elements, Node, NodeGroup... | [
"collections.namedtuple",
"pathlib.Path",
"uuid.uuid4"
] | [((337, 380), 'collections.namedtuple', 'namedtuple', (['"""ParsedLines"""', "('start', 'end')"], {}), "('ParsedLines', ('start', 'end'))\n", (347, 380), False, 'from collections import namedtuple\n'), ((813, 825), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (823, 825), False, 'import uuid\n'), ((3645, 3668), 'pathli... |
import easychart
chart = easychart.new("column")
chart.title = "France Olympic medals"
chart.subtitle = "by year and by medal class"
chart.categories = ["Gold","Silver","Bronze"]
chart.yAxis.title.text = "medals"
chart.plot([7, 16, 18], name=2008)
chart.plot([11, 11, 13], name=2012)
chart | [
"easychart.new"
] | [((26, 49), 'easychart.new', 'easychart.new', (['"""column"""'], {}), "('column')\n", (39, 49), False, 'import easychart\n')] |
# -*- coding: utf-8 -*-
import datetime
import platform
import time
# 检查当前操作系统版本信息
def check_os():
system = platform.system()
if system == SYSTEM_WINDOWS:
return SYSTEM_WINDOWS
if system == SYSTEM_LINUX:
return SYSTEM_LINUX
if system == SYSTEM_JAVA:
return SYSTEM_JAVA
retur... | [
"platform.system",
"time.time",
"datetime.date",
"datetime.timedelta"
] | [((114, 131), 'platform.system', 'platform.system', ([], {}), '()\n', (129, 131), False, 'import platform\n'), ((728, 745), 'datetime.date', 'datetime.date', (['*s'], {}), '(*s)\n', (741, 745), False, 'import datetime\n'), ((759, 776), 'datetime.date', 'datetime.date', (['*e'], {}), '(*e)\n', (772, 776), False, 'import... |
import copy
import unittest
from chiptunesak.midi import MIDI
from chiptunesak import chirp
from chiptunesak.constants import project_to_absolute_path
SONG_TEST_SONG = project_to_absolute_path('tests/data/twinkle.mid')
TRACK_TEST_SONG = project_to_absolute_path('tests/data/BWV_799.mid')
class SongTestCase(unittest.... | [
"copy.deepcopy",
"chiptunesak.midi.MIDI",
"chiptunesak.chirp.duration_to_note_name",
"unittest.main",
"chiptunesak.constants.project_to_absolute_path"
] | [((170, 220), 'chiptunesak.constants.project_to_absolute_path', 'project_to_absolute_path', (['"""tests/data/twinkle.mid"""'], {}), "('tests/data/twinkle.mid')\n", (194, 220), False, 'from chiptunesak.constants import project_to_absolute_path\n'), ((239, 289), 'chiptunesak.constants.project_to_absolute_path', 'project_... |
from pid import PID
from lowpass import LowPassFilter
from yaw_controller import YawController
import rospy
GAS_DENSITY = 2.858
ONE_MPH = 0.44704
class Controller(object):
def __init__(self, vehicle_mass, brake_deadband, decel_limit, wheel_radius, wheel_base, steer_ratio, max_lat_accel, max_steer_angle):
... | [
"yaw_controller.YawController",
"rospy.get_time",
"lowpass.LowPassFilter",
"pid.PID"
] | [((543, 622), 'yaw_controller.YawController', 'YawController', (['wheel_base', 'steer_ratio', 'ONE_MPH', 'max_lat_accel', 'max_steer_angle'], {}), '(wheel_base, steer_ratio, ONE_MPH, max_lat_accel, max_steer_angle)\n', (556, 622), False, 'from yaw_controller import YawController\n'), ((658, 697), 'pid.PID', 'PID', ([],... |
from django.contrib import admin
from follows.models import UserFollow, ThreadFollow
admin.site.register(UserFollow)
admin.site.register(ThreadFollow)
| [
"django.contrib.admin.site.register"
] | [((87, 118), 'django.contrib.admin.site.register', 'admin.site.register', (['UserFollow'], {}), '(UserFollow)\n', (106, 118), False, 'from django.contrib import admin\n'), ((119, 152), 'django.contrib.admin.site.register', 'admin.site.register', (['ThreadFollow'], {}), '(ThreadFollow)\n', (138, 152), False, 'from djang... |
import unittest
from pprint import pformat
from ipclassifier.iambic_line_processors.combinations_graph import CombinationsGraph
unittest.TestCase.maxDiff=None
def equal(expected, actual):
msg = "'" + pformat(actual) + "' != '" + pformat(expected) + "'"
assert expected == actual, msg
class TestCombinationsG... | [
"unittest.main",
"pprint.pformat",
"ipclassifier.iambic_line_processors.combinations_graph.CombinationsGraph"
] | [((2316, 2331), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2329, 2331), False, 'import unittest\n'), ((396, 481), 'ipclassifier.iambic_line_processors.combinations_graph.CombinationsGraph', 'CombinationsGraph', (['[([1], [0, 1, 0, 0, 2], [1], [1], [1], [1])]', '[0, 2]', '(True)', '(0)'], {}), '([([1], [0, 1, ... |
import itertools
from collections import defaultdict
from functools import partial
from math import ceil
from multiprocessing import Pool
from os import cpu_count
import numpy as np
from numba import njit
from pandas import DataFrame
def __set_matrix(x, phases=None, subset_genes=None, subset_samples=None, rm_zeros=T... | [
"numpy.unique",
"numba.njit",
"numpy.subtract",
"functools.partial",
"collections.defaultdict",
"os.cpu_count",
"multiprocessing.Pool",
"pandas.DataFrame",
"numpy.random.shuffle"
] | [((15823, 15829), 'numba.njit', 'njit', ([], {}), '()\n', (15827, 15829), False, 'from numba import njit\n'), ((16666, 16672), 'numba.njit', 'njit', ([], {}), '()\n', (16670, 16672), False, 'from numba import njit\n'), ((17108, 17114), 'numba.njit', 'njit', ([], {}), '()\n', (17112, 17114), False, 'from numba import nj... |
# Smallest multiple
# Problem 5
# 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
# What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
import time
start_time = time.time()
def divisible_by_all(number, range_to... | [
"time.time"
] | [((270, 281), 'time.time', 'time.time', ([], {}), '()\n', (279, 281), False, 'import time\n'), ((711, 722), 'time.time', 'time.time', ([], {}), '()\n', (720, 722), False, 'import time\n')] |
#!/usr/bin/python
"""
(C) Copyright 2020-2022 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
from apricot import TestWithServers
from network_utils import get_network_information, get_dmg_network_information, SUPPORTED_PROVIDERS
class DmgNetworkScanTest(TestWithServers):
# pylint: disab... | [
"network_utils.get_network_information"
] | [((931, 998), 'network_utils.get_network_information', 'get_network_information', (['self.hostlist_servers', 'SUPPORTED_PROVIDERS'], {}), '(self.hostlist_servers, SUPPORTED_PROVIDERS)\n', (954, 998), False, 'from network_utils import get_network_information, get_dmg_network_information, SUPPORTED_PROVIDERS\n')] |
from django.db import models
from datetime import datetime
class TestModel(models.Model):
date = models.DateField(default=datetime.today())
| [
"datetime.datetime.today"
] | [((128, 144), 'datetime.datetime.today', 'datetime.today', ([], {}), '()\n', (142, 144), False, 'from datetime import datetime\n')] |
"""
Class for caching posts from a subreddit. Loads posts from file,
fetches new ones when the cache is stale, and computes the scores
for words found in the title
@author <NAME>
@version 7/19/21
"""
import json
import os
import time
import praw
import config
import utils
from data import Post, TermGroup
class Po... | [
"os.path.exists",
"data.Post",
"utils.keys_ignored",
"json.load",
"time.time",
"json.dump"
] | [((6175, 6186), 'time.time', 'time.time', ([], {}), '()\n', (6184, 6186), False, 'import time\n'), ((1322, 1354), 'os.path.exists', 'os.path.exists', (['self._cache_file'], {}), '(self._cache_file)\n', (1336, 1354), False, 'import os\n'), ((2039, 2052), 'json.load', 'json.load', (['fp'], {}), '(fp)\n', (2048, 2052), Fa... |
from src.modules.preprocessing.preprocess_all_data import *
import pandas as pd
def get_all_datasets():
nlp_sentences = sentence_loader.preprocessed_sentences_sql()
bibliography = bib_loader.preprocessed_bibliography()
neotoma = nl.neotoma_loader()
neotoma_joined_df = nl.grouped_coords_df(neotoma)
... | [
"pandas.DataFrame"
] | [((814, 859), 'pandas.DataFrame', 'pd.DataFrame', (['A'], {'columns': "['_gddid', 'States']"}), "(A, columns=['_gddid', 'States'])\n", (826, 859), True, 'import pandas as pd\n'), ((868, 910), 'pandas.DataFrame', 'pd.DataFrame', (['B'], {'columns': "['_gddid', 'doi']"}), "(B, columns=['_gddid', 'doi'])\n", (880, 910), T... |
from accelerator.sitetree_navigation.utils import (
create_subnav,
delete_nav_tree
)
from accelerator_abstract.models import BaseUserRole
FINALIST = BaseUserRole.FINALIST
ALUMNI = BaseUserRole.ALUM
MENTOR = BaseUserRole.MENTOR
DIRECTORY_SUBNAV_TREE = {
"title": 'Directories SubNav',
"alias": 'director... | [
"accelerator.sitetree_navigation.utils.create_subnav",
"accelerator.sitetree_navigation.utils.delete_nav_tree"
] | [((705, 765), 'accelerator.sitetree_navigation.utils.create_subnav', 'create_subnav', (['DIRECTORY_SUBNAV_TREE', 'DIRECTORY_SUBNAV_ITEMS'], {}), '(DIRECTORY_SUBNAV_TREE, DIRECTORY_SUBNAV_ITEMS)\n', (718, 765), False, 'from accelerator.sitetree_navigation.utils import create_subnav, delete_nav_tree\n'), ((803, 841), 'ac... |
import numpy as np
import pandas as pd
import streamlit as st
import altair as alt
from matplotlib import pyplot as plt
import config, dataset, main, utils
# Matplotlib params
plt.style.use("seaborn")
plt.rcParams["figure.dpi"] = 300
def get_altair_hist_plot(series, name, bin_min, bin_max, bin_step):
"""
P... | [
"altair.Chart",
"main.main",
"dataset.ProductDataset",
"utils.get_l0_lb",
"streamlit.header",
"numpy.arange",
"streamlit.sidebar.write",
"matplotlib.pyplot.style.use",
"streamlit.set_page_config",
"pandas.DataFrame",
"streamlit.altair_chart",
"matplotlib.pyplot.gcf",
"streamlit.write",
"st... | [((179, 203), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn"""'], {}), "('seaborn')\n", (192, 203), True, 'from matplotlib import pyplot as plt\n'), ((784, 831), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""3D Bin Packing"""'}), "(page_title='3D Bin Packing')\n", (802, 831)... |
from typing import Collection
from matplotlib import pyplot as plt
from os.path import expanduser
import os,sys
import datetime as dt
import matplotlib.dates as mdates
sys.path.append('.')
from twitter_loader import load_twitter_data
def plot(tdata,incs):
output_dir = os.environ['ZENO_OUTPUT_DIR']+'/analyzer/basic... | [
"os.makedirs",
"datetime.datetime.strptime",
"matplotlib.pyplot.gcf",
"matplotlib.dates.DateFormatter",
"matplotlib.pyplot.gca",
"os.path.isdir",
"matplotlib.dates.DayLocator",
"matplotlib.pyplot.title",
"twitter_loader.load_twitter_data",
"sys.path.append",
"matplotlib.pyplot.subplots"
] | [((168, 188), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (183, 188), False, 'import os, sys\n'), ((1467, 1486), 'twitter_loader.load_twitter_data', 'load_twitter_data', ([], {}), '()\n', (1484, 1486), False, 'from twitter_loader import load_twitter_data\n'), ((341, 366), 'os.path.isdir', 'os.pa... |
from flask_login import login_user, current_user, login_required, logout_user
from flask import render_template, redirect, request, flash, jsonify
from jinja2 import Template, Environment, PackageLoader, select_autoescape
from sqlalchemy.sql.expression import func
import sqlalchemy.sql
import uuid
import os
from app... | [
"flask.render_template",
"flask.flash",
"flask_login.login_user",
"flask_login.logout_user",
"flask_login.current_user.get_id",
"os.path.join",
"sqlalchemy.sql.expression.func.random",
"uuid.uuid4",
"flask.redirect",
"jinja2.select_autoescape",
"app.app.route",
"jinja2.PackageLoader",
"flask... | [((1377, 1421), 'app.app.route', 'app.route', (['"""/list/<int:id>"""'], {'methods': "['GET']"}), "('/list/<int:id>', methods=['GET'])\n", (1386, 1421), False, 'from app import app\n'), ((2635, 2680), 'app.app.route', 'app.route', (['"""/list/<int:id>"""'], {'methods': "['POST']"}), "('/list/<int:id>', methods=['POST']... |
import numpy as np
from itertools import compress
from autodp.rl_core.env.sim_env import SimEnv
class BatchSimEnv(object):
"""This class is a wrapper to create and control a list of environments for batch processing."""
def __init__(self, image_batch=[], label_batch=[]):
self._envs = [SimEnv(i, l) fo... | [
"numpy.logical_not",
"autodp.rl_core.env.sim_env.SimEnv"
] | [((305, 317), 'autodp.rl_core.env.sim_env.SimEnv', 'SimEnv', (['i', 'l'], {}), '(i, l)\n', (311, 317), False, 'from autodp.rl_core.env.sim_env import SimEnv\n'), ((813, 825), 'autodp.rl_core.env.sim_env.SimEnv', 'SimEnv', (['i', 'l'], {}), '(i, l)\n', (819, 825), False, 'from autodp.rl_core.env.sim_env import SimEnv\n'... |
# Copyright (c) 2017 <NAME> <<EMAIL>>
# Copyright (c) 2018 <NAME> <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright not... | [
"zfs.zap.zap_factory",
"struct.unpack"
] | [((1815, 1854), 'zfs.zap.zap_factory', 'zap_factory', (['vdev', 'self._sa_attrs_dnode'], {}), '(vdev, self._sa_attrs_dnode)\n', (1826, 1854), False, 'from zfs.zap import zap_factory\n'), ((2186, 2213), 'zfs.zap.zap_factory', 'zap_factory', (['vdev', 'registry'], {}), '(vdev, registry)\n', (2197, 2213), False, 'from zfs... |
import configparser
import math
import multiprocessing
import os
import subprocess
import time
from shapely.geometry import box
from src.tile import Tile, TileTypes
from src.utils.helpers import Stages
class Subtiling:
def __init__(self, tile: Tile, connectivity: dict):
""" Helper class that orchestrate... | [
"os.path.exists",
"src.tile.Tile",
"configparser.ConfigParser",
"subprocess.Popen",
"os.path.join",
"shapely.geometry.box",
"os.path.realpath",
"time.time",
"multiprocessing.current_process"
] | [((798, 825), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (823, 825), False, 'import configparser\n'), ((752, 778), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (768, 778), False, 'import os\n'), ((846, 889), 'os.path.join', 'os.path.join', (['directory', '... |
from flask_wtf import FlaskForm
from wtforms import SubmitField
class Add_playlist(FlaskForm):
submit = SubmitField(
'Создать',
render_kw={"class": "btn btn-primary"}
)
| [
"wtforms.SubmitField"
] | [((109, 171), 'wtforms.SubmitField', 'SubmitField', (['"""Создать"""'], {'render_kw': "{'class': 'btn btn-primary'}"}), "('Создать', render_kw={'class': 'btn btn-primary'})\n", (120, 171), False, 'from wtforms import SubmitField\n')] |
from tea_block import *
import math
# VERIFY DIFFERENTIAL TRAIL PROBABILITIES
def compute_round_differences(alpha, beta):
round_differences = [[0x00000000,0x00000000] for i in range(len(alpha)+1)]
# round_differences[0] = [0xFFFFFFF1, 0xFFFFFFFF]
round_differences[0] = [sub(alpha[1],beta[0]), alpha[0]]
... | [
"math.ceil",
"math.log"
] | [((1929, 1995), 'math.ceil', 'math.ceil', (['(2 ** accumulated_expected_probability[number_of_rounds])'], {}), '(2 ** accumulated_expected_probability[number_of_rounds])\n', (1938, 1995), False, 'import math\n'), ((4268, 4305), 'math.log', 'math.log', (['heuristic_probability[r]', '(2)'], {}), '(heuristic_probability[r... |
from __future__ import print_function
import networkx as nx
from semnav.lib.categories import room2category, behavior_id2category
from semnav.lib.sem_graph import Node, Edge
class SubGraph(object):
"""Sub-graph of SemGraph used for graph networks.
"""
def __init__(self, sem_graph, cur_position, n_neigh... | [
"networkx.OrderedDiGraph",
"semnav.lib.categories.behavior_id2category",
"semnav.lib.categories.room2category"
] | [((4335, 4354), 'networkx.OrderedDiGraph', 'nx.OrderedDiGraph', ([], {}), '()\n', (4352, 4354), True, 'import networkx as nx\n'), ((5235, 5254), 'networkx.OrderedDiGraph', 'nx.OrderedDiGraph', ([], {}), '()\n', (5252, 5254), True, 'import networkx as nx\n'), ((5465, 5489), 'semnav.lib.categories.room2category', 'room2c... |
"""Platform for sensor integration."""
from homeassistant.const import ATTR_ATTRIBUTION, ATTR_DEVICE_CLASS, ATTR_ICON, CONF_NAME
from homeassistant.components.sensor import ATTR_STATE_CLASS, SensorEntity
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from homeassistant.helpers.typing import Sta... | [
"logging.getLogger"
] | [((626, 653), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (643, 653), False, 'import logging\n')] |
import random
from queue import Queue
from simulation import task as CTask
from simulation import printer
def new_print_task():
num = random.randrange(1, 181)
return num == 180
def simulation(num_seconds, pages_per_minute):
lab_printer = printer.Printer(pages_per_minute)
print_queue = Queue()
wa... | [
"simulation.printer.Printer",
"simulation.task.Task",
"queue.Queue",
"random.randrange"
] | [((140, 164), 'random.randrange', 'random.randrange', (['(1)', '(181)'], {}), '(1, 181)\n', (156, 164), False, 'import random\n'), ((254, 287), 'simulation.printer.Printer', 'printer.Printer', (['pages_per_minute'], {}), '(pages_per_minute)\n', (269, 287), False, 'from simulation import printer\n'), ((306, 313), 'queue... |
from pyica import fastica
from pyica import sources
import numpy as np
class TestICA():
def setup(self):
self.signals = np.vstack([np.sin([x/20.0 for x in range(1,1001)]),(1.0 + np.mod(range(1000),200) - 100.0)/100.0])
self.mixing = np.array([[0.291, 0.6557], [-0.5439, 0.5572]])
self.X = ... | [
"numpy.eye",
"numpy.corrcoef",
"numpy.array",
"numpy.dot",
"pyica.fastica.fastica",
"pyica.sources.unitsources"
] | [((256, 302), 'numpy.array', 'np.array', (['[[0.291, 0.6557], [-0.5439, 0.5572]]'], {}), '([[0.291, 0.6557], [-0.5439, 0.5572]])\n', (264, 302), True, 'import numpy as np\n'), ((320, 353), 'numpy.dot', 'np.dot', (['self.mixing', 'self.signals'], {}), '(self.mixing, self.signals)\n', (326, 353), True, 'import numpy as n... |
import traceback
from math import *
from PyQt5.QtCore import QEvent, QPoint, Qt, QPointF
from PyQt5.QtGui import QColor, QLinearGradient, QTransform, QPen, QPainter, QBrush
from PyQt5.QtWidgets import QDialog, QInputDialog, QMessageBox, QWidget
from Business.SketchActions import *
from Data.Style import BrushType
fro... | [
"PyQt5.QtGui.QTransform",
"PyQt5.QtGui.QPainter",
"PyQt5.QtGui.QColor",
"PyQt5.QtGui.QLinearGradient",
"GUI.GeometryViews.SketchView.get_sketch_view",
"PyQt5.QtWidgets.QWidget.__init__",
"GUI.init.is_dark_theme",
"PyQt5.QtCore.QPoint",
"traceback.print_exc",
"PyQt5.QtCore.QPointF",
"PyQt5.QtWidg... | [((544, 574), 'PyQt5.QtWidgets.QWidget.__init__', 'QWidget.__init__', (['self', 'parent'], {}), '(self, parent)\n', (560, 574), False, 'from PyQt5.QtWidgets import QDialog, QInputDialog, QMessageBox, QWidget\n'), ((728, 743), 'GUI.init.is_dark_theme', 'is_dark_theme', ([], {}), '()\n', (741, 743), False, 'from GUI.init... |
from core.entities import make_audio_order
def build_add_audio_orders(insert_audio_order):
def add_audio_order(user_id, title, text, start_page, end_page, cloned) -> bool:
audio_order = make_audio_order(user_id=user_id, title=title, text=text,
start_page=start_... | [
"core.entities.make_audio_order"
] | [((205, 324), 'core.entities.make_audio_order', 'make_audio_order', ([], {'user_id': 'user_id', 'title': 'title', 'text': 'text', 'start_page': 'start_page', 'end_page': 'end_page', 'cloned': 'cloned'}), '(user_id=user_id, title=title, text=text, start_page=\n start_page, end_page=end_page, cloned=cloned)\n', (221, ... |
'''
Created on Aug 18, 2020
@author: <NAME>
'''
from datetime import datetime
def create_html_report(data_dict, icon_url, html_file):
alt_var = data_dict['weather']
with open(html_file, mode='w') as outfile:
outfile.write('<html>\n')
outfile.write('<head>\n<title>Python Weathe... | [
"datetime.datetime.now",
"weather_data.get_weather_data"
] | [((1584, 1608), 'weather_data.get_weather_data', 'get_weather_data', (['"""KLAX"""'], {}), "('KLAX')\n", (1600, 1608), False, 'from weather_data import get_weather_data\n'), ((1272, 1286), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1284, 1286), False, 'from datetime import datetime\n')] |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
from logging import Formatter
from logging.handlers import TimedRotatingFileHandler
from ant.logger.handler import LoggerHandler
class FileHandler(LoggerHandler):
def __init__(self, logger_dir, logger_filename: str = "ant", when: str = "MIDNIGHT", backup_count... | [
"os.path.exists",
"logging.handlers.TimedRotatingFileHandler",
"os.path.join",
"os.makedirs"
] | [((737, 790), 'os.path.join', 'os.path.join', (['self._logger_dir', 'self._logger_filename'], {}), '(self._logger_dir, self._logger_filename)\n', (749, 790), False, 'import os\n'), ((815, 903), 'logging.handlers.TimedRotatingFileHandler', 'TimedRotatingFileHandler', (['filename'], {'when': 'self._when', 'backupCount': ... |
from email.mime import image
from app.extract_vector import search
import io
import base64
import time
from PIL import Image
def get_similar(image_endcoded, dataset):
msg = base64.b64decode(image_endcoded)
buf = io.BytesIO(msg)
img = Image.open(buf)
begin = time.time()
result = search(img, 50, dat... | [
"PIL.Image.open",
"io.BytesIO",
"base64.b64decode",
"time.time",
"app.extract_vector.search"
] | [((178, 210), 'base64.b64decode', 'base64.b64decode', (['image_endcoded'], {}), '(image_endcoded)\n', (194, 210), False, 'import base64\n'), ((221, 236), 'io.BytesIO', 'io.BytesIO', (['msg'], {}), '(msg)\n', (231, 236), False, 'import io\n'), ((247, 262), 'PIL.Image.open', 'Image.open', (['buf'], {}), '(buf)\n', (257, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import sys
from collections import OrderedDict
from django_excel_tools import exceptions
from django_excel_tools.fields import (
BooleanField, CharField, IntegerField, DateField,
DateTimeField
)
from django_excel_tools.utils import error_trans
try:
... | [
"logging.getLogger",
"collections.OrderedDict",
"django.db.transaction.atomic",
"django_excel_tools.exceptions.SerializerConfigError",
"django_excel_tools.exceptions.FieldNotExist",
"django.utils.translation.ugettext",
"django_excel_tools.utils.error_trans"
] | [((685, 712), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (702, 712), False, 'import logging\n'), ((564, 667), 'django_excel_tools.exceptions.SerializerConfigError', 'exceptions.SerializerConfigError', (['"""Django is required. Please make sure you have install via pip."""'], {}), "(\n... |
#### <NAME>-Converting Private database with x, y, z coordinate to LIDC format XML ####
#### Convention of x, y, z --> x, y = (0,0) at upper left, z counted from the lowest point"
import glob
import os
import subprocess
import SimpleITK as sitk
import numpy as np
import csv
import IPython
# import lidcXmlHelper as x... | [
"SimpleITK.ReadImage",
"os.listdir",
"os.path.join",
"os.walk"
] | [((1033, 1059), 'os.listdir', 'os.listdir', (['path_to_dicoms'], {}), '(path_to_dicoms)\n', (1043, 1059), False, 'import sys, os\n'), ((1142, 1188), 'os.path.join', 'os.path.join', (['path_to_dicoms', 'all_dirs[dir_it]'], {}), '(path_to_dicoms, all_dirs[dir_it])\n', (1154, 1188), False, 'import sys, os\n'), ((1286, 130... |
from db.models import Stop
from dijkstra import shortest_path
from network import Network
from parser import parse_route
from time import perf_counter
from traffic import Traffic
"""
Command-line interface for the Lakbay algorithm.
:Author: <NAME>
:Version: v3.0 (2015-04-07)
"""
print("Loading d... | [
"dijkstra.shortest_path",
"parser.parse_route",
"time.perf_counter",
"network.Network",
"traffic.Traffic"
] | [((348, 362), 'time.perf_counter', 'perf_counter', ([], {}), '()\n', (360, 362), False, 'from time import perf_counter\n'), ((369, 399), 'network.Network', 'Network', (['"""sqlite:///db/app.db"""'], {}), "('sqlite:///db/app.db')\n", (376, 399), False, 'from network import Network\n'), ((412, 446), 'traffic.Traffic', 'T... |
class SolutionCumulativeSum:
"""
2. Intuition:
- Store the nbr of the passengers picked or dropped off by time
- Compute the cumulative sum by time and check if it exceeds the capacity
3. Complexity Analysis:
- Time Complexity: O(N)
- Space Complexity: O(N)
"""
... | [
"heapq.heappush",
"heapq.heappop"
] | [((1951, 2005), 'heapq.heappush', 'heapq.heappush', (['heap', '(trip[end_idx], trip[count_idx])'], {}), '(heap, (trip[end_idx], trip[count_idx]))\n', (1965, 2005), False, 'import heapq\n'), ((1777, 1796), 'heapq.heappop', 'heapq.heappop', (['heap'], {}), '(heap)\n', (1790, 1796), False, 'import heapq\n')] |
import ngender
import time
name = input("请输入您的名字")
# time.sleep(5)
print(ngender.guess(name)) | [
"ngender.guess"
] | [((73, 92), 'ngender.guess', 'ngender.guess', (['name'], {}), '(name)\n', (86, 92), False, 'import ngender\n')] |
import sys
import subprocess
import functools
from os import path
target_path, output_file = sys.argv[1:3]
# >> grep for class definitions
grep_out = subprocess.check_output(["grep", "-rE", "^\\s*class", target_path])
raw_data = [x.split(':') for x in grep_out.decode('utf-8').split('\n') if not x.endswith(';')]
# ... | [
"subprocess.check_output",
"functools.partial",
"os.path.basename"
] | [((154, 221), 'subprocess.check_output', 'subprocess.check_output', (["['grep', '-rE', '^\\\\s*class', target_path]"], {}), "(['grep', '-rE', '^\\\\s*class', target_path])\n", (177, 221), False, 'import subprocess\n'), ((531, 547), 'os.path.basename', 'path.basename', (['f'], {}), '(f)\n', (544, 547), False, 'from os i... |
import pandas as pd
import numpy as np
import ffmpeg
from joblib import Parallel, delayed
import warnings
import cv2
from tqdm import tqdm
# UPSAMPLE DATA
def upsample(df, frac=2):
up_df = df.query("distance>=20").copy()
up_df = up_df.sample(frac=frac, replace=True)
up_df = pd.concat([df.query("distance<20... | [
"cv2.imwrite",
"ffmpeg.input",
"joblib.delayed",
"joblib.Parallel",
"ffmpeg.probe",
"warnings.warn",
"numpy.frombuffer"
] | [((962, 984), 'ffmpeg.input', 'ffmpeg.input', (['filepath'], {}), '(filepath)\n', (974, 984), False, 'import ffmpeg\n'), ((707, 725), 'ffmpeg.probe', 'ffmpeg.probe', (['path'], {}), '(path)\n', (719, 725), False, 'import ffmpeg\n'), ((1895, 1946), 'joblib.Parallel', 'Parallel', ([], {'n_jobs': '(-1)', 'backend': '"""th... |
"""Gradient compression algorithms."""
from __future__ import division
import tensorflow as tf
from tensorflow.python.framework import load_library
from tensorflow.python.platform import resource_loader
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
import random, math
from horovod.tensorflow.mpi_ops i... | [
"tensorflow.math.pow",
"tensorflow.math.add_n",
"tensorflow.bitcast",
"tensorflow.linalg.inv",
"tensorflow.floormod",
"tensorflow.while_loop",
"tensorflow.pow",
"horovod.tensorflow.mpi_ops.rank",
"tensorflow.convert_to_tensor",
"tensorflow.less",
"tensorflow.unsorted_segment_mean",
"tensorflow... | [((204, 266), 'tensorflow.compat.v1.logging.set_verbosity', 'tf.compat.v1.logging.set_verbosity', (['tf.compat.v1.logging.ERROR'], {}), '(tf.compat.v1.logging.ERROR)\n', (238, 266), True, 'import tensorflow as tf\n'), ((2048, 2070), 'tensorflow.math.add_n', 'tf.math.add_n', (['tensors'], {}), '(tensors)\n', (2061, 2070... |
"""
The "device statuses" component.
"""
import asyncio
import logging
import os
import json
from datetime import timedelta
from homeassistant.config import load_yaml_config_file
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.core ... | [
"logging.getLogger",
"os.path.dirname",
"datetime.timedelta",
"homeassistant.helpers.entity_component.EntityComponent"
] | [((345, 372), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (362, 372), False, 'import logging\n'), ((431, 446), 'datetime.timedelta', 'timedelta', (['(3600)'], {}), '(3600)\n', (440, 446), False, 'from datetime import timedelta\n'), ((599, 652), 'homeassistant.helpers.entity_component.E... |
import scrapy
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
from recipeKR.items import RecipekrItem
from bs4 import BeautifulSoup
import traceback
class SsgrecipeSpider(CrawlSpider):
name = 'ssgrecipe'
allowed_domains = ['emart.ssg.com']
download_delay = 1.4
... | [
"bs4.BeautifulSoup",
"recipeKR.items.RecipekrItem",
"traceback.print_exc",
"scrapy.linkextractors.LinkExtractor"
] | [((483, 531), 'scrapy.linkextractors.LinkExtractor', 'LinkExtractor', ([], {'allow': '"""/recipe/recipe/detail.ssg"""'}), "(allow='/recipe/recipe/detail.ssg')\n", (496, 531), False, 'from scrapy.linkextractors import LinkExtractor\n'), ((1009, 1023), 'recipeKR.items.RecipekrItem', 'RecipekrItem', ([], {}), '()\n', (102... |
import os
includes = (
('src/lib/extras.js', (
'src/plugins/class.js',
'src/plugins/iff.js',
'src/plugins/jquery.mousewheel.js',
'src/plugins/jquery.hotkeys.js',
'src/parchment/querystring.js',
'src/parchment/remedial.js',
'src/parchment/error-handling.js',
'src/parchment/beret.js',
'src/parchment/f... | [
"os.system"
] | [((994, 1012), 'os.system', 'os.system', (['command'], {}), '(command)\n', (1003, 1012), False, 'import os\n')] |
import itertools
from Phyme import Phyme
import random
import sys
import time
random.seed(time.time())
ph = Phyme()
def get_rhyme(word):
# Get all rhymes and merge to one list (normally separated by syllable count)
rhymes = ph.get_perfect_rhymes(word)
rhyme_vals = list(itertools.chain.from_iterable(list... | [
"time.time",
"Phyme.Phyme"
] | [((110, 117), 'Phyme.Phyme', 'Phyme', ([], {}), '()\n', (115, 117), False, 'from Phyme import Phyme\n'), ((91, 102), 'time.time', 'time.time', ([], {}), '()\n', (100, 102), False, 'import time\n')] |
"""Test the Cement CLI Application."""
from calcipy.cli.main import CLIAppTest
def test_calcipy_cli():
"""Test calcipy without any subcommands or arguments."""
with CLIAppTest() as app:
app.run()
assert app.exit_code == 0
def test_calcipy_debug_cli():
"""Test that debug mode is function... | [
"calcipy.cli.main.CLIAppTest"
] | [((176, 188), 'calcipy.cli.main.CLIAppTest', 'CLIAppTest', ([], {}), '()\n', (186, 188), False, 'from calcipy.cli.main import CLIAppTest\n'), ((359, 380), 'calcipy.cli.main.CLIAppTest', 'CLIAppTest', ([], {'argv': 'argv'}), '(argv=argv)\n', (369, 380), False, 'from calcipy.cli.main import CLIAppTest\n')] |
"""Unit test for treadmill.cli.logs.
"""
import importlib
import unittest
import click
import click.testing
import mock
def _ret_event(event):
"""Noop, just return the positional args that it was invoked with."""
return event
# don't compain about protected member access
# pylint: disable=W0212
class Logs... | [
"unittest.main",
"mock.Mock",
"importlib.import_module",
"click.testing.CliRunner"
] | [((1395, 1410), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1408, 1410), False, 'import unittest\n'), ((474, 499), 'click.testing.CliRunner', 'click.testing.CliRunner', ([], {}), '()\n', (497, 499), False, 'import click\n'), ((523, 568), 'importlib.import_module', 'importlib.import_module', (['"""treadmill.cli... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project : tql-Python.
# @File : restful_sanic
# @Time : 2019-07-18 10:13
# @Author : yuanjie
# @Email : <EMAIL>
# @Software : PyCharm
# @Description :
import jieba
from restful_api import Api
import requests
from lxml.etree impo... | [
"restful_api.Api",
"lxml.etree.HTML",
"googletrans.Translator",
"requests.get"
] | [((377, 464), 'googletrans.Translator', 'Translator', ([], {'service_urls': "['translate.google.cn', 'translate.google.com']", 'timeout': '(3)'}), "(service_urls=['translate.google.cn', 'translate.google.com'],\n timeout=3)\n", (387, 464), False, 'from googletrans import Translator\n'), ((1328, 1388), 'restful_api.A... |
#
# events.py
"""This class contains the declarations and initializations for
pygame events and event types. """
import pygame
def init():
"""The events.init() function must
be called at the beginning of __main__() (in the main file) to
access the events."""
# Declare event types
global TEST_EV... | [
"pygame.event.Event"
] | [((931, 966), 'pygame.event.Event', 'pygame.event.Event', (['TEST_EVENT_TYPE'], {}), '(TEST_EVENT_TYPE)\n', (949, 966), False, 'import pygame\n'), ((993, 1037), 'pygame.event.Event', 'pygame.event.Event', (['LEFT_GOAL_SCORED_IN_TYPE'], {}), '(LEFT_GOAL_SCORED_IN_TYPE)\n', (1011, 1037), False, 'import pygame\n'), ((1065... |
"""
High level implementation of a channel access client.
"""
import weakref
import threading
from datetime import datetime
import enum
import channel_access.common as ca
from . import cac
#: Exception raised when an error occurs inside a channel access function.
CaException = cac.CaException
# Can't distinguish ... | [
"channel_access.common.epics_to_datetime",
"threading.Lock",
"threading.Condition",
"weakref.WeakSet"
] | [((495, 516), 'threading.Condition', 'threading.Condition', ([], {}), '()\n', (514, 516), False, 'import threading\n'), ((5032, 5048), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (5046, 5048), False, 'import threading\n'), ((22210, 22227), 'weakref.WeakSet', 'weakref.WeakSet', ([], {}), '()\n', (22225, 22227)... |
# Regression tests for the post-processing tests: sequencing, tracking, tracking
# back, etc.
import unittest
import os, shutil, glob, re
from scipy.misc import imread
from ptv1 import py_start_proc_c, py_init_proc_c
from ptv1 import py_sequence_init, py_sequence_loop, py_set_img
from ptv1 import py_trackcorr_init,... | [
"glob.iglob",
"re.compile",
"ptv1.py_init_proc_c",
"unittest.main",
"os.path.exists",
"ptv1.py_set_img",
"os.listdir",
"ptv1.py_trackcorr_init",
"ptv1.py_sequence_loop",
"ptv1.py_trackcorr_finish",
"scipy.misc.imread",
"ptv1.py_start_proc_c",
"os.mkdir",
"ptv1.py_trackcorr_loop",
"shutil... | [((885, 901), 'os.listdir', 'os.listdir', (['dir1'], {}), '(dir1)\n', (895, 901), False, 'import os, shutil, glob, re\n'), ((4299, 4314), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4312, 4314), False, 'import unittest\n'), ((1412, 1439), 'os.chdir', 'os.chdir', (['"""testing_fodder/"""'], {}), "('testing_fodd... |
import os
import re
import bpy
import logging
import json
from . import bpy_helper
from . import ifc_helper
from . import io
from . import exporter
def create(project, ifc_type=None, group_name='', prefix='', **kwargs):
i = 0
if ifc_type:
for elem in ifc_helper.elements_by_type(project, ifc_type):
... | [
"bpy.data.groups.new",
"json.dumps",
"os.path.join",
"re.match",
"bpy.data.objects.remove",
"re.search"
] | [((621, 650), 'bpy.data.groups.new', 'bpy.data.groups.new', (['grp_name'], {}), '(grp_name)\n', (640, 650), False, 'import bpy\n'), ((935, 969), 're.match', 're.match', (['target_regex', 'group.name'], {}), '(target_regex, group.name)\n', (943, 969), False, 'import re\n'), ((1285, 1320), 're.match', 're.match', (['sour... |
from __future__ import annotations
import collections
import os
import re
from graphlib import TopologicalSorter # noqa
Rules = dict[str, dict[str, int]]
AdjacencyList = dict[str, list[str]]
BAG_RE = re.compile(r'(?:(?P<count>\d+) )?(?P<color>\w+ \w+) bags?')
def main():
this_dir = os.path.dirname(os.path.abs... | [
"collections.deque",
"re.compile",
"os.path.join",
"collections.Counter",
"collections.defaultdict",
"os.path.abspath",
"graphlib.TopologicalSorter"
] | [((204, 265), 're.compile', 're.compile', (['"""(?:(?P<count>\\\\d+) )?(?P<color>\\\\w+ \\\\w+) bags?"""'], {}), "('(?:(?P<count>\\\\d+) )?(?P<color>\\\\w+ \\\\w+) bags?')\n", (214, 265), False, 'import re\n'), ((353, 388), 'os.path.join', 'os.path.join', (['this_dir', '"""input.txt"""'], {}), "(this_dir, 'input.txt')\... |
import os
class OSCommands:
OS = None
CLEAR = None
if (os.path.sep == '/'):
OSCommands.OS = 'Linux'
OSCommands.CLEAR = lambda: os.system('clear')
elif (os.path.sep == '\\'):
OSCommands.OS = 'Windows'
OSCommands.CLEAR = lambda: os.system('cls')
__all__ = [
'OSCommands',
]
| [
"os.system"
] | [((145, 163), 'os.system', 'os.system', (['"""clear"""'], {}), "('clear')\n", (154, 163), False, 'import os\n'), ((255, 271), 'os.system', 'os.system', (['"""cls"""'], {}), "('cls')\n", (264, 271), False, 'import os\n')] |
from django.conf.urls import url, include
from django.conf import settings
from django.conf.urls.static import static
from . import views
from django.contrib.auth.views import logout
urlpatterns = [
url(r'^$', views.rider, name='index-rider'),
url(r'^update-profile/$', views.update_profile_rider, name='up... | [
"django.conf.urls.static.static",
"django.conf.urls.include",
"django.conf.urls.url"
] | [((208, 250), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.rider'], {'name': '"""index-rider"""'}), "('^$', views.rider, name='index-rider')\n", (211, 250), False, 'from django.conf.urls import url, include\n'), ((258, 344), 'django.conf.urls.url', 'url', (['"""^update-profile/$"""', 'views.update_profile_rider'... |
import requests
from bs4 import BeautifulSoup
import time
import tqdm
import json
import codecs
import csv
URL = 'http://www.geocoding.jp/api/'
def coordinate(address):
"""
addressに住所を指定すると緯度経度を返す。
>>> coordinate('東京都文京区本郷7-3-1')
['35.712056', '139.762775']
"""
payload = {'q': address}
h... | [
"requests.get",
"time.sleep",
"bs4.BeautifulSoup",
"codecs.open",
"csv.reader",
"json.dump"
] | [((326, 359), 'requests.get', 'requests.get', (['URL'], {'params': 'payload'}), '(URL, params=payload)\n', (338, 359), False, 'import requests\n'), ((371, 413), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html.content', '"""html.parser"""'], {}), "(html.content, 'html.parser')\n", (384, 413), False, 'from bs4 import Beaut... |
import sys
import utils.diff as diff
from databuild.backend import GeneDocMongoDBBackend
from pymongo import MongoClient
def main(s1, s2, p=False):
conn1, dbstr1, colstr1 = s1
conn2, dbstr2, colstr2 = s2
col1 = MongoClient(conn1)[dbstr1][colstr1]
col2 = MongoClient(conn2)[dbstr2][colstr2]
b1 = Ge... | [
"databuild.backend.GeneDocMongoDBBackend",
"pymongo.MongoClient",
"utils.diff.diff_collections"
] | [((318, 345), 'databuild.backend.GeneDocMongoDBBackend', 'GeneDocMongoDBBackend', (['col1'], {}), '(col1)\n', (339, 345), False, 'from databuild.backend import GeneDocMongoDBBackend\n'), ((355, 382), 'databuild.backend.GeneDocMongoDBBackend', 'GeneDocMongoDBBackend', (['col2'], {}), '(col2)\n', (376, 382), False, 'from... |
from urllib import request
import json
CATEGORY = ['no such category'] * 50
CATEGORY[1] = 'Film & Animation'
CATEGORY[2] = 'Autos & Vehicles'
CATEGORY[10] = 'Music'
CATEGORY[15] = 'Pets & Animals'
CATEGORY[17] = 'Sports'
CATEGORY[18] = 'Short Movies'
CATEGORY[19] = 'Travel & Events'
CATEGORY[20] = 'Gaming'
... | [
"urllib.request.Request",
"json.loads",
"urllib.request.urlopen"
] | [((5279, 5304), 'urllib.request.Request', 'request.Request', (['self.url'], {}), '(self.url)\n', (5294, 5304), False, 'from urllib import request\n'), ((5414, 5430), 'json.loads', 'json.loads', (['page'], {}), '(page)\n', (5424, 5430), False, 'import json\n'), ((5325, 5345), 'urllib.request.urlopen', 'request.urlopen',... |
import re
from datetime import datetime
from pathlib import Path
from subprocess import Popen, check_output
from tempfile import TemporaryDirectory
from django.core.files.base import ContentFile
from django.db import transaction
from django.utils.translation import ugettext_lazy as _
from django_rq import job
from tqd... | [
"subprocess.check_output",
"tempfile.TemporaryDirectory",
"common.utils.export.send_export",
"django.utils.translation.ugettext_lazy",
"accounts.models.HierarchicUser.objects.get",
"libretto.export.Source.objects.create",
"pathlib.Path",
"libretto.export.Source.objects.get",
"common.utils.export.sen... | [((2824, 2864), 'libretto.models.Evenement.objects.filter', 'Evenement.objects.filter', ([], {'pk__in': 'pk_list'}), '(pk__in=pk_list)\n', (2848, 2864), False, 'from libretto.models import Evenement\n'), ((3111, 3199), 'common.utils.export.send_pdf', 'send_pdf', (['context', 'template_name', 'subject', 'filename', 'use... |
# Generated by Django 3.0.5 on 2021-01-09 11:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('siswa', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='siswa',
name='diterima_di_tingkat',
... | [
"django.db.models.CharField"
] | [((335, 435), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('10', '10'), ('11', '11'), ('12', '12'), ('13', '13')]", 'max_length': '(3)'}), "(choices=[('10', '10'), ('11', '11'), ('12', '12'), ('13',\n '13')], max_length=3)\n", (351, 435), False, 'from django.db import migrations, models\n')] |
##################################################### Import system libraries ######################################################
import matplotlib as mpl
mpl.rcdefaults()
mpl.rcParams.update(mpl.rc_params_from_file('meine-matplotlibrc'))
import matplotlib.pyplot as plt
import numpy as np
import scipy.constants as c... | [
"matplotlib.pyplot.grid",
"numpy.sqrt",
"sys.path.insert",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.annotate",
"matplotlib.rc_params_from_file",
"table.make_SI",
"table.make_full_table",
"numpy.genfromtxt",
"curve_fit.ucurve_fit",
"matplotlib.rcdefaults",
"matplotlib.pyplot.xlabel",
"m... | [((158, 174), 'matplotlib.rcdefaults', 'mpl.rcdefaults', ([], {}), '()\n', (172, 174), True, 'import matplotlib as mpl\n'), ((2307, 2366), 'numpy.genfromtxt', 'np.genfromtxt', (['"""messdaten/1_Messung_werte.txt"""'], {'unpack': '(True)'}), "('messdaten/1_Messung_werte.txt', unpack=True)\n", (2320, 2366), True, 'import... |
import tensorflow as tf
tf.enable_eager_execution()
import numpy as np
import pandas as pd
import os
# import argparse
def read_tf(tfrecord_path):
"""
read in the tensors
:param tfrecord_path: the path to the tensor
:return: the image and the label
"""
raw_image_dataset = tf.data.TFRecordDatas... | [
"tensorflow.data.TFRecordDataset",
"matplotlib.pyplot.imshow",
"numpy.mean",
"os.path.exists",
"tensorflow.io.parse_single_example",
"os.path.join",
"tensorflow.enable_eager_execution",
"tensorflow.decode_raw",
"numpy.array",
"tensorflow.io.FixedLenFeature",
"os.mkdir",
"numpy.std",
"matplot... | [((24, 51), 'tensorflow.enable_eager_execution', 'tf.enable_eager_execution', ([], {}), '()\n', (49, 51), True, 'import tensorflow as tf\n'), ((299, 337), 'tensorflow.data.TFRecordDataset', 'tf.data.TFRecordDataset', (['tfrecord_path'], {}), '(tfrecord_path)\n', (322, 337), True, 'import tensorflow as tf\n'), ((3044, 3... |
# tested on python 3.9
import http.server
import socketserver
import urllib
import urllib.request
import json
import requests
from http import HTTPStatus
youtubeChannelId = "UCKHzE6XF__put_your_real_channel_id"
youtubeApiKey = "<KEY>"
url = "https://www.googleapis.com/youtube/v3/channels?part=statistics&id=" + youtu... | [
"json.dumps",
"json.loads",
"socketserver.TCPServer",
"requests.get"
] | [((1640, 1681), 'socketserver.TCPServer', 'socketserver.TCPServer', (["('', 80)", 'Handler'], {}), "(('', 80), Handler)\n", (1662, 1681), False, 'import socketserver\n'), ((520, 537), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (532, 537), False, 'import requests\n'), ((558, 583), 'json.loads', 'json.load... |
from django import forms
from django.db.models.functions import Lower
from django.contrib import admin
from methodmapping.models import MethodMapping
from secret.models import Secret
class SecretAdminForm(forms.ModelForm):
methods = forms.ModelMultipleChoiceField(
queryset=MethodMapping.objects.all().ord... | [
"methodmapping.models.MethodMapping.objects.all",
"django.contrib.admin.site.register",
"django.db.models.functions.Lower"
] | [((592, 632), 'django.contrib.admin.site.register', 'admin.site.register', (['Secret', 'SecretAdmin'], {}), '(Secret, SecretAdmin)\n', (611, 632), False, 'from django.contrib import admin\n'), ((326, 338), 'django.db.models.functions.Lower', 'Lower', (['"""uri"""'], {}), "('uri')\n", (331, 338), False, 'from django.db.... |
from redis import Redis
import fakeredis
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
from flask_jwt_extended import JWTManager
from config import TestingConfig
db = SQLAlchemy()
bcrypt = Bcrypt()
jwt = JWTManager()
def create_app(config_class=TestingConfig):
'... | [
"redis.Redis.from_url",
"flask_jwt_extended.JWTManager",
"flask.Flask",
"flask_bcrypt.Bcrypt",
"fakeredis.FakeStrictRedis",
"flask_sqlalchemy.SQLAlchemy"
] | [((219, 231), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (229, 231), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((241, 249), 'flask_bcrypt.Bcrypt', 'Bcrypt', ([], {}), '()\n', (247, 249), False, 'from flask_bcrypt import Bcrypt\n'), ((256, 268), 'flask_jwt_extended.JWTManager', 'JWTManager... |
import numpy as np
import matplotlib.pyplot as plt
from custom_poling.core.target import Target
from custom_poling.core.custom_crystal import CustomCrystal
# Crystal properties
domain_width = 10.0e-6
number_domains = 1000
L = number_domains * domain_width
k0 = np.pi / domain_width
# Numerical integration parameters
... | [
"numpy.abs",
"matplotlib.pyplot.savefig",
"numpy.arange",
"numpy.exp",
"custom_poling.core.target.Target",
"custom_poling.core.custom_crystal.CustomCrystal",
"matplotlib.pyplot.legend"
] | [((363, 412), 'numpy.arange', 'np.arange', (['(k0 - k_range / 2)', '(k0 + k_range / 2)', 'dk'], {}), '(k0 - k_range / 2, k0 + k_range / 2, dk)\n', (372, 412), True, 'import numpy as np\n'), ((460, 503), 'custom_poling.core.custom_crystal.CustomCrystal', 'CustomCrystal', (['domain_width', 'number_domains'], {}), '(domai... |
# implementation based on DeepLTL https://github.com/reactive-systems/deepltl
from argparse import ArgumentParser
import subprocess
import os.path as path
import sys
import json
import random
import tensorflow as tf
import numpy as np
from dlsgs.utils import ltl_parser
def argparser():
parser = ArgumentParser... | [
"sys.exit",
"tensorflow.io.gfile.remove",
"tensorflow.io.gfile.GFile",
"argparse.ArgumentParser",
"subprocess.Popen",
"json.dumps",
"numpy.random.seed",
"sys.stdout.flush",
"random.randint",
"tensorflow.keras.callbacks.TensorBoard",
"tensorflow.expand_dims",
"tensorflow.random.set_seed",
"te... | [((306, 322), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (320, 322), False, 'from argparse import ArgumentParser\n'), ((3607, 3658), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (3651, 3658), True, 'import t... |
import threading
from functools import wraps
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
_kwd_mark = object()
_data_lock = threading.Lock()
def cache(f):
"""
Decorator that caches the function's return value, so cached RDDs,
DataFrames, and other objects can be shared... | [
"functools.wraps",
"threading.Lock",
"celery.utils.log.get_task_logger"
] | [((100, 125), 'celery.utils.log.get_task_logger', 'get_task_logger', (['__name__'], {}), '(__name__)\n', (115, 125), False, 'from celery.utils.log import get_task_logger\n'), ((161, 177), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (175, 177), False, 'import threading\n'), ((359, 367), 'functools.wraps', 'wra... |
#!/usr/bin/env python3
import argparse
import os
from werkzeug.security import generate_password_hash
def main():
parser = argparse.ArgumentParser(description="loader of users to elastic")
parser.add_argument('--file', required=True, help="Input file with users infos")
parser.add_argument('--host', requi... | [
"werkzeug.security.generate_password_hash",
"argparse.ArgumentParser"
] | [((129, 194), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""loader of users to elastic"""'}), "(description='loader of users to elastic')\n", (152, 194), False, 'import argparse\n'), ((1026, 1058), 'werkzeug.security.generate_password_hash', 'generate_password_hash', (['password'], {}),... |
import datetime
print(1,datetime.datetime.now())
import apscheduler
print(2,datetime.datetime.now())
import gevent
print(3,datetime.datetime.now())
import eventlet
print(4,datetime.datetime.now())
import asyncio
print(5,datetime.datetime.now())
import threading
print(6,datetime.datetime.now())
import pymongo
pri... | [
"datetime.datetime.now"
] | [((24, 47), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (45, 47), False, 'import datetime\n'), ((77, 100), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (98, 100), False, 'import datetime\n'), ((124, 147), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', ... |
# -*- coding: utf-8 -*-
"""
* Created by PyCharm.
* Project: restaurant-menu
* Author name: <NAME>
* Author login: pma007
* File: webserver_restaurants
* Date: 2/4/16
* Time: 10:46
* To change this template use File | Settings | File Templates.
"""
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
i... | [
"sqlalchemy.orm.sessionmaker",
"cgi.parse_multipart",
"sqlalchemy.create_engine",
"database_setup.Restaurant",
"BaseHTTPServer.HTTPServer"
] | [((471, 515), 'sqlalchemy.create_engine', 'create_engine', (['"""sqlite:///restaurantmenu.db"""'], {}), "('sqlite:///restaurantmenu.db')\n", (484, 515), False, 'from sqlalchemy import create_engine\n'), ((558, 583), 'sqlalchemy.orm.sessionmaker', 'sessionmaker', ([], {'bind': 'engine'}), '(bind=engine)\n', (570, 583), ... |
# -*- coding: utf-8 -*-
from upbitpy import Upbitpy
import unittest
import logging
class UpbitpyExchangeTest(unittest.TestCase):
KEY = ''
SECRET = ''
TEST_MARKET = ''
TEST_BID_PRICE = 0
TEST_VOLUME = 0
def test_get_get_accounts(self):
upbit = Upbitpy(self.KEY, self.SECRET)
re... | [
"logging.basicConfig",
"upbitpy.Upbitpy",
"logging.info",
"unittest.main"
] | [((2228, 2267), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (2247, 2267), False, 'import logging\n'), ((2663, 2678), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2676, 2678), False, 'import unittest\n'), ((279, 309), 'upbitpy.Upbitpy', 'Upbitpy', (['s... |
import numpy as np
from pyriemann.estimation import Covariances
from pyriemann.spatialfilters import CSP
from sklearn.feature_selection import SelectKBest, mutual_info_classif
from sklearn.model_selection import GridSearchCV
from sklearn.pipeline import make_pipeline
from sklearn.svm import SVC
from moabb.pipelines.ut... | [
"sklearn.feature_selection.SelectKBest",
"pyriemann.estimation.Covariances",
"numpy.logspace",
"pyriemann.spatialfilters.CSP",
"sklearn.svm.SVC"
] | [((363, 385), 'numpy.logspace', 'np.logspace', (['(-2)', '(2)', '(10)'], {}), '(-2, 2, 10)\n', (374, 385), True, 'import numpy as np\n'), ((406, 426), 'sklearn.svm.SVC', 'SVC', ([], {'kernel': '"""linear"""'}), "(kernel='linear')\n", (409, 426), False, 'from sklearn.svm import SVC\n'), ((542, 591), 'sklearn.feature_sel... |
#!/usr/bin/env python
# test: base_dirs.py
from unittest import TestCase
#from unittest.mock import patch
from yxes.config.find_dir import FindDir
class TestFindDir(TestCase):
def setUp(self):
self.fd = FindDir()
def test_conf(self):
self.assertTrue(
self.fd.conf_dir.endswith("yx... | [
"yxes.config.find_dir.FindDir"
] | [((220, 229), 'yxes.config.find_dir.FindDir', 'FindDir', ([], {}), '()\n', (227, 229), False, 'from yxes.config.find_dir import FindDir\n'), ((658, 677), 'yxes.config.find_dir.FindDir', 'FindDir', (['"""test_dir"""'], {}), "('test_dir')\n", (665, 677), False, 'from yxes.config.find_dir import FindDir\n'), ((827, 861), ... |
# vim: set encoding=utf-8
from unittest import TestCase
from regparser.tree import reg_text
from regparser.tree.struct import FrozenNode
from regparser.diff import tree as difftree
class DiffTreeTest(TestCase):
def test_subparts(self):
""" Create a tree with no subparts, then add subparts. """
ti... | [
"regparser.tree.reg_text.build_reg_text_tree",
"regparser.diff.tree.changes_between",
"regparser.tree.struct.FrozenNode.from_node",
"regparser.tree.struct.FrozenNode"
] | [((661, 704), 'regparser.tree.reg_text.build_reg_text_tree', 'reg_text.build_reg_text_tree', (['old_text', '(204)'], {}), '(old_text, 204)\n', (689, 704), False, 'from regparser.tree import reg_text\n'), ((1213, 1256), 'regparser.tree.reg_text.build_reg_text_tree', 'reg_text.build_reg_text_tree', (['new_text', '(204)']... |
import os, json, argparse, sys, datetime, time
import xml.etree.ElementTree as ET, gzip
"""
Loads all items with IPR except domain families and checks InterPro release for additions.
Checks also for duplicate IPR. Use with wd ce.
"""
# Initiate the parser
parser = argparse.ArgumentParser()
parser.add_argument("-q", "-... | [
"json.loads",
"xml.etree.ElementTree.parse",
"argparse.ArgumentParser",
"gzip.open",
"json.dumps",
"os.path.basename"
] | [((266, 291), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (289, 291), False, 'import os, json, argparse, sys, datetime, time\n'), ((899, 912), 'json.loads', 'json.loads', (['s'], {}), '(s)\n', (909, 912), False, 'import os, json, argparse, sys, datetime, time\n'), ((922, 950), 'gzip.open', '... |
from flask import Blueprint, render_template, current_app, Response
from application.database import global_db
from application.helpers import requires_auth
from core.monitoring.models import SENSOR_CLASS_MAP
sensor_heatmap_pages = Blueprint('sensor_heatmap', __name__
, template_folder='templates', static_folder='st... | [
"flask.render_template",
"application.database.global_db.session.query",
"flask.Blueprint",
"time.time"
] | [((234, 328), 'flask.Blueprint', 'Blueprint', (['"""sensor_heatmap"""', '__name__'], {'template_folder': '"""templates"""', 'static_folder': '"""static"""'}), "('sensor_heatmap', __name__, template_folder='templates',\n static_folder='static')\n", (243, 328), False, 'from flask import Blueprint, render_template, cur... |
import os
def get_file_path_name_ext(filename: str):
"""
获取文件路径、文件名、扩展名
get_extension('6666')
('', '6666', '')
get_extension('6666/jpg')
('6666', 'jpg', '')
get_extension('6666.jpg')
('', '6666', '.jpg')
"""
filepath, tempfilename = os.path.split(filename)
shotname,... | [
"os.path.splitext",
"os.path.split"
] | [((283, 306), 'os.path.split', 'os.path.split', (['filename'], {}), '(filename)\n', (296, 306), False, 'import os\n'), ((333, 363), 'os.path.splitext', 'os.path.splitext', (['tempfilename'], {}), '(tempfilename)\n', (349, 363), False, 'import os\n')] |
import os
import csv
filepath = os.path.join("Resources", "employees.csv")
new_employee_data = []
#Read data into a dictionary and create an email
with open(filepath, newline="") as csvfile:
print(csvfile)
reader = csv.DictReader(csvfile)
#print(reader)
for row in reader:
print(row["... | [
"csv.DictWriter",
"csv.DictReader",
"os.path.join",
"os.path.split"
] | [((33, 75), 'os.path.join', 'os.path.join', (['"""Resources"""', '"""employees.csv"""'], {}), "('Resources', 'employees.csv')\n", (45, 75), False, 'import os\n'), ((797, 820), 'os.path.split', 'os.path.split', (['filepath'], {}), '(filepath)\n', (810, 820), False, 'import os\n'), ((857, 889), 'os.path.join', 'os.path.j... |
from PIL import Image
# prompt for file
name = input("File name: ")
img = Image.open(name)
# split into 3 profiles
red, green, blue = img.split()
# swap red and green
new_image = Image.merge('RGB', (green, red, blue))
new_image.save('output.png')
| [
"PIL.Image.open",
"PIL.Image.merge"
] | [((75, 91), 'PIL.Image.open', 'Image.open', (['name'], {}), '(name)\n', (85, 91), False, 'from PIL import Image\n'), ((182, 220), 'PIL.Image.merge', 'Image.merge', (['"""RGB"""', '(green, red, blue)'], {}), "('RGB', (green, red, blue))\n", (193, 220), False, 'from PIL import Image\n')] |
from django import forms
from apps.inicio.models import DatosPersonales
class PersonaForm(forms.ModelForm):
class Meta:
model = DatosPersonales
fields = ['id_datos_personales','dni','sexo',
'alias','fecha_nacimiento','telefono','celular','foto','id_auth_user',
]
labels = {
'dni':'DNI',
'alias'... | [
"django.forms.DateInput",
"django.forms.Select",
"django.forms.DateTimeInput",
"django.forms.FileInput",
"django.forms.TextInput"
] | [((525, 573), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'class': 'form-control'}"}), "(attrs={'class': 'form-control'})\n", (540, 573), False, 'from django import forms\n'), ((585, 633), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'class': 'form-control'}"}), "(attrs={'class': 'for... |
import pytest
import networkx as nx
from ..pyfastg import add_node_to_digraph
def test_basic():
def check_asdf(g):
assert "asdf" in g.nodes
assert g.nodes["asdf"]["cov"] == 5.2
assert g.nodes["asdf"]["gc"] == 4 / 6.0
assert g.nodes["asdf"]["length"] == 6
def check_ghjasdf(g):
... | [
"networkx.DiGraph",
"pytest.raises"
] | [((509, 521), 'networkx.DiGraph', 'nx.DiGraph', ([], {}), '()\n', (519, 521), True, 'import networkx as nx\n'), ((2032, 2044), 'networkx.DiGraph', 'nx.DiGraph', ([], {}), '()\n', (2042, 2044), True, 'import networkx as nx\n'), ((2921, 2933), 'networkx.DiGraph', 'nx.DiGraph', ([], {}), '()\n', (2931, 2933), True, 'impor... |
import pandas as pd
class DataLoader:
def __init__(self, config):
base_data_path = config.labels_generator.paths.base_data_path
test_data_path = config.defects_classifier.paths.test_data_path
generated_labels_path = config.labels_generator.paths.save_data_path
self.common_cols = ['... | [
"pandas.concat",
"pandas.read_csv"
] | [((726, 761), 'pandas.read_csv', 'pd.read_csv', (['path'], {'encoding': '"""utf-8"""'}), "(path, encoding='utf-8')\n", (737, 761), True, 'import pandas as pd\n'), ((1105, 1151), 'pandas.concat', 'pd.concat', (['[pos_train_df, unlabelled_train_df]'], {}), '([pos_train_df, unlabelled_train_df])\n', (1114, 1151), True, 'i... |
import bgapi.module
import time
import serial.tools.list_ports
from enum import Enum
class SensorTagServices(Enum):
Device = "1800"
DeviceInformation = "180A"
Battery = "180F"
Button = "FFE0"
IRTemp = "F000AA00-0451-4000-B000-000000000000"
H... | [
"time.sleep"
] | [((15133, 15148), 'time.sleep', 'time.sleep', (['(0.2)'], {}), '(0.2)\n', (15143, 15148), False, 'import time\n'), ((15780, 15795), 'time.sleep', 'time.sleep', (['(0.2)'], {}), '(0.2)\n', (15790, 15795), False, 'import time\n'), ((27679, 27694), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (27689, 27694), Fa... |
import torch
from torch import nn
from torch.nn import functional as F
from typing import Dict, Optional
from utils.misc_utils import combine_first_ax
from slowfast.models.video_model_builder import SlowFast, ResNet
from fairseq.models.transformer import (
TransformerEncoder,
TransformerDecoder,
# EncoderO... | [
"torch.nn.ReLU",
"torch.nn.AvgPool3d",
"vidsitu_code.seq_gen.EncoderOut",
"utils.misc_utils.combine_first_ax",
"torch.cat",
"torch.nn.AdaptiveAvgPool3d",
"transformers.GPT2LMHeadModel.from_pretrained",
"torch.nn.functional.cross_entropy",
"torch.nn.Linear",
"torch.nn.Embedding"
] | [((12728, 12874), 'vidsitu_code.seq_gen.EncoderOut', 'EncoderOut', ([], {'encoder_out': 'enc_out', 'encoder_padding_mask': 'None', 'encoder_embedding': 'None', 'encoder_states': 'None', 'src_tokens': 'None', 'src_lengths': 'None'}), '(encoder_out=enc_out, encoder_padding_mask=None,\n encoder_embedding=None, encoder_... |
import logging
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import get_object_or_404, render, redirect
from django.contrib import messages
from django.urls import reverse
from dal import autocomplete
from ..models import Guests
from ..forms import AddGuest
logging.basicConfig(level... | [
"logging.basicConfig",
"django.shortcuts.render",
"logging.getLogger",
"django.http.HttpResponse",
"django.shortcuts.get_object_or_404",
"django.contrib.messages.success",
"django.shortcuts.redirect",
"django.urls.reverse"
] | [((295, 334), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (314, 334), False, 'import logging\n'), ((344, 371), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (361, 371), False, 'import logging\n'), ((1335, 1373), 'django.shortcu... |
import numpy as np
import pandas as pd
import rpy2
import rpy2.robjects as ro
# ro.r('library(devtools)') ## to use source_url
# ro.r('library(tidyverse)')
############################## rpy2 functions ##############################
# def pull(r):
# return r2p(ro.globalenv[r])
# def push(py,rname=None):
# im... | [
"numpy.hstack",
"numpy.asmatrix",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.vstack",
"numpy.full",
"rpy2.robjects.r",
"numpy.arange"
] | [((3685, 3699), 'numpy.asmatrix', 'np.asmatrix', (['A'], {}), '(A)\n', (3696, 3699), True, 'import numpy as np\n'), ((3706, 3720), 'numpy.asmatrix', 'np.asmatrix', (['B'], {}), '(B)\n', (3717, 3720), True, 'import numpy as np\n'), ((4804, 4821), 'numpy.hstack', 'np.hstack', (['[A, B]'], {}), '([A, B])\n', (4813, 4821),... |
"""Definitions for filesystem-related [Tasks][snoop.data.models.Task].
These are the first steps in processing any dataset: walking the filesystem and recording files and
directories in their respective database tables.
The root directory for a dataset is explored by the [snoop.data.filesystem.walk][]
[Task][snoop.da... | [
"logging.getLogger",
"snoop.profiler.profile",
"json.load"
] | [((1162, 1189), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1179, 1189), False, 'import logging\n'), ((2082, 2091), 'snoop.profiler.profile', 'profile', ([], {}), '()\n', (2089, 2091), False, 'from snoop.profiler import profile\n'), ((6860, 6869), 'snoop.profiler.profile', 'profile', ... |
#!/usr/bin/env python
import sys
import PySimpleGUI as sg
# Recipe for getting keys, one at a time as they are released
# If want to use the space bar, then be sure and disable the "default focus"
layout = [[sg.Text("Press a key or scroll mouse")],
[sg.Text("", size=(18, 1), key='text')],
[sg.Butt... | [
"PySimpleGUI.Button",
"PySimpleGUI.Text",
"PySimpleGUI.Window"
] | [((351, 443), 'PySimpleGUI.Window', 'sg.Window', (['"""Keyboard Test"""', 'layout'], {'return_keyboard_events': '(True)', 'use_default_focus': '(False)'}), "('Keyboard Test', layout, return_keyboard_events=True,\n use_default_focus=False)\n", (360, 443), True, 'import PySimpleGUI as sg\n'), ((210, 248), 'PySimpleGUI... |
"""
``utils`` module with utility parsing functions.
"""
__all__ = [
'split_msg',
'get_newline_type',
'get_headers',
'parse_status_line',
'parse_request_line',
'parse_header_line',
]
import collections
import re
from . import constants, errors
SplitMessage = collections.named... | [
"collections.namedtuple",
"re.match"
] | [((303, 359), 'collections.namedtuple', 'collections.namedtuple', (['"""SplitRequest"""', "['head', 'body']"], {}), "('SplitRequest', ['head', 'body'])\n", (325, 359), False, 'import collections\n'), ((375, 442), 'collections.namedtuple', 'collections.namedtuple', (['"""RequestLine"""', "['method', 'uri', 'version']"],... |
# Uses python3
import sys
from gcd import get_gcd
def get_lcm(n, m):
gcd = get_gcd(n, m)
if gcd == 0: return 0
return n * (m // gcd)
if __name__ == '__main__':
input = sys.stdin.read()
a, b = map(int, input.split())
print(get_lcm(a, b)) | [
"sys.stdin.read",
"gcd.get_gcd"
] | [((81, 94), 'gcd.get_gcd', 'get_gcd', (['n', 'm'], {}), '(n, m)\n', (88, 94), False, 'from gcd import get_gcd\n'), ((187, 203), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (201, 203), False, 'import sys\n')] |
#!/usr/bin/env python
import os
import subprocess
#Changing Python working directory to script directory.
os.chdir(os.path.dirname(os.path.abspath(__file__)))
#Get activation code from user and prepend activation CLI
activation_code = input('Please press enter and input your activation code. If connecting to Tenable.sc... | [
"os.path.abspath",
"subprocess.run"
] | [((650, 735), 'subprocess.run', 'subprocess.run', (["['docker', 'build', './', '-f', 'Dockerfile', '-t', 'nnm-image']"], {}), "(['docker', 'build', './', '-f', 'Dockerfile', '-t', 'nnm-image']\n )\n", (664, 735), False, 'import subprocess\n'), ((777, 823), 'subprocess.run', 'subprocess.run', (["['docker-compose', 'u... |
from bltk.langtools.taggertools import adjective_suffix, noun_suffix, verb_suffix, pronouns
from bltk.langtools.pos_tagger import PosTagger
class UgraStemmer:
def __init__(self):
self.pos_tagger = PosTagger()
self.pronoun_values = list(pronouns.values())
self.pronoun_keys = list(pronouns.k... | [
"bltk.langtools.taggertools.pronouns.keys",
"bltk.langtools.taggertools.pronouns.values",
"bltk.langtools.pos_tagger.PosTagger"
] | [((211, 222), 'bltk.langtools.pos_tagger.PosTagger', 'PosTagger', ([], {}), '()\n', (220, 222), False, 'from bltk.langtools.pos_tagger import PosTagger\n'), ((258, 275), 'bltk.langtools.taggertools.pronouns.values', 'pronouns.values', ([], {}), '()\n', (273, 275), False, 'from bltk.langtools.taggertools import adjectiv... |
#Rock, Paper, Scissors game
from random import randint
player = input('rock(r), paper(p) or scissors(s)?')
print (player, ' vs ', end = ' ')
chosen = randint(1, 3)
#print(chosen)
if chosen == 1:
computer = 'r'
elif chosen == 2:
computer = 'p'
else:
computer = 's'
print(computer)
if player == computer:
print(... | [
"random.randint"
] | [((152, 165), 'random.randint', 'randint', (['(1)', '(3)'], {}), '(1, 3)\n', (159, 165), False, 'from random import randint\n')] |
# Copyright (c) Microsoft Corporation and Fairlearn contributors.
# Licensed under the MIT License.
from typing import Any, Callable, Dict, Optional
import logging
import numpy as np
logger = logging.getLogger(__name__)
_DEFAULT_NAME = 'metric'
_METRIC_FUNCTION_NONE = "Found 'None' instead of metric function"
_METR... | [
"logging.getLogger",
"numpy.asarray"
] | [((194, 221), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (211, 221), False, 'import logging\n'), ((2006, 2019), 'numpy.asarray', 'np.asarray', (['v'], {}), '(v)\n', (2016, 2019), True, 'import numpy as np\n')] |
from collections import OrderedDict
from datetime import date, timedelta, datetime
from typing import List
from ux.sequences.action_sequence import ActionSequence
from ux.compound_types import DatePair, DateTimePair
from ux.utils.dates import monday_on_or_before, date_to_datetime
def _get_sequence_start_end_dates(se... | [
"datetime.datetime",
"collections.OrderedDict",
"ux.utils.dates.date_to_datetime",
"datetime.date",
"datetime.timedelta",
"ux.utils.dates.monday_on_or_before"
] | [((2793, 2806), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2804, 2806), False, 'from collections import OrderedDict\n'), ((4112, 4125), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (4123, 4125), False, 'from collections import OrderedDict\n'), ((5269, 5300), 'ux.utils.dates.monday_on_or... |
import logging
import os
from abc import ABC
import numpy as np
import pandas as pd
import torch
import torch.nn.functional as F
from sklearn.metrics.pairwise import cosine_distances
logger = logging.getLogger()
class EvalDatasetMixin(ABC):
def store_scores_batch(self, q_idx, scores):
# fact idxs are a... | [
"logging.getLogger",
"pandas.DataFrame",
"sklearn.metrics.pairwise.cosine_distances",
"numpy.where",
"os.path.join",
"warnings.catch_warnings",
"numpy.argsort",
"numpy.array",
"numpy.nanmean",
"numpy.isnan",
"numpy.vstack",
"numpy.concatenate",
"torch.save",
"warnings.simplefilter",
"tor... | [((194, 213), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (211, 213), False, 'import logging\n'), ((1479, 1530), 'numpy.concatenate', 'np.concatenate', (['(row.partial_expl, [selected_fact])'], {}), '((row.partial_expl, [selected_fact]))\n', (1493, 1530), True, 'import numpy as np\n'), ((1615, 1640), 'n... |
import os
import sqlite3
from flask import current_app, g
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
DATABASE = os.path.join(BASE_DIR, "data/database.db")
def get_db():
db = getattr(g, '_database', None)
if db is None:
db = g._database = sqlite3.connect(DATABASE)
return db
def close_c... | [
"os.path.abspath",
"os.path.join",
"sqlite3.connect"
] | [((125, 167), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""data/database.db"""'], {}), "(BASE_DIR, 'data/database.db')\n", (137, 167), False, 'import os\n'), ((87, 112), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (102, 112), False, 'import os\n'), ((268, 293), 'sqlite3.connect', 'sql... |
from games.abstract_game import AbstractGame
import subprocess
from constants import *
import json
import platform
class Mario(AbstractGame):
"""
Represents a single Mario game.
"""
def __init__(self, model, game_batch_size, seed, level=None, vis_on=False, use_visualization_tool=False, test=False):
... | [
"subprocess.Popen",
"json.loads",
"platform.system"
] | [((2284, 2372), 'subprocess.Popen', 'subprocess.Popen', (['command'], {'stdin': 'subprocess.PIPE', 'stdout': 'subprocess.PIPE', 'bufsize': '(-1)'}), '(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE,\n bufsize=-1)\n', (2300, 2372), False, 'import subprocess\n'), ((2851, 2867), 'json.loads', 'json.loads', (['l... |