code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import datetime
import functools
import io
import os
import zipfile
import httpx
import pytest
from coverage_comment import coverage as coverage_module
from coverage_comment import github_client, settings
@pytest.fixture
def base_config():
def _(**kwargs):
defaults = {
# GitHub stuff
... | [
"datetime.datetime",
"zipfile.ZipFile",
"coverage_comment.github_client.GitHub",
"io.BytesIO",
"coverage_comment.coverage.FileDiffCoverage",
"os.getcwd",
"os.chdir",
"coverage_comment.settings.Config",
"httpx.Request",
"coverage_comment.coverage.CoverageInfo"
] | [((8990, 9027), 'coverage_comment.github_client.GitHub', 'github_client.GitHub', ([], {'session': 'session'}), '(session=session)\n', (9010, 9027), False, 'from coverage_comment import github_client, settings\n'), ((9422, 9433), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (9431, 9433), False, 'import os\n'), ((9438, 94... |
from colorama import Fore, Style
from Player import Player
class InputService:
def __init__(self):
self.game_board = ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']
self.available_tiles = list(range(1, 10))
@staticmethod
def get_player_names():
player_1_name_input = input("Pl... | [
"Player.Player.player_from_input"
] | [((1501, 1561), 'Player.Player.player_from_input', 'Player.player_from_input', (['player_1_name_input', 'player_1_move'], {}), '(player_1_name_input, player_1_move)\n', (1525, 1561), False, 'from Player import Player\n'), ((1581, 1641), 'Player.Player.player_from_input', 'Player.player_from_input', (['player_2_name_inp... |
"""Provides the blueprint for the fulltext API."""
from typing import Optional, Callable, Any, List
from flask import request, Blueprint, Response, make_response
from werkzeug.exceptions import NotAcceptable, BadRequest, NotFound
from flask.json import jsonify
from arxiv import status
from arxiv.users.domain import Se... | [
"werkzeug.exceptions.BadRequest",
"flask.request.auth.is_authorized",
"flask.json.jsonify",
"werkzeug.exceptions.NotAcceptable",
"arxiv.base.logging.getLogger",
"werkzeug.exceptions.NotFound",
"fulltext.controllers.get_task_status",
"fulltext.controllers.start_extraction",
"fulltext.controllers.retr... | [((545, 572), 'arxiv.base.logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (562, 572), False, 'from arxiv.base import logging\n'), ((687, 733), 'flask.Blueprint', 'Blueprint', (['"""fulltext"""', '__name__'], {'url_prefix': '""""""'}), "('fulltext', __name__, url_prefix='')\n", (696, 733), F... |
from math import exp, log
from random import random
from pandas import DataFrame
from BaseBanditAlgorithm import BaseBanditAlgorithm
class Softmax(BaseBanditAlgorithm):
"""
Implementation of the Softmax algorithm for Multi-Armed Bandit
"""
def __init__(self, temperature=0.1, annealing=False, cou... | [
"pandas.DataFrame",
"math.exp",
"random.random",
"math.log"
] | [((716, 766), 'pandas.DataFrame', 'DataFrame', (["{'Iteration': counts, 'Reward': values}"], {}), "({'Iteration': counts, 'Reward': values})\n", (725, 766), False, 'from pandas import DataFrame\n'), ((1419, 1427), 'random.random', 'random', ([], {}), '()\n', (1425, 1427), False, 'from random import random\n'), ((1909, ... |
# ABC066a
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
bell = tuple(map(int, input().split()))
print(sum(bell)-max(bell))
| [
"sys.setrecursionlimit"
] | [((48, 78), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10 ** 6)'], {}), '(10 ** 6)\n', (69, 78), False, 'import sys\n')] |
# Generated by Django 2.2.12 on 2020-05-21 03:10
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('accounts', '0002_auto_20200501_0524'),
('classifications', '0001_initial'),
]
... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.BooleanField",
"django.db.models.SlugField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((447, 540), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (463, 540), False, 'from django.db import migrations, models\... |
# ============================================================================
# FILE: junkfile.py
# AUTHOR: <NAME> <Shougo.Matsu at gmail.<EMAIL>>
# License: MIT license
# ============================================================================
from .base import Base
from time import strftime
from denite.util imp... | [
"time.strftime",
"os.path.join",
"denite.util.expand",
"os.path.basename",
"os.path.getmtime",
"os.walk"
] | [((579, 622), 'denite.util.expand', 'expand', (["self.vim.vars['junkfile#directory']"], {}), "(self.vim.vars['junkfile#directory'])\n", (585, 622), False, 'from denite.util import expand\n'), ((1105, 1118), 'os.walk', 'os.walk', (['base'], {}), '(base)\n', (1112, 1118), False, 'import os\n'), ((776, 810), 'time.strftim... |
# Generated by Django 3.1.5 on 2021-01-29 09:54
import api.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='User',
fields=[
... | [
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((617, 705), 'django.db.models.CharField', 'models.CharField', ([], {'default': 'api.models.generate_unique_code', 'max_length': '(8)', 'unique': '(True)'}), '(default=api.models.generate_unique_code, max_length=8,\n unique=True)\n', (633, 705), False, 'from django.db import migrations, models\n'), ((331, 424), 'dj... |
#!/usr/bin/env python
# pylint: disable=wrong-import-position
# -*- coding: utf-8 -*-
"""
To run this script uncomment the following lines in the
[options.entry_points] section in setup.cfg:
console_scripts =
fibonacci = dbupdater.skeleton:run
Then run `python setup.py install` which will install the com... | [
"firebase_admin.db.reference",
"psycopg2.connect",
"firebase_admin.initialize_app",
"pathlib.Path",
"inspect.currentframe",
"json.dump",
"json.dumps",
"geocoder.google",
"time.sleep",
"firebase_admin.credentials.Certificate",
"twitter.Api",
"json.load",
"psycopg2.extras.execute_values",
"o... | [((1068, 1118), 'os.path.expanduser', 'expanduser', (['"""~/Projects/twitter_map_react/db.json"""'], {}), "('~/Projects/twitter_map_react/db.json')\n", (1078, 1118), False, 'from os.path import expanduser\n'), ((1913, 2035), 'twitter.Api', 'twitter.Api', (["config['CONSUMER_KEY']", "config['CONSUMER_SECRET']", "config[... |
import sys,os
for path in [
'rindow/framework/lib',
]:
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), path)))
| [
"os.path.abspath"
] | [((118, 143), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (133, 143), False, 'import sys, os\n')] |
"""
Generate download locations within a country and download them.
Written by <NAME>.
5/2020
"""
import os
import configparser
import math
import pandas as pd
import numpy as np
import random
import geopandas as gpd
from shapely.geometry import Point
import requests
import matplotlib.pyplot as plt
from PIL import Ima... | [
"random.uniform",
"os.listdir",
"os.makedirs",
"matplotlib.pyplot.imsave",
"os.path.join",
"math.sqrt",
"random.seed",
"shapely.geometry.Point",
"time.sleep",
"numpy.linspace",
"utils.PlanetDownloader",
"sys.path.append"
] | [((437, 462), 'sys.path.append', 'sys.path.append', (['BASE_DIR'], {}), '(BASE_DIR)\n', (452, 462), False, 'import sys\n'), ((602, 645), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""data"""', '"""countries"""'], {}), "(BASE_DIR, 'data', 'countries')\n", (614, 645), False, 'import os\n'), ((657, 707), 'os.path.join... |
# Enter script code
import re
winClass = window.get_active_class()
isTerminalWin1 = re.search("konsole\\.konsole", winClass)
isTerminalWin2 = re.search("x+terminal.*", winClass)
if isTerminalWin1 or isTerminalWin2:
keyboard.send_keys("<ctrl>+<shift>+t")
else:
keyboard.send_keys("<ctrl>+t")
| [
"re.search"
] | [((84, 124), 're.search', 're.search', (['"""konsole\\\\.konsole"""', 'winClass'], {}), "('konsole\\\\.konsole', winClass)\n", (93, 124), False, 'import re\n'), ((142, 177), 're.search', 're.search', (['"""x+terminal.*"""', 'winClass'], {}), "('x+terminal.*', winClass)\n", (151, 177), False, 'import re\n')] |
# -*- coding: utf-8 -*-
""" The Neural Network classifier for IRIS. """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import urllib
import numpy as np
import tensorflow as tf
# Data sets
IRIS_TRAINING = "IRIS_data/iris_training.csv"
IRIS_TRAINI... | [
"os.path.exists",
"tensorflow.estimator.DNNClassifier",
"tensorflow.contrib.learn.datasets.base.load_csv_with_header",
"tensorflow.estimator.inputs.numpy_input_fn",
"tensorflow.feature_column.numeric_column",
"numpy.array",
"urllib.request.urlopen"
] | [((982, 1107), 'tensorflow.contrib.learn.datasets.base.load_csv_with_header', 'tf.contrib.learn.datasets.base.load_csv_with_header', ([], {'filename': 'IRIS_TRAINING', 'target_dtype': 'np.int', 'features_dtype': 'np.float'}), '(filename=IRIS_TRAINING,\n target_dtype=np.int, features_dtype=np.float)\n', (1033, 1107),... |
from drift import *
from hard_edge_transport import *
from hard_edge_sol import *
from accel import *
import sys
class Stage(HardEdgeTransport):
"""
A final cooling stage comprises:
HardEdgeTransport with transport field comprising:
(1) Drift (d1)
(2) HardEdgeSol
(3) Drift (d2)
(4) Acc... | [
"sys.exit"
] | [((4802, 4813), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (4810, 4813), False, 'import sys\n')] |
import math
class Vec3:
def __init__(self, x=.0, y=.0, z=.0):
self.x = float(x)
self.y = float(y)
self.z = float(z)
def __str__(self):
return "Vector(%.4f, %.4f, %.4f)" % (self.x, self.y, self.z)
def __add__(self, vec):
return Vec3(self.x+vec.x,... | [
"math.sqrt"
] | [((830, 880), 'math.sqrt', 'math.sqrt', (['(self.x ** 2 + self.y ** 2 + self.z ** 2)'], {}), '(self.x ** 2 + self.y ** 2 + self.z ** 2)\n', (839, 880), False, 'import math\n')] |
import os
import re
import shutil
from ._base import DanubeCloudCommand, CommandOption, CommandError, lcd
class Command(DanubeCloudCommand):
help = 'Generate documentation files displayed in GUI.'
DOC_REPO = 'https://github.com/erigones/esdc-docs.git'
DOC_TMP_DIR = '/var/tmp/esdc-docs'
options = (
... | [
"os.open",
"os.path.join",
"os.path.isfile",
"shutil.rmtree",
"re.search"
] | [((1337, 1424), 'os.path.join', 'os.path.join', (['self.settings.PROJECT_DIR', '"""var"""', '"""www"""', '"""static"""', '"""api"""', '"""bin"""', '"""es"""'], {}), "(self.settings.PROJECT_DIR, 'var', 'www', 'static', 'api',\n 'bin', 'es')\n", (1349, 1424), False, 'import os\n'), ((1513, 1539), 'os.path.isfile', 'os... |
# -*- coding: utf-8 -*-
"""
Created on 09 Nov 2020 22:25:38
@author: jiahuei
cd caption_vae
python -m scripts.plot_nonzero_weights_kde --log_dir x --id y
/home/jiahuei/Documents/1_TF_files/prune/mscoco_v3
word_w256_LSTM_r512_h1_ind_xu_REG_1.0e+02_init_5.0_L1_wg_60.0_ann_sps_0.975_dec_prune_cnnFT/run_01_sparse
/home/... | [
"logging.getLogger",
"seaborn.cubehelix_palette",
"utils.misc.configure_logging",
"scipy.stats.mstats.winsorize",
"seaborn.color_palette",
"seaborn.despine",
"argparse.ArgumentParser",
"matplotlib.pyplot.figtext",
"matplotlib.pyplot.close",
"matplotlib.pyplot.savefig",
"seaborn.set_context",
"... | [((887, 914), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (904, 914), False, 'import logging\n'), ((923, 962), 'seaborn.color_palette', 'sns.color_palette', (['"""gray_r"""'], {'n_colors': '(3)'}), "('gray_r', n_colors=3)\n", (940, 962), True, 'import seaborn as sns\n'), ((972, 1012), ... |
from django.contrib.auth import get_user_model
from django.db import models
class Log(models.Model):
"""
Model that describe a Log object, it contains information about daily
executions.
"""
execution_time = models.FloatField()
users = models.IntegerField()
lessons = models.IntegerField()
... | [
"django.contrib.auth.get_user_model",
"django.db.models.DateField",
"django.db.models.FloatField",
"django.db.models.IntegerField",
"django.db.models.BooleanField"
] | [((230, 249), 'django.db.models.FloatField', 'models.FloatField', ([], {}), '()\n', (247, 249), False, 'from django.db import models\n'), ((262, 283), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (281, 283), False, 'from django.db import models\n'), ((298, 319), 'django.db.models.IntegerFie... |
import logging
from typing import Any, Dict, List
from unittest import TestCase
import pytest
from grapl_analyzerlib.nodes.lens import LensQuery, LensView
from grapl_tests_common.clients.engagement_edge_client import EngagementEdgeClient
from grapl_tests_common.clients.graphql_endpoint_client import GraphqlEndpointCli... | [
"grapl_analyzerlib.nodes.lens.LensQuery",
"grapl_tests_common.wait.WaitForQuery",
"grapl_tests_common.wait.WaitForCondition",
"logging.info",
"grapl_tests_common.clients.engagement_edge_client.EngagementEdgeClient"
] | [((911, 930), 'grapl_tests_common.wait.WaitForQuery', 'WaitForQuery', (['query'], {}), '(query)\n', (923, 930), False, 'from grapl_tests_common.wait import WaitForCondition, WaitForQuery, wait_for_one\n'), ((1123, 1190), 'logging.info', 'logging.info', (['f"""Expected 3-5 nodes in scope, currently is {length}"""'], {})... |
import json
import os
from eg import config
from eg import substitute
from eg import util
from mock import Mock
from mock import patch
PATH_UNSQUEEZED_FILE = os.path.join(
'test',
'assets',
'pwd_unsqueezed.md'
)
PATH_SQUEEZED_FILE = os.path.join(
'test',
'assets',
'pwd_squeezed.md'
)
def _cr... | [
"mock.Mock",
"eg.util.get_file_paths_for_program",
"eg.util._is_example_file",
"eg.util.handle_program",
"eg.util.get_list_of_all_supported_commands",
"eg.util._get_alias_file_path",
"eg.substitute.Substitution",
"mock.patch",
"eg.util.page_string",
"eg.util.get_squeezed_contents",
"json.dumps",... | [((160, 211), 'os.path.join', 'os.path.join', (['"""test"""', '"""assets"""', '"""pwd_unsqueezed.md"""'], {}), "('test', 'assets', 'pwd_unsqueezed.md')\n", (172, 211), False, 'import os\n'), ((247, 296), 'os.path.join', 'os.path.join', (['"""test"""', '"""assets"""', '"""pwd_squeezed.md"""'], {}), "('test', 'assets', '... |
def format_card(card_num):
"""
Formats card numbers to remove any spaces, unnecessary characters, etc
Input: Card number, integer or string
Output: Correctly formatted card number, string
"""
import re
card_num = str(card_num)
# Regex to remove any nondigit characters
return re.sub(... | [
"re.sub"
] | [((313, 340), 're.sub', 're.sub', (['"""\\\\D"""', '""""""', 'card_num'], {}), "('\\\\D', '', card_num)\n", (319, 340), False, 'import re\n')] |
from abc import ABC, abstractmethod
from oop_di import ContainerDefinition, Extension
# #############Mailer bounded context###############
class MailerInterface(ABC):
@abstractmethod
def send_mail(self):
...
class Mailer(MailerInterface):
def __init__(self, from_email):
self.from_email... | [
"oop_di.ContainerDefinition"
] | [((1005, 1026), 'oop_di.ContainerDefinition', 'ContainerDefinition', ([], {}), '()\n', (1024, 1026), False, 'from oop_di import ContainerDefinition, Extension\n')] |
#!/usr/bin/env python
"""
nearest_cloud.py - Version 1.0 2013-07-28
Compute the COG of the nearest object in x-y-z space and publish as a PoseStamped message.
Relies on PCL ROS nodelets in the launch file to pre-filter the
cloud on the x, y and z dimensions.
Based on the follower app... | [
"rospy.init_node",
"cv2.fitEllipse",
"sensor_msgs.point_cloud2.read_points",
"numpy.mean",
"geometry_msgs.msg.Quaternion",
"rospy.spin",
"rospy.Subscriber",
"rospy.get_param",
"math.radians",
"rospy.Time.now",
"geometry_msgs.msg.Point",
"rospy.Publisher",
"rospy.loginfo",
"rospy.wait_for_m... | [((1422, 1454), 'rospy.init_node', 'rospy.init_node', (['"""nearest_cloud"""'], {}), "('nearest_cloud')\n", (1437, 1454), False, 'import rospy\n'), ((1490, 1524), 'rospy.get_param', 'rospy.get_param', (['"""~min_points"""', '(25)'], {}), "('~min_points', 25)\n", (1505, 1524), False, 'import rospy\n'), ((1553, 1590), 'r... |
import lvgl as lv
import utime
# RESOURCES_ROOT = "S:/Users/liujuncheng/workspace/iot/esp32/solution/HaaSPython/solutions/smart_panel/"
RESOURCES_ROOT = "S:/data/pyamp/"
def drawOver(e):
global g_clickTime
if (g_clickTime != 0):
currentTime = utime.ticks_ms()
print("create Environment page us... | [
"lvgl.color_make",
"lvgl.scr_load_anim",
"lvgl.label",
"lvgl.img",
"lvgl.color_black",
"smart_panel.load_smart_panel",
"utime.ticks_ms",
"lvgl.obj",
"lvgl.color_white"
] | [((262, 278), 'utime.ticks_ms', 'utime.ticks_ms', ([], {}), '()\n', (276, 278), False, 'import utime\n'), ((577, 595), 'smart_panel.load_smart_panel', 'load_smart_panel', ([], {}), '()\n', (593, 595), False, 'from smart_panel import load_smart_panel\n'), ((925, 941), 'utime.ticks_ms', 'utime.ticks_ms', ([], {}), '()\n'... |
import logging
import os
import threading
from xml.etree import ElementTree # nosec
import xbmc
from lib import routes # noqa
from lib.httpserver import threaded_http_server
from lib.kodi import ADDON_PATH, get_repository_port, set_logger
def update_repository_port(port, xml_path=os.path.join(ADDON_PATH, "addon.x... | [
"xml.etree.ElementTree.parse",
"logging.debug",
"lib.kodi.get_repository_port",
"os.path.join",
"lib.kodi.set_logger",
"lib.httpserver.threaded_http_server"
] | [((287, 324), 'os.path.join', 'os.path.join', (['ADDON_PATH', '"""addon.xml"""'], {}), "(ADDON_PATH, 'addon.xml')\n", (299, 324), False, 'import os\n'), ((389, 416), 'xml.etree.ElementTree.parse', 'ElementTree.parse', (['xml_path'], {}), '(xml_path)\n', (406, 416), False, 'from xml.etree import ElementTree\n'), ((1804,... |
import torch
from data import get_diff
import editdistance
import re
from data import chars
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
import matplotlib.pyplot as plt
from matplotlib import pylab
import numpy as np
char_to_idx = {ch: i for i, ch in enumerate(chars)}
device = torch.device... | [
"torch.manual_seed",
"numpy.mean",
"torch.device",
"torch.topk",
"torch.load",
"matplotlib.pyplot.close",
"torch.no_grad",
"torch.cuda.is_available",
"matplotlib.pyplot.subplots",
"torch.save",
"matplotlib.pyplot.scatter",
"torch.nn.utils.rnn.pack_padded_sequence",
"re.sub",
"editdistance.... | [((371, 391), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (388, 391), False, 'import torch\n'), ((4898, 4923), 'torch.zeros', 'torch.zeros', (['output.shape'], {}), '(output.shape)\n', (4909, 4923), False, 'import torch\n'), ((4939, 4967), 'torch.topk', 'torch.topk', (['output', '(3)'], {'dim': '(... |
"""
A simple stream constructor that constructs a Stream by evaluating
parameter substitutions from a dictionary parameters. Finds tokens of the form
\{\{([a-zA-Z_-][\w-]*)\}\}
and replaces {{var}} with the contents of gettattr(parameters, var) in
the new stream.
"""
import re
from StringIO import StringIO
class Te... | [
"StringIO.StringIO.__init__",
"re.compile"
] | [((451, 495), 're.compile', 're.compile', (['"""\\\\{\\\\{([a-zA-Z_][\\\\w-]*)\\\\}\\\\}"""'], {}), "('\\\\{\\\\{([a-zA-Z_][\\\\w-]*)\\\\}\\\\}')\n", (461, 495), False, 'import re\n'), ((787, 810), 'StringIO.StringIO.__init__', 'StringIO.__init__', (['self'], {}), '(self)\n', (804, 810), False, 'from StringIO import St... |
import pyxel
import constants as c
import random
class Gachi:
def __init__(self, x, y):
self.x = x
self.y = y
self.x_side = [-16, 16, 16, 16, 16, 16]
self.y_side = [16, -16, 16, 16, 16, 16, 16, 16, 16, 16]
self.hp = c.gachi_hp
def draw(self):
pyxel.blt(self... | [
"pyxel.blt"
] | [((559, 598), 'pyxel.blt', 'pyxel.blt', (['(-2)', '(10)', '(0)', '(48)', '(48)', '(16)', '(16)', '(0)'], {}), '(-2, 10, 0, 48, 48, 16, 16, 0)\n', (568, 598), False, 'import pyxel\n'), ((607, 652), 'pyxel.blt', 'pyxel.blt', (['(-18)', '(10)', '(0)', '(48 + 16)', '(48)', '(16)', '(16)', '(0)'], {}), '(-18, 10, 0, 48 + 16... |
import numpy as np
import pydicom as dicom
def read_dicom(filename):
"""Read DICOM file and convert it to a decent quality uint8 image.
Parameters
----------
filename: str
Existing DICOM file filename.
"""
try:
data = dicom.read_file(filename)
img = np.frombuffer(data.... | [
"numpy.frombuffer",
"numpy.ones",
"numpy.diff",
"numpy.argsort",
"pydicom.read_file",
"numpy.percentile"
] | [((950, 988), 'numpy.percentile', 'np.percentile', (['img', '[cut_min, cut_max]'], {}), '(img, [cut_min, cut_max])\n', (963, 988), True, 'import numpy as np\n'), ((261, 286), 'pydicom.read_file', 'dicom.read_file', (['filename'], {}), '(filename)\n', (276, 286), True, 'import pydicom as dicom\n'), ((1719, 1740), 'numpy... |
# desafio 21
import pygame
pygame.mixer.init()
pygame.mixer.music.load('Deutschland.mp3')
pygame.mixer.music.play()
while (pygame.mixer.music.get_busy()): pass | [
"pygame.mixer.music.play",
"pygame.mixer.music.get_busy",
"pygame.mixer.init",
"pygame.mixer.music.load"
] | [((28, 47), 'pygame.mixer.init', 'pygame.mixer.init', ([], {}), '()\n', (45, 47), False, 'import pygame\n'), ((48, 90), 'pygame.mixer.music.load', 'pygame.mixer.music.load', (['"""Deutschland.mp3"""'], {}), "('Deutschland.mp3')\n", (71, 90), False, 'import pygame\n'), ((91, 116), 'pygame.mixer.music.play', 'pygame.mixe... |
import datetime
import appdaemon.plugins.hass.hassapi as hass
import calendar
SHOULDER_START_HOUR = 13
PEAK_START_HOUR = 15
PEAK_END_HOUR = 19
# SHOULDER_END_HOUR = 21
SUMMER_MONTHS = [6, 7, 8, 9]
ON_PEAK = 'on-peak'
SHOULDER = 'shoulder'
OFF_PEAK = 'off-peak'
# PCCA = 0.00401
# DSMCA = 0.00159
# TCA = 0.00203
# CA... | [
"datetime.datetime",
"datetime.time",
"datetime.datetime.now",
"calendar.monthcalendar",
"datetime.timedelta"
] | [((3141, 3164), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (3162, 3164), False, 'import datetime\n'), ((1186, 1209), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1207, 1209), False, 'import datetime\n'), ((1333, 1383), 'datetime.datetime', 'datetime.datetime', (['self.ye... |
import sys
from itertools import permutations
read = sys.stdin.readline
n = int(read())
arr = list(map(int, read().split()))
# 순열로 조합한다.
cases = list(permutations(arr))
result = 0
for card in cases:
ans = 0
for idx in range(n - 1):
ans += abs(card[idx] - card[idx + 1])
result = max(result, ans... | [
"itertools.permutations"
] | [((154, 171), 'itertools.permutations', 'permutations', (['arr'], {}), '(arr)\n', (166, 171), False, 'from itertools import permutations\n')] |
"""
It contains customadmin's models. It's used to customize admin's interface
"""
from upy.contrib.tree.models import _
from django.db import models
from upy.contrib.colors.fields import ColorField
from upy.contrib.sortable.models import PositionModel
from django.conf import settings
from imagekit.models import ImageS... | [
"upy.contrib.tree.models._",
"pilkit.processors.ResizeToFit"
] | [((3671, 3684), 'upy.contrib.tree.models._', '_', (['u"""Default"""'], {}), "(u'Default')\n", (3672, 3684), False, 'from upy.contrib.tree.models import _\n'), ((10352, 10370), 'upy.contrib.tree.models._', '_', (['u"""Custom Admin"""'], {}), "(u'Custom Admin')\n", (10353, 10370), False, 'from upy.contrib.tree.models imp... |
#! /usr/bin/env python
import os
import shutil
import sys
import gdal
import wetland_id_defaults as default
"""
Folder structure for pyGeoNet is as follows
geoNetHomeDir : defines where files will be written
e.g.
geoNetHomeDir = "C:\\Mystuff\\IO_Data\\"
--- \\data (input lidar files will be rea... | [
"gdal.UseExceptions",
"os.path.join",
"sys.platform.startswith",
"os.getcwd"
] | [((999, 1010), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1008, 1010), False, 'import os\n'), ((1372, 1392), 'gdal.UseExceptions', 'gdal.UseExceptions', ([], {}), '()\n', (1390, 1392), False, 'import gdal\n'), ((2616, 2672), 'os.path.join', 'os.path.join', (['shapefilepath', "(pointshapefileName + '.shp')"], {}), "(s... |
# AUTOGENERATED! DO NOT EDIT! File to edit: ttbarzp.ipynb (unless otherwise specified).
__all__ = ['get_elijah_ttbarzp_cs', 'get_manuel_ttbarzp_cs', 'import47Ddata', 'get47Dfeatures']
# Cell
import numpy as np
import tensorflow as tf
# Cell
def get_elijah_ttbarzp_cs():
r"""
Contains cross section information... | [
"numpy.load",
"tensorflow.keras.utils.get_file"
] | [((2383, 2442), 'tensorflow.keras.utils.get_file', 'tf.keras.utils.get_file', (['f"""{name}.npy"""', "(url + name + '.npy')"], {}), "(f'{name}.npy', url + name + '.npy')\n", (2406, 2442), True, 'import tensorflow as tf\n'), ((2458, 2471), 'numpy.load', 'np.load', (['path'], {}), '(path)\n', (2465, 2471), True, 'import ... |
# SPDX-FileCopyrightText: 2021 iteratec GmbH
#
# SPDX-License-Identifier: Apache-2.0
import argparse
import logging
import sys
from zapv2 import ZAPv2
from .zap_automation import ZapAutomation
# set up logging to file - see previous section for more details
logging.basicConfig(
level=logging.INFO,
format='%... | [
"logging.basicConfig",
"logging.getLogger",
"argparse.ArgumentParser",
"logging.exception",
"sys.exit",
"zapv2.ZAPv2",
"logging.info"
] | [((262, 400), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s %(name)-12s %(levelname)-8s: %(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M"""'}), "(level=logging.INFO, format=\n '%(asctime)s %(name)-12s %(levelname)-8s: %(message)s', datefmt=\n '%Y-%m-%d %H:%M... |
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Founda... | [
"SimPy.Simulation.now",
"OperatedMachine.OperatedMachine",
"SimPy.Simulation.Resource"
] | [((14945, 14968), 'SimPy.Simulation.Resource', 'Resource', (['self.capacity'], {}), '(self.capacity)\n', (14953, 14968), False, 'from SimPy.Simulation import Process, Resource, now, activate, passivate, waituntil, hold\n'), ((19250, 19255), 'SimPy.Simulation.now', 'now', ([], {}), '()\n', (19253, 19255), False, 'from S... |
''' An example of playing randomly in RLCard
'''
import argparse
import pprint
import rlcard
from rlcard.agents import RandomAgent
from rlcard.utils import set_seed
def run(args):
# Make environment
env = rlcard.make(args.env, config={'seed': 42})
# Seed numpy, torch, random
set_seed(42)
# Set a... | [
"rlcard.make",
"argparse.ArgumentParser",
"rlcard.utils.set_seed",
"rlcard.agents.RandomAgent",
"pprint.pprint"
] | [((215, 257), 'rlcard.make', 'rlcard.make', (['args.env'], {'config': "{'seed': 42}"}), "(args.env, config={'seed': 42})\n", (226, 257), False, 'import rlcard\n'), ((295, 307), 'rlcard.utils.set_seed', 'set_seed', (['(42)'], {}), '(42)\n', (303, 307), False, 'from rlcard.utils import set_seed\n'), ((338, 378), 'rlcard.... |
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 4 11:01:16 2015
@author: hehu
"""
import matplotlib.pyplot as plt
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
from sklearn.lda import LDA
from sklearn.svm import SVC, LinearSVC
from sklearn.linear_model import LogisticRegression
from sklearn.na... | [
"numpy.array",
"numpy.arange",
"matplotlib.pyplot.close",
"numpy.dot",
"numpy.linspace",
"numpy.random.seed",
"numpy.concatenate",
"numpy.argmin",
"numpy.hypot",
"matplotlib.pyplot.axis",
"numpy.tile",
"matplotlib.pyplot.savefig",
"numpy.ones",
"matplotlib.pyplot.title",
"numpy.random.ra... | [((788, 816), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '[6, 6]'}), '(figsize=[6, 6])\n', (800, 816), True, 'import matplotlib.pyplot as plt\n'), ((820, 837), 'matplotlib.pyplot.axis', 'plt.axis', (['"""equal"""'], {}), "('equal')\n", (828, 837), True, 'import matplotlib.pyplot as plt\n'), ((5852, ... |
import argparse
import os
import random
import pandas as pd
class DatasetSplitter:
""" Class that can be used to create a reproducible random-split of a dataset into train/validation/test sets """
def split_annotations_into_training_validation_and_test_set(self, dataset_directory: str,
... | [
"random.sample",
"os.path.join",
"argparse.ArgumentParser",
"random.seed"
] | [((2740, 2765), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2763, 2765), False, 'import argparse\n'), ((1065, 1082), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1076, 1082), False, 'import random\n'), ((1304, 1354), 'random.sample', 'random.sample', (['all_indices', 'validati... |
# coding: utf-8
"""
Translator Knowledge Beacon API
This is the Translator Knowledge Beacon web service application programming interface (API). # noqa: E501
The version of the OpenAPI document: 1.3.0
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
from __future__ import abs... | [
"unittest.main",
"tkbeacon.api.beacon_api.BeaconApi"
] | [((1602, 1617), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1615, 1617), False, 'import unittest\n'), ((585, 620), 'tkbeacon.api.beacon_api.BeaconApi', 'tkbeacon.api.beacon_api.BeaconApi', ([], {}), '()\n', (618, 620), False, 'import tkbeacon\n')] |
import FWCore.ParameterSet.Config as cms
BtagPerformanceESProducer_TTBARWPBTAGCSVL = cms.ESProducer("BtagPerformanceESProducer",
# this is what it makes available
ComponentName = cms.string('TTBARWPBTAGCSVL'),
# this is where it gets the payload from
PayloadName =... | [
"FWCore.ParameterSet.Config.string"
] | [((183, 212), 'FWCore.ParameterSet.Config.string', 'cms.string', (['"""TTBARWPBTAGCSVL"""'], {}), "('TTBARWPBTAGCSVL')\n", (193, 212), True, 'import FWCore.ParameterSet.Config as cms\n'), ((321, 370), 'FWCore.ParameterSet.Config.string', 'cms.string', (['"""BTagTTBARWPBTAGCSVLtable_v8_offline"""'], {}), "('BTagTTBARWPB... |
import numpy as np
import os
import os.path as op
import cv2
from tqdm import tqdm
import multiprocessing
from FeatureExtractor import get_gist_C_implementation
from utils import ensure_dir, info
input_dir = "./dataset/raw_image"
catalog = {}
paths = []
feats = []
for (root, dirs, files) in os.walk(input_dir):
fo... | [
"utils.info",
"numpy.savez",
"FeatureExtractor.get_gist_C_implementation",
"os.path.join",
"multiprocessing.Pool",
"cv2.imread",
"os.walk"
] | [((294, 312), 'os.walk', 'os.walk', (['input_dir'], {}), '(input_dir)\n', (301, 312), False, 'import os\n'), ((547, 598), 'utils.info', 'info', (['"""Extracting GIST descriptor"""'], {'domain': '__file__'}), "('Extracting GIST descriptor', domain=__file__)\n", (551, 598), False, 'from utils import ensure_dir, info\n'),... |
# -*- coding: utf-8 -*-
# Natural Language Toolkit: Interface to the TreeTagger POS-tagger
#
# Copyright (C) <NAME>
# Author: <NAME> <<EMAIL>>
"""
A Python module for interfacing with the Treetagger by <NAME>.
"""
import os
from subprocess import Popen, PIPE
from nltk.internals import find_binary, find_file
from nlt... | [
"nltk.internals.find_binary",
"subprocess.Popen",
"doctest.testmod"
] | [((6023, 6080), 'doctest.testmod', 'doctest.testmod', ([], {'optionflags': 'doctest.NORMALIZE_WHITESPACE'}), '(optionflags=doctest.NORMALIZE_WHITESPACE)\n', (6038, 6080), False, 'import doctest\n'), ((4201, 4366), 'nltk.internals.find_binary', 'find_binary', (['treetagger_bin_name', 'path_to_home'], {'env_vars': "('TRE... |
from glob import glob
import os
from unittest import TestCase
from nose.plugins.attrib import attr
from ..client import RaftClient
class RaftClientTest(TestCase):
@classmethod
def tearDownClass(cls):
map(os.remove, glob('./~test_file*'))
@attr("integration")
def test_client_init(self):
... | [
"glob.glob",
"nose.plugins.attrib.attr"
] | [((265, 284), 'nose.plugins.attrib.attr', 'attr', (['"""integration"""'], {}), "('integration')\n", (269, 284), False, 'from nose.plugins.attrib import attr\n'), ((236, 257), 'glob.glob', 'glob', (['"""./~test_file*"""'], {}), "('./~test_file*')\n", (240, 257), False, 'from glob import glob\n')] |
from datetime import datetime, timezone
from ..exceptions import *
class Orders(object):
def __init__(self, session, trading_types):
super(Orders, self).__init__()
self._session = session
self._trading_types = trading_types
def generateOrderObject(self, legacy_contract_id, issuer, quan... | [
"datetime.datetime",
"datetime.datetime.now",
"datetime.datetime.utcnow"
] | [((1497, 1523), 'datetime.datetime.now', 'datetime.now', (['timezone.utc'], {}), '(timezone.utc)\n', (1509, 1523), False, 'from datetime import datetime, timezone\n'), ((3327, 3344), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (3342, 3344), False, 'from datetime import datetime, timezone\n'), ((159... |
import collections
import numpy
import pandas
import scipy
from tqdm import tqdm
from .common import say, reconstruct_antigen_sequences
def compute_coverage(antigen, sequence, blast_df):
"""
Extract blast hits for some clones for a single antigen into a DataFrame
indicating whether each clone aligns at... | [
"dna_features_viewer.GraphicRecord",
"seaborn.despine",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.sca",
"seaborn.heatmap",
"matplotlib.pyplot.fill_between",
"matplotlib.pyplot.tight_layout",
"pandas.DataFrame"... | [((2003, 2046), 'pandas.DataFrame', 'pandas.DataFrame', (['result_rows'], {'index': 'clones'}), '(result_rows, index=clones)\n', (2019, 2046), False, 'import pandas\n'), ((3708, 3772), 'pandas.DataFrame', 'pandas.DataFrame', ([], {'index': 'all_coverage_by_clone.columns', 'dtype': 'int'}), '(index=all_coverage_by_clone... |
from go.contacts import tasks, utils
from go.contacts.parsers import ContactFileParser
class ContactImportException(Exception):
"""
Exception raised when an import handler determines that an import cannot
succeed.
"""
def dispatch_import_task(import_task, request, group, check_fields=None):
file... | [
"go.contacts.parsers.ContactFileParser.get_parser",
"go.contacts.utils.get_file_hints_from_session",
"go.contacts.utils.clear_file_hints_from_session"
] | [((339, 381), 'go.contacts.utils.get_file_hints_from_session', 'utils.get_file_hints_from_session', (['request'], {}), '(request)\n', (372, 381), False, 'from go.contacts import tasks, utils\n'), ((406, 445), 'go.contacts.parsers.ContactFileParser.get_parser', 'ContactFileParser.get_parser', (['file_name'], {}), '(file... |
import os
import pandas as pd
base_project_path = os.path.dirname(
os.path.dirname(
os.path.abspath(__file__)
)
)
def make_table(df):
html_tables = {}
df[['DocSection', 'DocText']] = df["DocText"].str.rsplit(":", 1, expand=True)
for section, sub_df in df.groupby(['DocSection']):
s... | [
"os.path.abspath",
"os.path.join"
] | [((97, 122), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (112, 122), False, 'import os\n'), ((798, 849), 'os.path.join', 'os.path.join', (['base_project_path', '"""logs"""', '"""test.log"""'], {}), "(base_project_path, 'logs', 'test.log')\n", (810, 849), False, 'import os\n'), ((1491, 1564... |
#
# Copyright (c) 2020 <NAME>.
#
# 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... | [
"importlib.invalidate_caches",
"importlib.import_module",
"importlib.machinery.FileFinder.path_hook",
"pycg.utils.join_ns",
"os.path.split",
"sys.path_importer_cache.clear",
"copy.deepcopy",
"os.path.abspath",
"importlib.machinery.all_suffixes",
"os.path.relpath"
] | [((2774, 2803), 'importlib.invalidate_caches', 'importlib.invalidate_caches', ([], {}), '()\n', (2801, 2803), False, 'import importlib\n'), ((2812, 2843), 'sys.path_importer_cache.clear', 'sys.path_importer_cache.clear', ([], {}), '()\n', (2841, 2843), False, 'import sys\n'), ((3198, 3220), 'os.path.abspath', 'os.path.... |
"""
A toy example of playing against defined set of bots on Mocsár
Using env "mocsar"-cfg Using 'human_mode'
"""
import rlcard3
# Make environment and enable human mode
env = rlcard3.make('mocsar-cfg', config={'human_mode': True})
# Register agents
agents = {"mocsar_random": 2, "mocsar_min": 2}
env.model.create_agen... | [
"rlcard3.make"
] | [((177, 232), 'rlcard3.make', 'rlcard3.make', (['"""mocsar-cfg"""'], {'config': "{'human_mode': True}"}), "('mocsar-cfg', config={'human_mode': True})\n", (189, 232), False, 'import rlcard3\n')] |
"""A convenience function to rename BCP images
"""
import os
import re
from krcg.parser import _CLAN
def prepare_bcp(path):
for (dirpath, _dirnames, filenames) in os.walk(path):
for name in filenames:
clan_prefix = re.match(r"({})_".format(_CLAN), name.lower())
if clan_prefix:
... | [
"os.path.join",
"os.walk"
] | [((170, 183), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (177, 183), False, 'import os\n'), ((364, 391), 'os.path.join', 'os.path.join', (['dirpath', 'name'], {}), '(dirpath, name)\n', (376, 391), False, 'import os\n')] |
import hou
import husdoutputprocessors.base as base
import os
class StagingDirOutputProcessor(base.OutputProcessorBase):
"""Output all USD Rop file nodes into the Staging Directory
Ignore any folders and paths set in the Configured Layers
and USD Rop node, just take the filename and save into a
singl... | [
"hou.StringParmTemplate",
"os.path.join",
"os.path.split",
"os.path.basename",
"hou.ParmTemplateGroup"
] | [((695, 718), 'hou.ParmTemplateGroup', 'hou.ParmTemplateGroup', ([], {}), '()\n', (716, 718), False, 'import hou\n'), ((745, 907), 'hou.StringParmTemplate', 'hou.StringParmTemplate', (['self.stagingdir_parm_name', '"""Staging Directory"""', '(1)'], {'string_type': 'hou.stringParmType.FileReference', 'file_type': 'hou.f... |
#!~/.virtualenvs/cv420/bin/python
# -*- coding: utf-8 -*-
"""
Author: <NAME>
Created: 4-May-2020
"""
import serial
import math
from threading import Thread
import rospy
import time
import numpy as np
from std_msgs.msg import String
ser = serial.Serial('/dev/ttyACM1',9600, timeout=5) # Ti MSP430
def inverse_Kinema... | [
"rospy.is_shutdown",
"rospy.init_node",
"time.sleep",
"math.sin",
"math.cos",
"serial.Serial",
"math.atan2",
"rospy.Subscriber"
] | [((243, 289), 'serial.Serial', 'serial.Serial', (['"""/dev/ttyACM1"""', '(9600)'], {'timeout': '(5)'}), "('/dev/ttyACM1', 9600, timeout=5)\n", (256, 289), False, 'import serial\n'), ((2261, 2304), 'rospy.init_node', 'rospy.init_node', (['"""listener"""'], {'anonymous': '(True)'}), "('listener', anonymous=True)\n", (227... |
#!/usr/bin/env python3
"""TPatrick | Alta3 Research
Creating a simple dice program utilizing classes."""
from random import randint
class Player:
def __init__(self):
self.dice = []
def roll(self):
self.dice = []
for i in range(3):
self.dice.append(randint(1,6))
de... | [
"random.randint"
] | [((299, 312), 'random.randint', 'randint', (['(1)', '(6)'], {}), '(1, 6)\n', (306, 312), False, 'from random import randint\n')] |
# coding=utf-8
from dynamo.api.serializers import DynamicModelSerializer, DynamicModelFieldSerializer
from dynamo.models import DynamicModel, DynamicModelField
from rest_framework import viewsets
from rest_framework import generics
from rest_framework.renderers import TemplateHTMLRenderer, JSONRenderer, HTMLFormRendere... | [
"dynamo.models.DynamicModelField.objects.all"
] | [((563, 594), 'dynamo.models.DynamicModelField.objects.all', 'DynamicModelField.objects.all', ([], {}), '()\n', (592, 594), False, 'from dynamo.models import DynamicModel, DynamicModelField\n')] |
from __future__ import unicode_literals
from django.db import models
from django.db.models.signals import post_save
from django.utils.translation import ugettext_lazy as _
class TableMap(models.Model):
"""
Combines local tables with google fusion tables via
fusiontable table id and local name created fro... | [
"django.utils.translation.ugettext_lazy",
"django.db.models.signals.post_save.send"
] | [((460, 509), 'django.utils.translation.ugettext_lazy', '_', (['"""Local table name (<app_label>;<model__name>)"""'], {}), "('Local table name (<app_label>;<model__name>)')\n", (461, 509), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((611, 636), 'django.utils.translation.ugettext_lazy', '_', (['... |
from flask import Blueprint
order_api_blueprint = Blueprint('order_api', __name__)
from . import routes | [
"flask.Blueprint"
] | [((51, 83), 'flask.Blueprint', 'Blueprint', (['"""order_api"""', '__name__'], {}), "('order_api', __name__)\n", (60, 83), False, 'from flask import Blueprint\n')] |
# -*- coding: utf-8 -*-
import requests
import os
from lxml import etree
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
try:
from .xmlns import strip_xmlns
from .service import Service
from .embedded_device import EmbeddedDevice
from .instance_singlet... | [
"os.path.exists",
"service.Service",
"urllib.parse.urlparse",
"os.makedirs",
"os.path.join",
"requests.get",
"lxml.etree.fromstring",
"xmlns.strip_xmlns",
"embedded_device.EmbeddedDevice"
] | [((755, 773), 'urllib.parse.urlparse', 'urlparse', (['location'], {}), '(location)\n', (763, 773), False, 'from urllib.parse import urlparse\n'), ((861, 883), 'requests.get', 'requests.get', (['location'], {}), '(location)\n', (873, 883), False, 'import requests\n'), ((1740, 1757), 'xmlns.strip_xmlns', 'strip_xmlns', (... |
import plotly.offline as py
import plotly.graph_objs as go
import plotly.figure_factory as ff
import pandas as pd
import numpy as np
def plotlinechart(data_list, countries, plot_name):
data_list.index = data_list.index.strftime("%Y-%m-%d")
fig = go.Figure()
if not countries:
countries = data_li... | [
"plotly.offline.plot",
"plotly.graph_objs.Scatter",
"pandas.DataFrame",
"plotly.graph_objs.Figure",
"pandas.concat"
] | [((258, 269), 'plotly.graph_objs.Figure', 'go.Figure', ([], {}), '()\n', (267, 269), True, 'import plotly.graph_objs as go\n'), ((764, 857), 'plotly.offline.plot', 'py.plot', (['fig'], {'show_link': '(False)', 'output_type': '"""div"""', 'include_plotlyjs': '(False)', 'auto_open': '(False)'}), "(fig, show_link=False, o... |
# -*- coding: utf-8 -*-
# PyGlobi
# TODO:
"""
PyGlobi Library
~~~~~~~~~~~~~~~~~~~~~
Python API for the Global Biotic Interactions (GloBI) dataset.
Basic usage:
>>> import pyglobi
>>> ...
"""
import os
import json
import warnings
from .__version__ import __title__, __description__, __url__, __version__
from .... | [
"json.load",
"os.path.abspath",
"logging.getLogger",
"logging.NullHandler"
] | [((705, 720), 'json.load', 'json.load', (['fptr'], {}), '(fptr)\n', (714, 720), False, 'import json\n'), ((1334, 1347), 'logging.NullHandler', 'NullHandler', ([], {}), '()\n', (1345, 1347), False, 'from logging import NullHandler\n'), ((1295, 1322), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name... |
from guifw.abstractparameters import *
from geometry import *
from solids import *
import multiprocessing as mp
import time
import pyclipper
from polygons import *
from gcode import *
from collections import OrderedDict
class LatheThreadingTool(ItemWithParameters):
def __init__(self, model=None, tools=[], view... | [
"collections.OrderedDict"
] | [((859, 1361), 'collections.OrderedDict', 'OrderedDict', (["[('M4 x 0.7', [4, 3.3, 0.7, 0]), ('M5 x 0.8', [5, 4.2, 0.8, 0]), ('M6 x 1',\n [6, 5.0, 1.0, 0]), ('M8 x 1.25', [8, 6.75, 1.25, 0]), ('M10 x 1.5', [10,\n 8.5, 1.5, 0]), ('M12 x 1.5', [12, 10.5, 1.5, 0]), ('M12 x 1.75', [12, \n 10.25, 1.75, 0]), ('M14 x... |
"""Spectrum module"""
import numpy as np
from scipy.stats import norm
def pow2db(power: np.array) -> np.array:
"""
Convert power to decibels
https://de.mathworks.com/help/signal/ref/pow2db.html
"""
return 10.0 * np.log10(power)
def db2pow(decibel: np.array) -> np.array:
"""
Convert deci... | [
"numpy.log10",
"numpy.power",
"numpy.square",
"numpy.apply_along_axis",
"numpy.finfo"
] | [((409, 439), 'numpy.power', 'np.power', (['(10.0)', '(decibel / 10.0)'], {}), '(10.0, decibel / 10.0)\n', (417, 439), True, 'import numpy as np\n'), ((1374, 1429), 'numpy.apply_along_axis', 'np.apply_along_axis', (['norm.cdf', '(1)', 'spectrum'], {'scale': 'scale'}), '(norm.cdf, 1, spectrum, scale=scale)\n', (1393, 14... |
import pytest
from deepctr.models import FiBiNET
from ..utils import check_model, SAMPLE_SIZE, get_test_data, get_test_data_estimator, check_estimator, TEST_Estimator
@pytest.mark.parametrize(
'bilinear_type',
["each",
"all", "interaction"]
)
def test_FiBiNET(bilinear_type):
model_name = "FiBiNET"
... | [
"pytest.mark.parametrize",
"deepctr.models.FiBiNET",
"deepctr.estimator.FiBiNETEstimator"
] | [((171, 243), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""bilinear_type"""', "['each', 'all', 'interaction']"], {}), "('bilinear_type', ['each', 'all', 'interaction'])\n", (194, 243), False, 'import pytest\n'), ((638, 695), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""bilinear_type"""', "... |
from __future__ import absolute_import
from unittest import TestCase
from plotly import exceptions
from plotly.graph_objs import Bar, Frames
class FramesTest(TestCase):
def test_instantiation(self):
native_frames = [
{},
{'data': []},
'foo',
{'data': [],... | [
"plotly.graph_objs.Frames",
"plotly.graph_objs.Bar"
] | [((388, 409), 'plotly.graph_objs.Frames', 'Frames', (['native_frames'], {}), '(native_frames)\n', (394, 409), False, 'from plotly.graph_objs import Bar, Frames\n'), ((418, 426), 'plotly.graph_objs.Frames', 'Frames', ([], {}), '()\n', (424, 426), False, 'from plotly.graph_objs import Bar, Frames\n'), ((478, 486), 'plotl... |
"""Downloads the RAVDESS Video Dataset."""
import os
import sys
import zipfile
import argparse
import urllib.request
NUM_ACTORS = 24
DATA_TYPES = ['song', 'speech']
BASE_DOWNLOAD_URL = 'https://zenodo.org/record/1188976/files/{0}?download=1'
def main(dest):
for datatype in DATA_TYPES:
base_filename = 'Video_... | [
"os.path.exists",
"os.makedirs",
"zipfile.ZipFile",
"argparse.ArgumentParser",
"os.path.join"
] | [((1503, 1562), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Command line options"""'}), "(description='Command line options')\n", (1526, 1562), False, 'import argparse\n'), ((580, 608), 'os.path.join', 'os.path.join', (['dest', 'filename'], {}), '(dest, filename)\n', (592, 608), False... |
import random
import xml.etree.ElementTree
import requests
def get_data(host, parameters):
result_data = {}
url = f'http://{host}/mux_http'
request_id = random.randint(4000, 6000)
payload_header = f'id={request_id}&show='
data = '|'.join(parameters)
payload = f'{payload_header}{data}~'
... | [
"requests.post",
"random.randint"
] | [((170, 196), 'random.randint', 'random.randint', (['(4000)', '(6000)'], {}), '(4000, 6000)\n', (184, 196), False, 'import random\n'), ((406, 455), 'requests.post', 'requests.post', (['url'], {'data': 'payload', 'headers': 'headers'}), '(url, data=payload, headers=headers)\n', (419, 455), False, 'import requests\n')] |
"""
Tests for python modules
"""
import unittest
# testing two different functions in my package
from lambdata_trevorjames.things import Character, Wizard
# import from other modules for testing
class UnitTests(unittest.TestCase):
def test_character(self):
"""Testing Character feilds are met"""
x... | [
"unittest.main",
"lambdata_trevorjames.things.Character",
"lambdata_trevorjames.things.Wizard"
] | [((964, 979), 'unittest.main', 'unittest.main', ([], {}), '()\n', (977, 979), False, 'import unittest\n'), ((323, 352), 'lambdata_trevorjames.things.Character', 'Character', (['"""trevor"""', '(200)', '(100)'], {}), "('trevor', 200, 100)\n", (332, 352), False, 'from lambdata_trevorjames.things import Character, Wizard\... |
import boto3
import os
import uuid
from urllib.parse import unquote_plus
from PIL import Image
s3_client = boto3.client('s3')
def resize_image(picture_file_path, crop_dimensions=None):
# get the profile pics store ready
image = Image.open(picture_file_path)
if crop_dimensions:
image = image.crop(c... | [
"PIL.Image.open",
"boto3.client",
"os.environ.get",
"uuid.uuid4",
"os.path.dirname",
"urllib.parse.unquote_plus"
] | [((108, 126), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (120, 126), False, 'import boto3\n'), ((238, 267), 'PIL.Image.open', 'Image.open', (['picture_file_path'], {}), '(picture_file_path)\n', (248, 267), False, 'from PIL import Image\n'), ((352, 382), 'os.environ.get', 'os.environ.get', (['"""RES... |
import numpy as np
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
def data_to_2d_heatmap(X):
pca = PCA(n_components=2)
pca.fit(X)
X_simple = pca.transform(X)
X_simple = np.array(X_simple)
# print(X_simple)
x_simple = X_simple[:,0]
y_simple = X_simple[:,1]
# fig, ax = pl... | [
"matplotlib.pyplot.imshow",
"numpy.random.rand",
"sklearn.decomposition.PCA",
"matplotlib.pyplot.clf",
"numpy.array",
"numpy.histogram2d",
"matplotlib.pyplot.show"
] | [((728, 771), 'numpy.random.rand', 'np.random.rand', (['num_samples', 'num_dimensions'], {}), '(num_samples, num_dimensions)\n', (742, 771), True, 'import numpy as np\n'), ((131, 150), 'sklearn.decomposition.PCA', 'PCA', ([], {'n_components': '(2)'}), '(n_components=2)\n', (134, 150), False, 'from sklearn.decomposition... |
# Copyright 2017 The Tensor2Tensor Authors.
#
# 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 ... | [
"tensorflow.gfile.Open",
"tensorflow.gfile.Glob",
"six.unichr",
"six.moves.xrange",
"collections.defaultdict"
] | [((4560, 4576), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (4571, 4576), False, 'from collections import defaultdict\n'), ((2296, 2305), 'six.unichr', 'unichr', (['i'], {}), '(i)\n', (2302, 2305), False, 'from six import unichr\n'), ((4040, 4071), 'tensorflow.gfile.Glob', 'tf.gfile.Glob', (['te... |
from git import Repo
import subprocess
import os, shutil
# I use this later to lazily generate an error with a message
class CustomError(Exception):
pass
repo_path = "../../"
r = Repo(repo_path)
repo_heads = r.heads # or it's alias: r.branches
repo_heads_names = [h.name for h in repo_heads]
#kokkos_src = '/Users... | [
"os.path.exists",
"subprocess.check_call",
"git.Repo.clone_from",
"os.path.join",
"shutil.rmtree",
"shutil.copytree",
"os.getcwd",
"os.path.isdir",
"git.Repo"
] | [((185, 200), 'git.Repo', 'Repo', (['repo_path'], {}), '(repo_path)\n', (189, 200), False, 'from git import Repo\n'), ((684, 726), 'subprocess.check_call', 'subprocess.check_call', (["['./timing_lib.sh']"], {}), "(['./timing_lib.sh'])\n", (705, 726), False, 'import subprocess\n'), ((886, 918), 'os.path.join', 'os.path.... |
# © 2020 [<NAME>](mailto:<EMAIL>)
import html
import logging
from xeda.utils import try_convert
from xml.etree import ElementTree
from ..flow import Flow, DebugLevel
from functools import reduce
logger = logging.getLogger()
def supported_vivado_generic(k, v, sim):
if sim:
return True
if isinstance(v,... | [
"logging.getLogger",
"xml.etree.ElementTree.parse",
"functools.reduce",
"html.unescape",
"xeda.utils.try_convert"
] | [((205, 224), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (222, 224), False, 'import logging\n'), ((1578, 1607), 'xml.etree.ElementTree.parse', 'ElementTree.parse', (['report_xml'], {}), '(report_xml)\n', (1595, 1607), False, 'from xml.etree import ElementTree\n'), ((2901, 2936), 'functools.reduce', 're... |
from django.urls import reverse
admin_link = reverse("misago:admin:settings:socialauth:index")
def test_providers_list_renders(admin_client):
response = admin_client.get(admin_link)
assert response.status_code == 200
def test_providers_list_renders_with_active_provider(admin_client, provider):
respons... | [
"django.urls.reverse"
] | [((47, 96), 'django.urls.reverse', 'reverse', (['"""misago:admin:settings:socialauth:index"""'], {}), "('misago:admin:settings:socialauth:index')\n", (54, 96), False, 'from django.urls import reverse\n')] |
import json
from django.core.management.base import BaseCommand, CommandError
from users.models import User
class Command(BaseCommand):
help = "Exports a user information as a set of environment variables"
def add_arguments(self, parser):
parser.add_argument("user_id", type=int)
def handle(sel... | [
"json.dumps",
"users.models.User.objects.get",
"django.core.management.base.CommandError"
] | [((474, 524), 'django.core.management.base.CommandError', 'CommandError', (['(\'User "%s" does not exist\' % user_id)'], {}), '(\'User "%s" does not exist\' % user_id)\n', (486, 524), False, 'from django.core.management.base import BaseCommand, CommandError\n'), ((394, 422), 'users.models.User.objects.get', 'User.objec... |
# -*- coding: utf-8 -*-
import requests
import pandas as pd
from netCDF4 import Dataset
# from lib.parse_urls import parse_urls
from . parse_urls import parse_urls
class dataset:
def __init__(self,datasetkey,datahub):
self.datasetkey = datasetkey
self.datahub=datahub
def variables(self):
... | [
"pandas.DataFrame",
"netCDF4.Dataset",
"requests.get"
] | [((2692, 2708), 'netCDF4.Dataset', 'Dataset', (['tdsfile'], {}), '(tdsfile)\n', (2699, 2708), False, 'from netCDF4 import Dataset\n'), ((3449, 3469), 'pandas.DataFrame', 'pd.DataFrame', (['injson'], {}), '(injson)\n', (3461, 3469), True, 'import pandas as pd\n'), ((2031, 2051), 'requests.get', 'requests.get', (['tdaddr... |
from src import tours
import numpy as np
tolerance = 1e-4
def test_tour_traversal():
square = np.array([[0, 0], [0, 1], [1, 1], [1, 0.]])
tour = [0, 1, 2, 3]
assert abs(tours.tour_traversal(tour, square) - 4.) < tolerance
| [
"numpy.array",
"src.tours.tour_traversal"
] | [((101, 145), 'numpy.array', 'np.array', (['[[0, 0], [0, 1], [1, 1], [1, 0.0]]'], {}), '([[0, 0], [0, 1], [1, 1], [1, 0.0]])\n', (109, 145), True, 'import numpy as np\n'), ((184, 218), 'src.tours.tour_traversal', 'tours.tour_traversal', (['tour', 'square'], {}), '(tour, square)\n', (204, 218), False, 'from src import t... |
from netCDF4 import Dataset, num2date
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = 'true'
import argparse
import ast
import gc
import logging
import math
import sys
import time
import numpy as np
import pandas as pd
import psutil
import tensorflow as t... | [
"tensorflow.unstack",
"tensorflow.train.Checkpoint",
"custom_losses.extract_central_region",
"tensorflow.boolean_mask",
"custom_losses.cond_rain",
"tensorflow.keras.backend.set_epsilon",
"utility.load_params",
"tensorflow_addons.optimizers.RectifiedAdam",
"tensorflow.GradientTape",
"models.model_l... | [((593, 631), 'tensorflow.keras.backend.set_floatx', 'tf.keras.backend.set_floatx', (['"""float16"""'], {}), "('float16')\n", (620, 631), True, 'import tensorflow as tf\n'), ((633, 668), 'tensorflow.keras.backend.set_epsilon', 'tf.keras.backend.set_epsilon', (['(0.001)'], {}), '(0.001)\n', (661, 668), True, 'import ten... |
#! /usr/bin/env python
#
# BitBake Toaster functional tests implementation
#
# Copyright (C) 2017 Intel Corporation
#
# SPDX-License-Identifier: GPL-2.0-only
#
import time
import re
from tests.functional.functional_helpers import SeleniumFunctionalTestCase
from orm.models import Project
class FuntionalTestBasic(Selen... | [
"re.match",
"orm.models.Project.objects.filter"
] | [((6244, 6285), 're.match', 're.match', (['"""openembedded-core"""', 'layer.text'], {}), "('openembedded-core', layer.text)\n", (6252, 6285), False, 'import re\n'), ((10418, 10459), 're.match', 're.match', (['"""openembedded-core"""', 'layer.text'], {}), "('openembedded-core', layer.text)\n", (10426, 10459), False, 'im... |
"""
This module contains functional for Child RP test items management.
Copyright (c) 2018 http://reportportal.io .
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/L... | [
"weakref.proxy"
] | [((2304, 2322), 'weakref.proxy', 'proxy', (['parent_item'], {}), '(parent_item)\n', (2309, 2322), False, 'from weakref import proxy\n')] |
#https://www.crummy.com/software/BeautifulSoup/bs4/doc/#strings-and-stripped-strings
html_doc = """<html><head><title>The Dormouse's story</title></head>
<body>
<p class="title"><b>The Dormouse's story</b></p>
<p class="story">Once upon a time there were three little sisters; and their names were
<a href="http://exam... | [
"bs4.BeautifulSoup"
] | [((632, 670), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html_doc', '"""html.parser"""'], {}), "(html_doc, 'html.parser')\n", (645, 670), False, 'from bs4 import BeautifulSoup\n')] |
import numpy as np
from numpy.random import seed
seed(1)
import pandas as pd
from math import sqrt
from sklearn.decomposition import PCA
######################################################################
# METRICS
######################################################################
def mse(y, y_hat):
"""
... | [
"pandas.Series",
"numpy.abs",
"sklearn.decomposition.PCA",
"pandas.DataFrame.from_dict",
"numpy.square",
"pandas.Index",
"numpy.random.seed",
"numpy.maximum",
"pandas.concat"
] | [((49, 56), 'numpy.random.seed', 'seed', (['(1)'], {}), '(1)\n', (53, 56), False, 'from numpy.random import seed\n'), ((4958, 5004), 'numpy.maximum', 'np.maximum', (['(tau * delta_y)', '((tau - 1) * delta_y)'], {}), '(tau * delta_y, (tau - 1) * delta_y)\n', (4968, 5004), True, 'import numpy as np\n'), ((6497, 6529), 'p... |
#!/usr/bin/env python
import util
import newdb
from collections import Counter
from collections import deque
#Check if two rows have equal values in the keys attributes
def __compare(row1,row2,keys):
equal=True
for key in keys:
if row1[key]!=row2[key]:
equal=False
break
ret... | [
"newdb.init_db",
"collections.deque",
"newdb.get_db",
"collections.Counter",
"util.dict_fields_eq",
"util.info"
] | [((372, 379), 'collections.deque', 'deque', ([], {}), '()\n', (377, 379), False, 'from collections import deque\n'), ((6104, 6118), 'newdb.get_db', 'newdb.get_db', ([], {}), '()\n', (6116, 6118), False, 'import newdb\n'), ((6206, 6254), 'util.info', 'util.info', (['"""\nChecking xrefs based on SecIds"""'], {}), '("""\n... |
# Generated by Django 2.2.10 on 2020-03-19 08:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('onepanman_api', '0013_auto_20200319_1714'),
]
operations = [
migrations.AlterField(
model_name='problem',
name='rul... | [
"django.db.migrations.DeleteModel",
"django.db.models.TextField"
] | [((485, 531), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""ProblemRuleInfo"""'}), "(name='ProblemRuleInfo')\n", (507, 531), False, 'from django.db import migrations, models\n'), ((564, 603), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""RuleInfo"""'})... |
import os
import pandas as pd
from datetime import datetime
from preprocessing_service import PreProcessingService
class PreProcessing(PreProcessingService):
"""
A class used to automatically scrape CSV files from ENTSOE Transparecny Platform
...
Attributes
----------
_preProcessing : str
... | [
"os.listdir",
"datetime.datetime.strptime",
"preprocessing_service.PreProcessingService",
"os.getcwd",
"pandas.to_numeric",
"pandas.concat"
] | [((734, 756), 'preprocessing_service.PreProcessingService', 'PreProcessingService', ([], {}), '()\n', (754, 756), False, 'from preprocessing_service import PreProcessingService\n'), ((788, 810), 'preprocessing_service.PreProcessingService', 'PreProcessingService', ([], {}), '()\n', (808, 810), False, 'from preprocessin... |
import logging
from typing import List
from typing import Dict
import line_data
import ean_data
from core.model.ptn import Stop
from core.util.constants import SECONDS_PER_MINUTE
from parameters import VSParameters
logger = logging.getLogger(__name__)
class VehicleSchedule:
def __init__(self, line_pool: line_da... | [
"logging.getLogger"
] | [((226, 253), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (243, 253), False, 'import logging\n')] |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
"numpy.array",
"src.exp.bboxes.read_images",
"cv2.VideoCapture"
] | [((1432, 1454), 'cv2.VideoCapture', 'cv2.VideoCapture', (['path'], {}), '(path)\n', (1448, 1454), False, 'import cv2\n'), ((1520, 1535), 'src.exp.bboxes.read_images', 'read_images', (['vc'], {}), '(vc)\n', (1531, 1535), False, 'from src.exp.bboxes import read_images\n'), ((1180, 1195), 'numpy.array', 'np.array', (['cli... |
import torch
import torchvision
from torchvision import transforms
def load_mnist_dataset(train_batch_size, test_batch_size=1):
train_set = torchvision.datasets.MNIST(".", train=True, transform=transforms.Compose([transforms.ToTensor()]), download=True)
test_set = torchvision.datasets.MNIST(".", train=False, ... | [
"torchvision.transforms.ToTensor",
"torch.utils.data.DataLoader"
] | [((409, 495), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['train_set'], {'batch_size': 'train_batch_size', 'shuffle': '(True)'}), '(train_set, batch_size=train_batch_size, shuffle\n =True)\n', (436, 495), False, 'import torch\n'), ((509, 594), 'torch.utils.data.DataLoader', 'torch.utils.data.Data... |
"""Setup script for openodia
Referred: https://github.com/realpython/reader/blob/master/setup.py
https://realpython.com/pypi-publish-python-package/
"""
import os.path
from setuptools import find_packages, setup
# The directory containing this file
HERE = os.path.abspath(os.path.dirname(__file__))
# Th... | [
"setuptools.find_packages"
] | [((1213, 1280), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests', '*.tests', '*.tests.*', 'tests.*']"}), "(exclude=['tests', '*.tests', '*.tests.*', 'tests.*'])\n", (1226, 1280), False, 'from setuptools import find_packages, setup\n')] |
from __future__ import absolute_import, print_function, unicode_literals
import os
import shutil
import stat
import sys
import tempfile
from io import StringIO, open
from subprocess import list2cmdline
from textwrap import dedent
import ksconf.ext.six as six
from ksconf.__main__ import cli
from ksconf.conf.parser im... | [
"io.open",
"os.remove",
"textwrap.dedent",
"os.chmod",
"ksconf.__main__.cli",
"os.path.isdir",
"os.unlink",
"io.StringIO",
"ksconf.conf.parser.parse_conf_stream",
"ksconf.util.file.file_hash",
"os.path.dirname",
"tempfile.mkdtemp",
"ksconf.conf.parser.parse_conf",
"ksconf.vc.git.git_cmd",
... | [((1051, 1064), 'ksconf.util.file.file_hash', 'file_hash', (['fn'], {}), '(fn)\n', (1060, 1064), False, 'from ksconf.util.file import file_hash\n'), ((1520, 1532), 'textwrap.dedent', 'dedent', (['text'], {}), '(text)\n', (1526, 1532), False, 'from textwrap import dedent\n'), ((1541, 1555), 'io.StringIO', 'StringIO', ([... |
from setuptools import setup
setup(name='reservoirlib',
version='0.1',
description='Python 3 library that provides utilities for creating and'
' training reservoir computers.',
author='<NAME>',
packages=['reservoirlib'],
url='https://github.com/Nathaniel-Rodriguez/reserv... | [
"setuptools.setup"
] | [((30, 364), 'setuptools.setup', 'setup', ([], {'name': '"""reservoirlib"""', 'version': '"""0.1"""', 'description': '"""Python 3 library that provides utilities for creating and training reservoir computers."""', 'author': '"""<NAME>"""', 'packages': "['reservoirlib']", 'url': '"""https://github.com/Nathaniel-Rodrigue... |
# todo: How to Select how many hidden layer and neurons in a neural network
# Importing the libraries
import pandas as pd
from keras.models import Sequential
from keras.layers import Dense, Activation
# Importing the dataset
dataset = pd.read_csv('Churn_Modelling.csv')
X = dataset.iloc[:, 3:13].values
y = dataset.ilo... | [
"sklearn.model_selection.GridSearchCV",
"sklearn.preprocessing.LabelEncoder",
"pandas.read_csv",
"keras.wrappers.scikit_learn.KerasClassifier",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.OneHotEncoder",
"keras.models.Sequential",
"sklearn.preprocessing.StandardScaler",
"keras... | [((237, 271), 'pandas.read_csv', 'pd.read_csv', (['"""Churn_Modelling.csv"""'], {}), "('Churn_Modelling.csv')\n", (248, 271), True, 'import pandas as pd\n'), ((461, 475), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (473, 475), False, 'from sklearn.preprocessing import LabelEncoder, OneHotEnc... |
"""
This module is the computational part of the geometrical module of ToFu
"""
# Built-in
import sys
import warnings
# Common
import numpy as np
import scipy.interpolate as scpinterp
import scipy.integrate as scpintg
if sys.version[0]=='3':
from inspect import signature as insp
elif sys.version[0]=='2':
from... | [
"numpy.sqrt",
"tofu.geom._GG.Poly_VolAngTor",
"numpy.log",
"tofu.geom._GG.discretize_segment2d",
"numpy.ascontiguousarray",
"numpy.array",
"numpy.arctan2",
"tofu.geom._GG._Ves_Smesh_Lin_SubFromD_cython",
"numpy.nanmin",
"numpy.sin",
"numpy.arange",
"numpy.repeat",
"tofu.geom._GG._Ves_Vmesh_T... | [((1201, 1289), 'tofu.geom._GG.Poly_Order', '_GG.Poly_Order', (['Poly'], {'order': '"""C"""', 'Clock': '(False)', 'close': '(True)', 'layout': '"""(cc,N)"""', 'Test': '(True)'}), "(Poly, order='C', Clock=False, close=True, layout='(cc,N)',\n Test=True)\n", (1215, 1289), True, 'import tofu.geom._GG as _GG\n'), ((1768... |
'''
Created on May 10, 2019
@author: kreuzer
'''
import json
import uuid
import base64
import time
import requests
import os
from contextlib import closing
from jupyterhub.orm import APIToken, User
from jupyterhub.apihandlers.base import APIHandler
class J4J_APITokenHandler(APIHandler):
async def get(self, user... | [
"jupyterhub.orm.APIToken.find",
"json.loads",
"requests.post",
"json.dumps",
"os.environ.get",
"uuid.uuid4",
"json.load",
"time.time"
] | [((7112, 7146), 'jupyterhub.orm.APIToken.find', 'APIToken.find', (['self.db'], {'token': 's[1]'}), '(self.db, token=s[1])\n', (7125, 7146), False, 'from jupyterhub.orm import APIToken, User\n'), ((7342, 7358), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (7352, 7358), False, 'import json\n'), ((472, 484), 'u... |
from django.db import models
# from django.contrib.auth.models import User
from apps.users.models import CustomUser
# 引入Enum类型
from enum import Enum
from enumfields import EnumIntegerField
class BillType(Enum):
OUTGO = 0 # 账目类型.支出
INCOME = 1 # 账目类型.收入
class Categorys(models.Model):
"""
账目明细分类表
... | [
"django.db.models.ForeignKey",
"django.db.models.DateTimeField",
"django.db.models.BooleanField",
"enumfields.EnumIntegerField",
"django.db.models.CharField"
] | [((343, 387), 'django.db.models.BooleanField', 'models.BooleanField', (['"""是否默认分类"""'], {'default': '(False)'}), "('是否默认分类', default=False)\n", (362, 387), False, 'from django.db import models\n'), ((427, 536), 'django.db.models.ForeignKey', 'models.ForeignKey', (['CustomUser'], {'verbose_name': '"""自定义分类所属用户"""', 'bl... |
"""Random subset dataset.
"""
import random
import numpy as np
import torch
from torch.utils.data import Dataset
from PIL import Image
class RandomSubset(Dataset):
"""Class allows to iterate every epoch through a different random subset of the original
dataset.
The intention behind this class is to spe... | [
"numpy.array",
"PIL.Image.fromarray"
] | [((2511, 2541), 'PIL.Image.fromarray', 'Image.fromarray', (['img'], {'mode': '"""L"""'}), "(img, mode='L')\n", (2526, 2541), False, 'from PIL import Image\n'), ((1013, 1035), 'numpy.array', 'np.array', (['dataset.data'], {}), '(dataset.data)\n', (1021, 1035), True, 'import numpy as np\n'), ((1451, 1476), 'numpy.array',... |
from tempfile import mkstemp
import os
import tinys3
def create_temp_file(data):
fd, temp_path = mkstemp()
file = open(temp_path, 'r')
file.write(data)
file.close()
os.close(fd)
return data
def push_to_s3(filepath):
s3 = tinys3.Connection(os.environ['AWS_ACCESS_KEY_ID'],os.environ['AWS_SE... | [
"os.close",
"tempfile.mkstemp",
"tinys3.Connection"
] | [((102, 111), 'tempfile.mkstemp', 'mkstemp', ([], {}), '()\n', (109, 111), False, 'from tempfile import mkstemp\n'), ((186, 198), 'os.close', 'os.close', (['fd'], {}), '(fd)\n', (194, 198), False, 'import os\n'), ((252, 347), 'tinys3.Connection', 'tinys3.Connection', (["os.environ['AWS_ACCESS_KEY_ID']", "os.environ['AW... |
import re
instr = re.compile(r'[ \t]*[a-z]+ ([a-z0-9\[\]]+,? *)*')
data = []
with open("conditionals.enc", "r") as file:
for line in file:
data.append(line)
from random import choice
conditions = ['zero', 'carry', 'negative', 'equal', 'greater', 'less']
with open("cond.enc", 'w') as file:
for line in data:... | [
"random.choice",
"re.compile"
] | [((20, 70), 're.compile', 're.compile', (['"""[ \\\\t]*[a-z]+ ([a-z0-9\\\\[\\\\]]+,? *)*"""'], {}), "('[ \\\\t]*[a-z]+ ([a-z0-9\\\\[\\\\]]+,? *)*')\n", (30, 70), False, 'import re\n'), ((392, 410), 'random.choice', 'choice', (['conditions'], {}), '(conditions)\n', (398, 410), False, 'from random import choice\n')] |
import torch
import torch.nn as nn
from einops.layers.torch import Rearrange
class cnnTransformer(nn.Module):
def __init__(self,
name:str,
n_token:int,
n_embed:int,
n_head:int,
n_hid:int,
n_layer:int,
... | [
"torch.nn.TransformerEncoder",
"torch.nn.TransformerEncoderLayer",
"einops.layers.torch.Rearrange",
"torch.randn"
] | [((439, 472), 'einops.layers.torch.Rearrange', 'Rearrange', (['"""b c h w -> (h w) b c"""'], {}), "('b c h w -> (h w) b c')\n", (448, 472), False, 'from einops.layers.torch import Rearrange\n'), ((575, 677), 'torch.nn.TransformerEncoderLayer', 'nn.TransformerEncoderLayer', ([], {'d_model': 'n_embed', 'nhead': 'n_head',... |
import numpy
import matplotlib.pyplot as plt
x = numpy.random.normal(1.9, 1.0, 109324)
plt.hist(x, 100)
plt.show()
| [
"numpy.random.normal",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.show"
] | [((50, 87), 'numpy.random.normal', 'numpy.random.normal', (['(1.9)', '(1.0)', '(109324)'], {}), '(1.9, 1.0, 109324)\n', (69, 87), False, 'import numpy\n'), ((89, 105), 'matplotlib.pyplot.hist', 'plt.hist', (['x', '(100)'], {}), '(x, 100)\n', (97, 105), True, 'import matplotlib.pyplot as plt\n'), ((106, 116), 'matplotli... |