code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Copyright (c) 2020 PaddlePaddle 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",
"os.environ.copy",
"re.search"
] | [((1941, 1956), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1954, 1956), False, 'import unittest\n'), ((948, 965), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (963, 965), False, 'import os\n'), ((1422, 1457), 're.search', 're.search', (['regex', 'out', 're.MULTILINE'], {}), '(regex, out, re.MULTILI... |
# generated by datamodel-codegen:
# filename: schema/type/collectionDescriptor.json
# timestamp: 2021-09-27T15:46:37+00:00
from __future__ import annotations
from typing import Optional
from pydantic import AnyUrl, BaseModel, Field
from . import profile
class CollectionInfo(BaseModel):
name: Optional[str... | [
"pydantic.Field"
] | [((324, 392), 'pydantic.Field', 'Field', (['None'], {'description': '"""Unique name that identifies a collection."""'}), "(None, description='Unique name that identifies a collection.')\n", (329, 392), False, 'from pydantic import AnyUrl, BaseModel, Field\n'), ((442, 495), 'pydantic.Field', 'Field', (['None'], {'descri... |
from lessweb import Application
from lessweb.plugin import database
from controller import list_reply
database.init(uri='mysql+mysqlconnector://root:pwd@localhost/db')
app = Application()
app.add_get_mapping('/reply/list', list_reply)
if __name__ == '__main__':
app.run() | [
"lessweb.Application",
"lessweb.plugin.database.init"
] | [((103, 168), 'lessweb.plugin.database.init', 'database.init', ([], {'uri': '"""mysql+mysqlconnector://root:pwd@localhost/db"""'}), "(uri='mysql+mysqlconnector://root:pwd@localhost/db')\n", (116, 168), False, 'from lessweb.plugin import database\n'), ((175, 188), 'lessweb.Application', 'Application', ([], {}), '()\n', ... |
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Conv2D, MaxPooling2D, Flatten
from keras.utils import np_utils
import matplotlib.pyplot as plt
import numpy as np
(X_train, Y_train), (X_test, Y_test) = mnist.load_data()
X_train = X_train.reshape(X_train.shape[0],28,... | [
"keras.layers.Conv2D",
"keras.layers.Flatten",
"keras.layers.MaxPooling2D",
"keras.datasets.mnist.load_data",
"keras.models.Sequential",
"keras.utils.np_utils.to_categorical",
"keras.layers.Dense"
] | [((255, 272), 'keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (270, 272), False, 'from keras.datasets import mnist\n'), ((442, 474), 'keras.utils.np_utils.to_categorical', 'np_utils.to_categorical', (['Y_train'], {}), '(Y_train)\n', (465, 474), False, 'from keras.utils import np_utils\n'), ((484,... |
"""
Tweets a message about a holiday
"""
# stdlib
import datetime as dt
from calendar import monthrange
from typing import Optional
# library
from dateutil.easter import easter as _easter
# module
import utils
from tweet import tweet
def is_nth_day(date: dt.date, nth: int, weekday: int, month: int) -> bool:
""... | [
"dateutil.easter.easter",
"calendar.monthrange",
"utils.now"
] | [((1335, 1353), 'dateutil.easter.easter', '_easter', (['date.year'], {}), '(date.year)\n', (1342, 1353), True, 'from dateutil.easter import easter as _easter\n'), ((3017, 3028), 'utils.now', 'utils.now', ([], {}), '()\n', (3026, 3028), False, 'import utils\n'), ((699, 732), 'calendar.monthrange', 'monthrange', (['date.... |
from flask import Flask
from flask_cors import CORS
from flask import request
from flask import json
from db import write_event
# Initiating the flask app
app = Flask(__name__)
# CORS wrapper to allow cross domain requests
CORS(app)
@app.route('/add_event', methods=['POST'])
def add_event():
"""
Recieve th... | [
"flask.request.get_json",
"db.write_event",
"flask_cors.CORS",
"flask.Flask"
] | [((163, 178), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (168, 178), False, 'from flask import Flask\n'), ((225, 234), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (229, 234), False, 'from flask_cors import CORS\n'), ((413, 431), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (... |
from calendar import month_name, monthrange
from pathlib import Path, PureWindowsPath
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import math as mt
from dataclima import helioclim3
class energycalc:
def __init__(self, df,
horizon,
... | [
"pandas.DataFrame",
"numpy.array",
"pandas.concat",
"numpy.cumprod"
] | [((3777, 3807), 'numpy.array', 'np.array', (["dflocalloss['value']"], {}), "(dflocalloss['value'])\n", (3785, 3807), True, 'import numpy as np\n'), ((3921, 3949), 'numpy.array', 'np.array', (["dfmodloss['value']"], {}), "(dfmodloss['value'])\n", (3929, 3949), True, 'import numpy as np\n'), ((4992, 5065), 'pandas.DataFr... |
import json
# pylint:disable=unused-variable
# pylint:disable=unused-argument
# pylint:disable=redefined-outer-name
import sys
from pathlib import Path
from typing import Dict
import dotenv
import pytest
import simcore_service_director_v2
from fastapi import FastAPI
from simcore_service_director_v2.core.application i... | [
"simcore_service_director_v2.core.application.init_app",
"pathlib.Path",
"starlette.testclient.TestClient",
"pytest.fixture",
"simcore_service_director_v2.core.settings.AppSettings.create_from_env",
"dotenv.dotenv_values"
] | [((903, 934), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (917, 934), False, 'import pytest\n'), ((1223, 1254), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (1237, 1254), False, 'import pytest\n'), ((1406, 1437), 'pytest.fi... |
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
start_page_keyboard = InlineKeyboardMarkup(row_width=2)
new_list_but = InlineKeyboardButton(
text='Новый список', callback_data='new_list')
user_lists_but = InlineKeyboardButton(
text='Мои списки', callback_data='user_lists')
start_page_key... | [
"aiogram.types.InlineKeyboardMarkup",
"aiogram.types.InlineKeyboardButton"
] | [((92, 125), 'aiogram.types.InlineKeyboardMarkup', 'InlineKeyboardMarkup', ([], {'row_width': '(2)'}), '(row_width=2)\n', (112, 125), False, 'from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton\n'), ((142, 209), 'aiogram.types.InlineKeyboardButton', 'InlineKeyboardButton', ([], {'text': '"""Новый списо... |
#!/usr/bin/env python
from sub_singleton import SubjuGator
from txros import util
from twisted.internet import defer
class BallDropTest(SubjuGator):
@util.cancellableInlineCallbacks
def run(self, args):
self.send_feedback('Dropping Ball')
yield self.actuators.drop_marker()
defer.return... | [
"twisted.internet.defer.returnValue"
] | [((308, 337), 'twisted.internet.defer.returnValue', 'defer.returnValue', (['"""Success!"""'], {}), "('Success!')\n", (325, 337), False, 'from twisted.internet import defer\n')] |
# Generated by Django 3.0.8 on 2020-08-09 03:05
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('volunteer_categories', '0003_auto_20200808_1221'),
]
operations = [
migrations.RenameField(
model_name='role',
old_name='num... | [
"django.db.migrations.RenameField"
] | [((240, 345), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""role"""', 'old_name': '"""number_of_slots"""', 'new_name': '"""number_of_positions"""'}), "(model_name='role', old_name='number_of_slots',\n new_name='number_of_positions')\n", (262, 345), False, 'from django.db impor... |
"""Bezier, a module for creating Bezier curves.
Version 1.1, from < BezierCurveFunction-v1.ipynb > on 2019-05-02
"""
import numpy as np
__all__ = ["Bezier"]
class Bezier():
def TwoPoints(t, P1, P2):
"""
Returns a point between P1 and P2, parametised by t.
INPUTS:
t float/... | [
"numpy.delete"
] | [((3282, 3304), 'numpy.delete', 'np.delete', (['curve', '(0)', '(0)'], {}), '(curve, 0, 0)\n', (3291, 3304), True, 'import numpy as np\n')] |
from db import db
from datetime import datetime
from sqlalchemy import ForeignKey, func
class OptionModel(db.Model):
__tablename__ = "options"
id = db.Column(db.Integer, primary_key=True)
option_name = db.Column(db.String, nullable=False, unique=True)
option_length = db.Column(db.Integer)
op_defau... | [
"db.db.session.delete",
"sqlalchemy.func.now",
"db.db.Column",
"db.db.session.commit",
"db.db.session.add"
] | [((158, 197), 'db.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (167, 197), False, 'from db import db\n'), ((216, 265), 'db.db.Column', 'db.Column', (['db.String'], {'nullable': '(False)', 'unique': '(True)'}), '(db.String, nullable=False, unique=True)\n', (22... |
from . import db
from flask_login import UserMixin, current_user
from werkzeug.security import generate_password_hash, check_password_hash
from datetime import datetime
from . import login_manager
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
class User(UserMixin, db.Model... | [
"werkzeug.security.generate_password_hash",
"werkzeug.security.check_password_hash"
] | [((949, 981), 'werkzeug.security.generate_password_hash', 'generate_password_hash', (['password'], {}), '(password)\n', (971, 981), False, 'from werkzeug.security import generate_password_hash, check_password_hash\n'), ((1043, 1090), 'werkzeug.security.check_password_hash', 'check_password_hash', (['self.pass_secure', ... |
import warnings
import unittest
import pytest
from unittest.mock import MagicMock, patch
import localAssigner
import pandas as pd
import mysql.connector
class testTeamAssigner(unittest.TestCase):
def testSetEmployeeAssignment(self):
""" Tests the method setEmployeeAssignment of localAssigner.py """
... | [
"localAssigner.setEmployeeAssignement",
"pandas.DataFrame",
"unittest.mock.MagicMock",
"unittest.main",
"unittest.mock.patch",
"localAssigner.persistTeamData"
] | [((3308, 3323), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3321, 3323), False, 'import unittest\n'), ((928, 1004), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['ProjectId', 'ProjectName', 'MemberId', 'MemberName']"}), "(columns=['ProjectId', 'ProjectName', 'MemberId', 'MemberName'])\n", (940, 1004),... |
import demistomock as demisto
import jwt
from Pcysys import Client, pentera_run_template_command, pentera_get_task_run_status_command, \
pentera_get_task_run_full_action_report_command, pentera_authentication
MOCK_PENTERA_FULL_ACTION_REPORT = 'penterascan-5e4530961deb8eda82b08730.csv'
MOCK_CSV = open('TestData/m... | [
"Pcysys.pentera_get_task_run_status_command",
"demistomock.params",
"demistomock.args",
"Pcysys.pentera_run_template_command",
"Pcysys.Client",
"Pcysys.pentera_authentication",
"Pcysys.pentera_get_task_run_full_action_report_command"
] | [((2022, 2036), 'demistomock.args', 'demisto.args', ([], {}), '()\n', (2034, 2036), True, 'import demistomock as demisto\n'), ((2050, 2190), 'Pcysys.Client', 'Client', ([], {'base_url': 'base_url', 'tgt': 'tgt', 'verify': 'verify_certificate', 'client_id': 'client_id', 'proxy': 'proxy', 'headers': "{'Accept': 'applicat... |
'''package_plugin.py
DatagovsgS3ResourcesPackagePlugin
Extends plugins.SingletonPlugin
'''
import datetime
import logging
from routes.mapper import SubMapper
import ckan.plugins as plugins
import ckanext.datagovsg_s3_resources.upload as upload
class DatagovsgS3ResourcesPackagePlugin(plugins.SingletonPlugin):
''... | [
"logging.getLogger",
"ckanext.datagovsg_s3_resources.upload.config_exists",
"routes.mapper.SubMapper",
"ckanext.datagovsg_s3_resources.upload.upload_package_zipfile_to_s3",
"ckan.plugins.implements"
] | [((512, 572), 'ckan.plugins.implements', 'plugins.implements', (['plugins.IPackageController'], {'inherit': '(True)'}), '(plugins.IPackageController, inherit=True)\n', (530, 572), True, 'import ckan.plugins as plugins\n'), ((577, 626), 'ckan.plugins.implements', 'plugins.implements', (['plugins.IRoutes'], {'inherit': '... |
import requests # to get html from a page
from bs4 import BeautifulSoup # library to do scraping in Python
import time # to slow down scraping to keep server happy
import csv
#https://github.com/search?p=4&q=python&type=Repositories #with page
#https://git... | [
"csv.DictWriter",
"time.sleep",
"bs4.BeautifulSoup",
"requests.get"
] | [((724, 768), 'csv.DictWriter', 'csv.DictWriter', (['myfile'], {'fieldnames': 'myheaders'}), '(myfile, fieldnames=myheaders)\n', (738, 768), False, 'import csv\n'), ((1140, 1164), 'requests.get', 'requests.get', (['github_url'], {}), '(github_url)\n', (1152, 1164), False, 'import requests\n'), ((1188, 1230), 'bs4.Beaut... |
# Author: <NAME>, <NAME>
# Copyright 2021- IBM Inc. All rights reserved
# SPDX-License-Identifier: MIT
import json
import os
import hydra
from omegaconf import (DictConfig, OmegaConf)
from algos import cpo_agent, ppo_lag_agent, trpo_lag_agent
from run_exp import SafetyGymExp
def run_baseline():
cfg = OmegaConf... | [
"algos.ppo_lag_agent",
"algos.trpo_lag_agent",
"omegaconf.OmegaConf.load",
"os.getcwd",
"json.load",
"algos.cpo_agent"
] | [((311, 340), 'omegaconf.OmegaConf.load', 'OmegaConf.load', (['"""config.yaml"""'], {}), "('config.yaml')\n", (325, 340), False, 'from omegaconf import DictConfig, OmegaConf\n'), ((431, 442), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (440, 442), False, 'import os\n'), ((465, 476), 'os.getcwd', 'os.getcwd', ([], {}), ... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [
"google.cloud.storage.Client",
"os.listdir",
"agents.scripts.train.train",
"tensorflow.logging.info",
"agents.tools.AttrDict",
"tensorflow.logging.set_verbosity",
"os.path.join",
"agents.scripts.utility.save_config",
"agents.scripts.visualize.visualize",
"shutil.copytree",
"datetime.datetime.now... | [((7098, 7120), 'pprint.pprint', 'pprint.pprint', (['hparams'], {}), '(hparams)\n', (7111, 7120), False, 'import pprint\n'), ((7631, 7705), 'tensorflow.logging.info', 'tf.logging.info', (['("""Preparing local files for upload:\n %s""" % local_files)'], {}), '("""Preparing local files for upload:\n %s""" % local_files)\... |
from django.db import models
class Image(models.Model):
file = models.ImageField(upload_to='images/')
| [
"django.db.models.ImageField"
] | [((68, 106), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': '"""images/"""'}), "(upload_to='images/')\n", (85, 106), False, 'from django.db import models\n')] |
# Generated by Django 2.0.1 on 2019-01-08 23:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('alias', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='aliasmaingame',
name='words_right',
... | [
"django.db.models.IntegerField"
] | [((333, 363), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)'}), '(default=0)\n', (352, 363), False, 'from django.db import migrations, models\n')] |
from unittest import mock
from dip import colors
@mock.patch('colored.stylize')
def test_amber(mock_style):
""" Shortcut for colored.stylize(). """
colors.amber('TEST')
mock_style.assert_called_once_with('TEST', colors.AMBER)
@mock.patch('colored.stylize')
def test_blue(mock_style):
""" Shortcut fo... | [
"dip.colors.red",
"dip.colors.teal",
"dip.colors.blue",
"dip.colors.amber",
"unittest.mock.patch"
] | [((53, 82), 'unittest.mock.patch', 'mock.patch', (['"""colored.stylize"""'], {}), "('colored.stylize')\n", (63, 82), False, 'from unittest import mock\n'), ((244, 273), 'unittest.mock.patch', 'mock.patch', (['"""colored.stylize"""'], {}), "('colored.stylize')\n", (254, 273), False, 'from unittest import mock\n'), ((432... |
#!/usr/bin/env python
"""line graph
----------
"""
import networkx as nx
from nose.tools import *
class TestGeneratorLine():
def test_line(self):
G=nx.star_graph(5)
L=nx.line_graph(G)
assert_true(nx.is_isomorphic(L,nx.complete_graph(5)))
G=nx.path_graph(5)
L=nx.line_graph... | [
"networkx.star_graph",
"networkx.is_isomorphic",
"networkx.DiGraph",
"networkx.complete_graph",
"networkx.cycle_graph",
"networkx.line_graph",
"networkx.path_graph"
] | [((164, 180), 'networkx.star_graph', 'nx.star_graph', (['(5)'], {}), '(5)\n', (177, 180), True, 'import networkx as nx\n'), ((191, 207), 'networkx.line_graph', 'nx.line_graph', (['G'], {}), '(G)\n', (204, 207), True, 'import networkx as nx\n'), ((280, 296), 'networkx.path_graph', 'nx.path_graph', (['(5)'], {}), '(5)\n'... |
# https://jira.hyperledger.org/browse/FAB-7065
# ?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment
# -tabpanel&showAll=true
import io
import json
import logging
import os
import tarfile
import time
from hfc.util.consts import CC_TYPE_GOLANG, CC_TYPE_NODE
_logger = logging.getLogger(__name__)
def zeroT... | [
"logging.getLogger",
"os.listdir",
"tarfile.open",
"os.walk",
"io.BytesIO",
"os.path.join",
"json.dumps",
"tarfile.TarInfo",
"os.path.relpath"
] | [((281, 308), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (298, 308), False, 'import logging\n'), ((1109, 1121), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (1119, 1121), False, 'import io\n'), ((3433, 3459), 'tarfile.TarInfo', 'tarfile.TarInfo', (['file_name'], {}), '(file_name)\n',... |
import os
from ..exceptions import ArgumentError
from ..thirdparty.download import download_binaries
from ..thirdparty.kaldi import collect_kaldi_binaries, validate_kaldi_binaries
def validate_args(args):
available_commands = ['download', 'validate', 'kaldi']
if args.command not in available_commands:
... | [
"os.path.exists",
"montreal_forced_aligner.command_line.mfa.thirdparty_parser.parse_args"
] | [((1199, 1229), 'montreal_forced_aligner.command_line.mfa.thirdparty_parser.parse_args', 'thirdparty_parser.parse_args', ([], {}), '()\n', (1227, 1229), False, 'from montreal_forced_aligner.command_line.mfa import thirdparty_parser\n'), ((664, 700), 'os.path.exists', 'os.path.exists', (['args.local_directory'], {}), '(... |
from time import sleep
from common.servicechain.config import ConfigSvcChain
from common.servicechain.verify import VerifySvcChain
from common.servicechain.mirror.verify import VerifySvcMirror
from common.servicechain.mirror.config import ConfigSvcMirror
from tcutils.util import get_random_cidr
from tcutils.util import... | [
"tcutils.util.get_random_name",
"time.sleep"
] | [((542, 568), 'tcutils.util.get_random_name', 'get_random_name', (['"""left_vn"""'], {}), "('left_vn')\n", (557, 568), False, 'from tcutils.util import get_random_name\n'), ((630, 656), 'tcutils.util.get_random_name', 'get_random_name', (['"""left_vm"""'], {}), "('left_vm')\n", (645, 656), False, 'from tcutils.util imp... |
from typing import List
import requests
import json
from balticlsc.scheme.logger import logger
from balticlsc.scheme.status import JobStatus, ComputationStatus
from balticlsc.scheme.token import AckToken, OutputToken, Token
from balticlsc.scheme.utils import snake_to_camel
class JobRestClient:
def __init__(self... | [
"requests.post",
"balticlsc.scheme.token.AckToken",
"balticlsc.scheme.utils.snake_to_camel",
"balticlsc.scheme.logger.logger.info",
"balticlsc.scheme.status.JobStatus"
] | [((506, 517), 'balticlsc.scheme.status.JobStatus', 'JobStatus', ([], {}), '()\n', (515, 517), False, 'from balticlsc.scheme.status import JobStatus, ComputationStatus\n'), ((1067, 1178), 'balticlsc.scheme.token.AckToken', 'AckToken', ([], {'sender_uid': 'self._sender_uid', 'msg_uids': 'msg_uids', 'is_final': 'is_final'... |
"""
Test functionality of the local environment wrapper.
The 'setUp' function creates variables and functions to be used in the unit tests.
"""
import unittest
import os
from ripsaw import local_env_wrapper
class TestEnvWrapper(unittest.TestCase):
@staticmethod
def get_output_score_func(output_file):
... | [
"os.path.join",
"ripsaw.local_env_wrapper.LocalEnvWrapper",
"unittest.main",
"os.path.abspath",
"os.remove"
] | [((4552, 4567), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4565, 4567), False, 'import unittest\n'), ((1349, 1394), 'os.path.join', 'os.path.join', (['self.wrapper.folder', '"""test.inp"""'], {}), "(self.wrapper.folder, 'test.inp')\n", (1361, 1394), False, 'import os\n'), ((2699, 2755), 'ripsaw.local_env_wrap... |
"""Main file for training of Deep Convolutional Generative Adversarial Network to generate images"""
import glob
import os
import imageio
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
import tensorflow_datasets as tfds
from absl import app, flags
from tqdm import tqdm
from model import Di... | [
"tensorflow.GradientTape",
"model.Generator",
"tensorflow.reduce_mean",
"tensorflow.cast",
"absl.flags.DEFINE_float",
"tensorflow.random.normal",
"os.path.exists",
"model.Discriminator",
"absl.app.run",
"tensorflow.square",
"tensorflow.distribute.MirroredStrategy",
"matplotlib.pyplot.axis",
... | [((365, 414), 'absl.flags.DEFINE_float', 'flags.DEFINE_float', (['"""lr"""', '(0.0001)', '"""learning rate"""'], {}), "('lr', 0.0001, 'learning rate')\n", (383, 414), False, 'from absl import app, flags\n'), ((413, 466), 'absl.flags.DEFINE_integer', 'flags.DEFINE_integer', (['"""batch_size"""', '(256)', '"""batch size"... |
"""Windows base service implementation.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import errno
import functools
import logging
import os
# Disable E0401: unable to import on linux
import win32security # py... | [
"logging.getLogger",
"win32security.SetFileSecurity",
"os.path.join",
"treadmill.dirwatch.DirWatcher",
"functools.partial",
"win32security.GetFileSecurity"
] | [((438, 465), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (455, 465), False, 'import logging\n'), ((2999, 3029), 'os.path.join', 'os.path.join', (['rsrc_dir', 'req_id'], {}), '(rsrc_dir, req_id)\n', (3011, 3029), False, 'import os\n'), ((1155, 1190), 'treadmill.dirwatch.DirWatcher', 'd... |
import numpy as np
class sensor:
def __init__(self, inverse_x=False, inverse_z=False):
self.inverse_x = inverse_x
self.inverse_z = inverse_z
self.flip_x_z = False
self.rotation = np.array([0, 0])
def get_angle(self):
rot = np.copy(self.rotation)
if self.flip_x_... | [
"numpy.array",
"numpy.copy"
] | [((217, 233), 'numpy.array', 'np.array', (['[0, 0]'], {}), '([0, 0])\n', (225, 233), True, 'import numpy as np\n'), ((274, 296), 'numpy.copy', 'np.copy', (['self.rotation'], {}), '(self.rotation)\n', (281, 296), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 Centre National d'Etudes Spatiales (CNES)
#
# 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
#
# ... | [
"os.path.exists",
"orchestrator.common.xml_tools.get_xml_float_value",
"os.listdir",
"orchestrator.common.xml_tools.get_root_xml",
"orchestrator.plugins.venus.maja_venus_l1_header_image_earth_explorer.VenusL1HeaderImageEarthExplorerXMLFileHandler",
"orchestrator.common.xml_tools.get_xml_int_value",
"orc... | [((2358, 2384), 'orchestrator.common.logger.maja_logging.configure_logger', 'configure_logger', (['__name__'], {}), '(__name__)\n', (2374, 2384), False, 'from orchestrator.common.logger.maja_logging import configure_logger\n'), ((2556, 2573), 'orchestrator.plugins.venus.maja_venus_plugin.MajaVenusPlugin', 'MajaVenusPlu... |
import concurrent
import traceback
from base_automation import BaseAutomation, do_action
from lib.actions import get_action
from lib.constraints import get_constraint
from lib.triggers import get_trigger
class ConfigurableAutomation(BaseAutomation):
def initialize(self):
self._global_constraints = []
... | [
"traceback.format_exc",
"lib.triggers.get_trigger",
"concurrent.futures.ThreadPoolExecutor",
"concurrent.futures.as_completed",
"base_automation.do_action",
"lib.constraints.get_constraint",
"lib.actions.get_action"
] | [((439, 486), 'lib.triggers.get_trigger', 'get_trigger', (['self', 'config', 'self.trigger_handler'], {}), '(self, config, self.trigger_handler)\n', (450, 486), False, 'from lib.triggers import get_trigger\n'), ((763, 791), 'lib.constraints.get_constraint', 'get_constraint', (['self', 'config'], {}), '(self, config)\n'... |
import os.path
import sys
import numpy as np
import copy
import shutil
import astropy.units as u
import pandas as pd
import pickle
from sklearn.neighbors import BallTree
import time
from nexoclom import math as mathMB
from nexoclom.atomicdata import gValue
from nexoclom.modelcode.input_classes import InputError
from ne... | [
"nexoclom.math.Histogram2d",
"nexoclom.math.Histogram",
"nexoclom.modelcode.SourceMap.SourceMap",
"time.sleep",
"numpy.isfinite",
"numpy.arctan2",
"copy.deepcopy",
"numpy.linalg.norm",
"sys.exit",
"numpy.sin",
"nexoclom.math.smooth",
"numpy.cross",
"IPython.embed",
"nexoclom.modelcode.Outp... | [((2416, 2437), 'copy.deepcopy', 'copy.deepcopy', (['inputs'], {}), '(inputs)\n', (2429, 2437), False, 'import copy\n'), ((5251, 5345), 'astropy.units.def_unit', 'u.def_unit', (["('R_' + self.inputs.geometry.planet.object)", 'self.inputs.geometry.planet.radius'], {}), "('R_' + self.inputs.geometry.planet.object, self.i... |
#!/usr/bin/python
# Copyright (c) 2019 PaddlePaddle 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... | [
"paddle.fluid.layers.concat",
"paddle.fluid.layers.auc",
"paddle.fluid.initializer.Uniform",
"argument.params_args",
"paddle.fluid.DatasetFactory",
"paddle.fluid.layers.data",
"paddle.fluid.layers.cross_entropy",
"paddle.fluid.layers.accuracy",
"math.sqrt",
"paddle.fluid.layers.reduce_sum",
"pad... | [((4413, 4426), 'argument.params_args', 'params_args', ([], {}), '()\n', (4424, 4426), False, 'from argument import params_args\n'), ((1026, 1112), 'paddle.fluid.layers.data', 'fluid.layers.data', ([], {'name': '"""dense_input"""', 'shape': '[dense_feature_dim]', 'dtype': '"""float32"""'}), "(name='dense_input', shape=... |
"""
A useful script for running multiple dataset processing scripts together. This
script assumes that the data directory contains a directory for each dataset (by
name).
The 'gh' cli can be used afterwards to upload all the assets in the output folder
to the correct GitHub release as follows:
```shell
gh auth login
g... | [
"argparse.ArgumentParser",
"pathlib.Path",
"pathlib.Path.cwd",
"subprocess.run",
"os.path.abspath"
] | [((483, 590), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Automatically run data processing scripts for multiple datasets"""'}), "(description=\n 'Automatically run data processing scripts for multiple datasets')\n", (506, 590), False, 'import argparse\n'), ((4212, 4235), 'subproce... |
# -*- coding: utf-8 -*-
import math
from app.api.views_common import CommonHandler
class AdminHandler(CommonHandler):
# 获取用户名称
@property
def admin_name(self):
return self.get_secure_cookie('name', None)
# 请求预处理
def prepare(self):
# 如果会话中没有用户账号,直接跳转登录页面
if not self.admin_na... | [
"math.ceil"
] | [((694, 720), 'math.ceil', 'math.ceil', (['(total / shownum)'], {}), '(total / shownum)\n', (703, 720), False, 'import math\n')] |
# -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals
from snapshottest import Snapshot
snapshots = Snapshot()
snapshots["test_request_thin_clients 1"] = {"thin_clients": []}
| [
"snapshottest.Snapshot"
] | [((156, 166), 'snapshottest.Snapshot', 'Snapshot', ([], {}), '()\n', (164, 166), False, 'from snapshottest import Snapshot\n')] |
# Generated by Django 2.2.3 on 2019-07-14 10:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('portal', '0006_request_phoneno'),
]
operations = [
migrations.AlterField(
model_name='request',
name='req_descriptio... | [
"django.db.models.TextField"
] | [((342, 402), 'django.db.models.TextField', 'models.TextField', ([], {'max_length': '(500)', 'verbose_name': '"""Description"""'}), "(max_length=500, verbose_name='Description')\n", (358, 402), False, 'from django.db import migrations, models\n')] |
# coding: utf-8
'''
-----------------------------------------------------------------------------
Copyright 2016 Esri
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... | [
"Configuration.Logger.debug",
"arcpy.CopyFeatures_management",
"arcpy.SearchCursor",
"UnitTestUtilities.createScratch",
"arcpy.AddRadialLineOfSightObserverFields_mt",
"os.path.join",
"Configuration.GetPlatform",
"arcpy.ListFields",
"Configuration.Logger.info",
"os.path.dirname",
"arcpy.Exists",
... | [((6165, 6180), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6178, 6180), False, 'import unittest\n'), ((1771, 1796), 'Configuration.GetLogger', 'Configuration.GetLogger', ([], {}), '()\n', (1794, 1796), False, 'import Configuration\n'), ((1805, 1832), 'Configuration.GetPlatform', 'Configuration.GetPlatform', (... |
import similarity
from similarity.normalized_levenshtein import NormalizedLevenshtein
from similarity.jarowinkler import JaroWinkler
from similarity.metric_lcs import MetricLCS
from similarity.qgram import QGram
from similarity.jaccard import Jaccard
from similarity.cosine import Cosine
from fuzzywuzzy import fuzz
from... | [
"similarity.jarowinkler.JaroWinkler",
"similarity.cosine.Cosine",
"similarity.qgram.QGram",
"fuzzywuzzy.fuzz.WRatio",
"similarity.jaccard.Jaccard",
"fuzzywuzzy.fuzz.QRatio",
"fuzzywuzzy.fuzz.UWRatio",
"fuzzywuzzy.fuzz.partial_token_sort_ratio",
"fuzzywuzzy.fuzz.token_set_ratio",
"fuzzywuzzy.fuzz.U... | [((386, 409), 'similarity.normalized_levenshtein.NormalizedLevenshtein', 'NormalizedLevenshtein', ([], {}), '()\n', (407, 409), False, 'from similarity.normalized_levenshtein import NormalizedLevenshtein\n'), ((424, 437), 'similarity.jarowinkler.JaroWinkler', 'JaroWinkler', ([], {}), '()\n', (435, 437), False, 'from si... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from github import Github
from time import sleep
import configparser
import codecs
import csv
from datetime import datetime
import os
import argparse
# import ipdb as pdb
def parse_args():
"""
Parse script input arguments.
Returns the parsed args, having va... | [
"configparser.ConfigParser",
"github.Github",
"argparse.ArgumentParser",
"csv.writer",
"time.sleep",
"os.path.isfile",
"datetime.datetime.now",
"codecs.open"
] | [((496, 522), 'os.path.isfile', 'os.path.isfile', (['args.input'], {}), '(args.input)\n', (510, 522), False, 'import os\n'), ((1085, 1180), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'usage', 'epilog': 'epilog', 'formatter_class': 'formatter_class'}), '(description=usage, epilog=epilog, ... |
import argparse
import numpy as np
import pandas as pd
import pytorch_lightning as pl
import torch
from torch.utils.data import DataLoader
from src.dataload.tabularDataset import (split_tabular_normal_only_train,
tabularDataset)
from src.lit_models.LitBaseAutoEncoder import Li... | [
"pytorch_lightning.callbacks.EarlyStopping",
"src.lit_models.LitBaseVAE.LitBaseVAE",
"argparse.ArgumentParser",
"pandas.read_csv",
"src.dataload.tabularDataset.split_tabular_normal_only_train",
"src.lit_models.LitBaseAutoEncoder.LitBaseAutoEncoder",
"pytorch_lightning.loggers.WandbLogger",
"numpy.arra... | [((425, 450), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (448, 450), False, 'import argparse\n'), ((1272, 1301), 'pandas.read_csv', 'pd.read_csv', (['config.data_path'], {}), '(config.data_path)\n', (1283, 1301), True, 'import pandas as pd\n'), ((1355, 1390), 'src.dataload.tabularDataset.sp... |
import numpy as np
from numpy import pi, sin, cos, tan, sqrt, arctan2, arcsin, arctan, arccos, log10
from .orbital_elements import elements, jupiter_oe, saturn_oe, uranus_oe
from .utils import *
from .transform import cartesian_to_spherical, spherical_to_cartesian, ecliptic_to_equatorial, elements_to_ecliptic, radec_to... | [
"numpy.log10",
"numpy.arccos",
"numpy.array",
"numpy.cos",
"numpy.sin"
] | [((6730, 6753), 'numpy.array', 'np.array', (['[lon, lat, r]'], {}), '([lon, lat, r])\n', (6738, 6753), True, 'import numpy as np\n'), ((7636, 7684), 'numpy.arccos', 'arccos', (['((s ** 2 + R ** 2 - r ** 2) / (2 * s * R))'], {}), '((s ** 2 + R ** 2 - r ** 2) / (2 * s * R))\n', (7642, 7684), False, 'from numpy import pi,... |
from setuptools import setup, find_packages
install_requires = [
'django >=1.7, <2',
'django-cors-headers',
'djangorestframework',
'faker',
'inflection',
'jsondiff',
'requests',
'simplejson',
'urllib3[secure]',
]
setup(
name='jsonapi-mock-server',
description='JSON API mock... | [
"setuptools.find_packages"
] | [((387, 402), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (400, 402), False, 'from setuptools import setup, find_packages\n')] |
from checkov.common.output.report import CheckType
from checkov.gitlab.dal import Gitlab
from checkov.json_doc.runner import Runner as JsonRunner
from checkov.runner_filter import RunnerFilter
class Runner(JsonRunner):
check_type = CheckType.GITLAB_CONFIGURATION
def __init__(self):
self.gitlab = Gitl... | [
"checkov.json_doc.runner.Runner._change_files_path_to_relative",
"checkov.gitlab.dal.Gitlab",
"checkov.runner_filter.RunnerFilter"
] | [((316, 324), 'checkov.gitlab.dal.Gitlab', 'Gitlab', ([], {}), '()\n', (322, 324), False, 'from checkov.gitlab.dal import Gitlab\n'), ((453, 467), 'checkov.runner_filter.RunnerFilter', 'RunnerFilter', ([], {}), '()\n', (465, 467), False, 'from checkov.runner_filter import RunnerFilter\n'), ((796, 845), 'checkov.json_do... |
'''
Author: jianzhnie
Date: 2022-01-17 14:13:42
LastEditTime: 2022-01-17 15:05:11
LastEditors: jianzhnie
Description:
'''
import torch
from torch import nn
from torch.nn.parameter import Parameter
class Time2Vec(nn.Module):
def __init__(self, in_features, out_features, act='sin', **kwargs):
super(Time2V... | [
"torch.sin",
"torch.Tensor",
"torch.cos",
"torch.matmul",
"torch.randn",
"torch.cat"
] | [((1039, 1069), 'torch.cat', 'torch.cat', (['[wgts, bias]'], {'dim': '(1)'}), '([wgts, bias], dim=1)\n', (1048, 1069), False, 'import torch\n'), ((1150, 1169), 'torch.Tensor', 'torch.Tensor', (['[[7]]'], {}), '([[7]])\n', (1162, 1169), False, 'import torch\n'), ((377, 404), 'torch.randn', 'torch.randn', (['in_features'... |
from django.urls import reverse
import pytest
from wizer.models import Activity
def test_help_view(db, client):
response = client.get(reverse('help'))
assert response.status_code == 200
assert "Keyboard Navigation" in response.content.decode('UTF-8')
def test_dashboard_view(db, client):
response = ... | [
"pytest.raises",
"django.urls.reverse"
] | [((141, 156), 'django.urls.reverse', 'reverse', (['"""help"""'], {}), "('help')\n", (148, 156), False, 'from django.urls import reverse\n'), ((331, 346), 'django.urls.reverse', 'reverse', (['"""home"""'], {}), "('home')\n", (338, 346), False, 'from django.urls import reverse\n'), ((513, 532), 'django.urls.reverse', 're... |
import pygame
from settings import *
from support import *
from random import choice, randint
from tile import Tile
from player import Player
from ui import UI
from weapon import Weapon
from enemy import Enemy
from particles import AnimationPlayer
from magic import MagicPlayer
from upgrade import Upgrade
class Level:... | [
"upgrade.Upgrade",
"particles.AnimationPlayer",
"random.choice",
"magic.MagicPlayer",
"weapon.Weapon",
"pygame.time.get_ticks",
"pygame.sprite.spritecollide",
"player.Player",
"pygame.sprite.Group",
"pygame.display.get_surface",
"ui.UI",
"pygame.math.Vector2",
"tile.Tile",
"pygame.image.lo... | [((407, 435), 'pygame.display.get_surface', 'pygame.display.get_surface', ([], {}), '()\n', (433, 435), False, 'import pygame\n'), ((517, 538), 'pygame.sprite.Group', 'pygame.sprite.Group', ([], {}), '()\n', (536, 538), False, 'import pygame\n'), ((628, 649), 'pygame.sprite.Group', 'pygame.sprite.Group', ([], {}), '()\... |
# this file is auto-generated by RBNF.hs and the Python package rbnf-rts
from rbnf_rts.rbnf_linker import link
from rbnf_rts.utils import ImmutableMap
from rbnf_rts.lexical import *
__all__ = ['lexicals', 'run_lexer', 'mk_parser']
(lexicals, run_lexer) = lexer(r(W='\\s+'), l['a'], ignores=['W'], reserved_map=Immutable... | [
"rbnf_rts.utils.ImmutableMap.from_dict",
"rbnf_rts.rts.Cons"
] | [((311, 351), 'rbnf_rts.utils.ImmutableMap.from_dict', 'ImmutableMap.from_dict', (["{'a': 'quote a'}"], {}), "({'a': 'quote a'})\n", (333, 351), False, 'from rbnf_rts.utils import ImmutableMap\n'), ((1073, 1101), 'rbnf_rts.rts.Cons', 'prim__cons', (['lcl_1', 'prim__nil'], {}), '(lcl_1, prim__nil)\n', (1083, 1101), True... |
import tensorflow as tf
def kl_divergence_unit_gaussian(mu, log_sigma_sq, mean_batch=True, name='kl_divergence_unit_gaussian'):
# KL divergence between a multivariate Gaussian distribution with diagonal covariance and an
# isotropic Gaussian distribution
with tf.name_scope(name):
latent_loss = -0.... | [
"mvg_distributions.covariance_representations.CovarianceFull",
"tensorflow.shape",
"tensorflow.reduce_sum",
"tensorflow.einsum",
"tensorflow.name_scope",
"tensorflow.losses.add_loss",
"tensorflow.square",
"tensorflow.assert_rank_at_least",
"tensorflow.reduce_mean",
"tensorflow.exp"
] | [((274, 293), 'tensorflow.name_scope', 'tf.name_scope', (['name'], {}), '(name)\n', (287, 293), True, 'import tensorflow as tf\n'), ((849, 868), 'tensorflow.name_scope', 'tf.name_scope', (['name'], {}), '(name)\n', (862, 868), True, 'import tensorflow as tf\n'), ((1677, 1696), 'tensorflow.name_scope', 'tf.name_scope', ... |
from ..exceptions import ArgumentError, ArgumentOutOfRangeError
from ..math import ComparableProtocol
from typing import TypeVar
T = TypeVar("T")
TComparable = TypeVar("TComparable", ComparableProtocol, int, float)
def assert_not_none(obj: T, argument_name: str) -> T:
if obj is None:
raise ArgumentError(a... | [
"typing.TypeVar"
] | [((134, 146), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (141, 146), False, 'from typing import TypeVar\n'), ((161, 215), 'typing.TypeVar', 'TypeVar', (['"""TComparable"""', 'ComparableProtocol', 'int', 'float'], {}), "('TComparable', ComparableProtocol, int, float)\n", (168, 215), False, 'from typing i... |
# Задача 1. Вариант 30.
'''
Напишите программу, которая выводит имя "<NAME>",
и запрашивает его псевдоним. Программа должна сцеплять две эти строки
и выводить полученную строку, разделяя имя и псевдоним с помощью тире.
'''
# <NAME>.
# 24.02.2016
from sys import stdout as c
from time import sleep
name = '<NAME>'
quest... | [
"sys.stdout.flush",
"time.sleep",
"sys.stdout.write"
] | [((384, 394), 'time.sleep', 'sleep', (['(1.0)'], {}), '(1.0)\n', (389, 394), False, 'from time import sleep\n'), ((538, 555), 'sys.stdout.write', 'c.write', (["('\\n' * 2)"], {}), "('\\n' * 2)\n", (545, 555), True, 'from sys import stdout as c\n'), ((584, 601), 'sys.stdout.write', 'c.write', (["('\\n' * 2)"], {}), "('\... |
'''
@since: 15 Sep 2015
@author: <NAME> <<EMAIL>>, <NAME> <<EMAIL>>
@license: Lenovo License
@copyright: Copyright 2016, Lenovo
@organization: Lenovo
@summary: This module provides interactive command class which provides base
implementation for all command classes
'''
import sys,getopt,os,json,logging, traceback
i... | [
"textwrap.dedent",
"traceback.format_exception_only",
"pylxca.pylxca_cmd.lxca_view.lxca_view",
"os.getenv",
"pylxca.pylxca_api.lxca_api",
"sys.exc_info",
"json.load"
] | [((630, 658), 'os.getenv', 'os.getenv', (['"""PYLXCA_CMD_PATH"""'], {}), "('PYLXCA_CMD_PATH')\n", (639, 658), False, 'import sys, getopt, os, json, logging, traceback\n'), ((847, 860), 'json.load', 'json.load', (['fp'], {}), '(fp)\n', (856, 860), False, 'import sys, getopt, os, json, logging, traceback\n'), ((1190, 121... |
"""In memory storage classes."""
from __future__ import absolute_import
import logging
import threading
from collections import Counter
from six.moves import queue
from splitio.models.segments import Segment
from splitio.storage import SplitStorage, SegmentStorage, ImpressionStorage, EventStorage, \
TelemetryStor... | [
"logging.getLogger",
"six.moves.queue.Queue",
"threading.Lock",
"threading.RLock",
"collections.Counter",
"splitio.models.segments.Segment"
] | [((531, 573), 'logging.getLogger', 'logging.getLogger', (['self.__class__.__name__'], {}), '(self.__class__.__name__)\n', (548, 573), False, 'import logging\n'), ((595, 612), 'threading.RLock', 'threading.RLock', ([], {}), '()\n', (610, 612), False, 'import threading\n'), ((702, 711), 'collections.Counter', 'Counter', ... |
import analytics
import logging,time,subprocess
from bson.objectid import ObjectId
from os import listdir,environ,makedirs,path
import sys,time
import graypy
from pymongo import MongoClient
import settings
analytics.write_key = settings.ANALYTICS_KEY
analytics.identify('downloader', traits={
'email': settings.REPO... | [
"logging.basicConfig",
"logging.getLogger",
"analytics.flush",
"os.listdir",
"urllib.parse.urlparse",
"subprocess.Popen",
"bson.objectid.ObjectId",
"time.sleep",
"analytics.track",
"os.path.abspath",
"pymongo.MongoClient",
"graypy.GELFHandler",
"sys.argv.index",
"analytics.identify"
] | [((255, 328), 'analytics.identify', 'analytics.identify', (['"""downloader"""'], {'traits': "{'email': settings.REPORT_EMAIL}"}), "('downloader', traits={'email': settings.REPORT_EMAIL})\n", (273, 328), False, 'import analytics\n'), ((386, 520), 'analytics.track', 'analytics.track', (['"""downloader"""', '"""download_s... |
import fbuild.builders.ocaml.ocamlfind
from fbuild.path import Path
def build(ctx):
ocaml = fbuild.builders.ocaml.ocamlfind.Ocaml(ctx,
packages=['unix'])
libb = ocaml.ocamlc.build_lib('libb', Path.glob('b*.ml{,i}'),
packages=['num'])
liba = ocaml.ocamlc.build_lib('liba', Path.glob('a*.ml{,... | [
"fbuild.path.Path.glob"
] | [((210, 232), 'fbuild.path.Path.glob', 'Path.glob', (['"""b*.ml{,i}"""'], {}), "('b*.ml{,i}')\n", (219, 232), False, 'from fbuild.path import Path\n'), ((302, 324), 'fbuild.path.Path.glob', 'Path.glob', (['"""a*.ml{,i}"""'], {}), "('a*.ml{,i}')\n", (311, 324), False, 'from fbuild.path import Path\n'), ((562, 584), 'fbu... |
import os
import time
import psutil
from apis.views import JsonResponse, Throttle
from apis.views.decorators import api_view
@api_view(["GET"], [Throttle])
def health_check(request) -> JsonResponse:
"""Health check route
Args:
request (request): Request
Returns:
JsonResponse: Uptime
... | [
"apis.views.decorators.api_view",
"time.time",
"os.getpid",
"apis.views.JsonResponse"
] | [((129, 158), 'apis.views.decorators.api_view', 'api_view', (["['GET']", '[Throttle]'], {}), "(['GET'], [Throttle])\n", (137, 158), False, 'from apis.views.decorators import api_view\n'), ((405, 466), 'apis.views.JsonResponse', 'JsonResponse', ([], {'data': "{'uptime': uptime, 'OK': True}", 'status': '(200)'}), "(data=... |
'''Move files into folders by years.
Author: <NAME> (<EMAIL>)
Update time: 2021-05-29 20:05:08.
'''
from __future__ import print_function
import os
import shutil
import glob
from datetime import datetime
#--------------Globals------------------------------------------
PREFIX='EI'
DIR='/home/guangzhi/datasets/flexpa... | [
"os.path.exists",
"os.listdir",
"os.makedirs",
"shutil.move",
"os.path.join",
"os.path.split",
"glob.glob"
] | [((671, 686), 'os.listdir', 'os.listdir', (['DIR'], {}), '(DIR)\n', (681, 686), False, 'import os\n'), ((1029, 1061), 'os.path.join', 'os.path.join', (['OUTPUTDIR', 'year4ii'], {}), '(OUTPUTDIR, year4ii)\n', (1041, 1061), False, 'import os\n'), ((1216, 1261), 'os.path.join', 'os.path.join', (['DIR', "('%s%s*' % (PREFIX... |
from django.contrib import admin
# Register your models here.
from .models import Login
from .models import Profile
from .models import Contact
admin.site.register(Login)
admin.site.register(Profile)
admin.site.register(Contact) | [
"django.contrib.admin.site.register"
] | [((146, 172), 'django.contrib.admin.site.register', 'admin.site.register', (['Login'], {}), '(Login)\n', (165, 172), False, 'from django.contrib import admin\n'), ((173, 201), 'django.contrib.admin.site.register', 'admin.site.register', (['Profile'], {}), '(Profile)\n', (192, 201), False, 'from django.contrib import ad... |
import pandas as pd
from dagster import execute_pipeline
from dagster.cli.load_handle import handle_for_pipeline_cli_args
from dagster.core.instance import DagsterInstance
from dagster.utils import file_relative_path
def test_papermill_pandas_hello_world_pipeline():
handle = handle_for_pipeline_cli_args(
... | [
"dagster.cli.load_handle.handle_for_pipeline_cli_args",
"dagster.utils.file_relative_path",
"dagster.core.instance.DagsterInstance.local_temp"
] | [((283, 411), 'dagster.cli.load_handle.handle_for_pipeline_cli_args', 'handle_for_pipeline_cli_args', (["{'module_name': 'dagster_pandas.examples', 'fn_name':\n 'papermill_pandas_hello_world_pipeline'}"], {}), "({'module_name': 'dagster_pandas.examples',\n 'fn_name': 'papermill_pandas_hello_world_pipeline'})\n", ... |
from copy import deepcopy
def fill_board(board, words):
if len(words) == 0:
for a in board:
for b in a:
print(b, end="")
print("")
first_open_space = open_space_finder(board)
result = word_placer(first_open_space, board, words)
if not result:
ret... | [
"copy.deepcopy"
] | [((2748, 2763), 'copy.deepcopy', 'deepcopy', (['board'], {}), '(board)\n', (2756, 2763), False, 'from copy import deepcopy\n'), ((2781, 2796), 'copy.deepcopy', 'deepcopy', (['words'], {}), '(words)\n', (2789, 2796), False, 'from copy import deepcopy\n')] |
import re
import numpy as np
from numpy.core.einsumfunc import _parse_einsum_input
from paderbox.array.segment import segment_axis
__all__ = [
'split_complex_features',
'merge_complex_features',
'tbf_to_tbchw',
'morph',
]
def split_complex_features(X):
""" Split a complex valued input array int... | [
"numpy.shape",
"paderbox.array.segment.segment_axis",
"numpy.asarray",
"numpy.squeeze",
"numpy.einsum",
"numpy.concatenate",
"numpy.pad"
] | [((1764, 1855), 'numpy.pad', 'np.pad', (['x', '((left_context, right_context), (0, 0), (0, 0))'], {'mode': 'pad_mode'}), '(x, ((left_context, right_context), (0, 0), (0, 0)), mode=pad_mode,\n **pad_kwargs)\n', (1770, 1855), True, 'import numpy as np\n'), ((5304, 5335), 'numpy.concatenate', 'np.concatenate', (['targe... |
""" some utility functions"""
# import paramiko
import datetime
from defaultlist import defaultlist
from collections import defaultdict, Iterable
def create_response_dict(code: int, message: str = "", nodes: list = None, links: list = None) -> dict:
"""
use code, nodes and links to chrate a response dict
... | [
"collections.defaultdict"
] | [((669, 686), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (680, 686), False, 'from collections import defaultdict, Iterable\n')] |
from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash, json
import tsx.api.lpi_data
from tsx.api.util import setup_db
import tsx.config
import uuid
from flask_cors import CORS
from flask_session import Session
import os.path
import tsx.api.upload
import tsx.api.lpi_data
import ... | [
"tsx.api.util.setup_db",
"flask_session.Session",
"flask_cors.CORS",
"flask.Flask"
] | [((457, 469), 'flask.Flask', 'Flask', (['"""tsx"""'], {}), "('tsx')\n", (462, 469), False, 'from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash, json\n'), ((543, 583), 'flask_cors.CORS', 'CORS', ([], {'app': 'app', 'supports_credentials': '(True)'}), '(app=app, supports_creden... |
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup (
... | [
"os.path.join",
"os.path.dirname",
"setuptools.setup"
] | [((310, 593), 'setuptools.setup', 'setup', ([], {'name': '"""ays"""', 'version': '"""0.9"""', 'description': '"""Python client for the AYS RESTful API"""', 'long_description': 'long_description', 'url': '"""https://github.com/jumpscale/lib9"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""... |
import subprocess
import re
def wifi_result():
stats={}
data = str(subprocess.check_output(['iwconfig', 'wlan0']))
R = re.search("Rate=(\d+)", data).group(1)
stats["Rate"] = int(R)
T = re.search("Power=(\d+)", data).group(1)
stats["TXPower"] = int(T)
Q = re.search("Quality=(\d+)", data).gro... | [
"subprocess.check_output",
"re.search"
] | [((76, 122), 'subprocess.check_output', 'subprocess.check_output', (["['iwconfig', 'wlan0']"], {}), "(['iwconfig', 'wlan0'])\n", (99, 122), False, 'import subprocess\n'), ((477, 533), 'subprocess.check_output', 'subprocess.check_output', (["['iwlist', 'wlan0', 'scanning']"], {}), "(['iwlist', 'wlan0', 'scanning'])\n", ... |
from os.path import abspath, dirname, join as pjoin
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
fn = abspath(pjoin(dirname(__file__), 'README.rst'))
fp = open(fn, 'r')
long_description = fp.read()
fp.close()
setup(
name='aino-convert',
version='0.1.0.14',
... | [
"os.path.dirname",
"distutils.core.setup"
] | [((262, 940), 'distutils.core.setup', 'setup', ([], {'name': '"""aino-convert"""', 'version': '"""0.1.0.14"""', 'url': '"""https://github.com/aino/aino-convert"""', 'license': '"""BSD"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""Magick for Django"""', 'long_description': 'long_desc... |
import os
import tkinter as tk
import tkinter.ttk as ttk
import pygubu
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
PROJECT_UI = os.path.join(PROJECT_PATH, "newproject")
class NewprojectApp:
def __init__(self, master=None):
# build ui
self.frame_1 = ttk.Frame(master)
self.butt... | [
"tkinter.ttk.Button",
"tkinter.ttk.Menubutton",
"tkinter.ttk.Scrollbar",
"tkinter.OptionMenu",
"tkinter.ttk.Entry",
"tkinter.ttk.Radiobutton",
"tkinter.ttk.Frame",
"tkinter.ttk.Label",
"tkinter.StringVar",
"tkinter.Message",
"tkinter.ttk.Combobox",
"tkinter.Menu",
"tkinter.ttk.Checkbutton",
... | [((143, 183), 'os.path.join', 'os.path.join', (['PROJECT_PATH', '"""newproject"""'], {}), "(PROJECT_PATH, 'newproject')\n", (155, 183), False, 'import os\n'), ((103, 128), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (118, 128), False, 'import os\n'), ((4108, 4115), 'tkinter.Tk', 'tk.Tk', (... |
from knack.help_files import helps
from azure.cli.core import AzCommandsLoader
class ConciergeCommandsLoader(AzCommandsLoader):
def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
custom_type = CliCommandType(operations_tmpl='azext_concierge#{}')
super(Con... | [
"azext_concierge.concierge.general.arguments.load_general_arguments",
"azext_concierge.concierge.general.commands.load_general_commands",
"azure.cli.core.commands.CliCommandType"
] | [((250, 302), 'azure.cli.core.commands.CliCommandType', 'CliCommandType', ([], {'operations_tmpl': '"""azext_concierge#{}"""'}), "(operations_tmpl='azext_concierge#{}')\n", (264, 302), False, 'from azure.cli.core.commands import CliCommandType\n'), ((596, 629), 'azext_concierge.concierge.general.commands.load_general_c... |
from talon import Context
ctx = Context()
ctx.settings["imgui.scale"] = 1.1
| [
"talon.Context"
] | [((33, 42), 'talon.Context', 'Context', ([], {}), '()\n', (40, 42), False, 'from talon import Context\n')] |
import torch
from . import MultiNodeData
from src.utils import create_dirs
import os
import dill
import collections
class MinMaxScaler(object):
"Handles min-max scaling of individual metrics. Either per node or per group."
def __init__(self, path_to_dir : str, target_min=0, target_max=1, normalizatio... | [
"os.path.exists",
"torch.max",
"os.path.join",
"src.utils.create_dirs",
"torch.min",
"dill.dump",
"torch.cat",
"dill.load"
] | [((1619, 1666), 'os.path.join', 'os.path.join', (['path_to_dir', '"""min_max_scaler.pkl"""'], {}), "(path_to_dir, 'min_max_scaler.pkl')\n", (1631, 1666), False, 'import os\n'), ((1687, 1715), 'os.path.exists', 'os.path.exists', (['path_to_file'], {}), '(path_to_file)\n', (1701, 1715), False, 'import os\n'), ((2107, 213... |
"""
Copyright (c) 2016-2020 <NAME> http://www.keithsterling.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, m... | [
"programy.services.rest.base.RESTServiceException.__init__",
"programy.services.base.ServiceQuery._get_matched_var",
"programy.services.base.ServiceQuery.__init__",
"os.path.dirname",
"programy.utils.logging.ylogger.YLogger.error",
"programy.services.rest.base.RESTService.__init__",
"programy.utils.logg... | [((1555, 1604), 'programy.services.base.ServiceQuery._get_matched_var', 'ServiceQuery._get_matched_var', (['matched', '(0)', '"""name"""'], {}), "(matched, 0, 'name')\n", (1584, 1604), False, 'from programy.services.base import ServiceQuery\n'), ((1647, 1683), 'programy.services.base.ServiceQuery.__init__', 'ServiceQue... |
"""Some general, project-level constants of little use outside Jacquard."""
import os
import pathlib
DEFAULT_CONFIG_FILE_PATH = pathlib.Path(os.environ.get(
'JACQUARD_CONFIG',
'/etc/jacquard/config.cfg',
))
| [
"os.environ.get"
] | [((143, 204), 'os.environ.get', 'os.environ.get', (['"""JACQUARD_CONFIG"""', '"""/etc/jacquard/config.cfg"""'], {}), "('JACQUARD_CONFIG', '/etc/jacquard/config.cfg')\n", (157, 204), False, 'import os\n')] |
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import copy
import glob
import json
import os
import luigi
import yaml
import shutil
import zipfile
from servicecatalog_puppet import config, constants
from servicecatalog_puppet.workflow import tasks
fr... | [
"servicecatalog_puppet.config.get_regions",
"servicecatalog_puppet.workflow.portfolio.accessors.get_products_and_provisioning_artifacts_task.GetProductsAndProvisioningArtifactsTask",
"zipfile.ZipFile",
"os.getenv",
"json.dumps",
"servicecatalog_puppet.config.get_home_region",
"copy.deepcopy",
"service... | [((790, 807), 'luigi.Parameter', 'luigi.Parameter', ([], {}), '()\n', (805, 807), False, 'import luigi\n'), ((1065, 1107), 'servicecatalog_puppet.config.get_regions', 'config.get_regions', (['self.puppet_account_id'], {}), '(self.puppet_account_id)\n', (1083, 1107), False, 'from servicecatalog_puppet import config, con... |
from giung2.config import CfgNode
_C = CfgNode()
_C.MODEL = CfgNode()
_C.MODEL.META_ARCHITECTURE = CfgNode()
_C.MODEL.META_ARCHITECTURE.NAME = 'ImageClassificationModelBase'
# preprocessing for ImageClassificationModelBase
_C.MODEL.PIXEL_MEAN = [0.0, 0.0, 0.0,]
_C.MODEL.PIXEL_STD = [1.0, 1.0, 1.0,]
# ------------... | [
"giung2.config.CfgNode"
] | [((41, 50), 'giung2.config.CfgNode', 'CfgNode', ([], {}), '()\n', (48, 50), False, 'from giung2.config import CfgNode\n'), ((63, 72), 'giung2.config.CfgNode', 'CfgNode', ([], {}), '()\n', (70, 72), False, 'from giung2.config import CfgNode\n'), ((102, 111), 'giung2.config.CfgNode', 'CfgNode', ([], {}), '()\n', (109, 11... |
"""
.. module:: vtk_helpers
:platform: Unix, Windows
:synopsis: Helper functions for VTK visualization component for NURBS-Python
.. moduleauthor:: <NAME> <<EMAIL>>
"""
from . import linalg
import vtk
def create_render_window(actors, callbacks, **kwargs):
""" Creates VTK render window with an interacto... | [
"vtk.vtkTriangle",
"vtk.vtkNamedColors",
"vtk.vtkCellArray",
"vtk.vtkPoints",
"vtk.vtkDelaunay3D",
"vtk.vtkUnstructuredGrid",
"vtk.vtkHexahedron",
"vtk.vtkRenderer",
"vtk.vtkCamera",
"vtk.vtkRenderWindowInteractor",
"vtk.vtkRenderWindow",
"vtk.vtkPolyLine",
"vtk.vtkPolyDataMapper",
"vtk.vt... | [((867, 882), 'vtk.vtkCamera', 'vtk.vtkCamera', ([], {}), '()\n', (880, 882), False, 'import vtk\n'), ((1008, 1025), 'vtk.vtkRenderer', 'vtk.vtkRenderer', ([], {}), '()\n', (1023, 1025), False, 'import vtk\n'), ((1235, 1256), 'vtk.vtkRenderWindow', 'vtk.vtkRenderWindow', ([], {}), '()\n', (1254, 1256), False, 'import v... |
"""
Displays a NetworkX octahedral graph to screen using a MatrixPlot.
"""
import matplotlib.pyplot as plt
import networkx as nx
from nxviz.plots import MatrixPlot
G = nx.octahedral_graph()
c = MatrixPlot(G)
c.draw()
plt.show()
| [
"nxviz.plots.MatrixPlot",
"networkx.octahedral_graph",
"matplotlib.pyplot.show"
] | [((171, 192), 'networkx.octahedral_graph', 'nx.octahedral_graph', ([], {}), '()\n', (190, 192), True, 'import networkx as nx\n'), ((197, 210), 'nxviz.plots.MatrixPlot', 'MatrixPlot', (['G'], {}), '(G)\n', (207, 210), False, 'from nxviz.plots import MatrixPlot\n'), ((220, 230), 'matplotlib.pyplot.show', 'plt.show', ([],... |
from aiohttp import web
async def index(request):
return web.Response(text="Success!")
async def websocket(request):
ws = web.WebSocketResponse()
await ws.prepare(request)
async for msg in ws:
await ws.send_str(msg.data.strip()[::-1])
return ws
app = web.Application()
app.add_routes(... | [
"aiohttp.web.run_app",
"aiohttp.web.Response",
"aiohttp.web.Application",
"aiohttp.web.get",
"aiohttp.web.WebSocketResponse"
] | [((287, 304), 'aiohttp.web.Application', 'web.Application', ([], {}), '()\n', (302, 304), False, 'from aiohttp import web\n'), ((63, 92), 'aiohttp.web.Response', 'web.Response', ([], {'text': '"""Success!"""'}), "(text='Success!')\n", (75, 92), False, 'from aiohttp import web\n'), ((134, 157), 'aiohttp.web.WebSocketRes... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import enum
import pefile
import re
from .. import UnpackResult, PathExtractorUnit
class RSRC(enum.IntEnum):
CURSOR = 0x01 # noqa
BITMAP = 0x02 # noqa
ICON = 0x03 # noqa
MENU = 0x04 # noqa
DIALOG = 0x05 # n... | [
"re.escape",
"pefile.PE"
] | [((2190, 2210), 'pefile.PE', 'pefile.PE', ([], {'data': 'data'}), '(data=data)\n', (2199, 2210), False, 'import pefile\n'), ((1087, 1099), 're.escape', 're.escape', (['p'], {}), '(p)\n', (1096, 1099), False, 'import re\n')] |
"""module for checking if source needs to be updated in Knowledge Network (KN).
Contains the class SrcClass which serves as the base class for each supported
source in the KN.
Contains module functions::
get_SrcClass(args)
compare_versions(SrcClass)
check(module, args=None)
main_parse_args()
Example... | [
"os.path.getsize",
"time.strptime",
"argparse.ArgumentParser",
"os.makedirs",
"mysql_utilities.get_file_meta",
"config_utilities.add_config_args",
"import_utilities.import_filemeta",
"os.path.join",
"config_utilities.config_args",
"csv.writer",
"os.path.isfile",
"os.path.basename",
"table_ut... | [((19511, 19587), 'os.path.join', 'os.path.join', (['src_obj.args.working_dir', 'src_obj.args.data_path', 'src_obj.name'], {}), '(src_obj.args.working_dir, src_obj.args.data_path, src_obj.name)\n', (19523, 19587), False, 'import os\n'), ((19617, 19650), 'os.makedirs', 'os.makedirs', (['f_dir'], {'exist_ok': '(True)'}),... |
import smbus2 as smbus
#bus = smbus.SMBus(1) # 0 = /dev/i2c-0 (port I2C0), 1 = /dev/i2c-1 (port I2C1)
DEVICE_ADDRESS = 0x38 #7 bit address (will be left shifted to add the read write bit)
ALTERNATE_DEVICE_ADDRESS = 0x20 #7 bit address (will be left shifted to add the read write bit)
RELAY8_INPORT_R... | [
"smbus2.SMBus"
] | [((1329, 1343), 'smbus2.SMBus', 'smbus.SMBus', (['(1)'], {}), '(1)\n', (1340, 1343), True, 'import smbus2 as smbus\n'), ((2355, 2369), 'smbus2.SMBus', 'smbus.SMBus', (['(1)'], {}), '(1)\n', (2366, 2369), True, 'import smbus2 as smbus\n'), ((3127, 3141), 'smbus2.SMBus', 'smbus.SMBus', (['(1)'], {}), '(1)\n', (3138, 3141... |
import unittest
from BrainFuck import BrainFuck
class Test(unittest.TestCase):
def tests(self):
# given input - expected output
codeTestCases = [
['#',''],
['+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.','A'],
['+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++..','A... | [
"unittest.main",
"BrainFuck.BrainFuck"
] | [((840, 855), 'unittest.main', 'unittest.main', ([], {}), '()\n', (853, 855), False, 'import unittest\n'), ((756, 771), 'BrainFuck.BrainFuck', 'BrainFuck', (['i[0]'], {}), '(i[0])\n', (765, 771), False, 'from BrainFuck import BrainFuck\n')] |
#!/usr/bin/env python
import argparse
from PIL import Image
def unpack(filename, width, height, start_index):
try:
image = Image.open(filename)
except:
print("Couldn't open file: {}".format(filename))
return
horiz_tiles = int(image.width / width)
vert_tiles = int(image.height ... | [
"PIL.Image.open",
"argparse.ArgumentParser"
] | [((1148, 1215), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Unpacks tiles from an image."""'}), "(description='Unpacks tiles from an image.')\n", (1171, 1215), False, 'import argparse\n'), ((137, 157), 'PIL.Image.open', 'Image.open', (['filename'], {}), '(filename)\n', (147, 157), Fal... |
"""
These views deal with the advocacy topics and the interviews.
As Interviews with the officials should contain sensitive data,
the information sharing is strictly controlled: the assessment of
an interview is exclusively accessible either to the volunteeer
designated to lead it or to a manager.
... | [
"django.urls.reverse_lazy"
] | [((1745, 1791), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""interviews:advocacy_topic_list"""'], {}), "('interviews:advocacy_topic_list')\n", (1757, 1791), False, 'from django.urls import reverse_lazy, reverse\n'), ((2063, 2109), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""interviews:advocacy_topic_list"""'... |
"""Library components."""
from KeePassLibrary.base import keyword, LibraryComponent, UUID
from KeePassLibrary.errors import DatabaseNotLoaded
from robot.utils import is_truthy
class KeePassGroups(LibraryComponent):
# FIXME: Catch uuid string and convert to class
@keyword
def get_groups(self, recursive... | [
"KeePassLibrary.base.UUID",
"KeePassLibrary.errors.DatabaseNotLoaded",
"robot.utils.is_truthy"
] | [((2398, 2446), 'KeePassLibrary.errors.DatabaseNotLoaded', 'DatabaseNotLoaded', (['"""No KeePass Database loaded."""'], {}), "('No KeePass Database loaded.')\n", (2415, 2446), False, 'from KeePassLibrary.errors import DatabaseNotLoaded\n'), ((3098, 3146), 'KeePassLibrary.errors.DatabaseNotLoaded', 'DatabaseNotLoaded', ... |
from django.core.management.base import BaseCommand
from filer.models import File, Folder
from filer import settings as filer_settings
from django.utils import timezone
from datetime import timedelta
class Command(BaseCommand):
help = "Hard-deletes old files and folders from filer trash."
def handle(self, *... | [
"filer.models.Folder.trash.get",
"filer.models.File.all_objects.filter",
"filer.models.Folder.trash.filter",
"django.utils.timezone.now",
"filer.models.File.trash.get",
"datetime.timedelta",
"filer.models.File.trash.filter"
] | [((425, 439), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (437, 439), False, 'from django.utils import timezone\n'), ((442, 470), 'datetime.timedelta', 'timedelta', ([], {'seconds': 'no_of_sec'}), '(seconds=no_of_sec)\n', (451, 470), False, 'from datetime import timedelta\n'), ((909, 935), 'filer.mod... |
from athenet.algorithm.derest.layers import DerestLayer
from athenet.algorithm.numlike import assert_numlike
class DerestDropoutLayer(DerestLayer):
def _count_activation(self, layer_input):
"""
Returns estimated activations
:param Numlike layer_input:
:return Numlike:
"""... | [
"athenet.algorithm.numlike.assert_numlike"
] | [((934, 961), 'athenet.algorithm.numlike.assert_numlike', 'assert_numlike', (['layer_input'], {}), '(layer_input)\n', (948, 961), False, 'from athenet.algorithm.numlike import assert_numlike\n'), ((1473, 1495), 'athenet.algorithm.numlike.assert_numlike', 'assert_numlike', (['output'], {}), '(output)\n', (1487, 1495), F... |
import boto3
import botocore
import os
def run(event, _context):
""" save string API Key as SecureString """
graphql_api_key_key_path = os.environ.get('GRAPHQL_API_KEY_KEY_PATH')
print("graphql_api_key_key_path =", graphql_api_key_key_path)
graphql_api_key = _get_parameter(graphql_api_key_key_path)
... | [
"boto3.client",
"os.environ.get"
] | [((147, 189), 'os.environ.get', 'os.environ.get', (['"""GRAPHQL_API_KEY_KEY_PATH"""'], {}), "('GRAPHQL_API_KEY_KEY_PATH')\n", (161, 189), False, 'import os\n'), ((561, 580), 'boto3.client', 'boto3.client', (['"""ssm"""'], {}), "('ssm')\n", (573, 580), False, 'import boto3\n'), ((846, 865), 'boto3.client', 'boto3.client... |
import logging
import sys
from PySide2.QtCore import Qt, QProcess, QSettings
from PySide2.QtGui import QIcon, QPixmap, QTextCursor
from PySide2.QtWidgets import (
QAction, QActionGroup, QApplication, QLabel, QMenu, QSystemTrayIcon, QTextBrowser)
import app
from app.realtime_interaction import InteractionServer
fr... | [
"logging.getLogger",
"PySide2.QtCore.QSettings",
"PySide2.QtWidgets.QMenu",
"PySide2.QtGui.QPixmap",
"app.ui.KeyboardUI",
"PySide2.QtWidgets.QActionGroup",
"app.realtime_interaction.InteractionServer",
"PySide2.QtCore.QProcess",
"PySide2.QtGui.QIcon",
"PySide2.QtWidgets.QTextBrowser",
"app.prefe... | [((404, 431), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (421, 431), False, 'import logging\n'), ((708, 727), 'app.preferences.PreferencesDialog', 'PreferencesDialog', ([], {}), '()\n', (725, 727), False, 'from app.preferences import PreferencesDialog\n'), ((1275, 1289), 'PySide2.QtCo... |
# Copyright (c) 2013, 2018 National Technology and Engineering Solutions of Sandia, LLC . Under the terms of Contract
# DE-NA0003525 with National Technology and Engineering Solutions of Sandia, LLC, the U.S. Government
# retains certain rights in this software.
import subprocess
def send_error(subject, body):
impo... | [
"subprocess.Popen"
] | [((474, 539), 'subprocess.Popen', 'subprocess.Popen', (['[\'echo\', \'"%s"\' % body]'], {'stdout': 'subprocess.PIPE'}), '([\'echo\', \'"%s"\' % body], stdout=subprocess.PIPE)\n', (490, 539), False, 'import subprocess\n'), ((553, 812), 'subprocess.Popen', 'subprocess.Popen', (['[\'mail\', \'-s\', \'"%s %s"\' % (slycat.w... |
from django.contrib.auth import login, authenticate
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect
from django.utils import timezone
import random
from .forms import RegistrationForm, VehicleForm
from django.contrib.auth.models import User
from django.contrib imp... | [
"django.shortcuts.render",
"xhtml2pdf.pisa.CreatePDF",
"django.contrib.auth.authenticate",
"django.contrib.messages.error",
"django.http.HttpResponse",
"django.contrib.messages.warning",
"django.contrib.auth.login",
"django.contrib.messages.info",
"django.utils.crypto.get_random_string",
"django.u... | [((3854, 3870), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {}), '()\n', (3868, 3870), False, 'from django.contrib.auth.decorators import login_required\n'), ((4439, 4455), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {}), '()\n', (4453, 4455), False, 'from django.... |
# -*- encoding:utf-8 -*-
# Copyright (c) Alibaba, Inc. and its affiliates.
"""Define cv_input, the base class for cv tasks."""
import tensorflow as tf
from google.protobuf import text_format
from easy_rec.python.input.csv_input import CSVInput
from easy_rec.python.input.csv_input_ex import CSVInputEx
from easy_rec.py... | [
"easy_rec.python.protos.dataset_pb2.DatasetConfig",
"tensorflow.ConfigProto",
"easy_rec.python.input.csv_input.CSVInput",
"tensorflow.test.main",
"easy_rec.python.protos.feature_config_pb2.FeatureConfig",
"easy_rec.python.utils.config_util.auto_expand_names",
"tensorflow.GPUOptions",
"google.protobuf.... | [((642, 667), 'tensorflow.python.framework.ops.disable_eager_execution', 'disable_eager_execution', ([], {}), '()\n', (665, 667), False, 'from tensorflow.python.framework.ops import disable_eager_execution\n'), ((11506, 11520), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (11518, 11520), True, 'import tens... |
from flask import Flask, render_template, jsonify, send_file, redirect
from datetime import date, timedelta
from io import BytesIO
import pdfmd as p
import apod
import os
app = Flask(__name__)
@app.route('/')
@app.route('/today')
def root():
data = apod.get_apod(date.today())
while data is None:
data... | [
"flask.render_template",
"flask.Flask",
"flask.jsonify",
"io.BytesIO",
"datetime.date.today",
"datetime.timedelta",
"flask.redirect",
"datetime.date",
"apod.get_apod",
"flask.send_file",
"pdfmd.pdf",
"os.remove"
] | [((178, 193), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (183, 193), False, 'from flask import Flask, render_template, jsonify, send_file, redirect\n'), ((377, 507), 'flask.render_template', 'render_template', (['"""main.html"""'], {'title': "data['title']", 'img_url': "data['image_url']", 'credits': "... |
# Copyright (C) 2009-2017 <NAME>
# Copyright (C) 2017-2018 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | [
"unittest.defaultTestLoader.loadTestsFromTestCase",
"usb._debug.methodtrace",
"usb.core.find",
"unittest.TestSuite"
] | [((1883, 1908), 'usb._debug.methodtrace', 'methodtrace', (['utils.logger'], {}), '(utils.logger)\n', (1894, 1908), False, 'from usb._debug import methodtrace\n'), ((2888, 2908), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (2906, 2908), False, 'import unittest\n'), ((2927, 2985), 'unittest.defaultTestL... |
"""
Created on Wed Sep 3 10:14:05 2014
@author: Natural Solutions (Thomas)
"""
from sqlalchemy import (
Column,
DateTime,
desc,
ForeignKey,
func,
Index,
Integer,
Numeric,
Sequence,
String,
UniqueConstraint
)
from ecorelevesensor.models import Base, dbConfig
from ecoreleve... | [
"sqlalchemy.func.now",
"sqlalchemy.Numeric",
"sqlalchemy.ForeignKey",
"sqlalchemy.desc",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.String",
"sqlalchemy.Sequence",
"sqlalchemy.Column"
] | [((615, 660), 'sqlalchemy.Column', 'Column', (['"""FK_creator"""', 'Integer'], {'nullable': '(False)'}), "('FK_creator', Integer, nullable=False)\n", (621, 660), False, 'from sqlalchemy import Column, DateTime, desc, ForeignKey, func, Index, Integer, Numeric, Sequence, String, UniqueConstraint\n'), ((856, 897), 'sqlalc... |
"""
During the python 2 to 3 conversion, I got this error a lot when I tried to do migrations:
django.db.utils.IntegrityError:
The row in table 'comms_msg_db_receivers_objects' with primary key '19035' has
an invalid foreign key: comms_msg_db_receivers_objects.msg_id contains a
value '198432' that does not have a corr... | [
"django.db.connection.cursor",
"evennia.comms.models.Msg.objects.values_list"
] | [((1377, 1417), 'evennia.comms.models.Msg.objects.values_list', 'Msg.objects.values_list', (['"""id"""'], {'flat': '(True)'}), "('id', flat=True)\n", (1400, 1417), False, 'from evennia.comms.models import Msg\n'), ((1813, 1832), 'django.db.connection.cursor', 'connection.cursor', ([], {}), '()\n', (1830, 1832), False, ... |
from unittest.mock import patch
from django.conf import settings
from mspray.apps.main.tests.test_base import TestBase
from mspray.apps.main.views.sprayday import SprayDayViewSet
from mspray.apps.main.tests.test_tasks import SUBMISSION_DATA, OSMXML
from mspray.celery import app
from mspray.apps.main.models import Spr... | [
"mspray.celery.app.conf.update",
"mspray.apps.main.models.SprayDay.objects.filter",
"mspray.apps.main.views.sprayday.SprayDayViewSet.as_view",
"mspray.apps.main.tests.test_tasks.OSMXML.strip",
"unittest.mock.patch",
"mspray.apps.main.tests.test_base.TestBase.setUp"
] | [((521, 566), 'unittest.mock.patch', 'patch', (['"""mspray.apps.main.tasks.fetch_osm_xml"""'], {}), "('mspray.apps.main.tasks.fetch_osm_xml')\n", (526, 566), False, 'from unittest.mock import patch\n'), ((572, 630), 'unittest.mock.patch', 'patch', (['"""mspray.apps.main.utils.run_tasks_after_spray_data"""'], {}), "('ms... |
# Generated with MassUnit
#
from enum import Enum
from enum import auto
class MassUnit(Enum):
""""""
MG = auto()
KG = auto()
def label(self):
if self == MassUnit.MG:
return "Mg"
if self == MassUnit.KG:
return "kg" | [
"enum.auto"
] | [((116, 122), 'enum.auto', 'auto', ([], {}), '()\n', (120, 122), False, 'from enum import auto\n'), ((132, 138), 'enum.auto', 'auto', ([], {}), '()\n', (136, 138), False, 'from enum import auto\n')] |