code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import sys
from django.contrib import admin
from django.utils import translation
from django.conf import settings
from markdown import markdown
from .models import Promotion, Image
class ImageInline(admin.StackedInline):
model = Image
extra = 1
fields = (('name', 'image'),
('title', 'senten... | [
"django.utils.translation.get_language_from_request",
"markdown.markdown"
] | [((1189, 1219), 'markdown.markdown', 'markdown', (['instance.description'], {}), '(instance.description)\n', (1197, 1219), False, 'from markdown import markdown\n'), ((1334, 1397), 'django.utils.translation.get_language_from_request', 'translation.get_language_from_request', (['request'], {'check_path': '(True)'}), '(r... |
""" This submodule implements the following :class:`BaseGromacsCommand`
subclasses:
* :class:`Gromacs_genconf` provides a wrapper around Gromacs genconf command.
* :class:`Gromacs_genbox` provides a wrapper around Gromacs genbox command.
* :class:`Gromacs_solvate` provides a wrapper around Gromacs solvate command.
* :... | [
"traits.api.Int",
"traits.api.ReadOnly",
"traits.api.Bool",
"traits.api.Property"
] | [((1570, 1589), 'traits.api.ReadOnly', 'ReadOnly', (['"""genconf"""'], {}), "('genconf')\n", (1578, 1589), False, 'from traits.api import Unicode, ReadOnly, Property, Bool, Int\n'), ((1660, 1699), 'traits.api.ReadOnly', 'ReadOnly', (["['-f', '-o', '-trj', '-nbox']"], {}), "(['-f', '-o', '-trj', '-nbox'])\n", (1668, 169... |
"""
Makes the web application modular!
"""
import os
from flask import Flask
from flask_socketio import SocketIO
from celery import Celery
from .config import configurations, Worker
app = Flask(__name__)
# Read from environment file and load local env variables
if not os.environ.get('Production', False) and not ... | [
"celery.Celery",
"os.getcwd",
"os.path.dirname",
"flask.Flask",
"os.environ.get",
"flask_socketio.SocketIO",
"os.path.join"
] | [((194, 209), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (199, 209), False, 'from flask import Flask\n'), ((774, 811), 'os.environ.get', 'os.environ.get', (['"""TEST_PASSWORD"""', 'None'], {}), "('TEST_PASSWORD', None)\n", (788, 811), False, 'import os\n'), ((842, 879), 'os.environ.get', 'os.environ.ge... |
import random
from typing import List, Tuple, Union
import numpy as np
from srl.base.define import ContinuousAction, DiscreteAction, DiscreteSpaceType, RLObservation
from srl.base.env.spaces.box import BoxSpace
class ArrayContinuousSpace(BoxSpace):
def __init__(
self,
size: int,
low: Unio... | [
"numpy.asarray"
] | [((1716, 1731), 'numpy.asarray', 'np.asarray', (['val'], {}), '(val)\n', (1726, 1731), True, 'import numpy as np\n'), ((2055, 2070), 'numpy.asarray', 'np.asarray', (['val'], {}), '(val)\n', (2065, 2070), True, 'import numpy as np\n')] |
from itertools import chain
from werkzeug.security import generate_password_hash
from urllib.parse import unquote
from flask import render_template, flash, url_for, redirect, request, jsonify
from . import bp
from app.forms import SignUpForm, LoginForm, ReviewForm
from app.models import Login, Subjects, Professors, Rev... | [
"urllib.parse.unquote",
"flask.flash",
"app.forms.ReviewForm",
"flask.jsonify",
"flask.url_for",
"flask_login.current_user.get_id",
"app.db.session.query",
"flask.request.args.get",
"flask.redirect",
"app.forms.LoginForm",
"app.db.session.commit",
"flask.render_template",
"app.models.Reviews... | [((479, 510), 'flask.render_template', 'render_template', (['"""newhome.html"""'], {}), "('newhome.html')\n", (494, 510), False, 'from flask import render_template, flash, url_for, redirect, request, jsonify\n'), ((584, 596), 'app.forms.SignUpForm', 'SignUpForm', ([], {}), '()\n', (594, 596), False, 'from app.forms imp... |
import os
from onadata.settings.local_settings import XML_VERSION_MAX_ITER
from onadata.apps.fsforms.models import XformHistory
from django.core.management.base import BaseCommand
import re
import datetime
def check_version(instance, n):
for i in range(n, 0, -1):
p = re.compile("""<bind calculate="\'(.*)\'... | [
"onadata.apps.fsforms.models.XformHistory.objects.all",
"re.compile"
] | [((867, 893), 'onadata.apps.fsforms.models.XformHistory.objects.all', 'XformHistory.objects.all', ([], {}), '()\n', (891, 893), False, 'from onadata.apps.fsforms.models import XformHistory\n'), ((1507, 1574), 're.compile', 're.compile', (['"""<bind calculate="\'(.*)\'" nodeset="/(.*)/_version_" """'], {}), '(\'<bind ca... |
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from .views import *
urlpatterns = [
path('register_user/', register_user, name='register_user'),
path('login_user/', login_user, name='login_user'),
path('login_new_user/', login_new_user, name='login_... | [
"django.conf.urls.static.static",
"django.urls.path"
] | [((461, 522), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n', (467, 522), False, 'from django.conf.urls.static import static\n'), ((395, 458), 'django.conf.urls.static.static', 'static', (['setti... |
# coding: utf-8
from __future__ import unicode_literals
import json
from mock import Mock, MagicMock
import pytest
from boxsdk.auth.oauth2 import DefaultNetwork
from boxsdk.network import default_network
from boxsdk.network.default_network import DefaultNetworkResponse
from boxsdk.session.box_session import BoxRespons... | [
"pytest.fixture",
"json.dumps",
"boxsdk.session.box_session.BoxSession.get_url",
"mock.Mock",
"mock.MagicMock"
] | [((337, 353), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (351, 353), False, 'import pytest\n'), ((559, 591), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (573, 591), False, 'import pytest\n'), ((685, 713), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-02-16 13:11
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Cre... | [
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.DecimalField",
"django.db.models.DateTimeField"
] | [((4916, 5033), 'django.db.models.OneToOneField', 'models.OneToOneField', ([], {'db_column': '"""language_id"""', 'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""sakila.Language"""'}), "(db_column='language_id', on_delete=django.db.models.\n deletion.CASCADE, to='sakila.Language')\n", (4936, 5033), False... |
import json
from copy import deepcopy
from datetime import timedelta
from unittest.mock import patch
import graphene_linked_events
import pytest
from django.utils import timezone
from graphene.utils.str_converters import to_snake_case
from graphene_linked_events.rest_client import LinkedEventsApiClient
from graphene_l... | [
"unittest.mock.patch.object",
"copy.deepcopy",
"graphene.utils.str_converters.to_snake_case",
"django.utils.timezone.now",
"occurrences.factories.OccurrenceFactory",
"occurrences.models.PalvelutarjotinEvent.objects.count",
"pytest.fixture",
"json.dumps",
"common.tests.utils.assert_permission_denied"... | [((914, 942), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (928, 942), False, 'import pytest\n'), ((10585, 10771), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""given,expected"""', "[('keywordAnd', 'keyword_AND'), ('keywordNot', 'keyword!'), (\n 'allOngoingAnd', ... |
import ibm_boto3
from ibm_botocore.client import Config
from ibm_botocore.exceptions import ClientError
import json
import config
cos = ibm_boto3.client(
"s3",
aws_access_key_id=config.cos_creds['access_key_id'],
aws_secret_access_key=config.cos_creds['secret_access_key'],
ibm_service_instance_id=config.cos_... | [
"ibm_boto3.client"
] | [((139, 465), 'ibm_boto3.client', 'ibm_boto3.client', (['"""s3"""'], {'aws_access_key_id': "config.cos_creds['access_key_id']", 'aws_secret_access_key': "config.cos_creds['secret_access_key']", 'ibm_service_instance_id': "config.cos_creds['ibm_service_instance_id']", 'ibm_auth_endpoint': "config.cos_creds['ibm_auth_end... |
#!/usr/bin/env python
############################################################################
# <NAME>, LBNL
# See LBNLCopyright for copyright notice!
###########################################################################
import os, sys, unittest
from ServiceTest import main, ServiceTestCase, ServiceTestSuite... | [
"ServiceTest.main",
"os.makedirs",
"ZSI.generate.commands.wsdl2py",
"os.path.isdir",
"ZSI.schema.GED",
"unittest.makeSuite",
"ServiceTest.ServiceTestSuite",
"ServiceTest.ServiceTestCase.__init__"
] | [((1193, 1347), 'ZSI.generate.commands.wsdl2py', 'wsdl2py', (["['--complexType', '--schema', '--output-dir=stubs',\n 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'\n ]"], {}), "(['--complexType', '--schema', '--output-dir=stubs',\n 'http://docs.oasis-open.org/wss/2004/01/oa... |
from rest_framework import viewsets
from rest_framework.permissions import IsAuthenticated
from TheSphinx.models import Attendee
from TheSphinx.serializers import AttendeeGetSerializer, AttendeePostSerializer
from TheSphinx.permissions import IsInSafeMethods
class AttendeeViewSet(viewsets.ModelViewSet):
def get... | [
"TheSphinx.models.Attendee.objects.all"
] | [((494, 516), 'TheSphinx.models.Attendee.objects.all', 'Attendee.objects.all', ([], {}), '()\n', (514, 516), False, 'from TheSphinx.models import Attendee\n')] |
# encoding: utf-8
#
# Copyright (C) 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | [
"typhon.objects.collections.maps.ConstMap",
"typhon.objects.collections.lists.unwrapList",
"typhon.objects.collections.lists.wrapList",
"typhon.objects.collections.lists.FlexList",
"typhon.objects.collections.sets.ConstSet",
"typhon.objects.collections.maps.monteMap",
"typhon.objects.collections.sets.mo... | [((1017, 1027), 'typhon.objects.collections.maps.monteMap', 'monteMap', ([], {}), '()\n', (1025, 1027), False, 'from typhon.objects.collections.maps import ConstMap, monteMap\n'), ((1055, 1067), 'typhon.objects.data.IntObject', 'IntObject', (['(5)'], {}), '(5)\n', (1064, 1067), False, 'from typhon.objects.data import C... |
#!/usr/bin/env python3
import collections
import glob
import os
import pandas as pd
import numpy as np
import torch.nn.functional as F
import PIL.Image as Image
from inference.base_image_utils import get_scale_size, image2batch, choose_center_full_size_crop_params
from inference.metrics.fid.fid_score import _compute_... | [
"inference.base_image_utils.image2batch",
"inference.perspective.load_video_frames_from_folder",
"argparse.ArgumentParser",
"collections.defaultdict",
"numpy.mean",
"inference.encode_and_animate.sum_dicts",
"os.path.join",
"pandas.DataFrame",
"inference.base_image_utils.get_scale_size",
"os.path.d... | [((3471, 3596), 'inference.metrics.fid.fid_score._compute_statistics_of_images', '_compute_statistics_of_images', (['gt_frames_as_img', 'fid_model'], {'batch_size': 'args.batch', 'dims': '(2048)', 'cuda': '(True)', 'keep_size': '(False)'}), '(gt_frames_as_img, fid_model, batch_size=args.\n batch, dims=2048, cuda=Tru... |
import json
from itertools import chain
from hanon.data import open_data
from hanon.note import Note, NoteMatch, Scale
SCALES = {
'Cmaj': Scale(0, [2, 2, 1, 2, 2, 2, 1])
}
def load_exercises(path, bpm):
def as_exercise(obj):
if 'scale' in obj and 'patterns' in obj:
return Exercise(SCAL... | [
"json.load",
"hanon.note.Note",
"hanon.data.open_data",
"hanon.note.Scale",
"itertools.chain.from_iterable",
"hanon.note.NoteMatch"
] | [((146, 177), 'hanon.note.Scale', 'Scale', (['(0)', '[2, 2, 1, 2, 2, 2, 1]'], {}), '(0, [2, 2, 1, 2, 2, 2, 1])\n', (151, 177), False, 'from hanon.note import Note, NoteMatch, Scale\n'), ((393, 420), 'hanon.data.open_data', 'open_data', (['"""exercises.json"""'], {}), "('exercises.json')\n", (402, 420), False, 'from han... |
# For very deep data structures, it may not be desirable for the output to
# include all of the details. The data may not be formatted properly, the
# formatted text might be too large to manage, or some of the data may be extraneous.
from pprint import pprint
from pprint_data import data
# pprint(data)
ppr... | [
"pprint.pprint"
] | [((317, 338), 'pprint.pprint', 'pprint', (['data'], {'depth': '(1)'}), '(data, depth=1)\n', (323, 338), False, 'from pprint import pprint\n'), ((378, 399), 'pprint.pprint', 'pprint', (['data'], {'depth': '(2)'}), '(data, depth=2)\n', (384, 399), False, 'from pprint import pprint\n')] |
import numpy as np
def CheckScore(board):
Win = Loss = Tie = False
zeros = np.where(board == 0)
if np.all(board[0,0:3] == 1) or np.all(board[1,0:3] == 1) or np.all(board[2,0:3] == 1):
Win = True
elif np.all(board[0:3,0] == 1) or np.all(board[0:3,1] == 1) or np.all(board[0:3,2] == 1):
Wi... | [
"numpy.where",
"numpy.all"
] | [((84, 104), 'numpy.where', 'np.where', (['(board == 0)'], {}), '(board == 0)\n', (92, 104), True, 'import numpy as np\n'), ((112, 138), 'numpy.all', 'np.all', (['(board[0, 0:3] == 1)'], {}), '(board[0, 0:3] == 1)\n', (118, 138), True, 'import numpy as np\n'), ((141, 167), 'numpy.all', 'np.all', (['(board[1, 0:3] == 1)... |
import logging.config
import os
import platform
import sys
from logging import StreamHandler, FileHandler, Formatter
from queue import Queue
from threading import Thread, Event
from typing import IO
import fastapi
import uvicorn
from fastapi import FastAPI
from starlette.responses import HTMLResponse
from telegram imp... | [
"platform.python_version",
"logging.Formatter",
"os.path.isfile",
"kuri.database.KuriDatabase",
"kuri.database.KuriDatabase.from_file",
"logging.FileHandler",
"kuri.command_register.CommandRegister",
"threading.Event",
"uvicorn.run",
"kuri.secret_generator.generate_secret",
"fastapi.FastAPI",
... | [((2511, 2574), 'logging.Formatter', 'Formatter', (['"""[%(asctime)s][%(name)s][%(levelname)s] %(message)s"""'], {}), "('[%(asctime)s][%(name)s][%(levelname)s] %(message)s')\n", (2520, 2574), False, 'from logging import StreamHandler, FileHandler, Formatter\n'), ((2594, 2609), 'logging.StreamHandler', 'StreamHandler', ... |
"""
Taken from: https://raw.githubusercontent.com/codenio/Mock.GPIO/master/Mock/GPIO.py
Mock Library for RPi.GPIO
"""
# flake8: noqa
import time
BCM = 11
BOARD = 10
BOTH = 33
FALLING = 32
HARD_PWM = 43
HIGH = 1
I2C = 42
IN = 1
LOW = 0
OUT = 0
PUD_DOWN = 21
PUD_OFF = 20
PUD_UP = 22
RISING = 31
RPI_INFO = {'MANUFACTURER... | [
"time.sleep"
] | [((1027, 1040), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1037, 1040), False, 'import time\n')] |
#!/usr/bin/python3
#
# Monitor GUI for an array of CBRS boards to watch power levels
# and temperature across time along with a user-controlled
# value for frequency, gain, and others.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO T... | [
"PyQt5.QtCore.pyqtSignal",
"numpy.abs",
"PyQt5.QtWidgets.QMainWindow.__init__",
"numpy.argmax",
"PyQt5.QtWidgets.QDockWidget.__init__",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtWidgets.QApplication",
"sklk_widgets.FreqEntryWidget",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtCor... | [((3545, 3561), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', (['dict'], {}), '(dict)\n', (3555, 3561), False, 'from PyQt5.QtCore import pyqtSignal\n'), ((6522, 6540), 'sklk_widgets.LogPowerFFT', 'LogPowerFFT', (['samps'], {}), '(samps)\n', (6533, 6540), False, 'from sklk_widgets import LogPowerFFT\n'), ((7292, 7302), 'nump... |
import unittest
from dcp.problems.linkedlist.single import build_list
from dcp.problems.linkedlist.is_palindrome import is_palindrome1
class Test_IsPalindrome1(unittest.TestCase):
def setUp(self):
pass
def test_case1(self):
assert is_palindrome1(None) == None
def test_case2(self):
... | [
"dcp.problems.linkedlist.single.build_list",
"dcp.problems.linkedlist.is_palindrome.is_palindrome1"
] | [((344, 381), 'dcp.problems.linkedlist.single.build_list', 'build_list', (["['a', 'b', 'c', 'b', 'a']"], {}), "(['a', 'b', 'c', 'b', 'a'])\n", (354, 381), False, 'from dcp.problems.linkedlist.single import build_list\n'), ((486, 518), 'dcp.problems.linkedlist.single.build_list', 'build_list', (["['a', 'b', 'b', 'a']"],... |
"""
The :mod:`skmultilearn.ext` provides wrappers for other multi-label
classification libraries. Currently it provides a wrapper for:
Currently the available classes include:
+--------------------------------------------+------------------------------------------------------------------+
| Name ... | [
"platform.architecture"
] | [((1571, 1594), 'platform.architecture', 'platform.architecture', ([], {}), '()\n', (1592, 1594), False, 'import sys, platform\n')] |
import pymongo
client = pymongo.MongoClient('127.0.0.1', 27017)
db = client['qbot']
userdb = client['user']
def make_query(group_id: str, user_id: str): return {
'group_id': group_id, 'user_id': user_id}
class User:
admin = 0
def __init__(self, group_id: str, user_id: str):
self.group_id = grou... | [
"pymongo.MongoClient"
] | [((25, 64), 'pymongo.MongoClient', 'pymongo.MongoClient', (['"""127.0.0.1"""', '(27017)'], {}), "('127.0.0.1', 27017)\n", (44, 64), False, 'import pymongo\n')] |
import bcrypt
class Password:
@staticmethod
def encrypt(password):
hash = bcrypt.hashpw(bytes(password, 'utf-8'), bcrypt.gensalt())
return hash.decode('utf-8')
@staticmethod
def decrypt(password, hash):
return bcrypt.checkpw(bytes(password, 'utf-8'), bytes(hash, 'utf-8'))
| [
"bcrypt.gensalt"
] | [((123, 139), 'bcrypt.gensalt', 'bcrypt.gensalt', ([], {}), '()\n', (137, 139), False, 'import bcrypt\n')] |
"""
Defines the blueprint for the users
"""
from flask import Blueprint
from flask_restful import Api
from util import API_ERRORS
from resources import TicketResource, TicketsResource, DiscussionsResource
TICKET_BLUEPRINT = Blueprint('ticket', __name__)
api = Api(TICKET_BLUEPRINT, catch_all_404s=True, errors=API_ERRO... | [
"flask_restful.Api",
"flask.Blueprint"
] | [((226, 255), 'flask.Blueprint', 'Blueprint', (['"""ticket"""', '__name__'], {}), "('ticket', __name__)\n", (235, 255), False, 'from flask import Blueprint\n'), ((262, 323), 'flask_restful.Api', 'Api', (['TICKET_BLUEPRINT'], {'catch_all_404s': '(True)', 'errors': 'API_ERRORS'}), '(TICKET_BLUEPRINT, catch_all_404s=True,... |
import unittest
from katas.kyu_7.number_of_occurrences import number_of_occurrences
class NumberOfOccurrencesTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(number_of_occurrences(4, []), 0)
def test_equals_2(self):
self.assertEqual(number_of_occurrences(4, [4, 0, 4]), 2)... | [
"katas.kyu_7.number_of_occurrences.number_of_occurrences"
] | [((193, 221), 'katas.kyu_7.number_of_occurrences.number_of_occurrences', 'number_of_occurrences', (['(4)', '[]'], {}), '(4, [])\n', (214, 221), False, 'from katas.kyu_7.number_of_occurrences import number_of_occurrences\n'), ((281, 316), 'katas.kyu_7.number_of_occurrences.number_of_occurrences', 'number_of_occurrences'... |
#!/usr/bin/env python3
import numpy as np
from computeCostMulti import computeCostMulti
def gradientDescentMulti(X, y, theta, alpha, num_iters):
#GRADIENTDESCENTMULTI Performs gradient descent to learn theta
# theta = GRADIENTDESCENTMULTI(x, y, theta, alpha, num_iters) updates theta by
# taking num_... | [
"numpy.dot",
"numpy.zeros",
"computeCostMulti.computeCostMulti"
] | [((479, 503), 'numpy.zeros', 'np.zeros', (['(num_iters, 1)'], {}), '((num_iters, 1))\n', (487, 503), True, 'import numpy as np\n'), ((1147, 1176), 'computeCostMulti.computeCostMulti', 'computeCostMulti', (['X', 'y', 'theta'], {}), '(X, y, theta)\n', (1163, 1176), False, 'from computeCostMulti import computeCostMulti\n'... |
##technically, this means that I don't have to force floats in my division
from __future__ import division, absolute_import
##this makes the plot lines thicker, darker, etc.
from matplotlib import rc,rcParams
rc('text', usetex=True)
rc('axes', linewidth=2)
rc('font', weight='bold')
##importing the needed modules
impo... | [
"matplotlib.rc",
"numpy.nanmedian",
"pandas.read_csv",
"numpy.argsort",
"numpy.histogram",
"numpy.arange",
"scipy.spatial.cKDTree",
"numpy.unique",
"numpy.nanmean",
"os.path.exists",
"numpy.isfinite",
"numpy.max",
"matplotlib.pyplot.subplots",
"numpy.radians",
"matplotlib.pyplot.show",
... | [((210, 233), 'matplotlib.rc', 'rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (212, 233), False, 'from matplotlib import rc, rcParams\n'), ((234, 257), 'matplotlib.rc', 'rc', (['"""axes"""'], {'linewidth': '(2)'}), "('axes', linewidth=2)\n", (236, 257), False, 'from matplotlib import rc, rcPar... |
import pytest
from unittest.mock import MagicMock
from importgraph import ImportAction
@pytest.fixture
def import_action():
return ImportAction('some.module.name', {}, [], 0, MagicMock())
| [
"unittest.mock.MagicMock"
] | [((182, 193), 'unittest.mock.MagicMock', 'MagicMock', ([], {}), '()\n', (191, 193), False, 'from unittest.mock import MagicMock\n')] |
import unittest
import tempfile
import configparser
from ...utils import config
class Test(unittest.TestCase):
def setUp(self):
# Use a temporary file to test the config
file_ = tempfile.NamedTemporaryFile()
config.configPath = file_.name
def test_getConfig(self):
self.asser... | [
"tempfile.NamedTemporaryFile"
] | [((202, 231), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {}), '()\n', (229, 231), False, 'import tempfile\n')] |
import matplotlib.pyplot as plt
import numpy as np
def plotLine(c0, c1, ax):
t = np.linspace(0, 1, 11)
c = (c1 - c0) * t + c0
ax.plot(c.real, c.imag)
def plotCircle(c0, r, ax):
t = np.linspace(0, 1, 1001) * 2 * np.pi
s = c0 + r * np.exp(1j * t)
ax.plot(s.real, s.imag)
def plotEllipse(c0, a... | [
"numpy.fmax",
"numpy.abs",
"numpy.sum",
"matplotlib.pyplot.gca",
"numpy.hstack",
"numpy.imag",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.exp",
"numpy.real",
"numpy.linspace",
"waveforms.math.fit.mult_gaussian_pdf",
"waveforms.math.fit.get_threshold_info"
] | [((87, 108), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(11)'], {}), '(0, 1, 11)\n', (98, 108), True, 'import numpy as np\n'), ((387, 403), 'numpy.exp', 'np.exp', (['(1.0j * t)'], {}), '(1.0j * t)\n', (393, 403), True, 'import numpy as np\n'), ((684, 710), 'waveforms.math.fit.get_threshold_info', 'get_threshold_... |
from django.shortcuts import render,redirect, get_object_or_404, Http404
from django.contrib.auth.models import User
from .models import Profile, Project, Rate
from .forms import UserRegistrationForm, ProjectPostForm, UserUpdateForm, ProfileUpdateForm, RatingForm
from django.contrib.auth.decorators import login_require... | [
"django.shortcuts.render",
"django.contrib.messages.success",
"django.shortcuts.redirect",
"rest_framework.response.Response"
] | [((680, 733), 'django.shortcuts.render', 'render', (['request', '"""index.html"""', "{'projects': projects}"], {}), "(request, 'index.html', {'projects': projects})\n", (686, 733), False, 'from django.shortcuts import render, redirect, get_object_or_404, Http404\n'), ((1116, 1186), 'django.shortcuts.render', 'render', ... |
#%%
## Project Name: mia
### Program Name: mia_audiofiles.py
### Purpose: To download audio data of MIA Collections.
##### Date Created: Mar 2nd 2021
import os
import pathlib
import requests
import json
import pandas as pd
import numpy as np
import re
APP_PATH = str(pathlib.Path(__file__).parent.resolve())
#%%
# R... | [
"pandas.DataFrame.from_dict",
"pathlib.Path",
"re.findall",
"requests.get",
"os.path.join"
] | [((902, 952), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['audiolinks'], {'orient': '"""index"""'}), "(audiolinks, orient='index')\n", (924, 952), True, 'import pandas as pd\n'), ((1732, 1780), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['imglinks'], {'orient': '"""index"""'}), "(imglinks, o... |
import pdb
import unittest
from dwetl.transform_field import TransformField
class TestTransformField(unittest.TestCase):
# def test_load_table_config(self):
# TABLE_PATH = os.path.join('tests','data','test_table_config_z30.json')
# table_config = load_table_config(TABLE_PATH)
# self.assert... | [
"unittest.main",
"dwetl.transform_field.TransformField"
] | [((1041, 1056), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1054, 1056), False, 'import unittest\n'), ((401, 452), 'dwetl.transform_field.TransformField', 'TransformField', (['"""in_z30_rec_key"""', '"""000001200000020"""'], {}), "('in_z30_rec_key', '000001200000020')\n", (415, 452), False, 'from dwetl.transfo... |
"""
Registers $v0 and $v1 are used to return values from functions.
Registers $t0 – $t9 are caller-saved registers that are used to
hold temporary quantities that need not be preserved across calls
Registers $s0 – $s7 (16–23) are callee-saved registers that hold long-lived
values that should be preserved across calls.... | [
"sys.path.append",
"commons.visitor.on",
"commons.visitor.when",
"commons.cil_ast.Call",
"commons.cil_ast.Allocate"
] | [((1590, 1611), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (1605, 1611), False, 'import sys\n'), ((3069, 3087), 'commons.visitor.on', 'visitor.on', (['"""node"""'], {}), "('node')\n", (3079, 3087), True, 'import commons.visitor as visitor\n'), ((3204, 3229), 'commons.visitor.when', 'visitor.w... |
from unittest import TestCase
from Graph.Color import Color
from Graph.ColorNode import ColorNode
from GraphReader.TextReader import TextReader
from GraphSolver.FourMapSolver import FourMapSolver
class TestFourMapSolverReader(TestCase):
def test_should_return_correct_solution(self):
# Arrange
fi... | [
"GraphSolver.FourMapSolver.FourMapSolver.solve",
"GraphReader.TextReader.TextReader.read_graph"
] | [((364, 395), 'GraphReader.TextReader.TextReader.read_graph', 'TextReader.read_graph', (['filename'], {}), '(filename)\n', (385, 395), False, 'from GraphReader.TextReader import TextReader\n'), ((434, 460), 'GraphSolver.FourMapSolver.FourMapSolver.solve', 'FourMapSolver.solve', (['nodes'], {}), '(nodes)\n', (453, 460),... |
from typing import Tuple, List
from Crypto.Cipher import PKCS1_OAEP
from Crypto.Hash import SHA256
from Crypto.PublicKey import RSA
from zkay.config import cfg
from zkay.transaction.crypto.rsa_base import RSACrypto, PersistentLocals
class RSAOAEPCrypto(RSACrypto):
def _enc(self, plain: int, _: int, target_pk: i... | [
"Crypto.PublicKey.RSA.construct",
"Crypto.Cipher.PKCS1_OAEP.new"
] | [((374, 423), 'Crypto.PublicKey.RSA.construct', 'RSA.construct', (['(target_pk, self.default_exponent)'], {}), '((target_pk, self.default_exponent))\n', (387, 423), False, 'from Crypto.PublicKey import RSA\n'), ((460, 500), 'Crypto.Cipher.PKCS1_OAEP.new', 'PKCS1_OAEP.new', (['pub_key'], {'hashAlgo': 'SHA256'}), '(pub_k... |
from easydict import EasyDict as edict
# This file defines a dictionary, cfg, which includes the default parameters of the ResDepth pipeline.
# The dictionary is updated/extended at runtime with the parameters defined by the user in the input
# JSON configuration file.
cfg = edict({'model': edict(), 'multiview': edic... | [
"easydict.EasyDict"
] | [((5101, 5108), 'easydict.EasyDict', 'edict', ([], {}), '()\n', (5106, 5108), True, 'from easydict import EasyDict as edict\n'), ((294, 301), 'easydict.EasyDict', 'edict', ([], {}), '()\n', (299, 301), True, 'from easydict import EasyDict as edict\n'), ((316, 323), 'easydict.EasyDict', 'edict', ([], {}), '()\n', (321, ... |
import lorm
from lorm.manif import Sphere2
from lorm.funcs import ManifoldObjectiveFunction
from nfft import nfsft
import numpy as np
import copy as cp
class plan(ManifoldObjectiveFunction):
def __init__(self, M, N, alpha, L, equality_constraint=False, closed=True):
'''
plan for computing the (poly... | [
"numpy.sum",
"nfft.nfsft.plan",
"numpy.zeros",
"nfft.nfsft.SphericalFourierCoefficients",
"lorm.manif.Sphere2",
"numpy.ones",
"numpy.sin",
"numpy.linalg.norm",
"numpy.cos",
"numpy.sqrt"
] | [((765, 781), 'nfft.nfsft.plan', 'nfsft.plan', (['M', 'N'], {}), '(M, N)\n', (775, 781), False, 'from nfft import nfsft\n'), ((809, 846), 'nfft.nfsft.SphericalFourierCoefficients', 'nfsft.SphericalFourierCoefficients', (['N'], {}), '(N)\n', (843, 846), False, 'from nfft import nfsft\n'), ((964, 1001), 'nfft.nfsft.Spher... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | [
"pulumi.get",
"pulumi.getter",
"pulumi.set"
] | [((4713, 4759), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""deployArtifactSourceType"""'}), "(name='deployArtifactSourceType')\n", (4726, 4759), False, 'import pulumi\n'), ((5161, 5203), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""base64encodedContent"""'}), "(name='base64encodedContent')\n", (5174, 520... |
# Copyright 2020 The FastEstimator 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 appl... | [
"numpy.allclose",
"tensorflow.constant",
"fastestimator.backend.exp",
"numpy.array",
"torch.tensor"
] | [((874, 896), 'numpy.array', 'np.array', (['[-2.0, 2, 1]'], {}), '([-2.0, 2, 1])\n', (882, 896), True, 'import numpy as np\n'), ((911, 928), 'fastestimator.backend.exp', 'fe.backend.exp', (['n'], {}), '(n)\n', (925, 928), True, 'import fastestimator as fe\n'), ((944, 989), 'numpy.array', 'np.array', (['[0.13533528, 7.3... |
# (c) 2019-2021, <NAME> @ ETH Zurich
# Computer-assisted Applications in Medicine (CAiM) Group, Prof. <NAME>
import tensorflow as tf
import numpy as np
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
class DiceLoss(tf.losses.Loss):
"""
Dice loss
References
----... | [
"tensorflow.reduce_sum",
"tensorflow.nn.softmax_cross_entropy_with_logits",
"tensorflow.argmax",
"tensorflow.reshape",
"tensorflow.reduce_mean",
"tensorflow.multiply",
"tensorflow.shape",
"numpy.array",
"logging.getLogger"
] | [((181, 208), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (198, 208), False, 'import logging\n'), ((2124, 2155), 'tensorflow.multiply', 'tf.multiply', (['prediction', 'labels'], {}), '(prediction, labels)\n', (2135, 2155), True, 'import tensorflow as tf\n'), ((2570, 2618), 'tensorflow.... |
__version__ = '1.0.0-rc.1'
__author__ = '<NAME>, <NAME>, <NAME>, <NAME>'
import json
import os
import random
import numpy as np
import torch
from transformers import AutoTokenizer
from rate_severity_of_toxic_comments.dataset import AVAILABLE_DATASET_TYPES
from rate_severity_of_toxic_comments.embedding import AVAILA... | [
"rate_severity_of_toxic_comments.tokenizer.NaiveTokenizer",
"json.load",
"numpy.random.seed",
"rate_severity_of_toxic_comments.tokenizer.create_recurrent_model_tokenizer",
"torch.manual_seed",
"os.path.exists",
"torch.cuda.manual_seed",
"transformers.AutoTokenizer.from_pretrained",
"random.seed",
... | [((825, 848), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (842, 848), False, 'import torch\n'), ((853, 873), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (867, 873), True, 'import numpy as np\n'), ((878, 895), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (889... |
from unittest import TestCase
import os
from os.path import isfile
import yaml
from traits.api import Instance, Int, List
from traits.trait_handlers import TraitListObject
from app_common.traits.assertion_utils import assert_has_traits_almost_equal
from app_common.apptools.preferences import BasePreferenceGroup, \
... | [
"traits.api.Instance",
"os.remove",
"yaml.load",
"traits.api.Int",
"os.path.isfile",
"app_common.traits.assertion_utils.assert_has_traits_almost_equal"
] | [((2288, 2295), 'traits.api.Int', 'Int', (['(30)'], {}), '(30)\n', (2291, 2295), False, 'from traits.api import Instance, Int, List\n'), ((2631, 2663), 'traits.api.Instance', 'Instance', (['AppPreferenceGroup', '()'], {}), '(AppPreferenceGroup, ())\n', (2639, 2663), False, 'from traits.api import Instance, Int, List\n'... |
from pymc import *
from numpy import ones, array
n = 5*ones(4,dtype=int)
dose=array([-.86,-.3,-.05,.73])
@stochastic
def alpha(value=-1.):
return 0.
@stochastic
def beta(value=10.):
return 0.
@deterministic
def theta(a=alpha, b=beta, d=dose):
"""theta = inv_logit(a+b)"""
return invlogit(a+b*d)
@obs... | [
"numpy.array",
"numpy.ones"
] | [((79, 112), 'numpy.array', 'array', (['[-0.86, -0.3, -0.05, 0.73]'], {}), '([-0.86, -0.3, -0.05, 0.73])\n', (84, 112), False, 'from numpy import ones, array\n'), ((56, 74), 'numpy.ones', 'ones', (['(4)'], {'dtype': 'int'}), '(4, dtype=int)\n', (60, 74), False, 'from numpy import ones, array\n'), ((366, 398), 'numpy.ar... |
from rest_framework import serializers
from dataset.models import Dataset, Investigator, Link, PublicationDocument, \
PublicationPubMedLink, Revision, Task, Contact
class ContactSerializer(serializers.ModelSerializer):
class Meta:
model = Contact
fields = ['email', 'name', 'website']
class In... | [
"rest_framework.serializers.StringRelatedField",
"rest_framework.serializers.DateTimeField",
"rest_framework.serializers.SerializerMethodField"
] | [((517, 563), 'rest_framework.serializers.StringRelatedField', 'serializers.StringRelatedField', ([], {'read_only': '(True)'}), '(read_only=True)\n', (547, 563), False, 'from rest_framework import serializers\n'), ((1024, 1068), 'rest_framework.serializers.DateTimeField', 'serializers.DateTimeField', ([], {'format': '"... |
#!/usr/bin/env python
import rospy
import angus
from sensor_msgs.msg import Image
from pprint import pprint
conn = angus.connect()
service = conn.services.get_service("scene_analysis", version=1)
service.enable_session()
def callback(data):
job = service.process({"image": open("/home/ros/test.jpg", 'rb'),
... | [
"rospy.Subscriber",
"pprint.pprint",
"rospy.init_node",
"angus.connect",
"rospy.spin"
] | [((117, 132), 'angus.connect', 'angus.connect', ([], {}), '()\n', (130, 132), False, 'import angus\n'), ((1003, 1021), 'pprint.pprint', 'pprint', (['job.result'], {}), '(job.result)\n', (1009, 1021), False, 'from pprint import pprint\n'), ((1049, 1099), 'rospy.init_node', 'rospy.init_node', (['"""scene_analysis"""'], {... |
import datetime, calendar
from flask import jsonify,request
from flask.ext.login import current_user
from sqlalchemy import desc
from mitra import app,db
from mitra.models.entry import Entry
from mitra.schemes.date import DateSchema
@app.route('/_entryByCategory', methods=['PUT', 'POST'])
def EntryByCategory():
... | [
"flask.ext.login.current_user.entries.filter",
"flask.ext.login.current_user.is_authenticated",
"datetime.date",
"flask.jsonify",
"mitra.app.route",
"mitra.schemes.date.DateSchema",
"sqlalchemy.desc",
"calendar.monthrange"
] | [((237, 292), 'mitra.app.route', 'app.route', (['"""/_entryByCategory"""'], {'methods': "['PUT', 'POST']"}), "('/_entryByCategory', methods=['PUT', 'POST'])\n", (246, 292), False, 'from mitra import app, db\n'), ((361, 392), 'flask.ext.login.current_user.is_authenticated', 'current_user.is_authenticated', ([], {}), '()... |
import numpy as np
import matplotlib.pyplot as plt
import sys
pose_file = sys.argv[1]
poses = np.load(pose_file)
x, y, z = poses[:30, 0, -1], poses[:30, 1, -1], poses[:30, 2, -1]
# Creating figure
fig = plt.figure(figsize = (10, 7))
ax = plt.axes(projection ="3d")
# Creating plot
ax.scatter3D(x, y, z, color = "gree... | [
"matplotlib.pyplot.title",
"numpy.load",
"matplotlib.pyplot.show",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.figure"
] | [((95, 113), 'numpy.load', 'np.load', (['pose_file'], {}), '(pose_file)\n', (102, 113), True, 'import numpy as np\n'), ((205, 232), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 7)'}), '(figsize=(10, 7))\n', (215, 232), True, 'import matplotlib.pyplot as plt\n'), ((240, 265), 'matplotlib.pyplot.axes'... |
# Disjunction Construction
import re
# Assign to the variable regexp a regular expression that matches either the
# exact string ab or one or more digits.
regexp = r"ab|[0-9]+"
# regexp matches:
print (re.findall(regexp,"ab") == ["ab"])
#>>> True
print (re.findall(regexp,"1") == ["1"])
#>>> True
... | [
"re.findall"
] | [((218, 242), 're.findall', 're.findall', (['regexp', '"""ab"""'], {}), "(regexp, 'ab')\n", (228, 242), False, 'import re\n'), ((274, 297), 're.findall', 're.findall', (['regexp', '"""1"""'], {}), "(regexp, '1')\n", (284, 297), False, 'import re\n'), ((328, 353), 're.findall', 're.findall', (['regexp', '"""123"""'], {}... |
"""
Molecule Splitter
=================
#. :class:`.MoleculeSplitter`
Class for splitting a molecule into many with new connectors.
"""
import logging
from rdkit.Chem import AllChem as rdkit
from itertools import combinations
import stk
logger = logging.getLogger(__name__)
class MoleculeSplitter:
"""
Sp... | [
"rdkit.Chem.AllChem.EditableMol",
"rdkit.Chem.AllChem.SanitizeMol",
"rdkit.Chem.AllChem.MolFromSmarts",
"logging.getLogger",
"itertools.combinations",
"stk.BuildingBlock.init_from_rdkit_mol",
"rdkit.Chem.AllChem.Kekulize"
] | [((252, 279), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (269, 279), False, 'import logging\n'), ((2541, 2569), 'rdkit.Chem.AllChem.SanitizeMol', 'rdkit.SanitizeMol', (['rdkit_mol'], {}), '(rdkit_mol)\n', (2558, 2569), True, 'from rdkit.Chem import AllChem as rdkit\n'), ((4006, 4029),... |
from typing import Any
import unittest
from dataclasses import dataclass, asdict
from datetime import datetime
from campersheaven.datastore import DictionaryStore, DataStoreAccess
from campersheaven.geometries import Point
from campersheaven.models import Camper
@dataclass
class DummyModel:
id: int
val: Any
... | [
"campersheaven.datastore.DataStoreAccess.find_campers_around",
"datetime.datetime.fromisoformat",
"campersheaven.datastore.DataStoreAccess.populate_campers",
"campersheaven.datastore.DictionaryStore",
"campersheaven.models.Camper",
"dataclasses.asdict",
"campersheaven.geometries.Point"
] | [((407, 434), 'campersheaven.datastore.DictionaryStore', 'DictionaryStore', (['DummyModel'], {}), '(DummyModel)\n', (422, 434), False, 'from campersheaven.datastore import DictionaryStore, DataStoreAccess\n'), ((3288, 3311), 'campersheaven.datastore.DictionaryStore', 'DictionaryStore', (['Camper'], {}), '(Camper)\n', (... |
#!/usr/bin/env python
from pyservos.ax12 import AX12
# from pyservos.servoserial import ServoSerial
# import sys
import argparse
import time
from colorama import Fore, Back
# import pyservos
from colorama import Fore, Back
import platform # system info
from math import pi
def print_status_pkt(info):
print('----... | [
"argparse.ArgumentParser",
"pyservos.ax12.AX12",
"time.sleep"
] | [((1232, 1238), 'pyservos.ax12.AX12', 'AX12', ([], {}), '()\n', (1236, 1238), False, 'from pyservos.ax12 import AX12\n'), ((1296, 1311), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (1306, 1311), False, 'import time\n'), ((2304, 2368), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description'... |
'''
############################################################################
## NALA REPOSITORY ##
############################################################################
repository name: nala
repository version: 1.0
repository link: https://github.com/... | [
"os.getcwd",
"os.system",
"os.chdir"
] | [((2628, 2639), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (2637, 2639), False, 'import os, shutil\n'), ((2745, 2785), 'os.system', 'os.system', (['"""brew uninstall pocketsphinx"""'], {}), "('brew uninstall pocketsphinx')\n", (2754, 2785), False, 'import os, shutil\n'), ((2786, 2828), 'os.system', 'os.system', (['"""... |
from django.db import models
from django.conf import settings
class Customer(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, null=True)
name = models.CharField(max_length=200, null=False, blank=False)
email = models.EmailField(null=False, blank=False)
def... | [
"django.db.models.OneToOneField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.EmailField",
"django.db.models.ImageField",
"django.db.models.DecimalField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField"
] | [((104, 191), 'django.db.models.OneToOneField', 'models.OneToOneField', (['settings.AUTH_USER_MODEL'], {'on_delete': 'models.CASCADE', 'null': '(True)'}), '(settings.AUTH_USER_MODEL, on_delete=models.CASCADE,\n null=True)\n', (124, 191), False, 'from django.db import models\n'), ((199, 256), 'django.db.models.CharFi... |
"""
In this file, we analyse the action library generated by Teacher1 and Teacher2.
Through
1. filtering out actions that decrease rho less effectively
2. filtering out actions that occur less frequently
3. filtering out "do nothing" action
4. add your filtering rules...,
we obtain an action space in th... | [
"pandas.read_csv",
"numpy.save",
"os.path.join",
"pandas.value_counts"
] | [((1242, 1281), 'pandas.value_counts', 'pd.value_counts', (["actions['action_list']"], {}), "(actions['action_list'])\n", (1257, 1281), True, 'import pandas as pd\n'), ((1517, 1581), 'os.path.join', 'os.path.join', (['save_path', "('actions%d.npy' % action_space.shape[0])"], {}), "(save_path, 'actions%d.npy' % action_s... |
import logging
from flask import request
from flask_restful import Resource
from apimes import utils
LOG = logging.getLogger(__name__)
class Message(Resource):
def __init__(self):
self.driver = utils.get_driver()
def post(self, topic):
if not utils.is_valid_name(topic):
msg = ... | [
"apimes.utils.get_driver",
"apimes.utils.server_error",
"flask.request.get_data",
"apimes.utils.is_valid_name",
"logging.getLogger"
] | [((111, 138), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (128, 138), False, 'import logging\n'), ((212, 230), 'apimes.utils.get_driver', 'utils.get_driver', ([], {}), '()\n', (228, 230), False, 'from apimes import utils\n'), ((778, 796), 'flask.request.get_data', 'request.get_data', (... |
# Copyright 2018 Google LLC
#
# 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 writing, ... | [
"apache_beam.metrics.Metrics.counter",
"logging.exception",
"tensorflow.train.Example",
"moonlight.util.more_iter_tools.iter_sample",
"tensorflow.Session",
"numpy.less",
"tensorflow.RunOptions",
"six.moves.filter"
] | [((1860, 1914), 'apache_beam.metrics.Metrics.counter', 'metrics.Metrics.counter', (['self.__class__', '"""total_pages"""'], {}), "(self.__class__, 'total_pages')\n", (1883, 1914), False, 'from apache_beam import metrics\n'), ((2002, 2057), 'apache_beam.metrics.Metrics.counter', 'metrics.Metrics.counter', (['self.__clas... |
from casadi import Opti, sin, cos, tan, vertcat
import numpy as np
import matplotlib.pyplot as plt
def bicycle_robot_model(q, u, L=0.3, dt=0.01):
"""
Implements the discrete time dynamics of your robot.
i.e. this function implements F in
q_{t+1} = F(q_{t}, u_{t})
dt is the discretization timestep... | [
"casadi.tan",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"casadi.cos",
"numpy.zeros",
"matplotlib.pyplot.ylabel",
"casadi.sin",
"casadi.vertcat",
"casadi.Opti",
"numpy.array",
"numpy.arange",
"numpy.linspace",
"matplotlib.... | [((1314, 1406), 'casadi.vertcat', 'vertcat', (['(x + x_dot * dt)', '(y + y_dot * dt)', '(theta + theta_dot * dt)', '(sigma + sigma_dot * dt)'], {}), '(x + x_dot * dt, y + y_dot * dt, theta + theta_dot * dt, sigma + \n sigma_dot * dt)\n', (1321, 1406), False, 'from casadi import Opti, sin, cos, tan, vertcat\n'), ((25... |
import logging
import os
logger = logging.getLogger(__name__)
class FrontEndCommonMemoryMapOnHostReport(object):
""" Report on memory usage
"""
def __call__(
self, report_default_directory,
processor_to_app_data_base_address):
"""
:param report_default_directory... | [
"os.path.join",
"logging.getLogger"
] | [((36, 63), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (53, 63), False, 'import logging\n'), ((423, 511), 'os.path.join', 'os.path.join', (['report_default_directory', '"""memory_map_from_processor_to_address_space"""'], {}), "(report_default_directory,\n 'memory_map_from_processor... |
import glob
import logging
import os
from collections import OrderedDict
from datetime import datetime
from operator import itemgetter
from .pathhelper import get_dump_glob
from .pathhelper import get_dump_matcher
# Inspired by Borg Backup code
# https://github.com/borgbackup/borg/blob/master/src/borg/helpers/misc.... | [
"os.remove",
"os.path.dirname",
"os.path.getmtime",
"collections.OrderedDict",
"os.rmdir",
"operator.itemgetter",
"os.listdir"
] | [((346, 546), 'collections.OrderedDict', 'OrderedDict', (["[('secondly', '%Y-%m-%d %H:%M:%S'), ('minutely', '%Y-%m-%d %H:%M'), (\n 'hourly', '%Y-%m-%d %H'), ('daily', '%Y-%m-%d'), ('weekly', '%G-%V'), (\n 'monthly', '%Y-%m'), ('yearly', '%Y')]"], {}), "([('secondly', '%Y-%m-%d %H:%M:%S'), ('minutely',\n '%Y-%m... |
#encoding=utf-8
# -------------------------------------------------------libraries----------------------------------------------------------
# Standard library
from flask import Flask
# Third-party libraries
from flask_mail import Mail
from flask_bootstrap import Bootstrap
from flask_moment import Moment
fr... | [
"celery.Celery",
"flask.Flask",
"flask_mail.Mail",
"flask_moment.Moment",
"flask_sqlalchemy.SQLAlchemy",
"flask_login.LoginManager",
"flask_bootstrap.Bootstrap"
] | [((615, 626), 'flask_bootstrap.Bootstrap', 'Bootstrap', ([], {}), '()\n', (624, 626), False, 'from flask_bootstrap import Bootstrap\n'), ((694, 702), 'flask_moment.Moment', 'Moment', ([], {}), '()\n', (700, 702), False, 'from flask_moment import Moment\n'), ((758, 770), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([],... |
# Syncs a local database table with the StreamNet database using the StreamNet REST Web API.
#
# Local data is replicated to the StreamNet server. This means that any records that exist locally but not remotely,
# or have been modified locally since the last sync, will be uploaded to StreamNet. Any records that exist... | [
"json.loads",
"json.dumps",
"datetime.datetime",
"pypyodbc.connect",
"datetime.datetime.now"
] | [((3228, 3263), 'pypyodbc.connect', 'pypyodbc.connect', (['db_connect_string'], {}), '(db_connect_string)\n', (3244, 3263), False, 'import pypyodbc\n'), ((5043, 5072), 'datetime.datetime', 'datetime.datetime', (['(1970)', '(1)', '(1)'], {}), '(1970, 1, 1)\n', (5060, 5072), False, 'import datetime\n'), ((5231, 5254), 'd... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
from optlang.symbolics import Zero, add
from modelseedpy.fbapkg.basefbapkg import BaseFBAPkg
from modelseedpy.fbapkg.fluxfittingpkg import FluxFittingPkg
from modelseedpy.fbapkg.revbinpkg import RevBinPkg
from modelseedpy.fbapkg.totalfluxpk... | [
"modelseedpy.fbapkg.fluxfittingpkg.FluxFittingPkg",
"optlang.symbolics.add",
"modelseedpy.fbapkg.basefbapkg.BaseFBAPkg.build_constraint",
"modelseedpy.fbapkg.basefbapkg.BaseFBAPkg.__init__",
"modelseedpy.fbapkg.basefbapkg.BaseFBAPkg.build_variable"
] | [((448, 615), 'modelseedpy.fbapkg.basefbapkg.BaseFBAPkg.__init__', 'BaseFBAPkg.__init__', (['self', 'model', '"""proteome fitting"""', "{'kapp': 'reaction', 'kvfit': 'reaction', 'kfit': 'reaction'}", "{'vkapp': 'reaction', 'kfitc': 'reaction'}"], {}), "(self, model, 'proteome fitting', {'kapp': 'reaction',\n 'kvfit'... |
import os,sys
import numpy as np
import pandas as pd
from toto.inputs.xls import XLSfile
filename=r'/home/remy/Calypso/Software/TOTO/Toto/_tests/xls_file/data.xlsx'
#tx=XLSfile([filename],sheetnames='test1',skiprows=0,time_col_name={'Year':'year','Month':'month','Day':'day','Hour [UTC]':'hour','Minute':'minute'})
tx=... | [
"toto.inputs.xls.XLSfile"
] | [((320, 554), 'toto.inputs.xls.XLSfile', 'XLSfile', (['[filename]'], {'sheetnames': '"""test3"""', 'colNames': '[]', 'unitNames': '[]', 'miss_val': '"""NaN"""', 'colNamesLine': '(1)', 'skiprows': '(2)', 'unitNamesLine': '(0)', 'skipfooter': '(0)', 'single_column': '(True)', 'unit': '"""s"""', 'customUnit': '"""%d-%m-%Y... |
from django.db import models
# Create your models here.
class FirebaseUser(models.Model):
firebase_id = models.CharField(max_length=255, blank=True)
def __str__(self):
return str(self.firebase_id)
class FoodCategory(models.Model):
title = models.CharField(max_length=255, blank=True)
def __s... | [
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.FloatField",
"django.db.models.BooleanField",
"django.db.models.IntegerField",
"django.db.models.DateField"
] | [((110, 154), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'blank': '(True)'}), '(max_length=255, blank=True)\n', (126, 154), False, 'from django.db import models\n'), ((263, 307), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'blank': '(True)'}), '(max... |
from twisted.internet.defer import Deferred
from twisted.internet.protocol import Protocol, connectionDone
from twisted.python import failure
from twisted.web._newclient import ResponseDone
from dgtc.dgtnix import dgtnix
class WriteToStdout(Protocol):
def __init__(self, prefix):
self.__prefix = prefix
... | [
"twisted.internet.defer.Deferred"
] | [((406, 416), 'twisted.internet.defer.Deferred', 'Deferred', ([], {}), '()\n', (414, 416), False, 'from twisted.internet.defer import Deferred\n')] |
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 18 12:49:59 2020
@author: tonim
"""
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 16 09:01:01 2020
Models 1 and 2
@author: Tonima
"""
#%% Data import and prep
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.r... | [
"matplotlib.pyplot.title",
"keras.preprocessing.image.ImageDataGenerator",
"numpy.argmax",
"keras.layers.MaxPool2D",
"keras.optimizers.Adagrad",
"keras.models.Model",
"sklearn.metrics.classification_report",
"keras.preprocessing.image.img_to_array",
"matplotlib.pyplot.figure",
"numpy.rot90",
"py... | [((927, 1015), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {'validation_split': '(0.2)', 'rescale': '(1.0 / 255)', 'featurewise_center': '(True)'}), '(validation_split=0.2, rescale=1.0 / 255,\n featurewise_center=True)\n', (945, 1015), False, 'from keras.preprocessing.image import Imag... |
import math
def run():
square_root_for_first_1000_natural_numbers = {i: math.sqrt(i) for i in range(1, 1001)}
print(square_root_for_first_1000_natural_numbers)
if __name__ == '__main__':
run() | [
"math.sqrt"
] | [((77, 89), 'math.sqrt', 'math.sqrt', (['i'], {}), '(i)\n', (86, 89), False, 'import math\n')] |
import pickle
import xgboost as xgb
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import StratifiedKFold
from sklearn import metrics
import time
def readbunchobj(path): # 读取bunch对象函数
file_obj = open(path, "rb")
bunch = pickle.load(file_obj) # 使用pickle.load反序列化对象
file_obj.... | [
"sklearn.model_selection.GridSearchCV",
"pickle.dump",
"sklearn.metrics.accuracy_score",
"sklearn.metrics.classification_report",
"time.time",
"pickle.load",
"sklearn.model_selection.StratifiedKFold",
"xgboost.XGBClassifier"
] | [((262, 283), 'pickle.load', 'pickle.load', (['file_obj'], {}), '(file_obj)\n', (273, 283), False, 'import pickle\n'), ((487, 498), 'time.time', 'time.time', ([], {}), '()\n', (496, 498), False, 'import time\n'), ((779, 987), 'xgboost.XGBClassifier', 'xgb.XGBClassifier', ([], {'learning_rate': '(0.1)', 'n_estimators': ... |
import apsw
__all__ = ['DB']
FASTA_TABLE_SQL = """
CREATE TABLE IF NOT EXISTS fasta_0 (
id INTEGER PRIMARY KEY,
name TEXT,
size INTEGER,
status TEXT,
fasta TEXT,
annotation TEXT
)
"""
SSR_TABLE_SQL = """
CREATE TABLE IF NOT EXISTS ssr_{} (
id INTEGER PRIMARY KEY,
chrom TEXT,
start INTEGER,
end INTEGER,
mo... | [
"apsw.Connection",
"apsw.Shell"
] | [((3141, 3165), 'apsw.Connection', 'apsw.Connection', (['db_file'], {}), '(db_file)\n', (3156, 3165), False, 'import apsw\n'), ((4872, 4895), 'apsw.Connection', 'apsw.Connection', (['dbfile'], {}), '(dbfile)\n', (4887, 4895), False, 'import apsw\n'), ((2945, 2969), 'apsw.Connection', 'apsw.Connection', (['db_file'], {}... |
"""
Custom integration to integrate stiebel_eltron_isg with Home Assistant.
For more details about this integration, please refer to
https://github.com/pail23/stiebel_eltron_isg
"""
import asyncio
from datetime import timedelta
import logging
import threading
from typing import Dict
import voluptuous as vol
from pym... | [
"pymodbus.payload.BinaryPayloadDecoder.fromRegisters",
"homeassistant.helpers.update_coordinator.UpdateFailed",
"voluptuous.Optional",
"voluptuous.Required",
"threading.Lock",
"datetime.timedelta",
"voluptuous.Schema",
"pymodbus.client.sync.ModbusTcpClient",
"logging.getLogger"
] | [((1780, 1801), 'datetime.timedelta', 'timedelta', ([], {'seconds': '(30)'}), '(seconds=30)\n', (1789, 1801), False, 'from datetime import timedelta\n'), ((1829, 1859), 'logging.getLogger', 'logging.getLogger', (['__package__'], {}), '(__package__)\n', (1846, 1859), False, 'import logging\n'), ((1916, 1939), 'voluptuou... |
# -*- coding: utf-8 -*-
"""
python代码整合器(c++类)代码构建器, 自动生成整合器代码, 以使得python代码统一整合到c++中, 以确保最终库文件只有一个动态库
"""
import os
import re
from os import path as op
from cpputils import *
from c import Cfg
from defs import LangType
class PyIntegratorBuilder(object):
@staticmethod
def build():
"""生成"""
# ... | [
"c.Cfg.getcodepath",
"os.path.basename",
"c.Cfg.getscriptpath",
"c.Cfg.getauthor",
"c.Cfg.getver",
"c.Cfg.getlicensehead",
"os.path.splitext",
"c.Cfg.getprojname",
"os.path.join",
"re.sub"
] | [((412, 429), 'c.Cfg.getcodepath', 'Cfg.getcodepath', ([], {}), '()\n', (427, 429), False, 'from c import Cfg\n'), ((596, 634), 'c.Cfg.getlicensehead', 'Cfg.getlicensehead', (['LangType.cplusplus'], {}), '(LangType.cplusplus)\n', (614, 634), False, 'from c import Cfg\n'), ((1026, 1045), 'c.Cfg.getscriptpath', 'Cfg.gets... |
import unittest, webnotes
class TestNSM(unittest.TestCase):
def setUp(self):
webnotes.conn.sql("delete from `tabItem Group`")
self.data = [
["t1", None, 1, 20],
["c0", "t1", 2, 3],
["c1", "t1", 4, 11],
["gc1", "c1", 5, 6],
["gc2", "c1", 7, 8],
["gc3", "c1", 9, 10],
["c2", "t1", 12, ... | [
"unittest.main",
"webnotes.utils.nestedset.rebuild_tree",
"webnotes.bean",
"webnotes.conn.rollback",
"webnotes.connect",
"webnotes.model.delete_doc",
"webnotes.conn.sql"
] | [((3717, 3735), 'webnotes.connect', 'webnotes.connect', ([], {}), '()\n', (3733, 3735), False, 'import webnotes\n'), ((3739, 3754), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3752, 3754), False, 'import unittest, webnotes\n'), ((81, 129), 'webnotes.conn.sql', 'webnotes.conn.sql', (['"""delete from `tabItem Gr... |
from __future__ import division
__copyright__ = "Copyright (C) 2012 <NAME>"
__license__ = """
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... | [
"loopy.kernel.data.CallMangleInfo"
] | [((1634, 1674), 'loopy.kernel.data.CallMangleInfo', 'CallMangleInfo', (['name', '(dtype,)', '(dtype,)'], {}), '(name, (dtype,), (dtype,))\n', (1648, 1674), False, 'from loopy.kernel.data import CallMangleInfo\n')] |
import time
print('t - 10 segundos para o lançamento dos fogos')
for c in range(10, 0, -1):
time.sleep(1)
print(c)
print('lançamento feito') | [
"time.sleep"
] | [((96, 109), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (106, 109), False, 'import time\n')] |
import urllib.request
import urllib.error
import json
import datetime
from logging import getLogger
from injector import inject
from gumo.task_emulator.application import TaskExecuteRunner
from gumo.task_emulator.domain.configuration import TaskEmulatorConfiguration
from gumo.task_emulator.domain import GumoTaskProces... | [
"datetime.datetime.utcnow",
"gumo.task_emulator.domain.ProcessRequest",
"logging.getLogger",
"json.dumps"
] | [((438, 457), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (447, 457), False, 'from logging import getLogger\n'), ((1968, 2000), 'json.dumps', 'json.dumps', (['task_process.payload'], {}), '(task_process.payload)\n', (1978, 2000), False, 'import json\n'), ((2017, 2124), 'gumo.task_emulator.doma... |
from numpy import array2string
from numpy import delete
from numpy import s_
from numpy import concatenate
from keras.models import model_from_json
from sklearn.preprocessing import MinMaxScaler
from connectDB import ConnectDB
import argparse
import time
class Predict(object):
SYMBOL = 0
ID_COIN = 1
def _... | [
"argparse.ArgumentParser",
"connectDB.ConnectDB",
"numpy.array2string",
"sklearn.preprocessing.MinMaxScaler",
"time.time",
"keras.models.model_from_json",
"numpy.delete",
"numpy.concatenate"
] | [((2798, 2876), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Forecast coin price with deep learning."""'}), "(description='Forecast coin price with deep learning.')\n", (2821, 2876), False, 'import argparse\n'), ((353, 364), 'connectDB.ConnectDB', 'ConnectDB', ([], {}), '()\n', (362, 3... |
# Generated by Django 2.0.13 on 2019-04-01 00:43
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookmodule', '0011_libraryaddbook_position'),
]
operations = [
migrations.RemoveField(
model_name='libraryaddbook',
name='p... | [
"django.db.migrations.RemoveField"
] | [((236, 304), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""libraryaddbook"""', 'name': '"""position"""'}), "(model_name='libraryaddbook', name='position')\n", (258, 304), False, 'from django.db import migrations\n'), ((349, 417), 'django.db.migrations.RemoveField', 'migrations.R... |
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
from python_testcase_generator.generator import generator
from test.lib.IO import BaseIO
class TestSyntax(unittest.TestCase):
def setUp(self):
self.target = generator
self.output = BaseIO()
def ... | [
"test.lib.IO.BaseIO"
] | [((302, 310), 'test.lib.IO.BaseIO', 'BaseIO', ([], {}), '()\n', (308, 310), False, 'from test.lib.IO import BaseIO\n'), ((362, 379), 'test.lib.IO.BaseIO', 'BaseIO', (['"""1\t2\t3"""'], {}), "('1\\t2\\t3')\n", (368, 379), False, 'from test.lib.IO import BaseIO\n'), ((510, 539), 'test.lib.IO.BaseIO', 'BaseIO', (['"""1 2 ... |
"""Wrappers for the dependency configuration files."""
import os
import sys
import shutil
import logging
import yorm
from . import common
from .shell import ShellMixin, GitMixin
logging.getLogger('yorm').setLevel(logging.INFO)
log = common.logger(__name__)
@yorm.attr(repo=yorm.standard.String)
@yorm.attr(dir=yorm... | [
"yorm.attr",
"os.remove",
"os.path.isdir",
"os.getcwd",
"os.path.dirname",
"os.path.exists",
"os.path.islink",
"yorm.sync",
"shutil.rmtree",
"os.path.join",
"os.listdir",
"logging.getLogger"
] | [((264, 300), 'yorm.attr', 'yorm.attr', ([], {'repo': 'yorm.standard.String'}), '(repo=yorm.standard.String)\n', (273, 300), False, 'import yorm\n'), ((302, 337), 'yorm.attr', 'yorm.attr', ([], {'dir': 'yorm.standard.String'}), '(dir=yorm.standard.String)\n', (311, 337), False, 'import yorm\n'), ((339, 374), 'yorm.attr... |
from flask import render_template, session, redirect, request, url_for, flash, Blueprint
from repository.users_repos import UsersRepository
from repository.resenha_repos import ResenhaRepository
from repository.comments_repos import CommentsRepository
from repository.curtidas_repos import CurtidasRepository
from models... | [
"flask.flash",
"repository.curtidas_repos.CurtidasRepository",
"repository.users_repos.UsersRepository",
"thirdparty.spotify.SpotifyGetFiveArtists",
"flask.url_for",
"thirdparty.spotify.SpotifyGetOneAlbum",
"flask.request.headers.get",
"repository.resenha_repos.ResenhaRepository",
"repository.commen... | [((704, 730), 'flask.Blueprint', 'Blueprint', (['"""res"""', '__name__'], {}), "('res', __name__)\n", (713, 730), False, 'from flask import render_template, session, redirect, request, url_for, flash, Blueprint\n'), ((7883, 7932), 'thirdparty.spotify.SpotifyCheckUser', 'SpotifyCheckUser', (["request.form['spotifyUserna... |
#! /usr/bin/env python
''' ------------------------| Python SOURCE FILE |------------------------
The Description of this file.
@copyright: Copyright (c) by Kodiak Data, Inc. All rights reserved.
'''
from xml.dom.minidom import Document
class KdHostBinding(object):
def __init__(self):
self.hosts = [... | [
"xml.dom.minidom.Document"
] | [((720, 730), 'xml.dom.minidom.Document', 'Document', ([], {}), '()\n', (728, 730), False, 'from xml.dom.minidom import Document\n')] |
import os
import config
import tools
from subprocess import (run, PIPE, TimeoutExpired)
from multiprocessing import Queue
from threading import Thread
def __thread_worker__():
global job_queue
while True:
attempt = job_queue.get()
if not attempt['evaluated']:
attid = attempt['attem... | [
"threading.Thread",
"subprocess.run",
"tools.add_attempt_to_contest",
"tools.Contest",
"multiprocessing.Queue",
"tools.log",
"tools.random_id",
"os.path.join"
] | [((1883, 1890), 'multiprocessing.Queue', 'Queue', ([], {}), '()\n', (1888, 1890), False, 'from multiprocessing import Queue\n'), ((1986, 2018), 'threading.Thread', 'Thread', ([], {'target': '__thread_worker__'}), '(target=__thread_worker__)\n', (1992, 2018), False, 'from threading import Thread\n'), ((2319, 2364), 'os.... |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import sys
from page_sets.login_helpers import dropbox_login
from page_sets.login_helpers import google_login
from telemetry.core import dis... | [
"logging.error",
"page_sets.login_helpers.dropbox_login.LoginAccount",
"page_sets.login_helpers.google_login.LoginGoogleAccount",
"telemetry.core.discover.DiscoverClassesInModule"
] | [((9358, 9446), 'page_sets.login_helpers.google_login.LoginGoogleAccount', 'google_login.LoginGoogleAccount', (['action_runner', '"""googletest"""', 'self.credentials_path'], {}), "(action_runner, 'googletest', self.\n credentials_path)\n", (9389, 9446), False, 'from page_sets.login_helpers import google_login\n'), ... |
import os
import tempfile
from fastapi.testclient import TestClient
from sqlalchemy.orm import Session
from app import crud
from app.core.config import settings
from app.tests.utils.track import create_random_track
def test_tracks_get(client: TestClient, db: Session) -> None:
db.connection().execute("TRUNCATE T... | [
"app.crud.track.get_multi",
"app.tests.utils.track.create_random_track",
"app.crud.track.remove"
] | [((370, 414), 'app.crud.track.get_multi', 'crud.track.get_multi', (['db'], {'skip': '(0)', 'limit': 'None'}), '(db, skip=0, limit=None)\n', (390, 414), False, 'from app import crud\n'), ((448, 482), 'app.crud.track.remove', 'crud.track.remove', (['db'], {'id': 'track.id'}), '(db, id=track.id)\n', (465, 482), False, 'fr... |
# Copyright Contributors to the Testing Farm project.
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Dict, List, Optional, cast # noqa
import collections
import re
import requests
from six.moves.urllib.parse import quote as urlquote
from six.moves.urllib.parse import urlencode
import gluetool
from g... | [
"gluetool.log.log_dict",
"typing.cast",
"six.moves.urllib.parse.quote",
"requests.Response",
"collections.OrderedDict.fromkeys",
"collections.namedtuple",
"requests.get",
"requests.post",
"six.moves.urllib.parse.urlencode",
"gluetool.GlueError",
"re.compile"
] | [((725, 785), 'collections.namedtuple', 'collections.namedtuple', (['"""TaskArches"""', "['complete', 'arches']"], {}), "('TaskArches', ['complete', 'arches'])\n", (747, 785), False, 'import collections\n'), ((15457, 15529), 're.compile', 're.compile', (['"""\\\\s*Depends-On:\\\\s*(.*/pull/|#)(\\\\d+)"""'], {'flags': '... |
from flask import Flask, jsonify
from flask_sqlalchemy import SQLAlchemy
import redis
from rq import Queue
app = Flask(__name__)
app.config.from_envvar('APP_SETTINGS')
app.config['TESTING'] = app.config['DEBUG'],
db = SQLAlchemy(app)
class Results(db.Model):
id = db.Column(db.String, primary_key=True, unique=Tru... | [
"redis.Redis",
"flask_sqlalchemy.SQLAlchemy",
"flask.Flask",
"rq.Queue"
] | [((114, 129), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (119, 129), False, 'from flask import Flask, jsonify\n'), ((220, 235), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (230, 235), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((488, 501), 'redis.Redis', 'redis.Redi... |
"""Add num block field to course
Revision ID: ea54b96ff65f
Revises: <KEY>
Create Date: 2020-08-23 17:51:10.552772
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ea54b96ff65f'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
def upgrade():
... | [
"alembic.op.drop_column",
"sqlalchemy.Integer"
] | [((593, 635), 'alembic.op.drop_column', 'op.drop_column', (['"""courses"""', '"""num_of_blocks"""'], {}), "('courses', 'num_of_blocks')\n", (607, 635), False, 'from alembic import op\n'), ((438, 450), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (448, 450), True, 'import sqlalchemy as sa\n')] |
import os
dirname = os.path.dirname(__file__)
class spacegroups:
def __init__(self):
groups = []
families = []
sgs = []
geni = []
with open(os.path.join(dirname,"HSGdict.txt"), 'r') as proto:
for line in proto.readlines():
group, family, sg, gen... | [
"os.path.dirname",
"os.path.join"
] | [((20, 45), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (35, 45), False, 'import os\n'), ((187, 223), 'os.path.join', 'os.path.join', (['dirname', '"""HSGdict.txt"""'], {}), "(dirname, 'HSGdict.txt')\n", (199, 223), False, 'import os\n')] |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import logging
from e2e.utils.cognito_bootstrap import common
from e2e.utils.aws.elbv2 import ElasticLoadBalancingV2
from e2e.utils.aws.route53 import Route53HostedZone
from e2e.utils.utils import print_banner, ... | [
"e2e.utils.aws.elbv2.ElasticLoadBalancingV2",
"logging.basicConfig",
"e2e.utils.utils.print_banner",
"e2e.utils.aws.route53.Route53HostedZone",
"e2e.utils.utils.load_yaml_file",
"logging.getLogger"
] | [((336, 375), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (355, 375), False, 'import logging\n'), ((385, 412), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (402, 412), False, 'import logging\n'), ((585, 654), 'e2e.utils.aws.ro... |
import os
import pprint
import time
import urllib.error
import urllib.request
from create_dir_before_write_file import create_dir_before_write_file
def download_file(url, dst_path):
create_dir_before_write_file(dst_path)
try:
with urllib.request.urlopen(url) as web_file:
data = web_file.re... | [
"create_dir_before_write_file.create_dir_before_write_file"
] | [((188, 226), 'create_dir_before_write_file.create_dir_before_write_file', 'create_dir_before_write_file', (['dst_path'], {}), '(dst_path)\n', (216, 226), False, 'from create_dir_before_write_file import create_dir_before_write_file\n')] |
# -*- coding: utf-8 -*-
import sys,os
import pandas as pd
import numpy as np
from collections import Counter
import joblib
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.model_selection import RandomizedSearchCV
from sklearn.model_selection import GroupKFold, StratifiedKFold
f... | [
"sys.path.append",
"sklearn.ensemble.RandomForestClassifier",
"sklearn.preprocessing.StandardScaler",
"os.makedirs",
"pandas.read_csv",
"numpy.unique",
"sklearn.preprocessing.OneHotEncoder",
"os.path.exists",
"sklearn.model_selection.RandomizedSearchCV",
"sklearn.metrics.make_scorer",
"numpy.vst... | [((584, 615), 'sys.path.append', 'sys.path.append', (['"""../analysis/"""'], {}), "('../analysis/')\n", (599, 615), False, 'import sys, os\n'), ((850, 880), 'os.path.join', 'os.path.join', (['outdir', '"""models"""'], {}), "(outdir, 'models')\n", (862, 880), False, 'import sys, os\n'), ((1039, 1142), 'pandas.read_csv',... |
"""
Definition of the plugin.
"""
from django.utils.translation import ugettext_lazy as _
from fluent_contents.extensions import ContentPlugin, plugin_pool
from . import forms, models
@plugin_pool.register
class InstagramEmbedPlugin(ContentPlugin):
model = models.InstagramEmbedItem
category = _('Assets')
... | [
"django.utils.translation.ugettext_lazy"
] | [((305, 316), 'django.utils.translation.ugettext_lazy', '_', (['"""Assets"""'], {}), "('Assets')\n", (306, 316), True, 'from django.utils.translation import ugettext_lazy as _\n')] |
from setuptools import setup, find_packages
def load_reqs(file_name):
with open(file_name) as fd:
return fd.readlines()
def load_version(file_name):
with open(file_name) as fd:
for line in fd:
if '__version__' in line:
version_string = line.split('=')[1]
... | [
"setuptools.find_packages"
] | [((653, 684), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['lib/']"}), "(exclude=['lib/'])\n", (666, 684), False, 'from setuptools import setup, find_packages\n')] |
# Copyright 2018-2019 QuantumBlack Visual Analytics Limited
#
# 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
#
# THE SOFTWARE IS PROVIDED "AS IS"... | [
"yaml.dump",
"pytest.mark.usefixtures",
"kedro.contrib.config.TemplatedConfigLoader"
] | [((1683, 1700), 'yaml.dump', 'yaml.dump', (['config'], {}), '(config)\n', (1692, 1700), False, 'import yaml\n'), ((6155, 6200), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""proj_catalog_param"""'], {}), "('proj_catalog_param')\n", (6178, 6200), False, 'import pytest\n'), ((6976, 7045), 'pytest.mark.usefi... |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | [
"ydk._core._dm_meta_info._MetaInfoClassMember",
"ydk._core._dm_meta_info._MetaInfoEnum"
] | [((543, 818), 'ydk._core._dm_meta_info._MetaInfoEnum', '_MetaInfoEnum', (['"""Asr9KEfdModeEnum"""', '"""ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_prm_cfg"""', "{'only-outer-encap': 'only_outer_encap', 'include-inner-encap':\n 'include_inner_encap'}", '"""Cisco-IOS-XR-asr9k-prm-cfg"""', "_yang_ns._namespaces['Cisco-... |
# Python Object Oriented Programming
import datetime
class Employee:
num_of_emps = 0 # Class Variable
raise_amount = 1.02 # Class Variable
def __init__(self, FirstName, LastName, salary):
self.FirstName = FirstName
self.LastName = LastName
self.salary = int(salary)
self.em... | [
"datetime.date.today"
] | [((2621, 2642), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (2640, 2642), False, 'import datetime\n')] |
import datetime
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import generics, response, status
from .filters import TagFilter
from .models import Entity
from .serializers import EntitySerializer, EntityDetailSerializer
class EntitiesView(generics.ListAPIView):
queryset = Ent... | [
"datetime.datetime.strptime",
"rest_framework.response.Response",
"datetime.timedelta",
"datetime.datetime.now"
] | [((1246, 1273), 'datetime.timedelta', 'datetime.timedelta', ([], {'days': '(31)'}), '(days=31)\n', (1264, 1273), False, 'import datetime\n'), ((1690, 1742), 'rest_framework.response.Response', 'response.Response', (['result'], {'status': 'status.HTTP_200_OK'}), '(result, status=status.HTTP_200_OK)\n', (1707, 1742), Fal... |