code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
import sys
import os
import hashlib
from src.imagefile import ImageFile
from PyQt5.QtWidgets import QApplication, QMainWindow, QFileDialog
from PyQt5 import QtWidgets, QtCore
from src.ui.mainwindow import Ui_MainWindow
class AppWindow(QMainWindow):
def __init__(self):
super().__init__()
... | [
"PyQt5.QtWidgets.QApplication",
"src.ui.mainwindow.Ui_MainWindow",
"src.imagefile.ImageFile",
"PyQt5.QtWidgets.QFileDialog.getOpenFileName"
] | [((3347, 3369), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (3359, 3369), False, 'from PyQt5.QtWidgets import QApplication, QMainWindow, QFileDialog\n'), ((330, 345), 'src.ui.mainwindow.Ui_MainWindow', 'Ui_MainWindow', ([], {}), '()\n', (343, 345), False, 'from src.ui.mainwindow ... |
import torch
from torchvision.models import mobilenet_v2
from nni.compression.pytorch import ModelSpeedup
from nni.algorithms.compression.pytorch.pruning import L1FilterPruner
model = mobilenet_v2(pretrained=True)
dummy_input = torch.rand(8, 3, 416, 416)
cfg_list = [{'op_types':['Conv2d'], 'sparsity':0.5}]
pruner =... | [
"nni.algorithms.compression.pytorch.pruning.L1FilterPruner",
"nni.compression.pytorch.ModelSpeedup",
"torchvision.models.mobilenet_v2",
"torch.rand"
] | [((186, 215), 'torchvision.models.mobilenet_v2', 'mobilenet_v2', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (198, 215), False, 'from torchvision.models import mobilenet_v2\n'), ((231, 257), 'torch.rand', 'torch.rand', (['(8)', '(3)', '(416)', '(416)'], {}), '(8, 3, 416, 416)\n', (241, 257), False, 'import t... |
# Copyright (C) 2020-2021 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This prog... | [
"gdb.register_window_type"
] | [((1297, 1341), 'gdb.register_window_type', 'gdb.register_window_type', (['"""test"""', 'TestWindow'], {}), "('test', TestWindow)\n", (1321, 1341), False, 'import gdb\n'), ((1552, 1593), 'gdb.register_window_type', 'gdb.register_window_type', (['"""fail"""', 'failwin'], {}), "('fail', failwin)\n", (1576, 1593), False, ... |
#!/usr/bin/env python
import sys, re
def parse_map(path):
'''Creates a 2D array from the data, given the path.'''
with open(path) as file:
width, height = map(int, file.readline().split())
grid = []
for line in file:
line = re.sub('[\n]', '', line)
array = line.... | [
"re.sub"
] | [((270, 294), 're.sub', 're.sub', (['"""[\n]"""', '""""""', 'line'], {}), "('[\\n]', '', line)\n", (276, 294), False, 'import sys, re\n')] |
# pylint: disable=R,C,E1101
import numpy as np
def s2_near_identity_grid(max_beta=np.pi / 8, n_alpha=8, n_beta=3):
'''
:return: rings around the north pole
size of the kernel = n_alpha * n_beta
'''
beta = np.arange(start=1, stop=n_beta + 1, dtype=np.float) * max_beta / n_beta
alpha = np.linspa... | [
"numpy.stack",
"numpy.meshgrid",
"numpy.arange",
"numpy.linspace"
] | [((311, 376), 'numpy.linspace', 'np.linspace', ([], {'start': '(0)', 'stop': '(2 * np.pi)', 'num': 'n_alpha', 'endpoint': '(False)'}), '(start=0, stop=2 * np.pi, num=n_alpha, endpoint=False)\n', (322, 376), True, 'import numpy as np\n'), ((388, 427), 'numpy.meshgrid', 'np.meshgrid', (['beta', 'alpha'], {'indexing': '""... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'gui.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.se... | [
"PyQt5.QtWidgets.QGridLayout",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtWidgets.QAction",
"PyQt5.QtWidgets.QMenuBar",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QComboBox",
"PyQt5.QtWidgets.QFrame",
"PyQt5.Q... | [((13650, 13682), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (13672, 13682), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((13700, 13723), 'PyQt5.QtWidgets.QMainWindow', 'QtWidgets.QMainWindow', ([], {}), '()\n', (13721, 13723), False, 'from PyQt5 import QtC... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016, French National Center for Scientific Research (CNRS)
# Distributed under the (new) BSD License. See LICENSE for more info.
import time
import numpy as np
import pyqtgraph as pg
from pyacq import create_manager, InputStream, NumpyDeviceBuffer, ThreadPollOutput
from pyacq.... | [
"pyacq.dsp.triggeraccumulator.TriggerAccumulator",
"pyqtgraph.mkQApp",
"pyqtgraph.Qt.QtCore.QTimer",
"numpy.arange",
"pyacq.NumpyDeviceBuffer",
"numpy.random.rand",
"pyacq.dsp.trigger.AnalogTrigger"
] | [((557, 574), 'numpy.arange', 'np.arange', (['length'], {}), '(length)\n', (566, 574), True, 'import numpy as np\n'), ((596, 630), 'numpy.random.rand', 'np.random.rand', (['length', 'nb_channel'], {}), '(length, nb_channel)\n', (610, 630), True, 'import numpy as np\n'), ((932, 943), 'pyqtgraph.mkQApp', 'pg.mkQApp', ([]... |
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
from read_mesonet_data import get_nysm_data, mtime, TEMP_2M, PRESSURE, AVG_WIND_SPEED, MAX_WIND_SPEED, WIND_DIRECTION, prcp_evol
#exec(open('read_m... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.suptitle",
"numpy.nanmax",
"pandas.plotting.register_matplotlib_converters",
"numpy.isfinite",
"datetime.datetime",
"read_mesonet_data.get_nysm_data",
"numpy.nanmin",
"matplotlib.pyplot.figure",
"numpy.where",
"numpy.mea... | [((140, 172), 'pandas.plotting.register_matplotlib_converters', 'register_matplotlib_converters', ([], {}), '()\n', (170, 172), False, 'from pandas.plotting import register_matplotlib_converters\n'), ((491, 566), 'numpy.where', 'np.where', (['((lon < maxlon) & (lon > minlon) & (lat > minlat) & (lat < maxlat))'], {}), '... |
#!/usr/bin/env python2
# coding: utf-8
"""Test ONLY_ON_TAINTED mode."""
import unittest
from triton import ARCH, MODE, CPUSIZE, TritonContext, Instruction, MemoryAccess
def checkAstIntegrity(instruction):
"""
This function check if all ASTs under an Instruction class are still
available.
"""
try... | [
"triton.TritonContext",
"triton.Instruction"
] | [((951, 966), 'triton.TritonContext', 'TritonContext', ([], {}), '()\n', (964, 966), False, 'from triton import ARCH, MODE, CPUSIZE, TritonContext, Instruction, MemoryAccess\n'), ((1146, 1171), 'triton.Instruction', 'Instruction', (["b'H\\x89\\xc3'"], {}), "(b'H\\x89\\xc3')\n", (1157, 1171), False, 'from triton import ... |
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from . import redis
from .routers import game
app = FastAPI()
app.include_router(game.router, prefix="/game")
app.add_middleware(
CORSMiddleware,
allow_origins=[
"http://localhost:3000",
"https://localhost:3000",
... | [
"fastapi.FastAPI"
] | [((133, 142), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (140, 142), False, 'from fastapi import FastAPI\n')] |
# Copyright 2021 AlQuraishi Laboratory
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | [
"argparse.ArgumentParser",
"json.dumps"
] | [((627, 826), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Outputs a DeepSpeed \n configuration file to \n stdout"""'}), '(description=\n """Outputs a DeepSpeed \n ... |
from entrylink import EntryLink
from rssbody import RssBody
from rssfeed import RssFeed
class GenFeedXpath(object):
async def gen_feed_from_xpath(self, xpath):
entry_link = EntryLink(xpath["site_url"],
xpath["entry_css"],
xpath["entry_link_css"... | [
"entrylink.EntryLink",
"rssbody.RssBody",
"rssfeed.RssFeed"
] | [((187, 368), 'entrylink.EntryLink', 'EntryLink', (["xpath['site_url']", "xpath['entry_css']", "xpath['entry_link_css']", "xpath['add_base_url']", "xpath['rss_link_prefix']", "xpath['site_title_css']", "xpath['site_motto_css']"], {}), "(xpath['site_url'], xpath['entry_css'], xpath['entry_link_css'],\n xpath['add_bas... |
from datetime import timedelta
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.operators.docker_operator import DockerOperator
from airflow.utils.dates import days_ago
# These args will get passed on to each operator
# You can override them on a per-task basis during oper... | [
"airflow.operators.bash_operator.BashOperator",
"airflow.operators.docker_operator.DockerOperator",
"datetime.timedelta",
"airflow.utils.dates.days_ago"
] | [((739, 854), 'airflow.operators.bash_operator.BashOperator', 'BashOperator', ([], {'task_id': '"""t_bash_test"""', 'bash_command': '"""set -eux -o pipefail; env; date; hostname; whoami"""', 'dag': 'dag'}), "(task_id='t_bash_test', bash_command=\n 'set -eux -o pipefail; env; date; hostname; whoami', dag=dag)\n", (75... |
from xyz_to_servo import *
import matplotlib.pyplot as plt
import operator
if __name__ == '__main__':
# lists to plot
iterations = 0
base_angles = []
shoulder_angles = []
elbow_angles = []
wrist_angles = []
residuals = []
# fitting parameters
side_lengths = Sides(15.0, 12.5, 15.0)
... | [
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot"
] | [((966, 978), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (976, 978), True, 'import matplotlib.pyplot as plt\n'), ((1026, 1113), 'matplotlib.pyplot.plot', 'plt.plot', (['x_values', 'shoulder_angles', 'x_values', 'elbow_angles', 'x_values', 'wrist_angles'], {}), '(x_values, shoulder_angles, x_values, elb... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | [
"msrest.Serializer",
"copy.deepcopy",
"azure.core.AsyncPipelineClient",
"msrest.Deserializer"
] | [((5572, 5642), 'azure.core.AsyncPipelineClient', 'AsyncPipelineClient', ([], {'base_url': '_base_url', 'config': 'self._config'}), '(base_url=_base_url, config=self._config, **kwargs)\n', (5591, 5642), False, 'from azure.core import AsyncPipelineClient\n'), ((5760, 5785), 'msrest.Serializer', 'Serializer', (['client_m... |
### flaskr/model/productDao.py
from flaskr import db
import json
class Product(db.Model):
__tablename__ = 'product'
__table_args__ = {'mysql_collate': 'utf8_general_ci'}
product_name = db.Column(db.String(30), primary_key=True, unique=True, nullable=False)
product_price = db.Column(db.Integer, nullab... | [
"flaskr.db.String",
"flaskr.db.Column"
] | [((292, 329), 'flaskr.db.Column', 'db.Column', (['db.Integer'], {'nullable': '(False)'}), '(db.Integer, nullable=False)\n', (301, 329), False, 'from flaskr import db\n'), ((350, 387), 'flaskr.db.Column', 'db.Column', (['db.Integer'], {'nullable': '(False)'}), '(db.Integer, nullable=False)\n', (359, 387), False, 'from f... |
# encoding: UTF-8
import talib as ta
import numpy as np
from ctaBase import *
from ctaTemplate import CtaTemplate
########################################################################
class DoubleSmaDemo(CtaTemplate):
"""基于Talib模块的双指数均线策略Demo"""
className = 'DoubleSmaDemo'
author = u'融拓科技'
# 策略... | [
"talib.SMA",
"numpy.array"
] | [((4197, 4224), 'numpy.array', 'np.array', (['self.closeHistory'], {}), '(self.closeHistory)\n', (4205, 4224), True, 'import numpy as np\n'), ((4243, 4278), 'talib.SMA', 'ta.SMA', (['closeArray', 'self.fastPeriod'], {}), '(closeArray, self.fastPeriod)\n', (4249, 4278), True, 'import talib as ta\n'), ((4297, 4332), 'tal... |
import numpy as np
import scipy as sp
import scipy.linalg
import scipy.sparse as sparse
import osqp
import warnings
class MPCController:
""" This class implements an MPC controller
Attributes
----------
Ad : 2D array_like. Size: (nx, nx)
Discrete-time system matrix Ad.
Bd : 2D array-like.... | [
"numpy.eye",
"numpy.empty",
"numpy.zeros",
"numpy.ones",
"numpy.transpose",
"time.time",
"numpy.shape",
"numpy.array",
"numpy.kron",
"numpy.linalg.inv",
"numpy.arange",
"numpy.diag",
"matplotlib.pyplot.subplots"
] | [((8904, 8948), 'numpy.array', 'np.array', (['[[1.0, Ts], [0, 1.0 - b / M * Ts]]'], {}), '([[1.0, Ts], [0, 1.0 - b / M * Ts]])\n', (8912, 8948), True, 'import numpy as np\n'), ((8976, 9003), 'numpy.array', 'np.array', (['[[0.0], [Ts / M]]'], {}), '([[0.0], [Ts / M]])\n', (8984, 9003), True, 'import numpy as np\n'), ((9... |
import inspect
from reloadium.vendored.sentry_sdk.hub import Hub
from reloadium.vendored.sentry_sdk.scope import Scope
from reloadium.vendored.sentry_sdk._types import MYPY
if MYPY:
from typing import Any
from typing import Dict
from typing import Optional
from typing import overload
from typing ... | [
"reloadium.vendored.sentry_sdk.hub.Hub.current.scope.set_level",
"reloadium.vendored.sentry_sdk.hub.Hub.current.push_scope",
"reloadium.vendored.sentry_sdk.hub.Hub.current.scope.set_tag",
"reloadium.vendored.sentry_sdk.hub.Hub.current.last_event_id",
"reloadium.vendored.sentry_sdk.hub.Hub.current.scope.set_... | [((618, 630), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (625, 630), False, 'from typing import TypeVar\n'), ((639, 677), 'typing.TypeVar', 'TypeVar', (['"""F"""'], {'bound': 'Callable[..., Any]'}), "('F', bound=Callable[..., Any])\n", (646, 677), False, 'from typing import TypeVar\n'), ((1742, 1807), '... |
"""
Computes the budget of Ox from 1-year GEOS-Chem Classic
or GCHP benchmark simulations.
"""
# ======================================================================
# Imports etc.
# ======================================================================
import os
import warnings
from calendar import monthrange
impo... | [
"gcpy.util.add_lumped_species_to_dataset",
"numpy.nansum",
"numpy.sum",
"os.makedirs",
"warnings.filterwarnings",
"os.path.isdir",
"os.path.dirname",
"xarray.open_dataset",
"os.path.exists",
"numpy.zeros",
"gcpy.util.rename_and_flip_gchp_rst_vars",
"numpy.ma.masked_array",
"gcpy.util.reshape... | [((586, 644), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'RuntimeWarning'}), "('ignore', category=RuntimeWarning)\n", (609, 644), False, 'import warnings\n'), ((645, 700), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning'}), "(... |
# Copyright 2017 Division of Medical Image Computing, German Cancer Research Center (DKFZ)
#
# 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
#... | [
"numpy.concatenate",
"theano.tensor.sum",
"theano.tensor.eq",
"matplotlib.pyplot.close",
"theano.tensor.zeros",
"matplotlib.use",
"theano.tensor.constant",
"theano.tensor.argmax",
"theano.tensor.flatten",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig"
] | [((702, 723), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (716, 723), False, 'import matplotlib\n'), ((1969, 1999), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(16, 12)'}), '(figsize=(16, 12))\n', (1981, 1999), True, 'import matplotlib.pyplot as plt\n'), ((3559, 3577), 'mat... |
import os
import sys
from setuptools import find_packages, setup
if sys.version_info < (3, 6):
sys.exit('Requires Python 3.6 or higher')
directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join('README.md'), encoding='utf-8') as f:
readme = f.read()
REQUIRED_PACKAGES = [
'tensorflow... | [
"os.path.dirname",
"os.path.join",
"setuptools.find_packages",
"sys.exit"
] | [((100, 141), 'sys.exit', 'sys.exit', (['"""Requires Python 3.6 or higher"""'], {}), "('Requires Python 3.6 or higher')\n", (108, 141), False, 'import sys\n'), ((171, 196), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (186, 196), False, 'import os\n'), ((209, 234), 'os.path.join', 'os.path.... |
'''custom tokenizer to remove and lemmatize the data'''
import spacy
nlp = spacy.load("en_core_web_sm", disable=["parser", "textcat", "ner"])
def custom_tokenizer(text):
'''
used to filter out unwanted words, punctuation, and so on
'''
tokens = []
for t in nlp(text):
if not(len(t) < 2 or... | [
"spacy.load"
] | [((77, 143), 'spacy.load', 'spacy.load', (['"""en_core_web_sm"""'], {'disable': "['parser', 'textcat', 'ner']"}), "('en_core_web_sm', disable=['parser', 'textcat', 'ner'])\n", (87, 143), False, 'import spacy\n')] |
#
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#
import csv
import json
import urllib.parse as urlparse
from io import StringIO
from typing import Any, Dict, Iterable, List, Mapping, MutableMapping, Optional
import requests
from airbyte_cdk.models import SyncMode
from source_iterable.iterable_streams impo... | [
"io.StringIO",
"json.loads",
"urllib.parse.urlparse"
] | [((1453, 1475), 'urllib.parse.urlparse', 'urlparse.urlparse', (['url'], {}), '(url)\n', (1470, 1475), True, 'import urllib.parse as urlparse\n'), ((6570, 6593), 'io.StringIO', 'StringIO', (['response.text'], {}), '(response.text)\n', (6578, 6593), False, 'from io import StringIO\n'), ((3785, 3805), 'io.StringIO', 'Stri... |
from pagedown.widgets import PagedownWidget
import os
import re
import langdetect
from django import forms
from django.utils.safestring import mark_safe
from django.core.exceptions import ValidationError
from django.shortcuts import reverse
from django.conf import settings
from snowpenguin.django.recaptcha2.fields impo... | [
"django.core.exceptions.ValidationError",
"langdetect.detect",
"django.forms.Select",
"django.utils.safestring.mark_safe",
"re.match",
"django.forms.ValidationError",
"os.path.isfile",
"django.forms.HiddenInput",
"django.forms.CharField"
] | [((3764, 3930), 'django.forms.CharField', 'forms.CharField', ([], {'label': '"""Post Title"""', 'max_length': '(200)', 'min_length': '(2)', 'validators': '[valid_title]', 'help_text': '"""Enter a descriptive title to promote better answers."""'}), "(label='Post Title', max_length=200, min_length=2,\n validators=[val... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de
# Aplicacion de las TIC basadas en Fuentes Abiertas, Spain.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistribution... | [
"Widget.Widget.Render",
"Widget.Widget.__init__"
] | [((2093, 2114), 'Widget.Widget.__init__', 'Widget.__init__', (['self'], {}), '(self)\n', (2108, 2114), False, 'from Widget import Widget\n'), ((2327, 2346), 'Widget.Widget.Render', 'Widget.Render', (['self'], {}), '(self)\n', (2340, 2346), False, 'from Widget import Widget\n'), ((2679, 2700), 'Widget.Widget.__init__', ... |
# -*- coding: utf-8 -*-
"""BigData3_2.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1ot4voGW2WgZWfo_uS7xvVs17-1N-VF0E
"""
from pyspark.sql.types import TimestampType, StringType, IntegerType, StructType, StructField
from pyspark.sql import Spar... | [
"pyspark.sql.types.IntegerType",
"pyspark.sql.SparkSession.builder.appName",
"pyspark.sql.types.StringType",
"pyspark.sql.types.TimestampType"
] | [((474, 522), 'pyspark.sql.SparkSession.builder.appName', 'SparkSession.builder.appName', (['"""Task1Assignment3"""'], {}), "('Task1Assignment3')\n", (502, 522), False, 'from pyspark.sql import SparkSession\n'), ((937, 949), 'pyspark.sql.types.StringType', 'StringType', ([], {}), '()\n', (947, 949), False, 'from pyspar... |
from dash_labs import build_id, templates
from dash_labs.dependency import Output
from .base import ComponentPlugin
class DynamicLabelPlugin(ComponentPlugin):
"""
Plugin that supports formatting a component's template label with the current
component value
"""
def __init__(self, input_dependency,... | [
"dash_labs.dependency.Output",
"dash_labs.build_id",
"dash_labs.templates.FlatDiv"
] | [((629, 646), 'dash_labs.build_id', 'build_id', (['"""label"""'], {}), "('label')\n", (637, 646), False, 'from dash_labs import build_id, templates\n'), ((389, 408), 'dash_labs.templates.FlatDiv', 'templates.FlatDiv', ([], {}), '()\n', (406, 408), False, 'from dash_labs import build_id, templates\n'), ((940, 978), 'das... |
# setup.py
# Setup installation for the application
from setuptools import find_namespace_packages, setup
import os
BASE_DIR = os.environ.get("BASE_DIR", None)
BASE_DIR = "." if BASE_DIR is None else BASE_DIR
# Load packages from requirements.txt
with open(f"{BASE_DIR}/requirements.txt") as file:
required_packag... | [
"os.environ.get",
"setuptools.find_namespace_packages"
] | [((129, 161), 'os.environ.get', 'os.environ.get', (['"""BASE_DIR"""', 'None'], {}), "('BASE_DIR', None)\n", (143, 161), False, 'import os\n'), ((1491, 1516), 'setuptools.find_namespace_packages', 'find_namespace_packages', ([], {}), '()\n', (1514, 1516), False, 'from setuptools import find_namespace_packages, setup\n')... |
from unittest import mock
from apns2.client import NotificationPriority
from django.test import TestCase
from push_notifications.apns import _apns_send
from push_notifications.exceptions import APNSUnsupportedPriority
class APNSPushPayloadTest(TestCase):
def test_push_payload(self):
with mock.patch("apns2.crede... | [
"unittest.mock.patch",
"push_notifications.apns._apns_send"
] | [((297, 341), 'unittest.mock.patch', 'mock.patch', (['"""apns2.credentials.init_context"""'], {}), "('apns2.credentials.init_context')\n", (307, 341), False, 'from unittest import mock\n'), ((994, 1038), 'unittest.mock.patch', 'mock.patch', (['"""apns2.credentials.init_context"""'], {}), "('apns2.credentials.init_conte... |
# Generated by Django 3.1.1 on 2020-09-06 20:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('index', '0002_auto_20200906_2002'),
]
operations = [
migrations.CreateModel(
name='Comapny',
fields=[
... | [
"django.db.models.TextField",
"django.db.models.AutoField"
] | [((337, 388), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)', 'serialize': '(False)'}), '(primary_key=True, serialize=False)\n', (353, 388), False, 'from django.db import migrations, models\n'), ((416, 455), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'nul... |
# Generated by Django 2.1.2 on 2019-10-31 08:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('kubeops_api', '0036_auto_20191031_0415'),
]
operations = [
migrations.RemoveField(
model_name='cluster',
name='auth_... | [
"django.db.migrations.RemoveField",
"django.db.models.CharField",
"django.db.migrations.DeleteModel"
] | [((239, 305), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""cluster"""', 'name': '"""auth_template"""'}), "(model_name='cluster', name='auth_template')\n", (261, 305), False, 'from django.db import migrations, models\n'), ((1031, 1074), 'django.db.migrations.DeleteModel', 'migrat... |
import multiprocess as mp
import pandas as pd
from itertools import combinations
import cooler
from bioframe import parse_regions
from .. import expected
import click
from . import cli
from . import util
# might be relevant to us ...
# https://stackoverflow.com/questions/46577535/how-can-i-run-a-dask-distributed-loca... | [
"pandas.DataFrame",
"click.argument",
"pandas.read_csv",
"click.option",
"click.Choice",
"cooler.Cooler",
"click.Path",
"bioframe.parse_regions",
"multiprocess.Pool"
] | [((450, 517), 'click.argument', 'click.argument', (['"""cool_path"""'], {'metavar': '"""COOL_PATH"""', 'type': 'str', 'nargs': '(1)'}), "('cool_path', metavar='COOL_PATH', type=str, nargs=1)\n", (464, 517), False, 'import click\n'), ((537, 686), 'click.option', 'click.option', (['"""--nproc"""', '"""-p"""'], {'help': '... |
import phonenumbers
from phonenumbers import carrier
from phonenumbers import geocoder
phone_number=phonenumbers.parse("+919323130355")
print(geocoder.description_for_number(phone_number,'en'))
print(carrier.name_for_number(phone_number,'en'))
| [
"phonenumbers.geocoder.description_for_number",
"phonenumbers.parse",
"phonenumbers.carrier.name_for_number"
] | [((103, 138), 'phonenumbers.parse', 'phonenumbers.parse', (['"""+919323130355"""'], {}), "('+919323130355')\n", (121, 138), False, 'import phonenumbers\n'), ((146, 197), 'phonenumbers.geocoder.description_for_number', 'geocoder.description_for_number', (['phone_number', '"""en"""'], {}), "(phone_number, 'en')\n", (177,... |
# usercustomize.py
from ideas.examples import function_keyword
from ideas import experimental_syntax_encoding # noqa
function_keyword.add_hook()
print(f" --> {__file__} was executed")
| [
"ideas.examples.function_keyword.add_hook"
] | [((120, 147), 'ideas.examples.function_keyword.add_hook', 'function_keyword.add_hook', ([], {}), '()\n', (145, 147), False, 'from ideas.examples import function_keyword\n')] |
# Copyright 2017 PerfKitBenchmarker Authors. 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 appli... | [
"unittest.main",
"mock.call",
"perfkitbenchmarker.flag_util.IntegerList",
"os.path.dirname",
"mock.patch",
"perfkitbenchmarker.linux_benchmarks.stencil2d_benchmark._MakeSamplesFromStencilOutput",
"mock.MagicMock",
"perfkitbenchmarker.linux_benchmarks.stencil2d_benchmark.Run"
] | [((2796, 2869), 'mock.patch', 'mock.patch', (['"""perfkitbenchmarker.linux_packages.cuda_toolkit_8.GetGpuType"""'], {}), "('perfkitbenchmarker.linux_packages.cuda_toolkit_8.GetGpuType')\n", (2806, 2869), False, 'import mock\n'), ((2893, 2972), 'mock.patch', 'mock.patch', (['"""perfkitbenchmarker.linux_packages.cuda_too... |
#
# Copyright 2016 The BigDL 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 to in ... | [
"numpy.sum",
"bigdl.orca.automl.hp.choice",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.optimizers.SGD",
"pytest.main",
"numpy.random.randint",
"bigdl.orca.automl.auto_estimator.AutoEstimator.from_keras",
"tensorflow.keras.layers.Concatenate",
"pytest.raises",
"tensorflow.keras.optimizers.A... | [((1319, 1337), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': '(32,)'}), '(shape=(32,))\n', (1324, 1337), False, 'from tensorflow.keras.layers import Input, Dense, Concatenate\n'), ((1352, 1370), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': '(64,)'}), '(shape=(64,))\n', (1357, 1370), False, 'from... |
import string
from math import hypot
from typing import List, Tuple
from climbingboard.hold import Hold
from climbingboard.position import Position
class Board:
vertical_count: int
horizontal_count: int
vertical_spacing: int
horizontal_spacing: int
missing_holds: List[Hold]
holds: List[Hold]
... | [
"string.ascii_uppercase.index",
"climbingboard.hold.Hold.Coordinates",
"math.hypot",
"climbingboard.position.Position"
] | [((2240, 2262), 'climbingboard.hold.Hold.Coordinates', 'Hold.Coordinates', (['hold'], {}), '(hold)\n', (2256, 2262), False, 'from climbingboard.hold import Hold\n'), ((2286, 2322), 'string.ascii_uppercase.index', 'string.ascii_uppercase.index', (['letter'], {}), '(letter)\n', (2314, 2322), False, 'import string\n'), ((... |
import numpy as np
import math
import sys
class Initializer():
def __init__(self, params):
raise NotImplementedError
def initialize(self, size):
raise NotImplementedError
class Gaussian(Initializer):
def __init__(self, mean=0, std=0.1):
self.mean = mean
self.std = std
... | [
"numpy.random.uniform",
"math.sqrt",
"numpy.random.normal"
] | [((368, 416), 'numpy.random.normal', 'np.random.normal', (['self.mean', 'self.std'], {'size': 'size'}), '(self.mean, self.std, size=size)\n', (384, 416), True, 'import numpy as np\n'), ((575, 619), 'numpy.random.uniform', 'np.random.uniform', (['self.a', 'self.b'], {'size': 'size'}), '(self.a, self.b, size=size)\n', (5... |
################################################################################
#
# Copyright (c) 2009 The MadGraph5_aMC@NLO Development team and Contributors
#
# This file is a part of the MadGraph5_aMC@NLO project, an application which
# automatically generates Feynman diagrams and matrix elements for arbitrary
# h... | [
"integrated_current_expressions.HE.CqqFF_Finite_Gabor_DIVJAC_NOD0",
"integrated_current_expressions.HE.CggFF_Finite_Gabor_DIVJAC_NOD0",
"madgraph.core.base_objects.EpsilonExpansion",
"integrated_current_expressions.HE.SoftFF_Finite_Gabor_DIVJAC_NOD0",
"commons.utils.SubtractionCurrentEvaluation",
"math.lo... | [((6484, 6516), 'commons.utils.SubtractionCurrentResult', 'utils.SubtractionCurrentResult', ([], {}), '()\n', (6514, 6516), True, 'import commons.utils as utils\n'), ((7248, 7371), 'commons.utils.SubtractionCurrentEvaluation', 'utils.SubtractionCurrentEvaluation', (["{'spin_correlations': [None], 'color_correlations': ... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import random
import time
import numpy as np
import pytest
import habitat
import habitat.datasets.pointnav.p... | [
"habitat.Dataset",
"habitat.datasets.pointnav.pointnav_generator.generate_pointnav_episode",
"os.getcwd",
"habitat.datasets.pointnav.pointnav_dataset.PointNavDatasetV1.get_scenes_to_load",
"numpy.allclose",
"habitat.datasets.pointnav.pointnav_dataset.PointNavDatasetV1.check_config_paths_exist",
"os.path... | [((944, 955), 'time.time', 'time.time', ([], {}), '()\n', (953, 955), False, 'import time\n'), ((1650, 1709), 'habitat.datasets.pointnav.pointnav_dataset.PointNavDatasetV1.get_scenes_to_load', 'PointNavDatasetV1.get_scenes_to_load', ([], {'config': 'dataset_config'}), '(config=dataset_config)\n', (1686, 1709), False, '... |
"""Tests for distutils.file_util."""
import unittest
import os
import shutil
from distutils.file_util import move_file, write_file, copy_file
from distutils import log
from distutils.tests import support
class FileUtilTestCase(support.TempdirManager, unittest.TestCase):
def _log(self, msg, *args):
if len... | [
"unittest.main",
"os.mkdir",
"unittest.makeSuite",
"distutils.file_util.write_file",
"distutils.file_util.move_file",
"distutils.file_util.copy_file",
"os.path.join"
] | [((2344, 2380), 'unittest.makeSuite', 'unittest.makeSuite', (['FileUtilTestCase'], {}), '(FileUtilTestCase)\n', (2362, 2380), False, 'import unittest\n'), ((2413, 2452), 'unittest.main', 'unittest.main', ([], {'defaultTest': '"""test_suite"""'}), "(defaultTest='test_suite')\n", (2426, 2452), False, 'import unittest\n')... |
# created by <NAME> <EMAIL>
import os
import logging
# import pkg_resources
from datetime import datetime
import attr
import pandas as pd
import numpy as np
from BuildingControlsSimulator.DataClients.DataStates import (
UNITS,
CHANNELS,
STATES,
)
from BuildingControlsSimulator.DataClients.DataSpec import... | [
"BuildingControlsSimulator.DataClients.DataSpec.convert_spec",
"attr.validators.instance_of",
"os.makedirs",
"attr.s",
"BuildingControlsSimulator.DataClients.DateTimeChannel.DateTimeChannel.get_timezone",
"attr.ib",
"logging.getLogger",
"datetime.datetime",
"os.environ.get",
"pandas.to_timedelta",... | [((970, 997), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (987, 997), False, 'import logging\n'), ((1001, 1021), 'attr.s', 'attr.s', ([], {'kw_only': '(True)'}), '(kw_only=True)\n', (1007, 1021), False, 'import attr\n'), ((1078, 1099), 'attr.ib', 'attr.ib', ([], {'default': 'None'}), '... |
import voltage # Import the Voltage module
from voltage.ext import commands # Importing commands for our client
client = commands.CommandsClient("!") # Initializing our client
ungodly_words = ["sus", "baka", "suppose", "real", "amogus"] # Creating our list to iterate through and add items later
@client.listen("... | [
"voltage.ext.commands.CommandsClient",
"voltage.ext.commands.command"
] | [((124, 152), 'voltage.ext.commands.CommandsClient', 'commands.CommandsClient', (['"""!"""'], {}), "('!')\n", (147, 152), False, 'from voltage.ext import commands\n'), ((962, 995), 'voltage.ext.commands.command', 'commands.command', ([], {'name': '"""add_word"""'}), "(name='add_word')\n", (978, 995), False, 'from volta... |
import logging
import re
from typing import *
import torch
from allennlp.common.from_params import Params, T
from allennlp.training.optimizers import Optimizer
logger = logging.getLogger('optim')
@Optimizer.register('transformer')
class TransformerOptimizer:
"""
Wrapper for AllenNLP optimizer.
This is u... | [
"allennlp.training.optimizers.Optimizer.register",
"re.match",
"logging.getLogger"
] | [((171, 197), 'logging.getLogger', 'logging.getLogger', (['"""optim"""'], {}), "('optim')\n", (188, 197), False, 'import logging\n'), ((201, 234), 'allennlp.training.optimizers.Optimizer.register', 'Optimizer.register', (['"""transformer"""'], {}), "('transformer')\n", (219, 234), False, 'from allennlp.training.optimiz... |
import pytest
@pytest.mark.usefixtures("ensure_armory_dirs")
def test_tf2_mnist():
pass
| [
"pytest.mark.usefixtures"
] | [((17, 62), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""ensure_armory_dirs"""'], {}), "('ensure_armory_dirs')\n", (40, 62), False, 'import pytest\n')] |
from flask import Flask, jsonify, abort, request
import flask_cors
import json
app = Flask(__name__)
DATA_PATH = 'data/'
@app.before_request
def option_autoreply():
""" Always reply 200 on OPTIONS request """
if request.method == 'OPTIONS':
resp = app.make_default_options_response()
headers... | [
"flask.request.args.get",
"flask.Flask",
"flask_cors.cross_origin",
"json.dumps"
] | [((86, 101), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (91, 101), False, 'from flask import Flask, jsonify, abort, request\n'), ((1336, 1402), 'flask_cors.cross_origin', 'flask_cors.cross_origin', ([], {'headers': "['Access-Control-Allow-Origin:*']"}), "(headers=['Access-Control-Allow-Origin:*'])\n", ... |
#!/usr/bin/env python
import numpy as np
from pylineclip import cohensutherland
"""
make box with corners LL/UR (1,3) (4,5)
and line segment with ends (0,0) (4,6)
"""
def main():
# %% LOWER to UPPER test
x1, y1, x2, y2 = cohensutherland(1, 5, 4, 3,
0, 0, 4, 6)
np.t... | [
"pylineclip.cohensutherland",
"numpy.testing.assert_array_almost_equal"
] | [((232, 271), 'pylineclip.cohensutherland', 'cohensutherland', (['(1)', '(5)', '(4)', '(3)', '(0)', '(0)', '(4)', '(6)'], {}), '(1, 5, 4, 3, 0, 0, 4, 6)\n', (247, 271), False, 'from pylineclip import cohensutherland\n'), ((316, 403), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['... |
from collections import namedtuple
import csv
import random
import numpy as np
import torch
def set_seed(seed):
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
if torch.cuda.is_available():
torch.cuda.manual_seed_all(seed)
def convert_dp_to_single(state_dict):
mod_key = "... | [
"numpy.random.seed",
"torch.manual_seed",
"torch.cuda.manual_seed_all",
"torch.cuda.is_available",
"random.seed"
] | [((119, 136), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (130, 136), False, 'import random\n'), ((141, 161), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (155, 161), True, 'import numpy as np\n'), ((166, 189), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (18... |
from .label_preprocess import remove_duplicates, remove_low_entropy_labels
from collections import deque
from itertools import chain
import numpy as np
import torch
import time
import os
from .envs import make_vec_envs
from .utils import download_run
try:
import wandb
except:
pass
checkpointed_steps_full = [1... | [
"wandb.log",
"numpy.random.uniform",
"torch.stack",
"torch.load",
"os.path.exists",
"numpy.random.RandomState",
"time.sleep",
"numpy.mean",
"numpy.random.randint",
"torch.zeros",
"torch.no_grad",
"itertools.chain.from_iterable",
"collections.deque"
] | [((1933, 1949), 'collections.deque', 'deque', ([], {'maxlen': '(10)'}), '(maxlen=10)\n', (1938, 1949), False, 'from collections import deque\n'), ((3685, 3748), 'torch.load', 'torch.load', (['filepath'], {'map_location': '(lambda storage, loc: storage)'}), '(filepath, map_location=lambda storage, loc: storage)\n', (369... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 19 19:39:28 2018
@author: egomez
"""
import numpy as np
import pandas as pd
def get_decision_index(decission_param, data_features, combination_dict):
Theta = pd.DataFrame()
for c in range(len(combination_dict)):
Theta_2 = pd.DataFrame()
... | [
"pandas.DataFrame",
"numpy.str",
"numpy.float",
"pandas.concat"
] | [((221, 235), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (233, 235), True, 'import pandas as pd\n'), ((299, 313), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (311, 313), True, 'import pandas as pd\n'), ((994, 1011), 'pandas.concat', 'pd.concat', (['frames'], {}), '(frames)\n', (1003, 1011), True, '... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | [
"subprocess.run",
"yaml.load",
"pkg_resources.parse_requirements",
"json.load",
"click.argument",
"yaml.safe_dump",
"pkg_resources.Requirement.parse",
"click.option",
"os.environ.get",
"collections.defaultdict",
"pathlib.Path",
"toml.load",
"toml.dump",
"packaging.utils.canonicalize_name",... | [((4226, 4239), 'click.group', 'click.group', ([], {}), '()\n', (4237, 4239), False, 'import click\n'), ((12098, 12132), 'click.argument', 'click.argument', (['"""extras"""'], {'nargs': '(-1)'}), "('extras', nargs=-1)\n", (12112, 12132), False, 'import click\n'), ((12134, 12399), 'click.option', 'click.option', (['"""-... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"tvm.driver.tvmc.registry.generate_registry_args",
"tvm.driver.tvmc.registry.reconstruct_registry_entity",
"argparse.ArgumentParser",
"pytest.raises"
] | [((1036, 1061), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1059, 1061), False, 'import argparse\n'), ((1066, 1106), 'tvm.driver.tvmc.registry.generate_registry_args', 'generate_registry_args', (['parser', 'Executor'], {}), '(parser, Executor)\n', (1088, 1106), False, 'from tvm.driver.tvmc.... |
"""app.services.location.csbs.py"""
import csv
from datetime import datetime
from asyncache import cached
from cachetools import TTLCache
from ...coordinates import Coordinates
from ...location.csbs import CSBSLocation
from ...utils import httputils
from . import LocationService
class CSBSLocationService(LocationSe... | [
"datetime.datetime.strptime",
"cachetools.TTLCache"
] | [((834, 863), 'cachetools.TTLCache', 'TTLCache', ([], {'maxsize': '(1)', 'ttl': '(3600)'}), '(maxsize=1, ttl=3600)\n', (842, 863), False, 'from cachetools import TTLCache\n'), ((2021, 2069), 'datetime.datetime.strptime', 'datetime.strptime', (['last_update', '"""%Y-%m-%d %H:%M"""'], {}), "(last_update, '%Y-%m-%d %H:%M'... |
from django.conf.urls import url
from . import views
app_name = 'lunch'
urlpatterns = [
# index /
url(r'^$', views.index, name='index'),
# /restaurant/add
url(r'^restaurant/add$', views.add_restaurant, name='add_restaurant'),
# /restaurant/<id>
url(r'^restaurant/(?P<restaurant_id>[0-9]+)$', views... | [
"django.conf.urls.url"
] | [((105, 141), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.index'], {'name': '"""index"""'}), "('^$', views.index, name='index')\n", (108, 141), False, 'from django.conf.urls import url\n'), ((170, 238), 'django.conf.urls.url', 'url', (['"""^restaurant/add$"""', 'views.add_restaurant'], {'name': '"""add_restaura... |
import copy
import os
from rdkit import Chem
import tqdm
from utils import MoleculeUtils, ReactionUtils, SearchUtils, calculate_cdscore, calculate_rdscore, \
get_node_info, calculate_asscore, calculate_stscore
from mcts_modules import Node, State, back_propagation
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
cl... | [
"utils.calculate_stscore",
"copy.deepcopy",
"utils.SearchUtils.is_proved",
"utils.MoleculeUtils.update_mol_condition",
"utils.calculate_cdscore",
"mcts_modules.State",
"utils.get_node_info",
"utils.ReactionUtils.predict_reactions",
"utils.ReactionUtils.react_product_to_reactants",
"utils.calculate... | [((1459, 1483), 'mcts_modules.State', 'State', (['[self.TARGET_MOL]'], {}), '([self.TARGET_MOL])\n', (1464, 1483), False, 'from mcts_modules import Node, State, back_propagation\n'), ((3279, 3411), 'utils.ReactionUtils.predict_reactions', 'ReactionUtils.predict_reactions', (['self.EXPANSION_RULES', 'expansion_model', '... |
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from django.utils import timezone
from .compat import JSONField
from .sign... | [
"django.contrib.contenttypes.fields.GenericForeignKey",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.PositiveIntegerField",
"django.utils.timezone.now",
"django.contrib.contenttypes.models.ContentType.objects.get_for_model",
"django.db.models.DateTimeField"
] | [((536, 593), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'default': 'timezone.now', 'db_index': '(True)'}), '(default=timezone.now, db_index=True)\n', (556, 593), False, 'from django.db import models\n'), ((607, 653), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)', 'db... |
"""
haravasto - yksinkertainen graafinen käyttöliittymäkirjasto miinaharavalle.
@author: <NAME>, <NAME>
Tämä kirjasto tarjoaa nipun funktioita, joilla opiskelijat voivat toteuttaa
graafisen käyttöliittymän miinaharavalle ilman, että heidän tarvitsee erikseen
opetella kokonaista käyttöliittymä- tai pelikirjastoa. Kirj... | [
"pyglet.resource.image",
"pyglet.clock.unschedule",
"pyglet.app.run",
"pyglet.text.Label",
"pyglet.graphics.Batch",
"pyglet.image.SolidColorImagePattern",
"pyglet.window.Window",
"pyglet.gl.glEnable",
"pyglet.app.exit",
"pyglet.clock.schedule_interval"
] | [((1925, 1948), 'pyglet.gl.glEnable', 'glEnable', (['GL_TEXTURE_2D'], {}), '(GL_TEXTURE_2D)\n', (1933, 1948), False, 'from pyglet.gl import glEnable, GL_TEXTURE_2D\n'), ((2860, 2900), 'pyglet.resource.image', 'pyglet.resource.image', (['"""ruutu_tyhja.png"""'], {}), "('ruutu_tyhja.png')\n", (2881, 2900), False, 'import... |
import configparser
import decimal
import os
import sqlite3
import sys
import time
import traceback
import urllib.request
import zipfile
def setup_surname_table(verbose):
'''This creates the surname database and does housekeeping.
Args:
verbose: True/False for whether function outputs info.
Retu... | [
"sys.stdout.write",
"traceback.print_exc",
"zipfile.ZipFile",
"decimal.Decimal",
"os.path.exists",
"time.sleep",
"sqlite3.connect",
"configparser.ConfigParser",
"os.path.expanduser"
] | [((5264, 5277), 'time.sleep', 'time.sleep', (['(0)'], {}), '(0)\n', (5274, 5277), False, 'import time\n'), ((572, 624), 'sys.stdout.write', 'sys.stdout.write', (['"""Checking db existence ... \t\t\t"""'], {}), "('Checking db existence ... \\t\\t\\t')\n", (588, 624), False, 'import sys\n'), ((652, 675), 'os.path.expandu... |
import numpy as np
import torch
import torch.nn as nn
import math
import copy
from typing import Union
from torch.distributions import Categorical
import os
import yaml
device = torch.device("cuda:1") if torch.cuda.is_available() else torch.device("cpu")
def hard_update(source, target):
target.load_state_dict(so... | [
"copy.deepcopy",
"torch.nn.ReLU",
"torch.distributions.Categorical",
"math.sqrt",
"torch.nn.Sequential",
"torch.nn.Tanh",
"numpy.square",
"numpy.zeros",
"torch.nn.Linear",
"numpy.random.randint",
"torch.cuda.is_available",
"torch.nn.Softmax",
"numpy.array",
"torch.device",
"numpy.squeeze... | [((205, 230), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (228, 230), False, 'import torch\n'), ((179, 201), 'torch.device', 'torch.device', (['"""cuda:1"""'], {}), "('cuda:1')\n", (191, 201), False, 'import torch\n'), ((236, 255), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu'... |
"""Collectors for SonarQube."""
from datetime import datetime
from typing import Dict, List
from dateutil.parser import isoparse
from base_collectors import SourceCollector, SourceUpToDatenessCollector
from collector_utilities.functions import match_string_or_regular_expression
from collector_utilities.type import U... | [
"collector_utilities.type.URL",
"base_collectors.SourceCollector._api_url",
"source_model.SourceResponses",
"source_model.SourceMeasurement",
"base_collectors.SourceCollector._landing_url"
] | [((1018, 1073), 'collector_utilities.type.URL', 'URL', (['f"""{url}/api/components/show?component={component}"""'], {}), "(f'{url}/api/components/show?component={component}')\n", (1021, 1073), False, 'from collector_utilities.type import URL, Response\n'), ((3526, 3626), 'collector_utilities.type.URL', 'URL', (['f"""{u... |
# Copyright 2019 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
"cirq.google.engine.engine.Engine",
"cirq.google.api.v2.run_context_pb2.RunContext.FromString",
"cirq.study.ParamResolver",
"cirq.google.engine.calibration_result.CalibrationResult",
"cirq.google.engine.calibration.Calibration",
"cirq.google.api.v2.results_from_proto",
"cirq.google.engine.engine_process... | [((3465, 3522), 'cirq.google.engine.engine.Engine', 'engine_base.Engine', (['self.project_id'], {'context': 'self.context'}), '(self.project_id, context=self.context)\n', (3483, 3522), True, 'import cirq.google.engine.engine as engine_base\n'), ((3719, 3795), 'cirq.google.engine.engine_program.EngineProgram', 'engine_p... |
#!/usr/bin/python2
# -*- coding: latin-1 -*-
"""
pubmed.py
PubMed handling functions.
This module gets publication data from a PubMed identifier, relying heavily on the doi.py module.
This module is a simple parser for the NCBI ID converter API:
http://www.ncbi.nlm.nih.gov/pmc/tools/id-converter-api/
using their web ... | [
"klab.comms.http.get_resource",
"klab.colortext.message",
"sys.path.insert",
"xml.dom.minidom.parseString"
] | [((588, 615), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../.."""'], {}), "(0, '../..')\n", (603, 615), False, 'import sys\n'), ((4843, 4922), 'klab.colortext.message', 'colortext.message', (['"""\nRetrieving the mapping for PMC3531190 and PMC3245039."""'], {}), '("""\nRetrieving the mapping for PMC3531190 and ... |
import yaml
import os
import re
def getFileInfo(fileName):
fileInfo = fileName.replace('/', '.').split('.')
l = len(fileInfo) - 1
return {'file': fileInfo[l-1].replace('/', ''),\
'ext': fileInfo[l].replace('/', '')}
def getFileData(fileName):
file = open(fileName, 'r')
data = file.read... | [
"yaml.load",
"os.path.isdir",
"yaml.dump",
"re.sub",
"os.listdir"
] | [((2068, 2090), 'yaml.load', 'yaml.load', (['currentData'], {}), '(currentData)\n', (2077, 2090), False, 'import yaml\n'), ((796, 811), 'yaml.load', 'yaml.load', (['data'], {}), '(data)\n', (805, 811), False, 'import yaml\n'), ((1609, 1628), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (1622, 1628), Fa... |
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
import filecmp
import os
import pytest
import yaml
from octavia_cli.generate.renderer import ConnectionSpecificationRenderer
pytestmark = pytest.mark.integration
SOURCE_SPECS = "../airbyte-config/init/src/main/resources/seed/source_specs.yaml"
DESTINATION_... | [
"pytest.mark.parametrize",
"filecmp.cmp",
"yaml.load",
"os.path.join"
] | [((403, 523), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""spec_type, spec_file_path"""', "[('source', SOURCE_SPECS), ('destination', DESTINATION_SPECS)]"], {}), "('spec_type, spec_file_path', [('source',\n SOURCE_SPECS), ('destination', DESTINATION_SPECS)])\n", (426, 523), False, 'import pytest\n'), ... |
"""
Copyright (c) 2019-2022 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
import os
import shutil
import tempfile
import zipfile
from typing import Optional, TYPE_CHECKING
from osbs.utils import ImageName
from... | [
"atomic_reactor.util.get_platforms",
"zipfile.ZipFile",
"os.path.basename",
"atomic_reactor.util.has_operator_bundle_manifest",
"os.walk",
"atomic_reactor.utils.operator.OperatorManifest.from_directory",
"tempfile.mkdtemp",
"os.path.relpath",
"shutil.rmtree",
"atomic_reactor.util.has_operator_appr... | [((830, 867), 'os.path.join', 'os.path.join', (['"""/"""', 'MANIFESTS_DIR_NAME'], {}), "('/', MANIFESTS_DIR_NAME)\n", (842, 867), False, 'import os\n'), ((1831, 1864), 'atomic_reactor.util.get_platforms', 'get_platforms', (['self.workflow.data'], {}), '(self.workflow.data)\n', (1844, 1864), False, 'from atomic_reactor.... |
# encoding: UTF-8
'''
vn.okcoin的gateway接入
注意:
1. 该接口尚处于测试阶段,用于实盘请谨慎
2. 目前仅支持USD和CNY的现货交易,USD的期货合约交易暂不支持
'''
import os
import json
from datetime import datetime
from copy import copy
from threading import Condition
from Queue import Queue
from threading import Thread
import vnokcoin
from vtGateway import *
# 价格类型映... | [
"threading.Thread",
"json.load",
"Queue.Queue",
"os.path.dirname",
"copy.copy",
"datetime.datetime.now",
"os.path.join"
] | [((3044, 3072), 'os.path.join', 'os.path.join', (['path', 'fileName'], {}), '(path, fileName)\n', (3056, 3072), False, 'import os\n'), ((3365, 3377), 'json.load', 'json.load', (['f'], {}), '(f)\n', (3374, 3377), False, 'import json\n'), ((7417, 7424), 'Queue.Queue', 'Queue', ([], {}), '()\n', (7422, 7424), False, 'from... |
#!/usr/bin/python3
#-*-coding:utf8-*-
'''
Emoji, I'm coming.
This project get emoji from [face.ersansan.cn]. Each category has one dictionary to hold its all pictures.
This example will show you how download files with spider.
'''
import aiohttp
from aiospider import Spider
import os
from os.path import splitext, bas... | [
"os.mkdir",
"aiospider.Spider",
"os.path.basename",
"os.path.splitext",
"os.path.join"
] | [((617, 625), 'aiospider.Spider', 'Spider', ([], {}), '()\n', (623, 625), False, 'from aiospider import Spider\n'), ((554, 568), 'os.mkdir', 'os.mkdir', (['path'], {}), '(path)\n', (562, 568), False, 'import os\n'), ((1500, 1531), 'os.path.join', 'join', (['os.curdir', 'category', 'name'], {}), '(os.curdir, category, n... |
# coding=utf-8
from __future__ import unicode_literals
from collections import OrderedDict
from .. import Provider as PersonProvider
class Provider(PersonProvider):
formats_male = OrderedDict((
('{{last_name_male}} {{first_name_male}} {{middle_name_male}}', 0.97),
('{{prefix_male}} {{last... | [
"collections.OrderedDict"
] | [((193, 378), 'collections.OrderedDict', 'OrderedDict', (["(('{{last_name_male}} {{first_name_male}} {{middle_name_male}}', 0.97), (\n '{{prefix_male}} {{last_name_male}} {{first_name_male}} {{middle_name_male}}'\n , 0.03))"], {}), "((('{{last_name_male}} {{first_name_male}} {{middle_name_male}}',\n 0.97), (\n... |
# -*- encoding: utf-8 -*-
# @Time : 2021/1/8
# @Author : <NAME>
# @email : <EMAIL>
# UPDATE
# @Time : 2021/1/9
# @Author : <NAME>
# @email : <EMAIL>
from crslab.config import Config
from crslab.data import get_dataset, get_dataloader
from crslab.system import get_system
def run_crslab(config... | [
"crslab.data.get_dataloader",
"crslab.system.get_system",
"crslab.data.get_dataset"
] | [((2789, 2928), 'crslab.system.get_system', 'get_system', (['config', 'train_dataloader', 'valid_dataloader', 'test_dataloader', 'vocab', 'side_data', 'restore_system', 'interact', 'debug', 'tensorboard'], {}), '(config, train_dataloader, valid_dataloader, test_dataloader,\n vocab, side_data, restore_system, interac... |
# Copyright 2020 Adap GmbH. 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 ag... | [
"flwr.proto.transport_pb2.ClientMessage.Disconnect",
"flwr.proto.transport_pb2.ClientMessage.EvaluateRes",
"typing.cast",
"flwr.proto.transport_pb2.Scalar",
"flwr.proto.transport_pb2.ServerMessage.FitIns",
"flwr.proto.transport_pb2.ServerMessage.GetParameters",
"flwr.proto.transport_pb2.ServerMessage.Ev... | [((1081, 1155), 'flwr.proto.transport_pb2.Parameters', 'Parameters', ([], {'tensors': 'parameters.tensors', 'tensor_type': 'parameters.tensor_type'}), '(tensors=parameters.tensors, tensor_type=parameters.tensor_type)\n', (1091, 1155), False, 'from flwr.proto.transport_pb2 import ClientMessage, Parameters, Reason, Scala... |
import tensorflow as tf
from tensorflow.python.framework import ops
from . import triplet_loss_op
@ops.RegisterGradient("Triplet")
def _triplet_grad(op, grad, _):
diff = op.outputs[1]
margin = op.get_attr('margin')
# compute gradient
data_grad = triplet_loss_op.triplet_loss_grad(diff, grad, margin)
return... | [
"tensorflow.python.framework.ops.RegisterGradient"
] | [((100, 131), 'tensorflow.python.framework.ops.RegisterGradient', 'ops.RegisterGradient', (['"""Triplet"""'], {}), "('Triplet')\n", (120, 131), False, 'from tensorflow.python.framework import ops\n')] |
from markov_sentence_generator import MarkovModel
from markov_sentence_generator import SentenceGenerator
from error_correction import API_URL_BASE, correct_spelling
from sentences import Message
from itertools import chain
import random
import os
import socket
import sys
def parce_input():
"""
Чтение копуса сообще... | [
"markov_sentence_generator.SentenceGenerator",
"sentences.Message",
"random.randint",
"socket.socket",
"sys.getsizeof"
] | [((784, 800), 'sentences.Message', 'Message', (['message'], {}), '(message)\n', (791, 800), False, 'from sentences import Message\n'), ((3892, 3915), 'markov_sentence_generator.SentenceGenerator', 'SentenceGenerator', (['data'], {}), '(data)\n', (3909, 3915), False, 'from markov_sentence_generator import SentenceGenera... |
#!/usr/bin/env python
#=========================================================================
# This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
# License (GPL) version 3, as described at www.opensource.org.
# Copyright (C)2017 <NAME> (<EMAIL>).
#=======================================================... | [
"ProgramName.get",
"os.system",
"Rex.Rex"
] | [((827, 832), 'Rex.Rex', 'Rex', ([], {}), '()\n', (830, 832), False, 'from Rex import Rex\n'), ((1251, 1336), 'os.system', 'os.system', (["('cd ' + STAN + '; rm -f ' + HERE + model + '.o; make ' + HERE + model)"], {}), "('cd ' + STAN + '; rm -f ' + HERE + model + '.o; make ' + HERE + model\n )\n", (1260, 1336), Fals... |
import logging
from django import forms
from django.contrib.auth import authenticate
from django.contrib.auth.forms import AuthenticationForm
from authy_me.models import AuthenticatorModel
from authy_me.utils import is_int
logger = logging.getLogger(__name__)
class AuthenticatorAdminForm(forms.ModelForm):
"""
... | [
"django.forms.EmailField",
"django.forms.BooleanField",
"django.forms.ValidationError",
"django.forms.CheckboxInput",
"django.forms.CharField",
"logging.getLogger"
] | [((235, 262), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (252, 262), False, 'import logging\n'), ((388, 515), 'django.forms.CharField', 'forms.CharField', ([], {'widget': 'forms.NumberInput', 'required': '(False)', 'help_text': '"""This ID is provided by Authy and cannot be changed.""... |
from collections import deque, defaultdict
import tqdm
import numpy as np
from loguru import logger
import jax
import jax.numpy as jnp
import optax
import rlax
from yahtzotron.game import play_tournament
from yahtzotron.interactive import print_score
REWARD_NORM = 100
WINNING_REWARD = 100
def entropy(logits):
... | [
"optax.adam",
"jax.numpy.full_like",
"jax.nn.log_softmax",
"numpy.argmax",
"numpy.mean",
"yahtzotron.game.play_tournament",
"jax.nn.one_hot",
"jax.nn.softmax",
"collections.deque",
"jax.tree_util.tree_map",
"jax.jit",
"jax.numpy.where",
"jax.numpy.vdot",
"optax.apply_updates",
"loguru.lo... | [((329, 351), 'jax.nn.softmax', 'jax.nn.softmax', (['logits'], {}), '(logits)\n', (343, 351), False, 'import jax\n'), ((367, 393), 'jax.nn.log_softmax', 'jax.nn.log_softmax', (['logits'], {}), '(logits)\n', (385, 393), False, 'import jax\n'), ((556, 588), 'jax.tree_util.tree_flatten', 'jax.tree_util.tree_flatten', (['t... |
import yaml
# Read config.yaml first as the other imports rely on it
try:
with open("config.yml") as file:
config = yaml.full_load(file)
except FileNotFoundError as e:
raise FileNotFoundError(
"The bot requires a config.yml file with the necessary values to start. "
"Please read the or... | [
"yaml.full_load"
] | [((130, 150), 'yaml.full_load', 'yaml.full_load', (['file'], {}), '(file)\n', (144, 150), False, 'import yaml\n')] |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | [
"os.mkdir",
"aiida.manage.database.delete.nodes.delete_nodes",
"aiida.orm.Code.get_from_string",
"sys.exc_info",
"shutil.rmtree",
"aiida.orm.Code.list_for_plugin",
"os.path.join",
"aiida.plugins.DataFactory",
"aiida.orm.ProcessNode",
"aiida.common.timezone.now",
"six.moves.StringIO",
"six.move... | [((52424, 52484), 'unittest.skip', 'unittest.skip', (['"""open issue JobCalculations cannot be stored"""'], {}), "('open issue JobCalculations cannot be stored')\n", (52437, 52484), False, 'import unittest\n'), ((60373, 60432), 'unittest.skip', 'unittest.skip', (['"""activate this test once #2238 is addressed"""'], {})... |
# Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | [
"pytorch_lightning.utilities.distributed.rank_zero_warn",
"pytorch_lightning.utilities.deprecation.deprecated"
] | [((1816, 1895), 'pytorch_lightning.utilities.deprecation.deprecated', 'deprecated', ([], {'target': '_MetricCollection', 'ver_deprecate': '"""1.3.0"""', 'ver_remove': '"""1.5.0"""'}), "(target=_MetricCollection, ver_deprecate='1.3.0', ver_remove='1.5.0')\n", (1826, 1895), False, 'from pytorch_lightning.utilities.deprec... |
# -*- coding: utf-8 -*-
"""
:author: 秋荏苒
:copyright: © 2019 by 秋荏苒 <<EMAIL>>.
:license: MIT, see LICENSE for more details.
"""
import random
from faker import Faker
from app.libs.extensions import db
from app.models import Admin, Category, Comment, Post, Link
faker = Faker('zh_cn')
def fake_admin():
... | [
"faker.Faker",
"app.models.Category.query.count",
"app.libs.extensions.db.session.add_all",
"app.libs.extensions.db.session.add",
"app.models.Comment.query.count",
"app.libs.extensions.db.auto_commit",
"app.models.Post.query.count",
"app.models.Link",
"app.models.Admin",
"app.models.Category"
] | [((283, 297), 'faker.Faker', 'Faker', (['"""zh_cn"""'], {}), "('zh_cn')\n", (288, 297), False, 'from faker import Faker\n'), ((357, 373), 'app.libs.extensions.db.auto_commit', 'db.auto_commit', ([], {}), '()\n', (371, 373), False, 'from app.libs.extensions import db\n'), ((391, 511), 'app.models.Admin', 'Admin', ([], {... |
#!/usr/bin/python2
"""
Project : SIM800 test script
Date&Time : 08th August 2019.
Description : This module consists all API's nececeary for testing SIMcom SIM800H module
http://simcomm2m.com/En/module/detail.aspx?id=75
"""
import serial
import logging
import time, sys, codecs
class SIM800H:
def __init__(
self... | [
"serial.Serial",
"logging.error",
"logging.debug",
"time.sleep",
"sys.exit"
] | [((665, 803), 'serial.Serial', 'serial.Serial', (['self.portName', 'self.baudRate'], {'timeout': 'self.timeout', 'bytesize': 'self.bytesize', 'parity': 'self.parity', 'stopbits': 'self.stopbits'}), '(self.portName, self.baudRate, timeout=self.timeout, bytesize=\n self.bytesize, parity=self.parity, stopbits=self.stop... |
import json
import torch
PAD_token = 0 # Used for padding short sentences
SOS_token = 1 # Start-of-sentence token
EOS_token = 2 # End-of-sentence token
# TODO: `.to(device=device)` for all tensors
class Voc:
def __init__(self, name):
self.name = name
self.trimmed = False
self.word2in... | [
"torch.ones",
"json.load",
"torch.LongTensor",
"torch.unsqueeze",
"torch.cat",
"torch.max",
"torch.zeros",
"torch.no_grad",
"torch.jit.load",
"torch.tensor"
] | [((622, 650), 'torch.jit.load', 'torch.jit.load', (['"""encoder.pt"""'], {}), "('encoder.pt')\n", (636, 650), False, 'import torch\n'), ((661, 689), 'torch.jit.load', 'torch.jit.load', (['"""decoder.pt"""'], {}), "('decoder.pt')\n", (675, 689), False, 'import torch\n'), ((597, 609), 'json.load', 'json.load', (['f'], {}... |
"""Publish the pose of some markers for testing purposes."""
# Copyright (c) 2022, ABB
# 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
# ... | [
"rclpy.spin",
"numpy.random.random_sample",
"rclpy.init",
"aruco_interfaces.msg.ArucoMarkers",
"rclpy.shutdown",
"geometry_msgs.msg.Pose"
] | [((3702, 3723), 'rclpy.init', 'rclpy.init', ([], {'args': 'args'}), '(args=args)\n', (3712, 3723), False, 'import rclpy\n'), ((3756, 3777), 'rclpy.spin', 'rclpy.spin', (['publisher'], {}), '(publisher)\n', (3766, 3777), False, 'import rclpy\n'), ((3812, 3828), 'rclpy.shutdown', 'rclpy.shutdown', ([], {}), '()\n', (3826... |
from __future__ import absolute_import
from datetime import datetime
from flask_restful.reqparse import RequestParser
from changes.api.base import APIView
from changes.api.validators.datetime import ISODatetime
from changes.config import db
from changes.constants import Result
from changes.models import JobStep
cla... | [
"flask_restful.reqparse.RequestParser",
"changes.api.validators.datetime.ISODatetime",
"changes.config.db.session.add",
"datetime.datetime.utcnow",
"changes.config.db.session.commit",
"changes.models.JobStep.query.get"
] | [((375, 390), 'flask_restful.reqparse.RequestParser', 'RequestParser', ([], {}), '()\n', (388, 390), False, 'from flask_restful.reqparse import RequestParser\n'), ((496, 522), 'changes.models.JobStep.query.get', 'JobStep.query.get', (['step_id'], {}), '(step_id)\n', (513, 522), False, 'from changes.models import JobSte... |
'''
Built on cartrgipper implementation in
https://github.com/SudeepDasari/visual_foresight
'''
import numpy as np
import random
from tensorflow.contrib.training import HParams
from gym import Env
from gym import utils
class BaseEnv(Env, utils.EzPickle):
def step(self, action):
"""
Applies the ac... | [
"numpy.random.seed",
"random.seed",
"tensorflow.contrib.training.HParams"
] | [((1009, 1018), 'tensorflow.contrib.training.HParams', 'HParams', ([], {}), '()\n', (1016, 1018), False, 'from tensorflow.contrib.training import HParams\n'), ((2991, 3008), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (3002, 3008), False, 'import random\n'), ((3017, 3037), 'numpy.random.seed', 'np.random.... |
from __future__ import division
import Adafruit_PCA9685
from adafruit_servokit import ServoKit
import adafruit_motor.servo
import time
pca = Adafruit_PCA9685.PCA9685()
kit = ServoKit(channels=16)
# I do not know what this is for, but it works without it
# servo = adafruit_motor.servo.Servo(0)
servo_0 = kit.servo[0]
... | [
"adafruit_servokit.ServoKit",
"Adafruit_PCA9685.PCA9685",
"time.sleep"
] | [((142, 168), 'Adafruit_PCA9685.PCA9685', 'Adafruit_PCA9685.PCA9685', ([], {}), '()\n', (166, 168), False, 'import Adafruit_PCA9685\n'), ((176, 197), 'adafruit_servokit.ServoKit', 'ServoKit', ([], {'channels': '(16)'}), '(channels=16)\n', (184, 197), False, 'from adafruit_servokit import ServoKit\n'), ((665, 678), 'tim... |
import numpy as np
from arcsv.helper import GenomeInterval
def sv_affected_len(path, blocks):
# ref_path = list(range(0, 2 * len(blocks)))
n_ref = len([x for x in blocks if not x.is_insertion()])
ref_block_num = list(range(n_ref))
ref_string = ''.join(chr(x) for x in range(ord('A'), ord('A') + n_ref))... | [
"numpy.floor",
"numpy.zeros",
"numpy.max",
"numpy.array",
"arcsv.helper.GenomeInterval"
] | [((1389, 1426), 'numpy.zeros', 'np.zeros', (['(l1 + 1, l2 + 1)'], {'dtype': 'int'}), '((l1 + 1, l2 + 1), dtype=int)\n', (1397, 1426), True, 'import numpy as np\n'), ((1438, 1478), 'numpy.array', 'np.array', (['([[None] * (l2 + 1)] * (l1 + 1))'], {}), '([[None] * (l2 + 1)] * (l1 + 1))\n', (1446, 1478), True, 'import num... |
from setuptools import find_packages, setup
VERSION = "0.1.4"
DESCRIPTION = "Basic ETL Pipeline construction for Airflow"
LONG_DESCRIPTION = "TODO"
AUTHORS = (
"<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>",
)
setup(
name="cspipeline",
version=VERSION,
author=AUTHORS,
author_ema... | [
"setuptools.find_packages"
] | [((408, 423), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (421, 423), False, 'from setuptools import find_packages, setup\n')] |
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
# for MNIST 32*32
class CNN_Net(nn.Module):
def __init__(self, device=None):
super(CNN_Net, self).__init__()
self.conv1 = nn.Conv2d(1, 64, 3, 1)
self.conv2 = nn.Conv2d(64, 16, 7, 1)
self.fc1 = nn.Linear(4 ... | [
"torch.nn.Dropout",
"torch.nn.Embedding",
"torch.cat",
"torch.nn.functional.avg_pool2d",
"torch.nn.functional.log_softmax",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.AvgPool2d",
"torch.nn.functional.max_pool2d",
"torch.nn.functional.relu",
"torchvision.models.resnet18",
"torch.nn.LogSoftmax"... | [((233, 255), 'torch.nn.Conv2d', 'nn.Conv2d', (['(1)', '(64)', '(3)', '(1)'], {}), '(1, 64, 3, 1)\n', (242, 255), True, 'import torch.nn as nn\n'), ((271, 294), 'torch.nn.Conv2d', 'nn.Conv2d', (['(64)', '(16)', '(7)', '(1)'], {}), '(64, 16, 7, 1)\n', (280, 294), True, 'import torch.nn as nn\n'), ((308, 334), 'torch.nn.... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"os.makedirs",
"mindspore.log.warning",
"mindspore.parallel._dp_allreduce_fusion._set_fusion_strategy_by_size",
"os.path.dirname",
"mindspore._checkparam.Validator.check_positive_int",
"os.path.exists",
"mindspore.parallel._dp_allreduce_fusion._set_fusion_strategy_by_idx",
"threading.Lock",
"mindspo... | [((22427, 22948), 'mindspore._checkparam.args_type_check', 'args_type_check', ([], {'device_num': 'int', 'global_rank': 'int', 'gradients_mean': 'bool', 'gradient_fp32_sync': 'bool', 'loss_repeated_mean': 'bool', 'parallel_mode': 'str', 'auto_parallel_search_mode': 'str', 'parameter_broadcast': 'bool', 'strategy_ckpt_l... |
from math import ceil
import numpy as np
def modulate(msg, Eb, Tb, f_c1, f_s):
f_c2 = ceil(f_c1 + 1 / Tb)
signal = []
t = np.linspace(0, Tb, int(Tb * f_s))
for i in msg:
s = np.sqrt(2 * Eb / Tb) * np.cos(2 * np.pi * f_c1 * t)
s1 = np.sqrt(2 * Eb / Tb) * np.cos(2 * np.pi * f_c2 * t)
... | [
"math.ceil",
"numpy.sin",
"numpy.array",
"numpy.exp",
"numpy.cos",
"numpy.sqrt"
] | [((93, 112), 'math.ceil', 'ceil', (['(f_c1 + 1 / Tb)'], {}), '(f_c1 + 1 / Tb)\n', (97, 112), False, 'from math import ceil\n'), ((456, 472), 'numpy.array', 'np.array', (['signal'], {}), '(signal)\n', (464, 472), True, 'import numpy as np\n'), ((525, 544), 'math.ceil', 'ceil', (['(f_c1 + 1 / Tb)'], {}), '(f_c1 + 1 / Tb)... |
import random
import re
from typing import List, Dict
from tornado import web
import aiohttp
from cache import CachedHandler
from settings import SEARCH_SETTINGS, HASH, ARTISTS
from utils import uni_hash, setup_logger, vk_url
class SearchHandler(CachedHandler):
logger = setup_logger('search')
@web.addslash... | [
"tornado.web.HTTPError",
"random.choice",
"utils.vk_url",
"aiohttp.ClientSession",
"re.search",
"utils.setup_logger",
"re.sub"
] | [((279, 301), 'utils.setup_logger', 'setup_logger', (['"""search"""'], {}), "('search')\n", (291, 301), False, 'from utils import uni_hash, setup_logger, vk_url\n'), ((3446, 3509), 'tornado.web.HTTPError', 'web.HTTPError', ([], {'status_code': '(400)', 'reason': 'error_message', 'args': 'args'}), '(status_code=400, rea... |
import dataclasses
import inspect
import json
import sys
from dataclasses import dataclass
from typing import ClassVar
# pylint: disable=redefined-builtin
@dataclass
class Message:
pass
@dataclass
class ShowTeaser(Message):
type: ClassVar = "show-teaser"
@dataclass
class ShowAuthCode(Message):
type:... | [
"dataclasses.asdict",
"json.loads",
"json.dumps",
"inspect.getmembers"
] | [((2484, 2500), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (2494, 2500), False, 'import json\n'), ((2713, 2740), 'dataclasses.asdict', 'dataclasses.asdict', (['message'], {}), '(message)\n', (2731, 2740), False, 'import dataclasses\n'), ((2784, 2800), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n',... |
__author__ = "<NAME>"
__copyright__ = "Copyright 2021, <NAME>"
__email__ = "<EMAIL>"
__license__ = "MIT"
import os
import posixpath
from urllib.error import URLError
from urllib.request import urlopen
from snakemake.exceptions import WorkflowError
from snakemake.script import script
from snakemake.sourcecache impor... | [
"posixpath.dirname",
"snakemake.sourcecache.infer_source_file",
"snakemake.sourcecache.SourceCache",
"snakemake.script.script",
"os.path.join"
] | [((1360, 1383), 'snakemake.sourcecache.infer_source_file', 'infer_source_file', (['path'], {}), '(path)\n', (1377, 1383), False, 'from snakemake.sourcecache import SourceCache, infer_source_file\n'), ((2711, 2983), 'snakemake.script.script', 'script', (['path', '""""""', 'input', 'output', 'params', 'wildcards', 'threa... |
#!/usr/bin/env python
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License... | [
"argparse.ArgumentParser",
"random.randint",
"st2common.config.parse_args",
"st2common.transport.utils.get_connection",
"pprint.pprint",
"kombu.Exchange",
"kombu.Queue"
] | [((1983, 2015), 'kombu.Exchange', 'Exchange', (['exchange'], {'type': '"""topic"""'}), "(exchange, type='topic')\n", (1991, 2015), False, 'from kombu import Exchange, Queue\n'), ((2028, 2107), 'kombu.Queue', 'Queue', ([], {'name': 'queue', 'exchange': 'exchange', 'routing_key': 'routing_key', 'auto_delete': '(True)'}),... |
import hmac
import os
from hashlib import sha1
from urllib.parse import urlencode
from urllib.request import urlopen
import json
from collections import namedtuple
HOSTNAME = 'http://timetableapi.ptv.vic.gov.au'
class ResultCollection(object):
def __init__(self, collection):
self.collection = collection
... | [
"json.dumps",
"collections.namedtuple",
"urllib.parse.urlencode",
"urllib.request.urlopen"
] | [((1560, 1619), 'collections.namedtuple', 'namedtuple', (['"""route_type"""', "['route_type_name', 'route_type']"], {}), "('route_type', ['route_type_name', 'route_type'])\n", (1570, 1619), False, 'from collections import namedtuple\n'), ((1852, 1950), 'collections.namedtuple', 'namedtuple', (['"""route"""', "['route_t... |
#################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021
# by the softwar... | [
"idaes.apps.caprese.tests.test_simple_model.initialize_t0",
"pyomo.core.expr.visitor.identify_variables",
"idaes.apps.caprese.tests.test_simple_model.make_small_model",
"pyomo.environ.SolverFactory",
"idaes.apps.caprese.dynamic_block.DynamicBlock",
"pyomo.environ.Constraint",
"pyomo.environ.Var",
"pyo... | [((2303, 2329), 'pyomo.environ.SolverFactory', 'pyo.SolverFactory', (['"""ipopt"""'], {}), "('ipopt')\n", (2320, 2329), True, 'import pyomo.environ as pyo\n'), ((28187, 28260), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not solver_available)'], {'reason': '"""IPOPT is not available"""'}), "(not solver_available, r... |
# -*- coding: utf-8 -*-
"""
Xtreme RGB Colourspace
======================
Defines the *Xtreme RGB* colourspace:
- :attr:`colour.models.XTREME_RGB_COLOURSPACE`.
See Also
--------
`RGB Colourspaces Jupyter Notebook
<http://nbviewer.jupyter.org/github/colour-science/colour-notebooks/\
blob/master/notebooks/models/rgb... | [
"colour.models.rgb.normalised_primary_matrix",
"numpy.linalg.inv",
"numpy.array",
"functools.partial"
] | [((1226, 1272), 'numpy.array', 'np.array', (['[[1.0, 0.0], [0.0, 1.0], [0.0, 0.0]]'], {}), '([[1.0, 0.0], [0.0, 1.0], [0.0, 0.0]])\n', (1234, 1272), True, 'import numpy as np\n'), ((1708, 1778), 'colour.models.rgb.normalised_primary_matrix', 'normalised_primary_matrix', (['XTREME_RGB_PRIMARIES', 'XTREME_RGB_WHITEPOINT'... |
import superimport
import numpy as np
import matplotlib.pyplot as plt
import os
figdir = "../figures"
def save_fig(fname): plt.savefig(os.path.join(figdir, fname))
xs = np.arange(-2, 2, step=0.01)
y1 = xs ** 2
y2 = y1 - 1
y3 = np.abs(y2)
y4 = y3 + y1
plt.figure()
plt.plot(xs, y1, 'r-', label='x^2')
plt.plot(xs, y2, ... | [
"matplotlib.pyplot.axhline",
"numpy.abs",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.annotate",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"numpy.arange",
"os.path.join"
] | [((172, 199), 'numpy.arange', 'np.arange', (['(-2)', '(2)'], {'step': '(0.01)'}), '(-2, 2, step=0.01)\n', (181, 199), True, 'import numpy as np\n'), ((230, 240), 'numpy.abs', 'np.abs', (['y2'], {}), '(y2)\n', (236, 240), True, 'import numpy as np\n'), ((254, 266), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()... |
from setuptools import setup, find_packages
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='zill',
version='0.1.0',
description='Deplyoment of scraping Redfin and Node.js webserver',
long_description=readme,
author='<NAME>',
... | [
"setuptools.setup"
] | [((150, 389), 'setuptools.setup', 'setup', ([], {'name': '"""zill"""', 'version': '"""0.1.0"""', 'description': '"""Deplyoment of scraping Redfin and Node.js webserver"""', 'long_description': 'readme', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/AlanK27/zill"""', 'license':... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.