code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from channels.staticfiles import StaticFilesConsumer
from .consumers import ws_connect, ws_receive, ws_disconnect, new_contestant, start_quiz, submit_answer
from channels import include, route
# Although we could, there is no path matching on these routes; instead we rely
# on the matching from the top-level routing.
... | [
"channels.staticfiles.StaticFilesConsumer",
"channels.include",
"channels.route"
] | [((639, 677), 'channels.route', 'route', (['"""websocket.connect"""', 'ws_connect'], {}), "('websocket.connect', ws_connect)\n", (644, 677), False, 'from channels import include, route\n'), ((735, 773), 'channels.route', 'route', (['"""websocket.receive"""', 'ws_receive'], {}), "('websocket.receive', ws_receive)\n", (7... |
#!/usr/bin/env python
# cardinal_pythonlib/sphinxtools.py
"""
===============================================================================
Original code copyright (C) 2009-2020 <NAME> (<EMAIL>).
This file is part of cardinal_pythonlib.
Licensed under the Apache License, Version 2.0 (the "License");
... | [
"logging.getLogger",
"os.path.exists",
"pygments.lexers.get_lexer_for_filename",
"cardinal_pythonlib.reprfunc.auto_repr",
"os.path.splitext",
"cardinal_pythonlib.fileops.relative_filename_within_dir",
"os.path.isfile",
"os.path.dirname",
"os.path.isdir",
"fnmatch.fnmatch",
"os.path.basename",
... | [((1712, 1739), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1729, 1739), False, 'import logging\n'), ((3665, 3682), 'os.path.dirname', 'dirname', (['filename'], {}), '(filename)\n', (3672, 3682), False, 'from os.path import abspath, basename, dirname, exists, expanduser, isdir, isfile... |
# Generated by Django 2.1.3 on 2018-11-08 21:12
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('monsterapi', '0004_name'),
]
operations = [
migrations.AddField(
model_name='monster',
... | [
"django.db.models.ForeignKey"
] | [((355, 467), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""monsterapi.Name"""'}), "(blank=True, null=True, on_delete=django.db.models.\n deletion.CASCADE, to='monsterapi.Name')\n", (372, 467), False, 'from d... |
import pandas as pd
from wikidataintegrator import wdi_login
import utils
from login import WDPASS, WDUSER
import argparse
import sys
parser = argparse.ArgumentParser()
df = utils.get_complex_portal_species_ids()
print(df.to_markdown()) | [
"utils.get_complex_portal_species_ids",
"argparse.ArgumentParser"
] | [((144, 169), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (167, 169), False, 'import argparse\n'), ((175, 213), 'utils.get_complex_portal_species_ids', 'utils.get_complex_portal_species_ids', ([], {}), '()\n', (211, 213), False, 'import utils\n')] |
import cv2
print(cv2.getBuildInformation())
| [
"cv2.getBuildInformation"
] | [((18, 43), 'cv2.getBuildInformation', 'cv2.getBuildInformation', ([], {}), '()\n', (41, 43), False, 'import cv2\n')] |
# =============================================================================
# System imports
import logging
import RPi.GPIO as RPiGPIO
# =============================================================================
# Logger setup
logger = logging.getLogger(__name__)
# =============================================... | [
"logging.getLogger",
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"RPi.GPIO.output",
"RPi.GPIO.setmode"
] | [((244, 271), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (261, 271), False, 'import logging\n'), ((1945, 1975), 'RPi.GPIO.setmode', 'RPiGPIO.setmode', (['RPiGPIO.BOARD'], {}), '(RPiGPIO.BOARD)\n', (1960, 1975), True, 'import RPi.GPIO as RPiGPIO\n'), ((1824, 1854), 'RPi.GPIO.cleanup', ... |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
from indra.statements import *
from indra.preassembler.grounding_mapper import GroundingMapper, \
default_grounding_map
def get_statements():
statements = []
... | [
"indra.preassembler.grounding_mapper.GroundingMapper"
] | [((4729, 4767), 'indra.preassembler.grounding_mapper.GroundingMapper', 'GroundingMapper', (['default_grounding_map'], {}), '(default_grounding_map)\n', (4744, 4767), False, 'from indra.preassembler.grounding_mapper import GroundingMapper, default_grounding_map\n')] |
import unittest
import base_test
import json
class PrincipalClaimTest(base_test.BaseTest):
def setUp(self):
super(PrincipalClaimTest, self).setUp()
self._org = self.post('/api/orgs', {"name":"claim_org", "url":"https://myorg.com"})
self._principal = self.post('/api/orgs/%s/principals' % sel... | [
"unittest.main",
"json.dumps"
] | [((2122, 2137), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2135, 2137), False, 'import unittest\n'), ((1851, 1867), 'json.dumps', 'json.dumps', (['resp'], {}), '(resp)\n', (1861, 1867), False, 'import json\n'), ((2072, 2088), 'json.dumps', 'json.dumps', (['resp'], {}), '(resp)\n', (2082, 2088), False, 'import... |
import pandas as pd
import yaml
import gzip
import re
import urllib
import shutil # for removing and creating folders
from pathlib import Path
from tqdm.autonotebook import tqdm
import warnings
from Bio import SeqIO
from Bio.Seq import Seq
from .cloud_caching import CLOUD_CACHE, download_from_cloud_cache
CACHE_PATH... | [
"pandas.read_csv",
"urllib.request.urlretrieve",
"pathlib.Path",
"gzip.open",
"pathlib.Path.home",
"Bio.Seq.Seq",
"yaml.safe_load",
"Bio.SeqIO.parse",
"shutil.rmtree",
"warnings.warn",
"re.sub"
] | [((323, 334), 'pathlib.Path.home', 'Path.home', ([], {}), '()\n', (332, 334), False, 'from pathlib import Path\n'), ((3420, 3447), 'pathlib.Path', 'Path', (['interval_list_dataset'], {}), '(interval_list_dataset)\n', (3424, 3447), False, 'from pathlib import Path\n'), ((4375, 4391), 'pathlib.Path', 'Path', (['cache_pat... |
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
import time
from datetime import timedelta
import os
# Importing a helper module for the functions of the Inception model.
import inception
import cifar10
from cifar10 import num_classes
from inception import transfer_values_cache
#Importing... | [
"tensorflow.equal",
"tensorflow.nn.softmax",
"cifar10.load_training_data",
"inception.Inception",
"tensorflow.reduce_mean",
"tensorflow.cast",
"matplotlib.pyplot.imshow",
"numpy.mean",
"sklearn.decomposition.PCA",
"tensorflow.placeholder",
"tensorflow.Session",
"inception.maybe_download",
"s... | [((574, 610), 'cifar10.maybe_download_and_extract', 'cifar10.maybe_download_and_extract', ([], {}), '()\n', (608, 610), False, 'import cifar10\n'), ((626, 652), 'cifar10.load_class_names', 'cifar10.load_class_names', ([], {}), '()\n', (650, 652), False, 'import cifar10\n'), ((775, 803), 'cifar10.load_training_data', 'c... |
from rest_framework.exceptions import NotFound, PermissionDenied
from rest_framework.generics import (
CreateAPIView,
DestroyAPIView,
RetrieveUpdateAPIView,
)
from .permissions import (
IsAdminOrModeratorOrReadOnly,
IsOwnerOrAdminOrModeratorOrReadOnly,
IsOwnerOrReadOnly,
)
from .serializers impo... | [
"posts.models.Post.objects.filter",
"posts.models.Note.objects.all",
"posts.models.Post.objects.all",
"rest_framework.exceptions.PermissionDenied"
] | [((561, 579), 'posts.models.Note.objects.all', 'Note.objects.all', ([], {}), '()\n', (577, 579), False, 'from posts.models import Note, Post\n'), ((1273, 1291), 'posts.models.Note.objects.all', 'Note.objects.all', ([], {}), '()\n', (1289, 1291), False, 'from posts.models import Note, Post\n'), ((1566, 1584), 'posts.mod... |
#!/usr/bin/env python
from __future__ import print_function
import sys
sys.path.insert(0, "/home/liangjiang/code/keras-jl-mean/")
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
from keras.models import model_from_json
from keras.models import Sequential
from keras.layers imp... | [
"sys.path.insert",
"keras.backend.learning_phase",
"keras.optimizers.SGD",
"keras.layers.Activation",
"numpy.mean",
"numpy.reshape",
"argparse.ArgumentParser",
"keras.layers.Flatten",
"keras.datasets.cifar10.load_data",
"keras.layers.MaxPooling2D",
"keras.models.Sequential",
"numpy.savetxt",
... | [((71, 129), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/home/liangjiang/code/keras-jl-mean/"""'], {}), "(0, '/home/liangjiang/code/keras-jl-mean/')\n", (86, 129), False, 'import sys\n'), ((734, 759), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (757, 759), False, 'import argparse\n')... |
import unittest
import subprocess
import re
from os import environ
class MoveRatingTestBasic(unittest.TestCase):
def setUp(self):
if environ.get('OMDB_API_KEY') is None or len(environ.get('OMDB_API_KEY')) < 1:
raise Exception("The OMDB_API_KEY environment variable is not set. Unable to run test... | [
"unittest.main",
"subprocess.run",
"re.match",
"os.environ.get"
] | [((2529, 2544), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2542, 2544), False, 'import unittest\n'), ((2036, 2156), 'subprocess.run', 'subprocess.run', (['"""/usr/src/app/movie_rating.py --api-key foo --title foo"""'], {'shell': '(True)', 'capture_output': '(True)', 'text': '(True)'}), "('/usr/src/app/movie_r... |
'''OpenGL extension ARB.shader_clock
This module customises the behaviour of the
OpenGL.raw.GL.ARB.shader_clock to provide a more
Python-friendly API
Overview (from the spec)
This extension exposes a 64-bit monotonically incrementing shader
counter which may be used to derive local timing information within
a ... | [
"OpenGL.extensions.hasGLExtension"
] | [((861, 903), 'OpenGL.extensions.hasGLExtension', 'extensions.hasGLExtension', (['_EXTENSION_NAME'], {}), '(_EXTENSION_NAME)\n', (886, 903), False, 'from OpenGL import extensions\n')] |
from functools import partial
from django.urls import path
from .views import openapi_json, swagger, home
def get_openapi_urls(api: "NinjaAPI"):
result = [path("", partial(home, api=api), name=f"api-root")]
if api.openapi_url:
result.append(
path(
api.openapi_url.lstrip("/... | [
"functools.partial"
] | [((170, 192), 'functools.partial', 'partial', (['home'], {'api': 'api'}), '(home, api=api)\n', (177, 192), False, 'from functools import partial\n'), ((340, 370), 'functools.partial', 'partial', (['openapi_json'], {'api': 'api'}), '(openapi_json, api=api)\n', (347, 370), False, 'from functools import partial\n'), ((704... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-29 18:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('places', '0027_auto_20171229_1606'),
]
operations = [
migrations.AddField(
... | [
"django.db.models.BooleanField"
] | [((418, 496), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'verbose_name': '"""Show in About Place section"""'}), "(default=False, verbose_name='Show in About Place section')\n", (437, 496), False, 'from django.db import migrations, models\n')] |
from builtins import str
import collections
import contextlib
import functools
import itertools
import io
import os
import re
import six
import subprocess
import threading
import tempfile
import time
import traceback
import termcolor
from . import command
from . import parser
COLORS = ['yellow', 'blue', 'red', 'gre... | [
"traceback.format_exc",
"collections.OrderedDict",
"collections.namedtuple",
"threading.Lock",
"subprocess.Popen",
"functools.wraps",
"os.environ.copy",
"io.open",
"time.sleep",
"builtins.str",
"itertools.count",
"collections.defaultdict",
"tempfile.gettempdir",
"six.iteritems",
"time.ti... | [((422, 497), 'collections.namedtuple', 'collections.namedtuple', (['"""RunnerResults"""', "('failed', 'running', 'interrupt')"], {}), "('RunnerResults', ('failed', 'running', 'interrupt'))\n", (444, 497), False, 'import collections\n'), ((630, 648), 'functools.wraps', 'functools.wraps', (['f'], {}), '(f)\n', (645, 648... |
"""
Model construction utilities based on keras
"""
import warnings
from distutils.version import LooseVersion
import tensorflow.keras
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Activation, Flatten
# from cleverhans.model import Model, NoSuchLayerError
import tensorflow a... | [
"tensorflow.reduce_min",
"tensorflow.executing_eagerly",
"tensorflow.keras.models.Model",
"tensorflow.reduce_max",
"tensorflow.control_dependencies",
"tensorflow.nn.softmax",
"warnings.warn",
"tensorflow.identity",
"tensorflow.cast",
"tensorflow.log",
"tensorflow.get_collection"
] | [((1815, 2306), 'warnings.warn', 'warnings.warn', (['"""Model.__call__ is deprecated. The call is ambiguous as to whether the output should be logits or probabilities, and getting the wrong one can cause serious problems. The output actually is probabilities, which are a very dangerous thing to use as part of any inter... |
from .db_handler import cursor
from tornado import concurrent
import tornado.web
executor = concurrent.futures.ThreadPoolExecutor(8)
def start_task(arg):
print("The Task has started") # Async task
return True
def stop_task(arg):
print("The Task has stopped") # Async task
return True
class Handler... | [
"tornado.concurrent.futures.ThreadPoolExecutor"
] | [((92, 132), 'tornado.concurrent.futures.ThreadPoolExecutor', 'concurrent.futures.ThreadPoolExecutor', (['(8)'], {}), '(8)\n', (129, 132), False, 'from tornado import concurrent\n')] |
import gurobipy as gp
from gurobipy import GRB
from scheduler.utils import *
import csv
W = {}
days = ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY"]
departments = ["CMPE"]
def create_W_matrix():
global W
allAvailableSlots = get_all_available_slots()
for availableSlot in allAvailabl... | [
"gurobipy.quicksum",
"csv.writer",
"gurobipy.Model"
] | [((979, 1001), 'gurobipy.Model', 'gp.Model', (['"""Scheduling"""'], {}), "('Scheduling')\n", (987, 1001), True, 'import gurobipy as gp\n'), ((3503, 3618), 'gurobipy.quicksum', 'gp.quicksum', (['(X[f, c, s, r] for f in allInstructors for s in allSlots for c in\n allCourses for r in allClassrooms)'], {}), '(X[f, c, s,... |
import sys,os
import time
import datetime
import random
import re
import json
import requests
from flask import Flask, jsonify
from flasgger import Swagger # pip install flasgger
from flasgger import swag_from
from flask import request
from api_helper import GretNet_API_Helper
LOCAL_PATH = os.path.abspath(os.... | [
"os.path.dirname",
"sys.path.insert",
"flask.jsonify"
] | [((349, 379), 'sys.path.insert', 'sys.path.insert', (['(0)', 'LOCAL_PATH'], {}), '(0, LOCAL_PATH)\n', (364, 379), False, 'import sys, os\n'), ((379, 417), 'sys.path.insert', 'sys.path.insert', (['(0)', "(LOCAL_PATH + '../')"], {}), "(0, LOCAL_PATH + '../')\n", (394, 417), False, 'import sys, os\n'), ((1350, 1365), 'fla... |
"""
paw_structure.ion
-----------------
Ion complex detection using geometric :ref:`algorithm<Control_ION_algorithm>`.
Main routine is :func:`.ion_find_parallel`.
Dependencies:
:py:mod:`functools`
:py:mod:`miniutils`
:py:mod:`numpy`
:py:mod:`pandas`
:mod:`.neighbor`
:mod:`.utility`
:class:... | [
"pandas.DataFrame",
"numpy.array",
"functools.partial",
"numpy.savetxt",
"miniutils.progress_bar.parallel_progbar",
"pandas.concat"
] | [((3330, 3371), 'pandas.concat', 'pd.concat', (['[id1_list, id2_list, id3_list]'], {}), '([id1_list, id2_list, id3_list])\n', (3339, 3371), True, 'import pandas as pd\n'), ((6036, 6082), 'numpy.savetxt', 'np.savetxt', (['f', 'snapshots[0].cell'], {'fmt': '"""%14.8f"""'}), "(f, snapshots[0].cell, fmt='%14.8f')\n", (6046... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('facilities', '0001_auto_20160328_1426'),
]
operations = [
migrations.AddField(
model_name='facilityunit',
... | [
"django.db.models.CharField"
] | [((367, 422), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'null': '(True)', 'blank': '(True)'}), '(max_length=100, null=True, blank=True)\n', (383, 422), False, 'from django.db import migrations, models\n'), ((556, 711), 'django.db.models.CharField', 'models.CharField', ([], {'help_te... |
# Copyright (c) 2015-2016 <NAME> <<EMAIL>>
# See LICENSE file for copyright information.
import sys
if 'PySide6' in sys.modules:
from PySide6.QtWidgets import QMessageBox, QLabel, QTextEdit
_exec_attr = 'exec'
elif 'PyQt6' in sys.modules:
from PyQt6.QtWidgets import QMessageBox, QLabel, QTextEdit
_exec... | [
"PyQt4.QtGui.QMessageBox",
"PyQt4.QtGui.QTextEdit"
] | [((1275, 1288), 'PyQt4.QtGui.QMessageBox', 'QMessageBox', ([], {}), '()\n', (1286, 1288), False, 'from PyQt4.QtGui import QMessageBox, QLabel, QTextEdit\n'), ((1843, 1856), 'PyQt4.QtGui.QMessageBox', 'QMessageBox', ([], {}), '()\n', (1854, 1856), False, 'from PyQt4.QtGui import QMessageBox, QLabel, QTextEdit\n'), ((232... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from matplotlib.colors import LinearSegmentedColormap
ms_color = [0.12156863, 0.46666667, 0.70588235, 1]
hc_color = [1., 0.49803922, 0.05490196, 1]
SMALL_SIZE = 12
MEDIUM_SIZE = 14
BIGGER_SIZE = 16
plt.rc('font', size=SMALL_SIZE) # contr... | [
"numpy.mean",
"matplotlib.pyplot.plot",
"numpy.concatenate",
"numpy.min",
"pandas.DataFrame",
"numpy.abs",
"matplotlib.pyplot.xticks",
"pandas.merge",
"numpy.squeeze",
"matplotlib.pyplot.register_cmap",
"matplotlib.pyplot.title",
"matplotlib.colors.LinearSegmentedColormap.from_list",
"matplo... | [((272, 303), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'size': 'SMALL_SIZE'}), "('font', size=SMALL_SIZE)\n", (278, 303), True, 'import matplotlib.pyplot as plt\n'), ((343, 380), 'matplotlib.pyplot.rc', 'plt.rc', (['"""axes"""'], {'titlesize': 'BIGGER_SIZE'}), "('axes', titlesize=BIGGER_SIZE)\n", (349, 380),... |
# coding=utf-8
import io
import os
import re
from setuptools import setup, find_packages
def get_path(*args):
return os.path.join(os.path.dirname(__file__), *args)
def read_from(filepath):
with io.open(filepath, 'rt', encoding='utf8') as f:
return f.read()
def get_requirements(filename='requiremen... | [
"os.path.dirname",
"setuptools.find_packages",
"io.open",
"re.search"
] | [((136, 161), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (151, 161), False, 'import os\n'), ((206, 246), 'io.open', 'io.open', (['filepath', '"""rt"""'], {'encoding': '"""utf8"""'}), "(filepath, 'rt', encoding='utf8')\n", (213, 246), False, 'import io\n'), ((819, 834), 'setuptools.find_pa... |
#!/usr/bin/env python3
'''
kicad-footprint-generator is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
kicad-footprint-generator is distribut... | [
"os.makedirs",
"argparse.ArgumentParser",
"os.path.join",
"footprint_text_fields.addTextFields",
"math.sqrt",
"yaml.safe_load",
"os.path.isdir"
] | [((892, 935), 'os.path.join', 'os.path.join', (['sys.path[0]', '""".."""', '""".."""', '""".."""'], {}), "(sys.path[0], '..', '..', '..')\n", (904, 935), False, 'import os\n'), ((1089, 1135), 'os.path.join', 'os.path.join', (['sys.path[0]', '""".."""', '""".."""', '"""tools"""'], {}), "(sys.path[0], '..', '..', 'tools'... |
# Configuration file for EmptySource
import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
process.load("FWCore.Framework.test.cmsExceptionsFatal_cff")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(8*5)
)
runToLumi = ((2,1),(10,3),(20,7) )
def findRunForLumi( lumi) :
l... | [
"FWCore.ParameterSet.Config.OutputModule",
"FWCore.ParameterSet.Config.LuminosityBlockID",
"FWCore.ParameterSet.Config.untracked.uint64",
"FWCore.ParameterSet.Config.VEventID",
"FWCore.ParameterSet.Config.EndPath",
"FWCore.ParameterSet.Config.EventID",
"FWCore.ParameterSet.Config.untracked",
"FWCore.P... | [((90, 109), 'FWCore.ParameterSet.Config.Process', 'cms.Process', (['"""TEST"""'], {}), "('TEST')\n", (101, 109), True, 'import FWCore.ParameterSet.Config as cms\n'), ((813, 827), 'FWCore.ParameterSet.Config.VEventID', 'cms.VEventID', ([], {}), '()\n', (825, 827), True, 'import FWCore.ParameterSet.Config as cms\n'), ((... |
# -*- coding: utf-8 -*-
"""
Provides functions for data transformation (currently only LLS) and
normalization.
"""
import numpy as np
def transform(raw_data, mode, direction='direct', **kwargs):
"""
Apply mathematical transformations to data.
Parameters
----------
raw_data : ndarray
2D n... | [
"numpy.trapz",
"numpy.sqrt",
"numpy.asarray",
"numpy.exp",
"numpy.min",
"numpy.arange"
] | [((2588, 2608), 'numpy.asarray', 'np.asarray', (['raw_data'], {}), '(raw_data)\n', (2598, 2608), True, 'import numpy as np\n'), ((1677, 1693), 'numpy.min', 'np.min', (['raw_data'], {}), '(raw_data)\n', (1683, 1693), True, 'import numpy as np\n'), ((2814, 2838), 'numpy.arange', 'np.arange', (['x_data_points'], {}), '(x_... |
#Predictions performed by this module
#dependencies
import base64
import numpy as np
import io
from PIL import Image
import keras
from keras import backend as K
from keras.models import Sequential
from keras.models import load_model
from keras.preprocessing.image import ImageDataGenerator, img_to_array
from model imp... | [
"keras.preprocessing.image.img_to_array",
"flask.Flask",
"io.BytesIO",
"base64.b64decode",
"flask.request.get_json",
"numpy.expand_dims",
"main.infer2",
"flask.jsonify"
] | [((478, 493), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (483, 493), False, 'from flask import Flask\n'), ((815, 834), 'keras.preprocessing.image.img_to_array', 'img_to_array', (['image'], {}), '(image)\n', (827, 834), False, 'from keras.preprocessing.image import ImageDataGenerator, img_to_array\n'), ... |
from typing import Any
import msgpack
from app.core.config import settings
from girder_client import GirderClient
from fastapi import HTTPException
from fastapi import Response
cache_settings = {
"directory": "/tmp/cache",
"eviction_policy": "least-frequently-used",
"size_limit": 2**20, # 1g
}
_gc = No... | [
"msgpack.packb",
"girder_client.GirderClient",
"fastapi.HTTPException"
] | [((406, 461), 'fastapi.HTTPException', 'HTTPException', ([], {'status_code': '(400)', 'detail': '"""Invalid token."""'}), "(status_code=400, detail='Invalid token.')\n", (419, 461), False, 'from fastapi import HTTPException\n'), ((512, 586), 'girder_client.GirderClient', 'GirderClient', ([], {'apiUrl': 'settings.GIRDER... |
import collections
import glob
import json
import os
import random
import re
from typing import Tuple, Iterator, List, Dict, Optional
from src.data.preprocess.example import Example
_DEFAULT_STATS_BOUNDARIES = {
"Python": {"max_line_len": (37, 741), "content_len": (111, 42476)},
"Java": {"max_line_len": (56, ... | [
"os.path.exists",
"re.compile",
"random.Random",
"os.path.join",
"os.path.isfile",
"collections.defaultdict",
"os.path.basename",
"json.load",
"re.search"
] | [((447, 505), 're.compile', 're.compile', (['"""auto[- ]?generated file"""'], {'flags': 're.IGNORECASE'}), "('auto[- ]?generated file', flags=re.IGNORECASE)\n", (457, 505), False, 'import re\n'), ((845, 871), 'random.Random', 'random.Random', (['random_seed'], {}), '(random_seed)\n', (858, 871), False, 'import random\n... |
#!/usr/bin/python
# encoding: utf-8
from __future__ import print_function, unicode_literals, absolute_import
import functools
import re
import sys
from textwrap import wrap
from urllib import quote_plus
from algoliasearch.search_client import SearchClient
from config import Config
from workflow import Workflow3, ICO... | [
"workflow.Workflow3",
"algoliasearch.search_client.SearchClient.create",
"functools.partial",
"textwrap.wrap",
"re.sub"
] | [((354, 432), 'algoliasearch.search_client.SearchClient.create', 'SearchClient.create', (['Config.ALGOLIA_APP_ID', 'Config.ALGOLIA_SEARCH_ONLY_API_KEY'], {}), '(Config.ALGOLIA_APP_ID, Config.ALGOLIA_SEARCH_ONLY_API_KEY)\n', (373, 432), False, 'from algoliasearch.search_client import SearchClient\n'), ((685, 718), 're.s... |
import glob,os,sys
class Path():
'''
>>> paths = Path(source,"*.txt")
>>> for path in paths:
lines = Stream(path)
for line in lines:
print(line)
'''
def __init__(self, source, pattern):
self.source = source
self.pattern = pattern ... | [
"os.path.join",
"glob.glob"
] | [((373, 412), 'os.path.join', 'os.path.join', (['self.source', 'self.pattern'], {}), '(self.source, self.pattern)\n', (385, 412), False, 'import glob, os, sys\n'), ((438, 455), 'glob.glob', 'glob.glob', (['source'], {}), '(source)\n', (447, 455), False, 'import glob, os, sys\n'), ((505, 535), 'os.path.join', 'os.path.j... |
import requests
from opbank.opbank_client import OPBankClient
def test_opbank():
requests.delete("http://localhost:8888/admin/storage")
client = OPBankClient()
client.API_URL = 'http://localhost:8000/https://sandbox.apis.op-palvelut.fi/'
payer_iban = 'FI3959986920207073'
receiver_iban = 'FI2350... | [
"opbank.opbank_client.OPBankClient",
"requests.delete"
] | [((88, 142), 'requests.delete', 'requests.delete', (['"""http://localhost:8888/admin/storage"""'], {}), "('http://localhost:8888/admin/storage')\n", (103, 142), False, 'import requests\n'), ((157, 171), 'opbank.opbank_client.OPBankClient', 'OPBankClient', ([], {}), '()\n', (169, 171), False, 'from opbank.opbank_client ... |
import pytest
from ctrlibrary.core.utils import get_observables
from ctrlibrary.threatresponse.enrich import enrich_refer_observables
from tests.functional.tests.constants import (
MODULE_NAME,
PULSEDIVE_URL,
OBSERVABLE_HUMAN_READABLE_NAME
)
from urllib.parse import quote
@pytest.mark.parametrize(
'ob... | [
"pytest.mark.parametrize",
"ctrlibrary.threatresponse.enrich.enrich_refer_observables",
"ctrlibrary.core.utils.get_observables",
"urllib.parse.quote"
] | [((288, 483), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""observable,observable_type"""', "(('1.1.1.1', 'ip'), ('brehmen.com', 'domain'), ('2a01:238:20a:202:1159::',\n 'ipv6'), ('http://juanthradio.com/Script/DOC/', 'url'))"], {}), "('observable,observable_type', (('1.1.1.1', 'ip'), (\n 'brehmen.c... |
import pygame
import constants
from player import *
from scene import *
from level01 import *
from level03 import *
from level02 import *
from customscene import *
import titlescene
class GameScene(Scene):
scr_w = constants.SCREENWIDTH
scr_h = constants.SCREENHEIGHT
def __init__(self, levelno):
sup... | [
"pygame.mixer.init",
"pygame.sprite.Group",
"titlescene.TitleScene",
"pygame.mixer.music.load",
"pygame.mixer.music.play"
] | [((845, 866), 'pygame.sprite.Group', 'pygame.sprite.Group', ([], {}), '()\n', (864, 866), False, 'import pygame\n'), ((923, 942), 'pygame.mixer.init', 'pygame.mixer.init', ([], {}), '()\n', (940, 942), False, 'import pygame\n'), ((964, 1011), 'pygame.mixer.music.load', 'pygame.mixer.music.load', (['"""music/jumpandrun.... |
"""Exceptions Table
Revision ID: 6245d75fa12
Revises: <PASSWORD>
Create Date: 2016-08-16 11:35:38.575026
"""
# revision identifiers, used by Alembic.
revision = '6245d75fa12'
down_revision = 'e0a6af364a3f'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - p... | [
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.DateTime",
"alembic.op.drop_table",
"sqlalchemy.Text",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Integer",
"sqlalchemy.String",
"alembic.op.drop_index",
"sqlalchemy.BigInteger",
"alembic.op.create_index"
] | [((1239, 1330), 'alembic.op.create_index', 'op.create_index', (['"""ix_exceptions_account_id"""', '"""exceptions"""', "['account_id']"], {'unique': '(False)'}), "('ix_exceptions_account_id', 'exceptions', ['account_id'],\n unique=False)\n", (1254, 1330), False, 'from alembic import op\n'), ((1331, 1417), 'alembic.op... |
from __future__ import division
from __future__ import print_function
import numpy as np
import copy
from scipy import stats
class QuantizeLayer:
def __init__(self, name="None", num_bin=2001):
self.name = name
self.min = 0.0
self.max = 0.0
self.edge = 0.0
self.num_bins = nu... | [
"numpy.histogram",
"scipy.stats.entropy",
"copy.deepcopy",
"matplotlib.pyplot.plot",
"numpy.max",
"numpy.array",
"numpy.zeros",
"scipy.stats.wasserstein_distance",
"numpy.min",
"numpy.argmin",
"numpy.random.randn",
"matplotlib.pyplot.show"
] | [((11155, 11177), 'numpy.random.randn', 'np.random.randn', (['(10000)'], {}), '(10000)\n', (11170, 11177), True, 'import numpy as np\n'), ((11703, 11725), 'numpy.random.randn', 'np.random.randn', (['(10000)'], {}), '(10000)\n', (11718, 11725), True, 'import numpy as np\n'), ((11990, 12023), 'matplotlib.pyplot.plot', 'p... |
import keras
import pandas as pd
import urllib2
from bs4 import BeautifulSoup
from pprint import pprint
from matplotlib import pyplot as plt
import sys
sys.path.append('/Users/BenJohnson/projects/what-is-this/wit/')
from wit import *
pd.set_option('display.max_rows', 50)
pd.set_option('display.max_columns', 500)
pd.... | [
"pandas.crosstab",
"pandas.set_option",
"bs4.BeautifulSoup",
"matplotlib.pyplot.scatter",
"pandas.HDFStore",
"sys.path.append",
"sklearn.cluster.DBSCAN",
"matplotlib.pyplot.show"
] | [((154, 217), 'sys.path.append', 'sys.path.append', (['"""/Users/BenJohnson/projects/what-is-this/wit/"""'], {}), "('/Users/BenJohnson/projects/what-is-this/wit/')\n", (169, 217), False, 'import sys\n'), ((237, 274), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(50)'], {}), "('display.max_rows', 5... |
#!/usr/bin/env python3
import cereal.messaging as messaging
import os
import datetime
import signal
import threading
from common.realtime import Ratekeeper
# customisable values
GPX_LOG_PATH = '/data/media/0/gpx_logs/'
LOG_HERTZ = 10 # 10 hz = 0.1 sec, higher for higher accuracy, 10hz seems fine
LOG_LENGTH = 10 # mins... | [
"datetime.datetime.utcfromtimestamp",
"os.path.exists",
"signal.signal",
"os.makedirs",
"datetime.datetime.utcnow",
"cereal.messaging.SubMaster",
"threading.Event",
"common.realtime.Ratekeeper"
] | [((713, 730), 'threading.Event', 'threading.Event', ([], {}), '()\n', (728, 730), False, 'import threading\n'), ((3531, 3580), 'common.realtime.Ratekeeper', 'Ratekeeper', (['LOG_HERTZ'], {'print_delay_threshold': 'None'}), '(LOG_HERTZ, print_delay_threshold=None)\n', (3541, 3580), False, 'from common.realtime import Ra... |
"""Gamma distribution."""
import numpy
from scipy import special
from ..baseclass import Dist
from ..operators.addition import Add
class gamma(Dist):
def __init__(self, a=1):
Dist.__init__(self, a=a)
def _pdf(self, x, a):
return x**(a-1)*numpy.e**(-x) / special.gamma(a)
def _cdf(self, ... | [
"scipy.special.gamma",
"scipy.special.gammainc",
"scipy.special.gammaincinv"
] | [((342, 364), 'scipy.special.gammainc', 'special.gammainc', (['a', 'x'], {}), '(a, x)\n', (358, 364), False, 'from scipy import special\n'), ((407, 432), 'scipy.special.gammaincinv', 'special.gammaincinv', (['a', 'q'], {}), '(a, q)\n', (426, 432), False, 'from scipy import special\n'), ((283, 299), 'scipy.special.gamma... |
import numpy as np
import torch
from scipy.stats import truncnorm
from pymoo.factory import get_sampling, get_crossover, get_mutation
from pymoo.operators.mixed_variable_operator import MixedVariableSampling, MixedVariableMutation, MixedVariableCrossover
from pymoo.model.sampling import Sampling
class TruncatedNormal... | [
"numpy.random.normal",
"numpy.random.random",
"pymoo.factory.get_mutation",
"pymoo.factory.get_sampling",
"pymoo.factory.get_crossover",
"scipy.stats.truncnorm.rvs"
] | [((851, 919), 'numpy.random.normal', 'np.random.normal', (['self.mu', 'self.std'], {'size': '(n_samples, problem.n_var)'}), '(self.mu, self.std, size=(n_samples, problem.n_var))\n', (867, 919), True, 'import numpy as np\n'), ((1109, 1153), 'numpy.random.random', 'np.random.random', (['(n_samples, problem.n_var)'], {}),... |
class UserModel(Table):
def __init__(self):
self.tableName = "User"
self.requiredFields = ['firstName', 'lastName', 'username', 'password']
self.optionalFields = ['email']
def check(self, data):
for req in self.requiredFields:
if req not in data:
return False
for opt in self.optionalFields:
if o... | [
"bcrypt.gensalt"
] | [((816, 832), 'bcrypt.gensalt', 'bcrypt.gensalt', ([], {}), '()\n', (830, 832), False, 'import bcrypt\n')] |
import config as cfg
import cv2
import numpy as np
from keras.models import load_model
from keras.preprocessing.image import img_to_array
from keras import backend as K
import tensorflow as tf
import keras
'''
esto es necesario para que no haya errores a la hora de exponer el servicio con flask
info --> https://github... | [
"keras.preprocessing.image.img_to_array",
"keras.models.load_model",
"tensorflow.Session",
"keras.backend.set_session",
"numpy.expand_dims",
"cv2.cvtColor",
"cv2.resize",
"tensorflow.get_default_graph"
] | [((432, 444), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (442, 444), True, 'import tensorflow as tf\n'), ((453, 475), 'tensorflow.get_default_graph', 'tf.get_default_graph', ([], {}), '()\n', (473, 475), True, 'import tensorflow as tf\n'), ((477, 494), 'keras.backend.set_session', 'set_session', (['sess'], {... |
# Generated by Django 2.2.1 on 2020-03-10 18:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gui', '0013_auto_20200310_1742'),
]
operations = [
migrations.AddField(
model_name='feedback',
name='childprotection... | [
"django.db.models.TextField"
] | [((341, 441), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'max_length': '(1000)', 'verbose_name': '"""Kinderschutzrelevante Information"""'}), "(blank=True, max_length=1000, verbose_name=\n 'Kinderschutzrelevante Information')\n", (357, 441), False, 'from django.db import migrations, m... |
# Copyright 2008-2009 <NAME>
#
# This file is part of Reinteract and distributed under the terms
# of the BSD license. See the file COPYING in the Reinteract
# distribution for full details.
#
########################################################################
import gtk
import os
from base_notebook_window impor... | [
"gtk.ScrolledWindow",
"file_list.FileList",
"gtk.rc_parse_string",
"base_notebook_window.BaseNotebookWindow._add_editor",
"gtk.HBox",
"gtk.MessageDialog",
"base_notebook_window.BaseNotebookWindow.__init__",
"os.remove",
"base_notebook_window.BaseNotebookWindow._update_editor_state",
"base_notebook... | [((515, 800), 'gtk.rc_parse_string', 'gtk.rc_parse_string', (['"""\n style "notebook-close-button" {\n GtkWidget::focus-line-width = 0\n GtkWidget::focus-padding = 0\n GtkButton::inner-border = { 0, 0, 0, 0 }\n }\n widget "*.notebook-close-button" style : highest "notebook-close-button"\n ... |
from dps.hyper import run_experiment
from dps.utils import copy_update
from dps.tf.updater import DummyUpdater
from silot.run import basic_config, alg_configs, env_configs
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--max-digits', type=int, choices=[6, 12], required=True)
args, _ = parser.p... | [
"silot.run.basic_config.copy",
"dps.hyper.run_experiment",
"dps.utils.copy_update",
"argparse.ArgumentParser"
] | [((198, 223), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (221, 223), False, 'import argparse\n'), ((1244, 1263), 'silot.run.basic_config.copy', 'basic_config.copy', ([], {}), '()\n', (1261, 1263), False, 'from silot.run import basic_config, alg_configs, env_configs\n'), ((1440, 1564), 'dps.... |
from django.contrib.auth import get_user_model
from rest_framework import viewsets, status, permissions
from rest_framework.response import Response
from profiles.models import Profile
from profiles.permissions import IsUserProfileOrAdmin
from profiles import serializers
User = get_user_model()
class ProfileViewSe... | [
"profiles.serializers.ProfileSerializer",
"django.contrib.auth.get_user_model",
"rest_framework.response.Response",
"profiles.models.Profile.objects.all"
] | [((282, 298), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (296, 298), False, 'from django.contrib.auth import get_user_model\n'), ((361, 382), 'profiles.models.Profile.objects.all', 'Profile.objects.all', ([], {}), '()\n', (380, 382), False, 'from profiles.models import Profile\n'), ((739,... |
import rclpy
import json,numpy
from numpy import clip
from rclpy.node import Node
from std_msgs.msg import Float64MultiArray
from sensor_msgs.msg import JointState
from diagnostic_msgs.msg import DiagnosticStatus, KeyValue
import can
from tinymovr import Tinymovr
from tinymovr.iface.can import CAN
from tinymovr.units... | [
"diagnostic_msgs.msg.KeyValue",
"numpy.clip",
"tinymovr.units.get_registry",
"rclpy.spin",
"diagnostic_msgs.msg.DiagnosticStatus",
"sensor_msgs.msg.JointState",
"can.Bus",
"numpy.isnan",
"json.load",
"rclpy.init",
"rclpy.shutdown",
"tinymovr.iface.can.CAN"
] | [((370, 384), 'tinymovr.units.get_registry', 'get_registry', ([], {}), '()\n', (382, 384), False, 'from tinymovr.units import get_registry\n'), ((5874, 5895), 'rclpy.init', 'rclpy.init', ([], {'args': 'args'}), '(args=args)\n', (5884, 5895), False, 'import rclpy\n'), ((6223, 6239), 'rclpy.shutdown', 'rclpy.shutdown', (... |
import socket
HOST = ""
PORT = ""
def address():
global HOST
print("What is the IP of the computer you want to connect to? ")
HOST = input(":")
global PORT
print("What is the PORT of the computer you want to connect to? ")
PORT = int(input(":"))
connector()
def connector():
... | [
"socket.socket"
] | [((330, 379), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (343, 379), False, 'import socket\n')] |
import re
import _pickle as cPickle
import logging
import argparse
#This script is not dependant on table of contents. It detects books and chapters based their titles
# Dictionary containing key and regex pattern to match the keys
pattern_dict = {
'blank_line': re.compile(r'^\s*$'),
'book_number': re.compile... | [
"logging.basicConfig",
"re.split",
"argparse.ArgumentParser",
"_pickle.dump",
"re.compile",
"re.findall",
"logging.error"
] | [((9074, 9167), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(asctime)s:%(levelname)s:%(message)s"""'}), "(level=logging.DEBUG, format=\n '%(asctime)s:%(levelname)s:%(message)s')\n", (9093, 9167), False, 'import logging\n'), ((269, 289), 're.compile', 're.compile', (['... |
from __future__ import print_function
from fileinput import filename
import os
import pandas as pd
import pdb
from datetime import timedelta
import datetime
import shutil
date_time_format = '%Y-%m-%dT%H:%M:%S.%f'
date_format = '%Y-%m-%d'
def make_dir(data_path):
if os.path.exists(data_path) is False:
os... | [
"os.path.exists",
"os.listdir",
"os.path.join",
"os.mkdir",
"shutil.copy",
"datetime.timedelta",
"pandas.to_datetime"
] | [((274, 299), 'os.path.exists', 'os.path.exists', (['data_path'], {}), '(data_path)\n', (288, 299), False, 'import os\n'), ((318, 337), 'os.mkdir', 'os.mkdir', (['data_path'], {}), '(data_path)\n', (326, 337), False, 'import os\n'), ((1210, 1249), 'os.path.join', 'os.path.join', (['root_dir', '"""delivery_data"""'], {}... |
from util_data_storage_and_load import *
import openpyxl
data_folder = '/home/jzh/Dropbox/Research/\
Data-driven_estimation_inverse_optimization/INRIX/Raw_data/'
########## extract tmc info for link_1
# load attribute table link_1 data
wb_link_1 = openpyxl.load_workbook(data_folder + 'filtered_INRIX_attribute_table... | [
"openpyxl.load_workbook"
] | [((252, 338), 'openpyxl.load_workbook', 'openpyxl.load_workbook', (["(data_folder + 'filtered_INRIX_attribute_table_link_1.xlsx')"], {}), "(data_folder +\n 'filtered_INRIX_attribute_table_link_1.xlsx')\n", (274, 338), False, 'import openpyxl\n'), ((778, 864), 'openpyxl.load_workbook', 'openpyxl.load_workbook', (["(d... |
#!/usr/bin/python
from __future__ import print_function
from __future__ import absolute_import
from past.builtins import basestring
import sys
import numpy as np
import moby2
trace = moby2.util.log.logger.trace
# transitional...
_fp_formats = {
'det_uid': '%4d',
'ok': '%1d',
'x0': '%9.6f',
'x0_err':... | [
"pylab.title",
"pylab.scatter",
"numpy.log10",
"pylab.subplots_adjust",
"moby2.scripting.get_depot",
"pylab.MaxNLocator",
"pylab.savefig",
"pylab.xlabel",
"moby2.scripting.execcfg.InputChooser",
"numpy.array",
"numpy.sin",
"moby2.util.StructDB.from_column_file",
"pylab.gca",
"numpy.arange"... | [((1905, 1935), 'numpy.loadtxt', 'np.loadtxt', (['filename'], {'unpack': '(1)'}), '(filename, unpack=1)\n', (1915, 1935), True, 'import numpy as np\n'), ((3620, 3676), 'moby2.util.StructDB.from_data', 'moby2.util.StructDB.from_data', (['data'], {'formats': '_fp_formats'}), '(data, formats=_fp_formats)\n', (3649, 3676),... |
from numpy.random import seed
seed(5393)
from tensorflow import set_random_seed
set_random_seed(12011)
import os
import numpy as np
import pandas as pd
from scipy import sparse
from sklearn.preprocessing import LabelEncoder, LabelBinarizer
from sklearn.pipeline import FeatureUnion
from sklearn.feature_extraction.te... | [
"logging.basicConfig",
"pandas.read_pickle",
"sklearn.preprocessing.LabelEncoder",
"sklearn.preprocessing.LabelBinarizer",
"scipy.sparse.vstack",
"os.makedirs",
"sklearn.model_selection.train_test_split",
"sklearn.feature_extraction.text.CountVectorizer",
"scipy.sparse.issparse",
"sklearn.model_se... | [((30, 40), 'numpy.random.seed', 'seed', (['(5393)'], {}), '(5393)\n', (34, 40), False, 'from numpy.random import seed\n'), ((80, 102), 'tensorflow.set_random_seed', 'set_random_seed', (['(12011)'], {}), '(12011)\n', (95, 102), False, 'from tensorflow import set_random_seed\n'), ((509, 548), 'logging.basicConfig', 'log... |
#!/usr/bin/python3
# author mhakala
import json
import re
import subprocess
import tempfile
import os
import xml.etree.cElementTree as ET
import argparse
import os.path
import time
import random
from datetime import datetime
from datetime import timedelta
import traceback
import configparser
import glob
def jobs_runn... | [
"subprocess.check_output",
"traceback.format_exc",
"os.uname",
"argparse.ArgumentParser",
"xml.etree.cElementTree.fromstring",
"json.dump",
"os.remove",
"datetime.datetime.now",
"os.path.isdir",
"datetime.timedelta",
"time.time",
"random.randint",
"glob.glob",
"re.search"
] | [((1741, 1762), 'xml.etree.cElementTree.fromstring', 'ET.fromstring', (['output'], {}), '(output)\n', (1754, 1762), True, 'import xml.etree.cElementTree as ET\n'), ((3161, 3191), 'glob.glob', 'glob.glob', (["(dir_name + '*.json')"], {}), "(dir_name + '*.json')\n", (3170, 3191), False, 'import glob\n'), ((3867, 3886), '... |
""" 参考自https://github.com/bojone/crf/ """
import tensorflow as tf
k = tf.keras
kl = tf.keras.layers
K = tf.keras.backend
from sklearn.model_selection import train_test_split
import numpy as np
import re
from tqdm import tqdm
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
class CRF(kl.L... | [
"re.split",
"tensorflow.keras.utils.to_categorical",
"matplotlib.pyplot.show",
"tensorflow.config.experimental.set_memory_growth",
"sklearn.model_selection.train_test_split",
"numpy.array",
"tensorflow.config.experimental.list_physical_devices",
"tensorflow.math.reduce_logsumexp",
"matplotlib.pyplot... | [((7282, 7333), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (7326, 7333), True, 'import tensorflow as tf\n'), ((7416, 7483), 'tensorflow.config.experimental.set_memory_growth', 'tf.config.experimental.set_memory_growth', (['ph... |
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
from selenium import webdriver
import requests
def login():
driver = webdriver.Chrome()
driver.implicitly_wait(20)
driver.get("https://tixc... | [
"requests.Session",
"selenium.webdriver.Chrome",
"selenium.webdriver.support.wait.WebDriverWait",
"selenium.webdriver.support.expected_conditions.alert_is_present",
"selenium.webdriver.support.expected_conditions.visibility_of_element_located"
] | [((242, 260), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {}), '()\n', (258, 260), False, 'from selenium import webdriver\n'), ((972, 990), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {}), '()\n', (988, 990), False, 'from selenium import webdriver\n'), ((1252, 1270), 'requests.Session', 'requests.Se... |
from rest_framework.views import APIView
from rest_framework.response import Response
from auth_API.helpers import get_or_create_user_information
class CheckConnection(APIView):
def post(self, request, format=None):
# --> 1. Get connection status and id
user_info = get_or_create_user_informatio... | [
"auth_API.helpers.get_or_create_user_information",
"rest_framework.response.Response"
] | [((291, 360), 'auth_API.helpers.get_or_create_user_information', 'get_or_create_user_information', (['request.session', 'request.user', '"""EOSS"""'], {}), "(request.session, request.user, 'EOSS')\n", (321, 360), False, 'from auth_API.helpers import get_or_create_user_information\n'), ((582, 640), 'rest_framework.respo... |
from models.statistical.ml_classifier import MLClassifier
from models.statistical.models import ModelsFactory
from models.statistical.tokenizer import TokenizerFactory
# can be loaded from a config file
model_name = 'xgb'
tokenizer_name = 'default'
ngrams = 2
name = 'sst2'
stopwords = False
max_features = 5000
test_... | [
"models.statistical.ml_classifier.MLClassifier",
"models.statistical.models.ModelsFactory.from_name",
"models.statistical.tokenizer.TokenizerFactory.from_name",
"pandas.read_csv"
] | [((340, 375), 'models.statistical.models.ModelsFactory.from_name', 'ModelsFactory.from_name', (['model_name'], {}), '(model_name)\n', (363, 375), False, 'from models.statistical.models import ModelsFactory\n'), ((402, 444), 'models.statistical.tokenizer.TokenizerFactory.from_name', 'TokenizerFactory.from_name', (['toke... |
from app.main import create_app
from waitress import serve
if __name__ == "__main__":
app = create_app()
serve(app, host='0.0.0.0', port='5000')
| [
"waitress.serve",
"app.main.create_app"
] | [((98, 110), 'app.main.create_app', 'create_app', ([], {}), '()\n', (108, 110), False, 'from app.main import create_app\n'), ((115, 154), 'waitress.serve', 'serve', (['app'], {'host': '"""0.0.0.0"""', 'port': '"""5000"""'}), "(app, host='0.0.0.0', port='5000')\n", (120, 154), False, 'from waitress import serve\n')] |
import martian
from martian.error import GrokError
from grokcore.component import name as namedirective
from zope import component
from bst.pygasus.datamanager.model import ExtBaseModel
from bst.pygasus.datamanager.interfaces import IModelTransformer
from bst.pygasus.datamanager.transformer import ModelTransfomerUtili... | [
"martian.component",
"zope.component.getGlobalSiteManager",
"bst.pygasus.datamanager.transformer.ModelTransfomerUtility",
"martian.directive",
"martian.error.GrokError"
] | [((479, 510), 'martian.component', 'martian.component', (['ExtBaseModel'], {}), '(ExtBaseModel)\n', (496, 510), False, 'import martian\n'), ((515, 540), 'martian.directive', 'martian.directive', (['schema'], {}), '(schema)\n', (532, 540), False, 'import martian\n'), ((545, 577), 'martian.directive', 'martian.directive'... |
#!/usr/bin/env python3
import logging
from os import getuid, getgid
from os.path import join
import docker
from .logger import log_from_docker
class DockerRsync(object):
def __init__(self, client=docker.from_env()):
self.client = client
def _run_rsync(self, volumes, from_path, to_path, relative):
... | [
"logging.warning",
"docker.from_env",
"os.path.join"
] | [((204, 221), 'docker.from_env', 'docker.from_env', ([], {}), '()\n', (219, 221), False, 'import docker\n'), ((2741, 2764), 'os.path.join', 'join', (['"""/"""', 'local_volume'], {}), "('/', local_volume)\n", (2745, 2764), False, 'from os.path import join\n'), ((3450, 3473), 'os.path.join', 'join', (['"""/"""', 'local_v... |
#!/usr/bin/env python
import collections
import re
def write_constants(out, lua_version):
out.write("EMSCRIPTEN_KEEPALIVE\n")
out.write("emlua_constant emlua_constants[] = {\n")
with open("lists/lua5{}/constants".format(lua_version)) as constants_file:
for line in constants_file:
c... | [
"re.match"
] | [((1221, 1278), 're.match', 're.match', (['"""^(.*\\\\W)(\\\\w+)\\\\s*\\\\((.*)\\\\);$"""', 'function_line'], {}), "('^(.*\\\\W)(\\\\w+)\\\\s*\\\\((.*)\\\\);$', function_line)\n", (1229, 1278), False, 'import re\n'), ((1799, 1837), 're.match', 're.match', (['"""^(.*\\\\W)(\\\\w+)$"""', 'typed_arg'], {}), "('^(.*\\\\W)(... |
import pytest
from django.urls import reverse
from tests.users import factories as users_factories
@pytest.mark.django_db
class TestTicketCreateView:
def test_get(self,client):
url = reverse('support:support-contact')
response = client.get(url)
assert response.status_code == 200
def ... | [
"tests.users.factories.StudentFactory",
"django.urls.reverse"
] | [((198, 232), 'django.urls.reverse', 'reverse', (['"""support:support-contact"""'], {}), "('support:support-contact')\n", (205, 232), False, 'from django.urls import reverse\n'), ((358, 392), 'django.urls.reverse', 'reverse', (['"""support:support-contact"""'], {}), "('support:support-contact')\n", (365, 392), False, '... |
"""Tests for handling the users resource"""
import unittest
import json
from app import create_app
from app.API.utilities.database import connection
class UserTestCase(unittest.TestCase):
"""Unit testiing for the user regsitration endpoint"""
def setUp(self):
"""Initialize the app and database connect... | [
"json.dumps",
"app.create_app",
"app.API.utilities.database.connection.initializedb",
"app.API.utilities.database.connection.dbconnection",
"app.API.utilities.database.connection.drop_tables"
] | [((347, 380), 'app.create_app', 'create_app', ([], {'config_name': '"""testing"""'}), "(config_name='testing')\n", (357, 380), False, 'from app import create_app\n'), ((1525, 1550), 'app.API.utilities.database.connection.initializedb', 'connection.initializedb', ([], {}), '()\n', (1548, 1550), False, 'from app.API.util... |
import numpy as np
import torch
import torch.nn as nn
from collections import OrderedDict
def tf2th(conv_weights):
"""Possibly convert HWIO to OIHW."""
if conv_weights.ndim == 4:
conv_weights = conv_weights.transpose([3, 2, 0, 1])
return torch.from_numpy(conv_weights)
def _rename_... | [
"collections.OrderedDict",
"re.match",
"torch.sqrt",
"torch.from_numpy",
"torch.var_mean",
"numpy.load"
] | [((272, 302), 'torch.from_numpy', 'torch.from_numpy', (['conv_weights'], {}), '(conv_weights)\n', (288, 302), False, 'import torch\n'), ((1609, 1622), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1620, 1622), False, 'from collections import OrderedDict\n'), ((1638, 1648), 'numpy.load', 'np.load', (['f']... |
import unittest
from convert import jboss_command_to_http_request
class TestJBOSSCommandToHTTPGETRequestOperationOnlyTestCase(unittest.TestCase):
"""Test case for JBOSS CLI commands operation only commands using HTTP GET"""
def test_no_path_one_operations_no_params_http_get(self):
"""See if we only o... | [
"unittest.main",
"convert.jboss_command_to_http_request"
] | [((10959, 10974), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10972, 10974), False, 'import unittest\n'), ((489, 536), 'convert.jboss_command_to_http_request', 'jboss_command_to_http_request', (['test_data', '"""GET"""'], {}), "(test_data, 'GET')\n", (518, 536), False, 'from convert import jboss_command_to_htt... |
from sc2.ids.effect_id import EffectId
from sc2.position import Point2
from sc2.units import Units
from sharpy.managers.combat2 import MicroStep, Action, MoveType
from sc2 import AbilityId
from sc2.unit import Unit
class MicroVoidrays(MicroStep):
def should_retreat(self, unit: Unit) -> bool:
if unit.shiel... | [
"sharpy.managers.combat2.Action",
"sc2.position.Point2.center"
] | [((2070, 2088), 'sharpy.managers.combat2.Action', 'Action', (['pos', '(False)'], {}), '(pos, False)\n', (2076, 2088), False, 'from sharpy.managers.combat2 import MicroStep, Action, MoveType\n'), ((1848, 1911), 'sharpy.managers.combat2.Action', 'Action', (['None', '(False)', 'AbilityId.EFFECT_VOIDRAYPRISMATICALIGNMENT']... |
#
# Copyright (c) 2019 EXXETA AG and others.
#
# This file is part of k8s-python-tools
# (see https://github.com/EXXETA/k8s-python-tools).
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information... | [
"os.path.join",
"yaml.load",
"os.getcwd",
"os.path.dirname",
"re.sub"
] | [((1431, 1459), 'yaml.load', 'load', (['text_io'], {'Loader': 'Loader'}), '(text_io, Loader=Loader)\n', (1435, 1459), False, 'from yaml import CLoader as Loader, CDumper as Dumper, load\n'), ((1184, 1195), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1193, 1195), False, 'import os\n'), ((1197, 1222), 'os.path.dirname',... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""WCS related utility functions."""
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
from astropy.wcs import WCS
from astropy.coordinates import Angle
__all__ = [
'linear_wcs_to_arrays',
'linea... | [
"numpy.abs",
"astropy.wcs.WCS",
"numpy.arange",
"astropy.coordinates.Angle"
] | [((2472, 2494), 'astropy.coordinates.Angle', 'Angle', (['delta_x', 'unit_x'], {}), '(delta_x, unit_x)\n', (2477, 2494), False, 'from astropy.coordinates import Angle\n'), ((2509, 2531), 'astropy.coordinates.Angle', 'Angle', (['delta_y', 'unit_y'], {}), '(delta_y, unit_y)\n', (2514, 2531), False, 'from astropy.coordinat... |
import yaml
from merceedge.exceptions import MerceEdgeError
from merceedge.settings import (
logger_access,
logger_code,
logger_console
)
_LOGGER = logger_code
def load_yaml(fname):
"""Load a YAML file."""
try:
with open(fname, encoding='utf-8') as conf_file:
# If configuratio... | [
"merceedge.exceptions.MerceEdgeError",
"yaml.safe_load",
"yaml.dump"
] | [((599, 620), 'merceedge.exceptions.MerceEdgeError', 'MerceEdgeError', (['error'], {}), '(error)\n', (613, 620), False, 'from merceedge.exceptions import MerceEdgeError\n'), ((776, 831), 'yaml.dump', 'yaml.dump', (['yaml_dict', 'outfile'], {'default_flow_style': '(False)'}), '(yaml_dict, outfile, default_flow_style=Fal... |
import random
import hashlib
import requests
from cctrans import conf
import cctrans
def _sign(app_key, secret_key, text):
salt = random.randint(32768, 65536)
sign = app_key + text + str(salt) + secret_key
return hashlib.md5(sign.encode('utf8')).hexdigest(), salt
def _request_data(url, app_key, text, s... | [
"random.randint",
"requests.get"
] | [((137, 165), 'random.randint', 'random.randint', (['(32768)', '(65536)'], {}), '(32768, 65536)\n', (151, 165), False, 'import random\n'), ((979, 997), 'requests.get', 'requests.get', (['data'], {}), '(data)\n', (991, 997), False, 'import requests\n')] |
import os
import sys
from time import sleep
from typing import Optional
from joint_teapot.utils.logger import logger
current_path = sys.path[0]
sys.path.remove(current_path)
from git import Repo
from git.exc import GitCommandError
sys.path.insert(0, current_path)
from joint_teapot.config import settings
class Git... | [
"os.path.exists",
"joint_teapot.utils.logger.logger.warning",
"sys.path.insert",
"git.Repo.clone_from",
"os.path.join",
"git.Repo",
"time.sleep",
"sys.path.remove",
"os.path.isdir",
"joint_teapot.utils.logger.logger.error",
"joint_teapot.utils.logger.logger.info",
"joint_teapot.utils.logger.lo... | [((146, 175), 'sys.path.remove', 'sys.path.remove', (['current_path'], {}), '(current_path)\n', (161, 175), False, 'import sys\n'), ((234, 266), 'sys.path.insert', 'sys.path.insert', (['(0)', 'current_path'], {}), '(0, current_path)\n', (249, 266), False, 'import sys\n'), ((649, 680), 'joint_teapot.utils.logger.logger.... |
from .watch_time import time_str
import fitlog
class Logger:
def __init__(self , fil_path = None):
self.log_fil = open(fil_path , "w" , encoding = "utf-8")
def nolog(self , cont = ""):
pass
def log_print(self , cont = ""):
self.log_fil.write(cont + "\n")
self.log_fil.flush()
print (cont)
fitlog.add_t... | [
"fitlog.add_to_line"
] | [((308, 332), 'fitlog.add_to_line', 'fitlog.add_to_line', (['cont'], {}), '(cont)\n', (326, 332), False, 'import fitlog\n')] |
import cv2
import numpy as np
import os
under_layer_path = '/home/ubuntu/share/cam_lidar/Tu_indoor/red2'
upper_layer_path = "/home/ubuntu/share/cam_lidar/Tu_indoor/aisle02_dir"
target_files = os.listdir(upper_layer_path)
target_imgs = [f for f in target_files if os.path.isfile(os.path.join(upper_layer_path, f))]
try:
... | [
"cv2.imwrite",
"os.listdir",
"cv2.inRange",
"cv2.bitwise_and",
"os.path.join",
"numpy.array",
"numpy.zeros",
"cv2.bitwise_not",
"cv2.add"
] | [((193, 221), 'os.listdir', 'os.listdir', (['upper_layer_path'], {}), '(upper_layer_path)\n', (203, 221), False, 'import os\n'), ((393, 414), 'numpy.array', 'np.array', (['[0, 0, 128]'], {}), '([0, 0, 128])\n', (401, 414), True, 'import numpy as np\n'), ((423, 444), 'numpy.array', 'np.array', (['[0, 0, 128]'], {}), '([... |
''' Events Model '''
import uuid
from django.db import models
# Utils Model
from eventup.utils.models import GeneralModel
class Event(GeneralModel):
''' Event Model '''
# Id
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
# Event data
name = models.CharField(max_leng... | [
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.ImageField",
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.models.URLField",
"django.db.models.UUIDField"
] | [((195, 265), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'primary_key': '(True)', 'default': 'uuid.uuid4', 'editable': '(False)'}), '(primary_key=True, default=uuid.uuid4, editable=False)\n', (211, 265), False, 'from django.db import models\n'), ((295, 340), 'django.db.models.CharField', 'models.CharField'... |
#! /usr/bin/env python
import django
from django.conf import settings
django.setup()
from geocamTiePoint.models import Overlay
def moveCenterPtOutOfExtras():
overlays = Overlay.objects.all()
for overlay in overlays:
overlay.centerLat = overlay.extras.centerLat
overlay.centerLon = overlay.extr... | [
"django.setup",
"geocamTiePoint.models.Overlay.objects.all"
] | [((70, 84), 'django.setup', 'django.setup', ([], {}), '()\n', (82, 84), False, 'import django\n'), ((176, 197), 'geocamTiePoint.models.Overlay.objects.all', 'Overlay.objects.all', ([], {}), '()\n', (195, 197), False, 'from geocamTiePoint.models import Overlay\n')] |
#coding:utf-8
import threading
class Singleton(object):
def __new__(cls, *args, **kwargs):
lock = threading.Lock()
lock.acquire()
if not hasattr(cls, "_instance"):
cls._instance = object.__new__(cls)
cls._instance.__Singleton_Init__(*args, **kwargs)
lock.rele... | [
"threading.Lock"
] | [((111, 127), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (125, 127), False, 'import threading\n')] |
from generator.actions import Actions
import random
import string
import struct
import numpy as np
import math
import datetime as dt
import ctypes
def kaprica_mixin(self):
if hasattr(self, 'xlat_seed'):
return
def xlat_seed(seed):
def hash_string(seed):
H = 0x314abc86
f... | [
"random.choice",
"random.randint"
] | [((1945, 1965), 'random.randint', 'random.randint', (['(0)', '(4)'], {}), '(0, 4)\n', (1959, 1965), False, 'import random\n'), ((2141, 2175), 'random.randint', 'random.randint', (['min_size', 'max_size'], {}), '(min_size, max_size)\n', (2155, 2175), False, 'import random\n'), ((2403, 2439), 'random.randint', 'random.ra... |
# Kano or Terminator
# By <NAME>
# I will not be held responsible for:
# any shenanigans
import os
# ಠ_ಠ
# ¯¯\_(ツ)_/¯¯
# (╭ರ_•́)
os.system("printf '\e[0;35;1;1m (╭ರ_'")
os.system("printf '\e[0;31;1;5m°'")
os.system("printf '\e[0;35;1;1m)\n'")
| [
"os.system"
] | [((130, 177), 'os.system', 'os.system', (['"""printf \'\\\\e[0;35;1;1m (╭ರ_\'"""'], {}), '("printf \'\\\\e[0;35;1;1m (╭ರ_\'")\n', (139, 177), False, 'import os\n'), ((177, 213), 'os.system', 'os.system', (['"""printf \'\\\\e[0;31;1;5m°\'"""'], {}), '("printf \'\\\\e[0;31;1;5m°\'")\n', (186, 213), False, '... |
import os
import re
import urllib.request
import click
import requests
from tqdm import tqdm
URL_UPTODOWN = 'https://spotify.de.uptodown.com/android/download'
URL_GHAPI = 'https://api.github.com/repos/Theta-Dev/Spotify-Gender-Ex/commits/master'
URL_RTABLE = 'https://raw.githubusercontent.com/Theta-Dev/Spotify-Gender-... | [
"re.escape",
"requests.get",
"os.path.isfile",
"click.echo",
"re.search"
] | [((2637, 2664), 'os.path.isfile', 'os.path.isfile', (['output_path'], {}), '(output_path)\n', (2651, 2664), False, 'import os\n'), ((981, 1011), 're.search', 're.search', (['pattern_url', 'r.text'], {}), '(pattern_url, r.text)\n', (990, 1011), False, 'import re\n'), ((1037, 1071), 're.search', 're.search', (['pattern_v... |
# Intraday latency check function
from datetime import datetime
import pytz
from datacoco_batch.batch import Batch
from datacoco_core.logger import Logger
log = Logger()
def convert_time(t):
# convert naive datetime object to utc aware datetime
utc = pytz.utc
timetz = utc.localize(t)
return timetz
... | [
"datetime.datetime.strptime",
"datacoco_batch.batch.Batch",
"datacoco_core.logger.Logger",
"datetime.datetime.now"
] | [((164, 172), 'datacoco_core.logger.Logger', 'Logger', ([], {}), '()\n', (170, 172), False, 'from datacoco_core.logger import Logger\n'), ((473, 510), 'datacoco_batch.batch.Batch', 'Batch', (['wf', 'batchy_server', 'batchy_port'], {}), '(wf, batchy_server, batchy_port)\n', (478, 510), False, 'from datacoco_batch.batch ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import open3d as o3d
def downSample(pointcloud_file_path, down_sample_cluster_num, save_pointcloud_file_path):
print("[INFO][downSample]")
print("\t start down sampling pointcloud :")
print("\t down_sample_cluster_num = " + str(down_sample_cluster_num) + "..."... | [
"open3d.io.write_point_cloud",
"open3d.geometry.PointCloud.uniform_down_sample",
"open3d.io.read_point_cloud"
] | [((339, 405), 'open3d.io.read_point_cloud', 'o3d.io.read_point_cloud', (['pointcloud_file_path'], {'print_progress': '(True)'}), '(pointcloud_file_path, print_progress=True)\n', (362, 405), True, 'import open3d as o3d\n'), ((437, 522), 'open3d.geometry.PointCloud.uniform_down_sample', 'o3d.geometry.PointCloud.uniform_d... |
import asyncio
import pickle
from congregation.net.messages import *
class Handler:
def __init__(self, peer, server: [asyncio.Protocol, None] = None):
self.peer = peer
self.server = server
self.msg_handlers = self._define_msg_map()
def handle_msg(self, data):
"""
deter... | [
"pickle.loads"
] | [((459, 477), 'pickle.loads', 'pickle.loads', (['data'], {}), '(data)\n', (471, 477), False, 'import pickle\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Evaluators.
"""
# ----------------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------------
# Standard library modules
import importlib
import time
from datetime import date
... | [
"seaborn.set",
"matplotlib.pyplot.savefig",
"importlib.import_module",
"pandas.read_csv",
"pathlib.Path",
"seaborn.despine",
"matplotlib.ticker.FuncFormatter",
"seaborn.set_context",
"seaborn.set_style",
"matplotlib.pyplot.figure",
"pandas.DataFrame",
"datetime.date.today",
"aim.core.image_u... | [((2037, 2052), 'pathlib.Path', 'Path', (['input_dir'], {}), '(input_dir)\n', (2041, 2052), False, 'from pathlib import Path\n'), ((6512, 6538), 'pandas.DataFrame', 'pd.DataFrame', (['self.results'], {}), '(self.results)\n', (6524, 6538), True, 'import pandas as pd\n'), ((2249, 2265), 'pathlib.Path', 'Path', (['output_... |
# MIT License
#
# Copyright (c) 2018 k1dd00
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publi... | [
"BeautifulSoup.BeautifulSOAP",
"urllib2.urlopen"
] | [((1811, 1850), 'urllib2.urlopen', 'urllib2.urlopen', (['self.IP_CHECK_ENDPOINT'], {}), '(self.IP_CHECK_ENDPOINT)\n', (1826, 1850), False, 'import urllib2\n'), ((2175, 2194), 'BeautifulSoup.BeautifulSOAP', 'BeautifulSOAP', (['html'], {}), '(html)\n', (2188, 2194), False, 'from BeautifulSoup import BeautifulSOAP\n'), ((... |
import unittest
from models import FeedSet, Base, RSSContent
import config
import sqlalchemy
from sqlalchemy.orm import sessionmaker
from unittest.mock import MagicMock
from test_data.feedparser_data import fake_response
from helpers import RSSContentHelper, FeedSetHelper
class TestFeedSet(unittest.TestCase):
def ... | [
"sqlalchemy.orm.sessionmaker",
"models.FeedSet",
"sqlalchemy.create_engine",
"models.RSSContent",
"unittest.main",
"models.Base.metadata.drop_all",
"unittest.mock.patch",
"models.Base.metadata.create_all"
] | [((1645, 1723), 'unittest.mock.patch', 'unittest.mock.patch', (['"""feedparser.parse"""'], {'return_value': 'feedparser_fake_response'}), "('feedparser.parse', return_value=feedparser_fake_response)\n", (1664, 1723), False, 'import unittest\n'), ((2043, 2121), 'unittest.mock.patch', 'unittest.mock.patch', (['"""feedpar... |
## -*- coding: utf-8 -*-
"""
Created on Tue Sep 26 13:38:17 2017
@author: Administrator
"""
import dlib
import cv2
import numpy as np
from sklearn.externals import joblib
import os
import pathAttributes
#ap = argparse.ArgumentParser()
#ap.add_argument("-p", "--shape-predictor", metavar="D:\\用户目录\\下载\\sh... | [
"cv2.rectangle",
"dlib.face_recognition_model_v1",
"dlib.rectangle",
"sklearn.externals.joblib.load",
"dlib.shape_predictor",
"cv2.imshow",
"numpy.max",
"dlib.get_frontal_face_detector",
"numpy.array",
"cv2.putText",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.resize"... | [((1116, 1148), 'dlib.get_frontal_face_detector', 'dlib.get_frontal_face_detector', ([], {}), '()\n', (1146, 1148), False, 'import dlib\n'), ((1166, 1223), 'dlib.shape_predictor', 'dlib.shape_predictor', (['pathAttributes.face_detection_model'], {}), '(pathAttributes.face_detection_model)\n', (1186, 1223), False, 'impo... |
from gamegym.game import Game, Situation
from gamegym.utils import get_rng
from gamegym.distribution import Explicit
from gamegym.value_learning.valuestore import LinearValueStore
import numpy as np
import pytest
from scipy.sparse import csr_matrix
def test_init():
LinearValueStore(shape=(3, 3))
LinearValueSt... | [
"pytest.approx",
"numpy.ones",
"gamegym.value_learning.valuestore.LinearValueStore",
"numpy.array",
"numpy.zeros",
"pytest.raises"
] | [((272, 302), 'gamegym.value_learning.valuestore.LinearValueStore', 'LinearValueStore', ([], {'shape': '(3, 3)'}), '(shape=(3, 3))\n', (288, 302), False, 'from gamegym.value_learning.valuestore import LinearValueStore\n'), ((590, 603), 'numpy.ones', 'np.ones', (['(4,)'], {}), '((4,))\n', (597, 603), True, 'import numpy... |
# Copyright Amazon.com Inc. or its affiliates. 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. A copy of the
# License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanyin... | [
"logging.debug",
"acktest.k8s.resource.get_resource_exists",
"acktest.k8s.resource.delete_custom_resource",
"acktest.k8s.resource.wait_resource_consumed_by_controller",
"acktest.k8s.resource.get_resource",
"acktest.k8s.resource.get_resource_condition",
"acktest.resources.random_suffix_name",
"time.sle... | [((2359, 2384), 'e2e.replacement_values.REPLACEMENT_VALUES.copy', 'REPLACEMENT_VALUES.copy', ([], {}), '()\n', (2382, 2384), False, 'from e2e.replacement_values import REPLACEMENT_VALUES\n'), ((2409, 2451), 'acktest.resources.random_suffix_name', 'random_suffix_name', (['"""route-table-test"""', '(24)'], {}), "('route-... |
# coding:utf-8
#!/usr/bin/python
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
# ------------------------------------------------------------------------... | [
"logging.getLogger",
"logging.basicConfig",
"pathlib.Path.joinpath",
"pathlib.Path",
"argparse.ArgumentParser",
"timeit.default_timer",
"subprocess.CompletedProcess",
"subprocess.Popen",
"requests.get",
"subprocess.call",
"sys.exit"
] | [((1740, 1762), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (1760, 1762), False, 'import timeit\n'), ((1833, 1864), 'logging.getLogger', '_logging.getLogger', (['_MODULENAME'], {}), '(_MODULENAME)\n', (1851, 1864), True, 'import logging as _logging\n'), ((2106, 2120), 'pathlib.Path', 'Path', (['__... |
import importlib
import platform
import site
import subprocess
import sys
import traceback
class InstallerClass:
sci_win = ['python', '-m', 'pip', 'install', 'scikit-learn']
nump_win = ['python', '-m', 'pip', 'install', 'numpy']
pan_win = ['python', '-m', 'pip', 'install', 'pandas']
req_win = ['python... | [
"traceback.print_exc",
"platform.system",
"subprocess.run",
"importlib.reload"
] | [((4649, 4671), 'importlib.reload', 'importlib.reload', (['site'], {}), '(site)\n', (4665, 4671), False, 'import importlib\n'), ((3678, 3695), 'platform.system', 'platform.system', ([], {}), '()\n', (3693, 3695), False, 'import platform\n'), ((926, 996), 'subprocess.run', 'subprocess.run', (['self.sci_win'], {'encoding... |
"""RCNN model
"""
import tensorflow as tf
from define_scope import define_scope # custom decorators
class Model:
def __init__(self, X, y, output_size=None,
learning_rate=1e-5, learning_rate_decay=0.95,
reg=1e-5, dropout=0.5, verbose=False):
"""
Initalize the model.
Inputs:
- output_size: number of clas... | [
"tensorflow.nn.sparse_softmax_cross_entropy_with_logits",
"tensorflow.nn.dropout",
"tensorflow.reduce_mean",
"tensorflow.cast",
"tensorflow.reduce_min",
"tensorflow.random_normal",
"tensorflow.nn.in_top_k",
"tensorflow.random_normal_initializer",
"tensorflow.histogram_summary",
"tensorflow.matmul"... | [((5194, 5229), 'tensorflow.reshape', 'tf.reshape', (['conv3', '[-1, 9 * 9 * 32]'], {}), '(conv3, [-1, 9 * 9 * 32])\n', (5204, 5229), True, 'import tensorflow as tf\n'), ((5299, 5314), 'tensorflow.nn.relu', 'tf.nn.relu', (['fc1'], {}), '(fc1)\n', (5309, 5314), True, 'import tensorflow as tf\n'), ((6116, 6165), 'tensorf... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Author : @Ruulian_
# Date created : 31 Oct 2021
from random import choice
from requests_html import HTMLSession
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.firefox.options import Optio... | [
"random.choice",
"selenium.webdriver.support.ui.WebDriverWait",
"urllib.parse.urlparse",
"argparse.ArgumentParser",
"re.compile",
"selenium.webdriver.support.expected_conditions.alert_is_present",
"json.dumps",
"selenium.webdriver.Firefox",
"time.sleep",
"argparse.ArgumentTypeError",
"urllib3.di... | [((603, 670), 'urllib3.disable_warnings', 'urllib3.disable_warnings', (['urllib3.exceptions.InsecureRequestWarning'], {}), '(urllib3.exceptions.InsecureRequestWarning)\n', (627, 670), False, 'import urllib3\n'), ((680, 700), 'random.choice', 'choice', (['[35, 93, 33]'], {}), '([35, 93, 33])\n', (686, 700), False, 'from... |
"""TODO: Add file description."""
import curio # async library
import logging # python standard logging library
import click # command line interface creation kit (click)
import click_log # connects the logger output to click output
from datasources.binance_csv import BinanceCSV
from datasources.binance... | [
"logging.getLogger",
"logging.StreamHandler",
"click_log.basic_config",
"click.option",
"click.group",
"click.echo",
"click.Path",
"logging.FileHandler",
"curio.run",
"click.command",
"click_log.simple_verbosity_option"
] | [((739, 766), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (756, 766), False, 'import logging\n'), ((767, 797), 'click_log.basic_config', 'click_log.basic_config', (['logger'], {}), '(logger)\n', (789, 797), False, 'import click_log\n'), ((1611, 1626), 'click.command', 'click.command', ... |
import sys
import traceback
import click
from . import imaging_utility as iu
from . import provisioning
from . import __version__
def eprint(msg, show):
if show:
traceback.print_exc()
print(file=sys.stderr)
click.echo(msg, file=sys.stderr)
@click.group()
@click.version_option(__version__)
@c... | [
"click.argument",
"click.group",
"click.option",
"click.echo",
"click.Path",
"click.version_option",
"traceback.print_exc"
] | [((269, 282), 'click.group', 'click.group', ([], {}), '()\n', (280, 282), False, 'import click\n'), ((284, 317), 'click.version_option', 'click.version_option', (['__version__'], {}), '(__version__)\n', (304, 317), False, 'import click\n'), ((319, 424), 'click.option', 'click.option', (['"""--traceback"""'], {'is_flag'... |
from django.contrib import admin
from ServerRestAPI.models import (
Student, Teacher, StudentLecture,
TeacherLecture, Lecture
)
admin.site.register(Student)
admin.site.register(Teacher)
admin.site.register(StudentLecture)
admin.site.register(TeacherLecture)
admin.site.register(Lecture) | [
"django.contrib.admin.site.register"
] | [((143, 171), 'django.contrib.admin.site.register', 'admin.site.register', (['Student'], {}), '(Student)\n', (162, 171), False, 'from django.contrib import admin\n'), ((172, 200), 'django.contrib.admin.site.register', 'admin.site.register', (['Teacher'], {}), '(Teacher)\n', (191, 200), False, 'from django.contrib impor... |
import itertools,math
L = [1,2,3]
p = list(itertools.permutations(L,3))
D = [list(map(int,input().split())) for i in range(4)]
ans = 999999999999
for pp in p:
k = [0]+list(pp)
d = 0
for i in range(1,4):
d += math.sqrt((D[k[i-1]][0] - D[k[i]][0])**2 + (D[k[i-1]][1] - D[k[i]][1])**2)
if d < ans:... | [
"itertools.permutations",
"math.sqrt"
] | [((43, 71), 'itertools.permutations', 'itertools.permutations', (['L', '(3)'], {}), '(L, 3)\n', (65, 71), False, 'import itertools, math\n'), ((230, 317), 'math.sqrt', 'math.sqrt', (['((D[k[i - 1]][0] - D[k[i]][0]) ** 2 + (D[k[i - 1]][1] - D[k[i]][1]) ** 2)'], {}), '((D[k[i - 1]][0] - D[k[i]][0]) ** 2 + (D[k[i - 1]][1]... |