code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import numpy as np
from evtol import eVTOL
import matplotlib.pyplot as plt
# OTHER STUFF STORED HERE FOR NOW
def unique(list1):
# initialize a null list
unique_list = []
unique_indices = []
# traverse for all elements
i = 0
for x in list1:
# check if exists in unique_list or not
... | [
"matplotlib.pyplot.ylabel",
"evtol.eVTOL",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((821, 889), 'evtol.eVTOL', 'eVTOL', (['m'], {'soc_init': '(100)', 'soc_limit': '(20)', 'mission': '[]', 'energy_density': '(260)'}), '(m, soc_init=100, soc_limit=20, mission=[], energy_density=260)\n', (826, 889), False, 'from evtol import eVTOL\n'), ((2241, 2255), 'matplotlib.pyplot.figure', 'plt.figure', (['(10)'],... |
import spotipy
import keys
import json
import subprocess
from spotipy.oauth2 import SpotifyClientCredentials
from apiclient.discovery import build
from apiclient.errors import HttpError
from oauth2client.tools import argparser
SPOTIFY_USERNAME = keys.SPOTIFY_USERNAME #'AUSERNAME'
SPOTIFY_PLAYLIST_ID = keys.SPOTIPY_PLA... | [
"spotipy.Spotify",
"apiclient.discovery.build",
"spotipy.oauth2.SpotifyClientCredentials",
"subprocess.call"
] | [((724, 817), 'apiclient.discovery.build', 'build', (['YOUTUBE_API_SERVICE_NAME', 'YOUTUBE_API_VERSION'], {'developerKey': 'YOUTUBE_DEVELOPER_KEY'}), '(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION, developerKey=\n YOUTUBE_DEVELOPER_KEY)\n', (729, 817), False, 'from apiclient.discovery import build\n'), ((1456, 1551... |
# This is the file that implements a flask server to do inferences. It's the file that you will modify to
# implement the scoring for your own algorithm.
import os
import json
import flask
import pickle
import pandas as pd
import tensorflow as tf
# Define the path
prefix = '/opt/ml/'
model_path = os.path.join(prefix,... | [
"flask.Flask",
"json.dumps",
"pickle.load",
"os.path.join",
"flask.request.get_json",
"flask.Response",
"tensorflow.math.top_k",
"pandas.read_json"
] | [((300, 329), 'os.path.join', 'os.path.join', (['prefix', '"""model"""'], {}), "(prefix, 'model')\n", (312, 329), False, 'import os\n'), ((2538, 2559), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (2549, 2559), False, 'import flask\n'), ((442, 456), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n... |
"""
Module for L & M Computer Sports timing company.
"""
import datetime
import logging
import re
import urllib
from lxml import etree as ET
from .common import RaceResults
class LMSports(RaceResults):
"""
Process races found on lmsports.com.
Attributes
----------
output_file : str
All ... | [
"lxml.etree.Element",
"re.compile",
"datetime.datetime.strptime",
"datetime.date",
"lxml.etree.fromstring",
"urllib.request.urlopen"
] | [((2304, 2363), 're.compile', 're.compile', (['pattern', '(re.VERBOSE | re.DOTALL | re.IGNORECASE)'], {}), '(pattern, re.VERBOSE | re.DOTALL | re.IGNORECASE)\n', (2314, 2363), False, 'import re\n'), ((3433, 3450), 'lxml.etree.Element', 'ET.Element', (['"""div"""'], {}), "('div')\n", (3443, 3450), True, 'from lxml impor... |
from joblib import Parallel, delayed
import numpy as np
from pyriemann.classification import MDM
from pyriemann.utils.distance import distance
from pyriemann.utils.geodesic import geodesic
from pyriemann.utils.mean import mean_covariance
class MDWM(MDM):
def __init__(self, L=0, **kwargs):
"""Init."""
... | [
"numpy.ones",
"numpy.unique",
"pyriemann.utils.distance.distance",
"joblib.Parallel",
"numpy.concatenate",
"pyriemann.utils.mean.mean_covariance",
"pyriemann.utils.geodesic.geodesic",
"joblib.delayed"
] | [((1113, 1125), 'numpy.unique', 'np.unique', (['y'], {}), '(y)\n', (1122, 1125), True, 'import numpy as np\n'), ((3318, 3346), 'numpy.concatenate', 'np.concatenate', (['dist'], {'axis': '(1)'}), '(dist, axis=1)\n', (3332, 3346), True, 'import numpy as np\n'), ((1290, 1316), 'numpy.ones', 'np.ones', (['X_domain.shape[0]... |
from virtool.hmm.fake import create_fake_hmms
async def test_fake_hmms(app, snapshot, tmp_path, dbi, example_path, pg):
hmm_dir = tmp_path / "hmm"
hmm_dir.mkdir()
await create_fake_hmms(app)
assert await dbi.hmm.find().to_list(None) == snapshot
with open(hmm_dir / "profiles.hmm", "r") as f_resu... | [
"virtool.hmm.fake.create_fake_hmms"
] | [((184, 205), 'virtool.hmm.fake.create_fake_hmms', 'create_fake_hmms', (['app'], {}), '(app)\n', (200, 205), False, 'from virtool.hmm.fake import create_fake_hmms\n')] |
import pytest
from src.pytradegate.api import Instrument, Request
@pytest.fixture
def isin():
return "DE0007664039"
@pytest.fixture
def request_():
user_agent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0"
header = {'user-agent': user_agent}
request = Request(heade... | [
"src.pytradegate.api.Request",
"src.pytradegate.api.Instrument"
] | [((307, 329), 'src.pytradegate.api.Request', 'Request', ([], {'header': 'header'}), '(header=header)\n', (314, 329), False, 'from src.pytradegate.api import Instrument, Request\n'), ((497, 523), 'src.pytradegate.api.Instrument', 'Instrument', (['isin', 'request_'], {}), '(isin, request_)\n', (507, 523), False, 'from sr... |
#hardware platform: FireBeetle-ESP8266
from machine import Pin,I2C
import ssd1306
from time import sleep
i2c = I2C(scl=Pin(2), sda=Pin(0), freq=100000) #Init i2c
lcd=ssd1306.SSD1306_I2C(128,64,i2c)
lcd.fill(0)#create LCD object,Specify col and row
a = 0
while True:
lcd.fill(0)
lcd.text("Hello",0,0) ... | [
"machine.Pin",
"time.sleep",
"ssd1306.SSD1306_I2C"
] | [((168, 201), 'ssd1306.SSD1306_I2C', 'ssd1306.SSD1306_I2C', (['(128)', '(64)', 'i2c'], {}), '(128, 64, i2c)\n', (187, 201), False, 'import ssd1306\n'), ((444, 452), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (449, 452), False, 'from time import sleep\n'), ((119, 125), 'machine.Pin', 'Pin', (['(2)'], {}), '(2)\n', (... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import sys
import os
ROOT_DIR = os.getenv('PLASTICC_DIR')
WORK_DIR = os.path.join(ROOT_DIR, 'plasticc')
sys.path.append(WORK_DIR)
import numpy as np
import argparse
import ANTARES_object
import p... | [
"plasticc.get_data.parse_getdata_options",
"os.path.exists",
"collections.OrderedDict",
"os.getenv",
"os.makedirs",
"os.path.join",
"plasticc.get_data.GetData",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"ANTARES_object.LAobject",
"plasticc.get_data.GetData.get_sntypes",
"sys.path.... | [((157, 182), 'os.getenv', 'os.getenv', (['"""PLASTICC_DIR"""'], {}), "('PLASTICC_DIR')\n", (166, 182), False, 'import os\n'), ((194, 228), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""plasticc"""'], {}), "(ROOT_DIR, 'plasticc')\n", (206, 228), False, 'import os\n'), ((229, 254), 'sys.path.append', 'sys.path.appen... |
import inviwopy
from inviwopy.glm import *
import numpy as np
import math
# input variables
# img - memory for the final image
# p - the processor
rAxis = np.linspace(p.realBounds.value[0],p.realBounds.value[1],img.data.shape[0])
iAxis = np.linspace(p.imaginaryBound.value[0],p.imaginaryBound.value[1],img.data.shape[... | [
"numpy.linspace",
"numpy.power",
"numpy.ndenumerate",
"math.log"
] | [((158, 234), 'numpy.linspace', 'np.linspace', (['p.realBounds.value[0]', 'p.realBounds.value[1]', 'img.data.shape[0]'], {}), '(p.realBounds.value[0], p.realBounds.value[1], img.data.shape[0])\n', (169, 234), True, 'import numpy as np\n'), ((241, 330), 'numpy.linspace', 'np.linspace', (['p.imaginaryBound.value[0]', 'p.... |
from math import sqrt
import numpy as np
class KNearestNeighborsClassifier:
"""
A simple attempt at creating a K-Nearest Neighbors algorithm.
n_neighbors: int, default=5
Number of neighbors to use by default in classification.
"""
def __init__(self, n_neighbors=5):
"""Initialize ... | [
"numpy.array",
"math.sqrt"
] | [((1118, 1139), 'numpy.array', 'np.array', (['predictions'], {}), '(predictions)\n', (1126, 1139), True, 'import numpy as np\n'), ((1413, 1423), 'math.sqrt', 'sqrt', (['dist'], {}), '(dist)\n', (1417, 1423), False, 'from math import sqrt\n')] |
"""
This module handles the representation of some additional types as a cell
value in a xlsx file. It also provides the needed import functionality. This
functionality should only be used for data types which need altering additional
cell properties like number format. When only the value of a cell is altered
there sh... | [
"typing.TypeVar"
] | [((625, 637), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (632, 637), False, 'from typing import Generic, Optional, TypeVar\n')] |
# Generated by Django 2.1.3 on 2018-12-02 04:16
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('venues', '0004_auto_20181106_0314'),
]
operations = [
migrations.CreateModel(
... | [
"django.db.migrations.AlterUniqueTogether",
"django.db.models.FloatField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.PositiveSmallIntegerField",
"django.db.models.CharField"
] | [((930, 1018), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether', ([], {'name': '"""tap"""', 'unique_together': "{('room', 'tap_number')}"}), "(name='tap', unique_together={('room',\n 'tap_number')})\n", (960, 1018), False, 'from django.db import migrations, models\n'), ((379, 472), 'djang... |
import numpy as np
import pandas as pd
import time
from sklearn.feature_extraction.text import TfidfVectorizer
import string
import warnings
warnings.filterwarnings('ignore')
from contextlib import contextmanager
import mysql.connector
from sqlalchemy import create_engine
import pygsheets
from tqdm import tqdm
import y... | [
"warnings.filterwarnings"
] | [((141, 174), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (164, 174), False, 'import warnings\n')] |
# pylint: disable=protected-access, unused-argument
__copyright__ = 'Copyright 2020, The RADICAL-Cybertools Team'
__license__ = 'MIT'
import glob
import os
import shutil
from unittest import TestCase, mock
import radical.pilot as rp
TEST_CASES_PATH = '%s/test_cases' % os.path.dirname(__file__)
# --------------... | [
"shutil.rmtree",
"os.path.dirname",
"os.path.isdir",
"unittest.mock.patch.object",
"radical.pilot.Session",
"glob.glob"
] | [((276, 301), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (291, 301), False, 'import os\n'), ((526, 597), 'unittest.mock.patch.object', 'mock.patch.object', (['rp.Session', '"""_initialize_primary"""'], {'return_value': 'None'}), "(rp.Session, '_initialize_primary', return_value=None)\n", ... |
"""@package service
@file service.py
@author <NAME> <<EMAIL>>
Copyright (c) 2007-2011 Kalinka Team
This file is part of Kalinka mediaserver.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal ... | [
"klk.common.Module.__init__"
] | [((1558, 1606), 'klk.common.Module.__init__', 'common.Module.__init__', (['self', 'UUID', 'NAME', 'server'], {}), '(self, UUID, NAME, server)\n', (1580, 1606), True, 'import klk.common as common\n')] |
# -*- coding: utf-8 -*-
#
# The MIT License (MIT)
#
# Copyright (c) 2018 <NAME>
#
# 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 t... | [
"pytz.timezone",
"sqlalchemy.create_engine",
"time.sleep",
"datetime.datetime.now",
"datetime.timedelta"
] | [((4292, 4301), 'time.sleep', 'sleep', (['(60)'], {}), '(60)\n', (4297, 4301), False, 'from time import sleep\n'), ((2169, 2206), 'sqlalchemy.create_engine', 'create_engine', (['url'], {'pool_recycle': '(3600)'}), '(url, pool_recycle=3600)\n', (2182, 2206), False, 'from sqlalchemy import create_engine\n'), ((2528, 2552... |
from django.urls import include, path
from django.contrib.auth.views import LoginView, LogoutView
from . import views
urlpatterns = [
path('', views.home, name='home'),
path('sobre/', views.sobre, name='sobre'),
path('adicionar_material/<int:pk>/<str:tipo>', views.adicionar_material, name='adicionar_materi... | [
"django.contrib.auth.views.LoginView.as_view",
"django.urls.path",
"django.contrib.auth.views.LogoutView.as_view"
] | [((139, 172), 'django.urls.path', 'path', (['""""""', 'views.home'], {'name': '"""home"""'}), "('', views.home, name='home')\n", (143, 172), False, 'from django.urls import include, path\n'), ((178, 219), 'django.urls.path', 'path', (['"""sobre/"""', 'views.sobre'], {'name': '"""sobre"""'}), "('sobre/', views.sobre, na... |
import random
import re
from contextlib import suppress
from socket import socket
from typing import Any, Tuple
from socks import ProxyError
from ripper.constants import HTTP_STATUS_CODE_CHECK_PERIOD_SEC
from ripper.context import Context, Errors
HTTP_STATUS_PATTERN = re.compile(r" (\d{3}) ")
class HttpFlood:
... | [
"random.choice",
"ripper.context.Errors",
"re.compile",
"contextlib.suppress",
"re.search"
] | [((272, 296), 're.compile', 're.compile', (['""" (\\\\d{3}) """'], {}), "(' (\\\\d{3}) ')\n", (282, 296), False, 'import re\n'), ((2487, 2523), 'random.choice', 'random.choice', (['self._ctx.user_agents'], {}), '(self._ctx.user_agents)\n', (2500, 2523), False, 'import random\n'), ((859, 878), 'contextlib.suppress', 'su... |
import exifread
import os
import uuid
from PIL import Image
from photomanager.lib.pmconst import SUPPORT_EXTS, SKIP_LIST, PATH_SEP
from photomanager.lib.helper import get_file_md5, get_timestamp_from_str
from photomanager.utils.logger import logger
class ImageInfo:
def __init__(self, filename):
self.fil... | [
"photomanager.lib.helper.get_timestamp_from_str",
"os.path.getsize",
"PIL.Image.open",
"os.path.getctime",
"os.path.splitext",
"uuid.uuid1",
"exifread.process_file",
"photomanager.lib.helper.get_file_md5",
"os.path.getmtime",
"os.walk"
] | [((4813, 4828), 'os.walk', 'os.walk', (['folder'], {}), '(folder)\n', (4820, 4828), False, 'import os\n'), ((5066, 5109), 'photomanager.lib.helper.get_timestamp_from_str', 'get_timestamp_from_str', (['last_index_time_str'], {}), '(last_index_time_str)\n', (5088, 5109), False, 'from photomanager.lib.helper import get_fi... |
# -*- coding: utf-8 -*-
from bag.core import BagProject
from serdes_ec.simulation.clkamp import ClkAmpChar
def characterize_linearity(prj):
specs_fname = 'specs_design/clkamp.yaml'
sim = ClkAmpChar(prj, specs_fname)
sim.setup_linearity()
sim.create_designs(tb_type='tb_pss_dc', extract=False)
def... | [
"bag.core.BagProject",
"serdes_ec.simulation.clkamp.ClkAmpChar"
] | [((200, 228), 'serdes_ec.simulation.clkamp.ClkAmpChar', 'ClkAmpChar', (['prj', 'specs_fname'], {}), '(prj, specs_fname)\n', (210, 228), False, 'from serdes_ec.simulation.clkamp import ClkAmpChar\n'), ((404, 432), 'serdes_ec.simulation.clkamp.ClkAmpChar', 'ClkAmpChar', (['prj', 'specs_fname'], {}), '(prj, specs_fname)\n... |
#! /usr/bin/env python3
# This is basically just the example from
# https://developers.google.com/gmail/api/quickstart/python
import base64
from email.mime.text import MIMEText
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
from httplib2 import Http
from oauth2client import f... | [
"oauth2client.client.flow_from_clientsecrets",
"oauth2client.file.Storage",
"httplib2.Http",
"oauth2client.tools.run_flow",
"email.mime.text.MIMEText"
] | [((761, 787), 'oauth2client.file.Storage', 'file.Storage', (['"""token.json"""'], {}), "('token.json')\n", (773, 787), False, 'from oauth2client import file, client, tools\n'), ((1585, 1607), 'email.mime.text.MIMEText', 'MIMEText', (['message_text'], {}), '(message_text)\n', (1593, 1607), False, 'from email.mime.text i... |
import pkg_resources
__version__ = pkg_resources.get_distribution("drsclient").version
| [
"pkg_resources.get_distribution"
] | [((36, 79), 'pkg_resources.get_distribution', 'pkg_resources.get_distribution', (['"""drsclient"""'], {}), "('drsclient')\n", (66, 79), False, 'import pkg_resources\n')] |
"""Run >> python -m spacy download en << to obtain the English collection of spacy."""
from nltk.corpus import stopwords
from nltk.stem import SnowballStemmer
from autocorrect import spell
from lib.utils.contractions import *
from lib.utils.timer import Timer
import unidecode
import spacy
from spacy_langdetect import ... | [
"nltk.stem.SnowballStemmer",
"nltk.corpus.stopwords.words",
"spacy.load",
"spacy_langdetect.LanguageDetector",
"unidecode.unidecode",
"autocorrect.spell"
] | [((344, 360), 'spacy.load', 'spacy.load', (['"""en"""'], {}), "('en')\n", (354, 360), False, 'import spacy\n'), ((374, 392), 'spacy_langdetect.LanguageDetector', 'LanguageDetector', ([], {}), '()\n', (390, 392), False, 'from spacy_langdetect import LanguageDetector\n'), ((1019, 1045), 'nltk.corpus.stopwords.words', 'st... |
from dolfin import *
from xii import *
def heat(n, dt, f, u0, gD):
'''BE u_t - (u_xx + u_yy) = f with u = gD on bdry and u(0, x) = u0'''
mesh = UnitSquareMesh(n, n)
facet_f = MeshFunction('size_t', mesh, 1, 0)
CompiledSubDomain('near(x[0], 0)').mark(facet_f, 1)
CompiledSubDomain('near(x[0], 1)').m... | [
"sympy.symbols",
"sympy.sin",
"sympy.printing.ccode"
] | [((1779, 1804), 'sympy.symbols', 'sp.symbols', (['"""x[0] x[1] t"""'], {}), "('x[0] x[1] t')\n", (1789, 1804), True, 'import sympy as sp\n'), ((1814, 1855), 'sympy.sin', 'sp.sin', (['(sp.pi * x * (x ** 2 + y ** 2) * t)'], {}), '(sp.pi * x * (x ** 2 + y ** 2) * t)\n', (1820, 1855), True, 'import sympy as sp\n'), ((1929,... |
from setuptools import setup
with open('README.md') as readme_file:
readme = readme_file.read()
setup(
name='malwarefeeds',
version='0.1.0',
description='An aggregator for malware feeds.',
long_description=readme,
packages=['malwarefeeds'],
url='https://github.com/neriberto/malw... | [
"setuptools.setup"
] | [((107, 498), 'setuptools.setup', 'setup', ([], {'name': '"""malwarefeeds"""', 'version': '"""0.1.0"""', 'description': '"""An aggregator for malware feeds."""', 'long_description': 'readme', 'packages': "['malwarefeeds']", 'url': '"""https://github.com/neriberto/malwarefeeds"""', 'license': '"""BSD 3-Clause License"""... |
import copy
import numpy as np
from collections import OrderedDict
import torch
from torch import optim
import torch.nn.functional as F
from torch.distributions import Categorical
from torchmeta.utils.gradient_based import gradient_update_parameters
import lio.model.meta_actor_net as meta_actor_net
import lio.model.ac... | [
"torch.nn.functional.softmax",
"torch.distributions.Categorical",
"torch.stack",
"torch.Tensor",
"lio.utils.util.Adam_Optim",
"torch.no_grad",
"lio.model.actor_net.Reward_net",
"torch.add",
"lio.utils.util.gd",
"torch.finfo",
"torch.nn.functional.log_softmax",
"numpy.zeros",
"torch.zeros",
... | [((609, 635), 'torch.finfo', 'torch.finfo', (['torch.float32'], {}), '(torch.float32)\n', (620, 635), False, 'import torch\n'), ((1104, 1149), 'lio.model.meta_actor_net.MetaNet_PG', 'MetaNet_PG', (['self.l_obs', 'self.n_action', 'l1', 'l2'], {}), '(self.l_obs, self.n_action, l1, l2)\n', (1114, 1149), False, 'from lio.m... |
from blaster import factory
import blaster
if __name__ == "__main__":
app = factory.create_app(celery=blaster.celery)
app.jinja_env.add_extension('jinja2.ext.do')
app.run(host='0.0.0.0', port=80)
| [
"blaster.factory.create_app"
] | [((80, 121), 'blaster.factory.create_app', 'factory.create_app', ([], {'celery': 'blaster.celery'}), '(celery=blaster.celery)\n', (98, 121), False, 'from blaster import factory\n')] |
#!/usr/bin/env python
from jinja2 import Environment, FileSystemLoader
import os
import argparse
import sys
import re
def doc_from_template(template, output, append=False, nvars=None):
nvars = nvars or {}
nvars.update(os.environ)
template_abs_path = os.path.abspath(template)
template_dir = os.path.di... | [
"re.split",
"argparse.ArgumentParser",
"os.path.dirname",
"os.path.basename",
"os.path.abspath",
"jinja2.FileSystemLoader"
] | [((265, 290), 'os.path.abspath', 'os.path.abspath', (['template'], {}), '(template)\n', (280, 290), False, 'import os\n'), ((310, 344), 'os.path.dirname', 'os.path.dirname', (['template_abs_path'], {}), '(template_abs_path)\n', (325, 344), False, 'import os\n'), ((365, 400), 'os.path.basename', 'os.path.basename', (['t... |
# -*- coding: utf-8 -*-
#Setup logging
import logging
import logging.config
logging.config.fileConfig('logging.conf')
# create logger
logger = logging.getLogger('root')
import multiprocessing
import threading
import time
import traceback
import subprocess as sp
import json
from devices.relay import Relay
from devices.d... | [
"logging.getLogger",
"traceback.format_exc",
"devices.ds18b20.DS18B20",
"devices.relay.Relay",
"devices.hcsr04.HCSR04",
"multiprocessing.Process.__init__",
"devices.l298n.L298N",
"time.sleep",
"logging.config.fileConfig",
"threading.Thread",
"logging.error"
] | [((76, 117), 'logging.config.fileConfig', 'logging.config.fileConfig', (['"""logging.conf"""'], {}), "('logging.conf')\n", (101, 117), False, 'import logging\n'), ((143, 168), 'logging.getLogger', 'logging.getLogger', (['"""root"""'], {}), "('root')\n", (160, 168), False, 'import logging\n'), ((444, 453), 'devices.rela... |
# check whether each of the images used here is contained in the downloaded entirety of images
import os
path = "../16-class-ImageNet/image_names"
txt_file_list = os.listdir(path)
print(txt_file_list)
for txt_file in txt_file_list:
file_path = os.path.join(path, txt_file)
print(file_path)
print(f"Now scanni... | [
"os.path.isfile",
"os.listdir",
"os.path.join"
] | [((163, 179), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (173, 179), False, 'import os\n'), ((248, 276), 'os.path.join', 'os.path.join', (['path', 'txt_file'], {}), '(path, txt_file)\n', (260, 276), False, 'import os\n'), ((710, 741), 'os.path.isfile', 'os.path.isfile', (['(location1 + img)'], {}), '(locat... |
# coding=utf-8
import datetime
import solution as f
to_unicode = f._compat.to_unicode
def _clean(form, value, **kwargs):
return value
def test_render_time():
field = f.Time()
field.name = u'abc'
field.load_data(obj_value=datetime.time(11, 55))
assert field() == field.as_input()
assert (f... | [
"solution.Time",
"datetime.time"
] | [((181, 189), 'solution.Time', 'f.Time', ([], {}), '()\n', (187, 189), True, 'import solution as f\n'), ((687, 755), 'solution.Time', 'f.Time', ([], {'data_modal': '(True)', 'aria_label': '"""test"""', 'foo': '"""niet"""', 'clean': '_clean'}), "(data_modal=True, aria_label='test', foo='niet', clean=_clean)\n", (693, 75... |
from utils.summary import makeResultSummaryByVerRange, makeResultByTrainConfigCond
# makeResultSummaryByVerRange(dataset='virushare-20',
# version_range=[80, 100])
# makeResultByTrainConfigCond(dataset='virushare-20',
# train_config_cond={
# ... | [
"utils.summary.makeResultSummaryByVerRange"
] | [((623, 700), 'utils.summary.makeResultSummaryByVerRange', 'makeResultSummaryByVerRange', ([], {'dataset': '"""virushare-20"""', 'version_range': '[318, 326]'}), "(dataset='virushare-20', version_range=[318, 326])\n", (650, 700), False, 'from utils.summary import makeResultSummaryByVerRange, makeResultByTrainConfigCond... |
import tensorflow as tf
from . import config
from .util import *
def add(dest, src, stride=1, activation=True, name=None, config=config.Config()):
src_channels = src.get_shape()[-1]
dest_channels = dest.get_shape()[-1]
if src_channels != dest_channels or stride > 1:
src = conv(src, dest_c... | [
"tensorflow.concat"
] | [((929, 960), 'tensorflow.concat', 'tf.concat', (['[dest, src]'], {'axis': '(-1)'}), '([dest, src], axis=-1)\n', (938, 960), True, 'import tensorflow as tf\n')] |
from distutils.core import setup
setup(
url = 'https://github.com/uxcn/x2x',
name = 'x2x',
version = '0.9',
fullname = 'x2x',
description = 'commands to convert radixes',
long_description = '''
x2x
Command... | [
"distutils.core.setup"
] | [((34, 1521), 'distutils.core.setup', 'setup', ([], {'url': '"""https://github.com/uxcn/x2x"""', 'name': '"""x2x"""', 'version': '"""0.9"""', 'fullname': '"""x2x"""', 'description': '"""commands to convert radixes"""', 'long_description': '"""\nx2x\n\nCommands to convert radixes.\n\n* x2b - convert to binary\n* x2o - c... |
# coding=utf-8
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------... | [
"json.loads",
"re.compile",
"azext_iot.common.utility.ensure_iothub_sdk_min_version",
"azext_iot.tests.generators.generate_generic_id",
"json.dumps",
"azure.mgmt.iothub.IotHubClient",
"azext_iot.operations.hub.iot_device_import",
"azext_iot.operations.hub.iot_device_export",
"pytest.raises"
] | [((868, 889), 'azext_iot.tests.generators.generate_generic_id', 'generate_generic_id', ([], {}), '()\n', (887, 889), False, 'from azext_iot.tests.generators import generate_generic_id\n'), ((2047, 2108), 'azext_iot.common.utility.ensure_iothub_sdk_min_version', 'ensure_iothub_sdk_min_version', (['IOTHUB_TRACK_2_SDK_MIN... |
import os
def get_nodes():
f = open("/rpicluster/config/nodes","r")
line = f.readline()
machines = []
while(line!=''):
split = line.split(',')
machines.append((split[0].rstrip(), split[2].rstrip()))
line = f.readline()
return machines
def get_ip(ip_output, interface):
... | [
"os.system"
] | [((1397, 1415), 'os.system', 'os.system', (['command'], {}), '(command)\n', (1406, 1415), False, 'import os\n')] |
import pandas as pd
import csv
import types
df = pd.read_csv("/home/bench/notebooks/data/IoT_Botnet/UNSW_2018_IoT_Botnet_Dataset_1.csv",header = None)
df.columns = ["pkSeqID","stime","flgs","proto","saddr","sport","daddr","dport","pkts","bytes","state","ltime","seq","dur","mean","stddev","smac","dmac","sum","min","max"... | [
"pandas.unique",
"pandas.concat",
"pandas.read_csv"
] | [((49, 158), 'pandas.read_csv', 'pd.read_csv', (['"""/home/bench/notebooks/data/IoT_Botnet/UNSW_2018_IoT_Botnet_Dataset_1.csv"""'], {'header': 'None'}), "(\n '/home/bench/notebooks/data/IoT_Botnet/UNSW_2018_IoT_Botnet_Dataset_1.csv',\n header=None)\n", (60, 158), True, 'import pandas as pd\n'), ((1221, 1286), 'pa... |
# coding: utf-8
# Author: <NAME>
# Contact: <EMAIL>
# Python modules
import os
import traceback
import logging
logger = logging.getLogger(__name__)
# Houdini modules
import nuke
import nukescripts
# Wizard modules
import wizard_communicate
def save_increment():
file_path, version_id = wizard_communicate.add_ver... | [
"logging.getLogger",
"nuke.String_Knob",
"nuke.scriptSaveAs",
"nuke.toNode",
"nuke.nodes.BackdropNode",
"os.path.dirname",
"nuke.allNodes",
"nuke.nodes.Read"
] | [((121, 148), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (138, 148), False, 'import logging\n'), ((639, 654), 'nuke.allNodes', 'nuke.allNodes', ([], {}), '()\n', (652, 654), False, 'import nuke\n'), ((725, 740), 'nuke.allNodes', 'nuke.allNodes', ([], {}), '()\n', (738, 740), False, 'i... |
import argparse
import logging
import os
from pathlib import Path
import re
import tempfile
from azure_devtools.ci_tools.git_tools import (
do_commit,
)
from azure_devtools.ci_tools.github_tools import (
manage_git_folder,
configure_user
)
from git import Repo
from github import Github
from . import buil... | [
"logging.getLogger",
"tempfile.TemporaryDirectory",
"logging.basicConfig",
"argparse.ArgumentParser",
"github.Github",
"re.compile",
"pathlib.Path",
"os.environ.get",
"azure_devtools.ci_tools.github_tools.configure_user"
] | [((360, 387), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (377, 387), False, 'import logging\n'), ((405, 459), 're.compile', 're.compile', (['"""^(sdk/[\\\\w-]+)/(azure[\\\\w-]+)/"""', 're.ASCII'], {}), "('^(sdk/[\\\\w-]+)/(azure[\\\\w-]+)/', re.ASCII)\n", (415, 459), False, 'import re... |
#!/usr/bin/env python3
#
# Copyright (c) 2020 <NAME> and contributors.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""The test_config module covers the config module."""
import os
import unittest
import unittest.mock
def mock_get_abspath(path: str) -> str:
... | [
"unittest.main",
"os.path.dirname",
"unittest.mock.patch",
"os.path.isabs"
] | [((385, 404), 'os.path.isabs', 'os.path.isabs', (['path'], {}), '(path)\n', (398, 404), False, 'import os\n'), ((955, 970), 'unittest.main', 'unittest.main', ([], {}), '()\n', (968, 970), False, 'import unittest\n'), ((450, 475), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (465, 475), Fals... |
########################################################################################################################
# This code was used to preprocess the training files. The training files were cleaned
# This file was screated by downloading a jupyter notebook from my paperspace account
##########################... | [
"os.path.exists",
"os.listdir",
"os.makedirs",
"os.rename",
"os.remove"
] | [((628, 668), 'os.listdir', 'os.listdir', (['f"""{PATH}CAX_Superhero_Train"""'], {}), "(f'{PATH}CAX_Superhero_Train')\n", (638, 668), False, 'import os\n'), ((787, 827), 'os.listdir', 'os.listdir', (['f"""{PATH}CAX_Superhero_Train"""'], {}), "(f'{PATH}CAX_Superhero_Train')\n", (797, 827), False, 'import os\n'), ((929, ... |
#import urllib.parse
import requests
url_version = 'https://s.ankama.com/games/wakfu/gamedata/config.json'
version = requests.get(url_version).json()
currentTypes = {'actions', 'equipmentItemTypes', 'itemProperties', 'items', 'states'}
print('Select type:')
for t in currentTypes:
print(t)
type = input()
print('T... | [
"requests.get"
] | [((118, 143), 'requests.get', 'requests.get', (['url_version'], {}), '(url_version)\n', (130, 143), False, 'import requests\n'), ((458, 480), 'requests.get', 'requests.get', (['main_api'], {}), '(main_api)\n', (470, 480), False, 'import requests\n')] |
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth.models import Group, User
from django.contrib.sites.models import Site
admin.autodiscover()
#admin.site.unregister(User)
#admin.site.unregister(Group)
#admin.site.unregister(Site)
urlpatterns = (
url(r'^feed/', inc... | [
"django.conf.urls.include",
"django.conf.urls.url",
"django.contrib.admin.autodiscover"
] | [((172, 192), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (190, 192), False, 'from django.contrib import admin\n'), ((647, 678), 'django.conf.urls.url', 'url', (['"""^admin/"""', 'admin.site.urls'], {}), "('^admin/', admin.site.urls)\n", (650, 678), False, 'from django.conf.urls import ... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import re
from enum import Enum, unique
from typing import Dict, Optional, Union
from packaging import version
from packaging.version import Version
from intelliflow.core.platform.definitions.aws.glue.client_wr... | [
"intelliflow.core.platform.definitions.aws.glue.client_wrapper.glue_spark_version_map",
"packaging.version.parse",
"re.compile"
] | [((1128, 1151), 'packaging.version.parse', 'version.parse', (['"""5.12.3"""'], {}), "('5.12.3')\n", (1141, 1151), False, 'from packaging import version\n'), ((1153, 1175), 'packaging.version.parse', 'version.parse', (['"""2.2.1"""'], {}), "('2.2.1')\n", (1166, 1175), False, 'from packaging import version\n'), ((1197, 1... |
""" Python script to train HRNet + shiftNet for multi frame super resolution (MFSR)
Credits:
This code is adapted from ElementAI's HighRes-Net: https://github.com/ElementAI/HighRes-net
"""
import os
import gc
import json
import argparse
import datetime
from functools import partial
from collections import defaultdic... | [
"wandb.log",
"torch.cuda.is_available",
"torch.sum",
"hrnet.src.utils.normalize_plotting",
"numpy.moveaxis",
"numpy.arange",
"torch.linalg.norm",
"collections.deque",
"tensorboardX.SummaryWriter",
"argparse.ArgumentParser",
"torch.mean",
"numpy.random.random",
"numpy.max",
"numpy.random.se... | [((1456, 1478), 'torch.stack', 'torch.stack', (['thetas', '(1)'], {}), '(thetas, 1)\n', (1467, 1478), False, 'import torch\n'), ((5547, 5594), 'os.path.join', 'os.path.join', (['tb_logging_dir', 'subfolder_pattern'], {}), '(tb_logging_dir, subfolder_pattern)\n', (5559, 5594), False, 'import os\n'), ((5599, 5638), 'os.m... |
from datetime import datetime
from flask import Blueprint, render_template, redirect, url_for, flash, abort
from flask_login import login_required, current_user
from app.models import EditableHTML, SiteSetting
from .forms import SiteSettingForm, PostForm, CategoryForm, EditCategoryForm, StatusForm
import commonmark
fro... | [
"flask.render_template",
"app.db.session.delete",
"app.models.SiteSetting.query.limit",
"app.models.SiteSetting.query.get",
"flask.flash",
"app.models.SiteSetting.query.order_by",
"app.models.SiteSetting.find_all",
"app.models.SiteSetting",
"app.db.session.query",
"flask.url_for",
"app.db.sessio... | [((449, 478), 'flask.Blueprint', 'Blueprint', (['"""public"""', '__name__'], {}), "('public', __name__)\n", (458, 478), False, 'from flask import Blueprint, render_template, redirect, url_for, flash, abort\n'), ((575, 627), 'flask.render_template', 'render_template', (['"""public/public.html"""'], {'public': 'public'})... |
import logging
import numpy as np
import pandas as pd
import faiss
def smart_kmeans_clustering(X, obj_Y, n_clusters, min_obj_per_cluster=5, search_in=20):
logging.info(
u"Params: initial number of clusters: %s, min objects per cluster: %s",
n_clusters, min_obj_per_cluster
)
kmeans = faiss... | [
"numpy.unique",
"numpy.in1d",
"logging.info",
"numpy.array",
"pandas.DataFrame",
"faiss.Kmeans"
] | [((161, 287), 'logging.info', 'logging.info', (['u"""Params: initial number of clusters: %s, min objects per cluster: %s"""', 'n_clusters', 'min_obj_per_cluster'], {}), "(\n u'Params: initial number of clusters: %s, min objects per cluster: %s',\n n_clusters, min_obj_per_cluster)\n", (173, 287), False, 'import lo... |
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("infile")
parser.add_argument("outfile")
flags = parser.parse_args()
with open(flags.infile, "r") as f:
lines = tuple(filter(None, (l.strip() for l in f.readlines())))
blocks = int(lines[... | [
"argparse.ArgumentParser"
] | [((57, 82), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (80, 82), False, 'import argparse\n')] |
from keeper_secrets_manager_helper.field import Field, FieldSectionEnum
from keeper_secrets_manager_helper.common import load_file
from keeper_secrets_manager_helper.v3.record_type import get_class_by_type as get_record_type_class
from keeper_secrets_manager_helper.v3.field_type import get_class_by_type as get_field_ty... | [
"keeper_secrets_manager_helper.common.load_file",
"keeper_secrets_manager_helper.v3.field_type.get_class_by_type",
"keeper_secrets_manager_helper.v3.record_type.get_class_by_type",
"importlib.import_module"
] | [((479, 494), 'keeper_secrets_manager_helper.common.load_file', 'load_file', (['file'], {}), '(file)\n', (488, 494), False, 'from keeper_secrets_manager_helper.common import load_file\n'), ((13114, 13153), 'keeper_secrets_manager_helper.v3.record_type.get_class_by_type', 'get_record_type_class', (['self.record_type'], ... |
import torch
from .num_nodes import maybe_num_nodes
def contains_self_loops(edge_index):
row, col = edge_index
mask = row == col
return mask.sum().item() > 0
def remove_self_loops(edge_index, edge_attr=None):
row, col = edge_index
mask = row != col
edge_attr = edge_attr if edge_attr is None... | [
"torch.cat",
"torch.arange"
] | [((646, 700), 'torch.arange', 'torch.arange', (['(0)', 'num_nodes'], {'dtype': 'dtype', 'device': 'device'}), '(0, num_nodes, dtype=dtype, device=device)\n', (658, 700), False, 'import torch\n'), ((760, 796), 'torch.cat', 'torch.cat', (['[edge_index, loop]'], {'dim': '(1)'}), '([edge_index, loop], dim=1)\n', (769, 796)... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase, override_settings
from processengine.models import Process
from unittest.mock import patch
from .datas import PROCESS_MAP
@override_settings(PROCESS_MAP=PROCESS_MAP)
@override_settings(CELERY_ALWAYS_EAGER=True)
class ... | [
"django.test.override_settings",
"unittest.mock.patch",
"processengine.models.Process",
"unittest.mock.patch.object"
] | [((226, 268), 'django.test.override_settings', 'override_settings', ([], {'PROCESS_MAP': 'PROCESS_MAP'}), '(PROCESS_MAP=PROCESS_MAP)\n', (243, 268), False, 'from django.test import TestCase, override_settings\n'), ((270, 313), 'django.test.override_settings', 'override_settings', ([], {'CELERY_ALWAYS_EAGER': '(True)'})... |
import json
import os
import cyflann.flann_info
pth = os.path.join(os.path.dirname(cyflann.flann_info.__file__), 'flann_config.json')
with open(pth, 'w') as f:
json.dump({'FLANN_DIR': os.environ['FLANN_DIR']}, f)
| [
"os.path.dirname",
"json.dump"
] | [((69, 113), 'os.path.dirname', 'os.path.dirname', (['cyflann.flann_info.__file__'], {}), '(cyflann.flann_info.__file__)\n', (84, 113), False, 'import os\n'), ((166, 218), 'json.dump', 'json.dump', (["{'FLANN_DIR': os.environ['FLANN_DIR']}", 'f'], {}), "({'FLANN_DIR': os.environ['FLANN_DIR']}, f)\n", (175, 218), False,... |
import numpy as np
import matplotlib.pyplot as plt
import time
import math
from numpy import linalg
import scipy as sc
import scipy.sparse as sparse
import scipy.sparse.linalg
plt.style.use('ggplot')
def spectral(N,nplots):
'''Algorithme de résolution par méthode spectrale de Fourier-Galerkin. N est la taille du ... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"numpy.array",
"numpy.sin",
"scipy.sparse.spdiags",
"numpy.arange",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.fft.fft",
"matplotlib.pyplot.style.use",
"numpy.asarray",
"matplotlib.pyplot.clos... | [((177, 200), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (190, 200), True, 'import matplotlib.pyplot as plt\n'), ((3673, 3682), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (3680, 3682), True, 'import matplotlib.pyplot as plt\n'), ((3683, 3748), 'matplotlib.pyplot.s... |
import json
from collections import OrderedDict
fileName = "sortedDictOfNames.json"
def dumpToJson(sortedDict):
jsonDump = open(fileName, "w")
jsonDump.write(json.dumps(sortedDict))
jsonDump.close()
def sortDictionary():
fileObj = open('names-nov_dec_2020.json')
regDict = json.loads(fileObj.rea... | [
"json.dumps"
] | [((169, 191), 'json.dumps', 'json.dumps', (['sortedDict'], {}), '(sortedDict)\n', (179, 191), False, 'import json\n')] |
"""
Django settings for MyTodo project.
Generated by 'django-admin startproject' using Django 3.0.6.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
imp... | [
"decouple.Csv",
"sentry_sdk.integrations.django.DjangoIntegration",
"dj_database_url.config",
"decouple.config",
"os.path.join",
"os.path.abspath"
] | [((1014, 1034), 'decouple.config', 'config', (['"""SECRET_KEY"""'], {}), "('SECRET_KEY')\n", (1020, 1034), False, 'from decouple import config\n'), ((1050, 1093), 'decouple.config', 'config', (['"""ENVIRONMENT"""'], {'default': '"""production"""'}), "('ENVIRONMENT', default='production')\n", (1056, 1093), False, 'from ... |
import math
import torch
import torch.nn as nn
from .layers import ConvLayer2d, ConvResBlock2d, EqualLinear
class DiscriminatorHead(nn.Module):
def __init__(self, in_channel, disc_stddev=False):
super().__init__()
self.disc_stddev = disc_stddev
stddev_dim = 1 if disc_stddev else 0
... | [
"torch.nn.Sequential",
"torch.nn.Flatten",
"math.log",
"torch.argsort",
"torch.cat"
] | [((821, 840), 'torch.argsort', 'torch.argsort', (['perm'], {}), '(perm)\n', (834, 840), False, 'import torch\n'), ((1401, 1426), 'torch.cat', 'torch.cat', (['[x, stddev]', '(1)'], {}), '([x, stddev], 1)\n', (1410, 1426), False, 'import torch\n'), ((2384, 2411), 'torch.nn.Sequential', 'nn.Sequential', (['*self.layers'],... |
# Copyright 2018 FastWave LLC
#
# NOTICE: All information contained herein is, and remains the property of
# FastWave LLC. The intellectual and technical concepts contained
# herein are proprietary to FastWave LLC and its suppliers and may be covered
# by U.S. and Foreign Patents, patents in process, and are protected... | [
"setuptools.setup"
] | [((703, 1016), 'setuptools.setup', 'setup', ([], {'name': '"""hfo_engine_web"""', 'description': '"""Web service for running hfo engine app remotely."""', 'version': 'VERSION', 'license': '"""Propietary"""', 'classifiers': "['Programming Language :: Python']", 'platforms': '"""any"""', 'packages': "['hfo_engine_web']",... |
import logging
from braces.views import PrefetchRelatedMixin, SelectRelatedMixin
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.cache import cache
from django.forms import modelform_factory
from django.http import Http404, HttpResponseNotAllowed, HttpResp... | [
"logging.getLogger",
"django.http.HttpResponseRedirect",
"django.utils.translation.ugettext_lazy",
"django.forms.modelform_factory",
"django.http.HttpResponseNotAllowed",
"django.shortcuts.get_object_or_404",
"rules.permissions.has_perm",
"django.urls.reverse_lazy"
] | [((1017, 1046), 'logging.getLogger', 'logging.getLogger', (['"""helpdesk"""'], {}), "('helpdesk')\n", (1034, 1046), False, 'import logging\n'), ((4449, 4515), 'django.forms.modelform_factory', 'modelform_factory', (['models.IssueCommentLink'], {'fields': "['cached_body']"}), "(models.IssueCommentLink, fields=['cached_b... |
""" The LaTex example was derived from: http://matplotlib.org/users/usetex.html
"""
from bokeh.models import Label
from bokeh.palettes import Spectral4
from bokeh.plotting import output_file, figure, show
import numpy as np
from scipy.special import jv
output_file('external_resources.html')
class LatexLabel(Label):... | [
"bokeh.plotting.show",
"bokeh.plotting.figure",
"numpy.arange",
"scipy.special.jv",
"bokeh.plotting.output_file"
] | [((256, 294), 'bokeh.plotting.output_file', 'output_file', (['"""external_resources.html"""'], {}), "('external_resources.html')\n", (267, 294), False, 'from bokeh.plotting import output_file, figure, show\n'), ((1856, 1972), 'bokeh.plotting.figure', 'figure', ([], {'title': '"""LaTex Extension Demonstration"""', 'plot... |
from django.conf.urls import url
from contact_forms.api import views
urlpatterns = [
url(r'^simple-contact/create/$', views.SimpleContactCreateAPIView.as_view(), name="simple-contact"),
url(r'^bug-report/create/$', views.BugReportCreateAPIView.as_view(), name="bug-report"),
url(r'^feedback/create/$', view... | [
"contact_forms.api.views.SimpleContactCreateAPIView.as_view",
"contact_forms.api.views.BugReportCreateAPIView.as_view",
"contact_forms.api.views.FeedbackCreateAPIView.as_view"
] | [((124, 166), 'contact_forms.api.views.SimpleContactCreateAPIView.as_view', 'views.SimpleContactCreateAPIView.as_view', ([], {}), '()\n', (164, 166), False, 'from contact_forms.api import views\n'), ((225, 263), 'contact_forms.api.views.BugReportCreateAPIView.as_view', 'views.BugReportCreateAPIView.as_view', ([], {}), ... |
from __future__ import absolute_import, division, unicode_literals
import re
from six.moves import zip
# FASTA
def read_fasta(infile, include_other_letters=False, return_headers=False):
sequences = []
if return_headers:
headers = []
currseq = []
for line in infile:
line = line.strip... | [
"re.sub",
"six.moves.zip"
] | [((1139, 1162), 'six.moves.zip', 'zip', (['headers', 'sequences'], {}), '(headers, sequences)\n', (1142, 1162), False, 'from six.moves import zip\n'), ((718, 745), 're.sub', 're.sub', (['"""[^ACGT]"""', '""""""', 'line'], {}), "('[^ACGT]', '', line)\n", (724, 745), False, 'import re\n')] |
# --------------
#Importing header files
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#Path of the file
path
#Code starts here
data = pd.read_csv(path)
data.rename(mapper={'Total':'Total_Medals'},axis=1,inplace=True)
print(data.head(10))
# --------------
#Code starts here
data['... | [
"matplotlib.pyplot.xticks",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"numpy.where",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots"
] | [((171, 188), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (182, 188), True, 'import pandas as pd\n'), ((1485, 1521), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(3)', '(1)'], {'figsize': '(14, 21)'}), '(3, 1, figsize=(14, 21))\n', (1497, 1521), True, 'import matplotlib.pyplot as plt\n'), ((3522, ... |
"""
k-fingerprinting attack.
First trains a random forest on the data.
Then using the training data, it extracts a set of fingerprints (which are the ID's of all of the leaves that were 'activated').
Finally, if we want to classify a new instance, we essentially extract the fingerprint using the random forest.
Next, w... | [
"sys.stdout.flush",
"sklearn.ensemble.RandomForestClassifier"
] | [((3395, 3409), 'sys.stdout.flush', 'stdout.flush', ([], {}), '()\n', (3407, 3409), False, 'from sys import stdout\n'), ((1370, 1442), 'sklearn.ensemble.RandomForestClassifier', 'RandomForestClassifier', ([], {'n_jobs': '(2)', 'n_estimators': 'num_trees', 'oob_score': '(True)'}), '(n_jobs=2, n_estimators=num_trees, oob... |
import os
import sys
from pathlib import Path
import django
currentPath = Path(os.getcwd())
sys.path.append(str(currentPath.parent.parent))
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'webview.settings')
django.setup()
from monitor.models import Fposition, Sposition
def f_save(angle,distance):
position = Fpo... | [
"os.environ.setdefault",
"django.setup",
"os.getcwd",
"monitor.models.Sposition.objects.create",
"monitor.models.Fposition.objects.create",
"monitor.models.Sposition.objects.all",
"monitor.models.Fposition.objects.all"
] | [((141, 208), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""webview.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'webview.settings')\n", (162, 208), False, 'import os\n'), ((209, 223), 'django.setup', 'django.setup', ([], {}), '()\n', (221, 223), False, 'import django\n'), (... |
from bricks_modeling.connectivity_graph import ConnectivityGraph
import numpy as np
from numpy import linalg as LA
import util.geometry_util as geo_util
from solvers.rigidity_solver.algo_core import (
spring_energy_matrix,
transform_matrix_fitting,
solve_rigidity
)
from solvers.rigidity_solver.internal_stru... | [
"util.geometry_util.subtract_orthobasis",
"solvers.rigidity_solver.internal_structure.structure_sampling",
"solvers.rigidity_solver.algo_core.spring_energy_matrix",
"numpy.linalg.norm",
"solvers.rigidity_solver.algo_core.transform_matrix_fitting",
"numpy.array",
"copy.deepcopy",
"util.geometry_util.tr... | [((551, 586), 'solvers.rigidity_solver.internal_structure.structure_sampling', 'structure_sampling', (['structure_graph'], {}), '(structure_graph)\n', (569, 586), False, 'from solvers.rigidity_solver.internal_structure import structure_sampling\n'), ((596, 660), 'solvers.rigidity_solver.algo_core.spring_energy_matrix',... |
'''
Contient les fonctions qui permettent d'afficher la grille de jeu ainsi que d'afficher correctectement le temps et
de permettre de sa déplacer dans la grille.
'''
from Colorama.colorama import *
from Fonctions import FinPartie
from Fonctions.Fonctions import *
def FormaterLigne(cases, ligne): # Afficher les lign... | [
"Fonctions.FinPartie.VerifierGrille"
] | [((4341, 4372), 'Fonctions.FinPartie.VerifierGrille', 'FinPartie.VerifierGrille', (['cases'], {}), '(cases)\n', (4365, 4372), False, 'from Fonctions import FinPartie\n')] |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 28 09:27:49 2020
@author: <NAME>
"""
import pickle
import pandas as pd
import numpy as np
from country import country
from scipy.integrate import solve_ivp
from scipy.optimize import minimize
from scipy.optimize import dual_annealing
from scipy.optimize i... | [
"numpy.clip",
"pandas.read_csv",
"numpy.polyfit",
"numpy.log",
"scipy.interpolate.interp1d",
"numpy.array",
"country_converter.convert",
"statsmodels.api.OLS",
"pandas.ExcelWriter",
"numpy.arange",
"scipy.ndimage.filters.uniform_filter1d",
"pandas.date_range",
"numpy.mean",
"pandas.to_date... | [((38757, 38775), 'pandas.DataFrame', 'pd.DataFrame', (['dict'], {}), '(dict)\n', (38769, 38775), True, 'import pandas as pd\n'), ((43864, 43893), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(10, 8)'}), '(figsize=(10, 8))\n', (43876, 43893), True, 'from matplotlib import pyplot as plt\n'), ((44258, ... |
import json
from libsaas import http, parsers
from libsaas.services import base
from . import (applications, application_hosts, application_instances,
key_transactions, servers, alert_policies,
notification_channels, users, plugins, components)
class NewRelic(base.Resource):
"""
... | [
"json.dumps",
"libsaas.services.base.resource",
"libsaas.http.Request"
] | [((965, 1004), 'libsaas.services.base.resource', 'base.resource', (['applications.Application'], {}), '(applications.Application)\n', (978, 1004), False, 'from libsaas.services import base\n'), ((1207, 1247), 'libsaas.services.base.resource', 'base.resource', (['applications.Applications'], {}), '(applications.Applicat... |
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Image(models.Model):
url = models.URLField(max_length=255)
snippet = models.TextField()
thumbnail = models.TextField()
context = models.TextField()
created = models.DateTimeField(auto_now_add=True... | [
"django.db.models.URLField",
"django.db.models.TextField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((135, 166), 'django.db.models.URLField', 'models.URLField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (150, 166), False, 'from django.db import models\n'), ((181, 199), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (197, 199), False, 'from django.db import models\n'), ((216, 234), 'dj... |
import numpy as np
from sklearn.datasets import load_iris
from sklearn.ensemble import RandomForestRegressor
iris = load_iris()
rf = RandomForestRegressor(random_state = 35)
from sklearn.model_selection import RandomizedSearchCV
X = iris.data
y = iris.target
n_estimators = [int(x) for x in np.linspace(start = 1, s... | [
"sklearn.datasets.load_iris",
"numpy.linspace",
"sklearn.ensemble.RandomForestRegressor",
"sklearn.model_selection.RandomizedSearchCV"
] | [((116, 127), 'sklearn.datasets.load_iris', 'load_iris', ([], {}), '()\n', (125, 127), False, 'from sklearn.datasets import load_iris\n'), ((133, 171), 'sklearn.ensemble.RandomForestRegressor', 'RandomForestRegressor', ([], {'random_state': '(35)'}), '(random_state=35)\n', (154, 171), False, 'from sklearn.ensemble impo... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Copyright (c) Megvii, Inc. and its affiliates.
import itertools
from typing import Optional
import numpy as np
import math
import paddle.distributed as dist
from paddle.io import Sampler, BatchSampler
class DistributedBatchSampler(BatchSampler):
def __init__(self,... | [
"paddle.distributed.get_rank",
"paddle.fluid.dygraph.parallel.ParallelEnv",
"paddle.distributed.get_world_size",
"numpy.random.seed",
"numpy.random.RandomState",
"numpy.arange",
"numpy.random.permutation"
] | [((3615, 3632), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (3629, 3632), True, 'import numpy as np\n'), ((6203, 6218), 'paddle.distributed.get_rank', 'dist.get_rank', ([], {}), '()\n', (6216, 6218), True, 'import paddle.distributed as dist\n'), ((6246, 6267), 'paddle.distributed.get_world_size', 'di... |
# Copyright 2018 AT&T Intellectual Property. All other 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... | [
"logging.getLogger",
"math.ceil",
"configparser.ConfigParser",
"shipyard_airflow.plugins.xcom_puller.XcomPuller",
"datetime.datetime.now",
"shipyard_airflow.plugins.get_k8s_logs.get_pod_logs"
] | [((1259, 1286), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1276, 1286), False, 'import logging\n'), ((3349, 3363), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (3361, 3363), False, 'from datetime import datetime\n'), ((3854, 3881), 'configparser.ConfigParser', 'configpa... |
import cv2
import time # Remove Later
import numpy as np
video = cv2.VideoCapture("./img/vert2.mp4")
target_low = (0, 0, 0)
target_high = (50, 50, 50)
while True:
ret, frame = video.read()
if not ret:
video = cv2.VideoCapture("./img/vert2.mp4")
continue
image = frame
image = cv2.resiz... | [
"cv2.rectangle",
"cv2.drawContours",
"numpy.ones",
"cv2.dilate",
"cv2.inRange",
"cv2.erode",
"cv2.line",
"time.sleep",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.resize",
"cv2.GaussianBlur",
"cv2.waitKey",
"cv2.boundingRect"
] | [((66, 101), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""./img/vert2.mp4"""'], {}), "('./img/vert2.mp4')\n", (82, 101), False, 'import cv2\n'), ((1154, 1168), 'cv2.waitKey', 'cv2.waitKey', (['(0)'], {}), '(0)\n', (1165, 1168), False, 'import cv2\n'), ((1169, 1192), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([... |
# -*- coding: utf-8 -*-
##########################################################################
# pySAP - Copyright (C) CEA, 2017 - 2018
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-e... | [
"pysap.Image",
"pysap.base.utils.flatten",
"numpy.asarray",
"pysap.base.utils.unflatten",
"pysap.load_transform",
"numpy.zeros",
"numpy.linalg.norm"
] | [((1312, 1346), 'pysap.load_transform', 'pysap.load_transform', (['wavelet_name'], {}), '(wavelet_name)\n', (1332, 1346), False, 'import pysap\n'), ((2021, 2058), 'pysap.base.utils.flatten', 'flatten', (['self.transform.analysis_data'], {}), '(self.transform.analysis_data)\n', (2028, 2058), False, 'from pysap.base.util... |
# -*- coding: utf-8 -*-
import os
import importlib
from kivyic import path
dic = {}
# print a summary of each .py file in the module
# list file name, __all__ and __version__
for file in [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))]:
if file.split('.')[1] == 'py' and file != '__init__.py'... | [
"os.listdir",
"os.path.join"
] | [((201, 217), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (211, 217), False, 'import os\n'), ((236, 257), 'os.path.join', 'os.path.join', (['path', 'f'], {}), '(path, f)\n', (248, 257), False, 'import os\n')] |
#coding: utf-8
import hashlib
import json
def hash_output(output):
output = json.loads(output)
hash_input = ""
hash_input += output["_updateDate_min"] + "," + output["_updateDate_max"]
hash_input += json.dumps(output['timetable'], sort_keys=True) #Fails reindexing
#hash_input += json.dumps(output['teachers'], sor... | [
"json.loads",
"json.dumps"
] | [((78, 96), 'json.loads', 'json.loads', (['output'], {}), '(output)\n', (88, 96), False, 'import json\n'), ((204, 251), 'json.dumps', 'json.dumps', (["output['timetable']"], {'sort_keys': '(True)'}), "(output['timetable'], sort_keys=True)\n", (214, 251), False, 'import json\n'), ((367, 410), 'json.dumps', 'json.dumps',... |
import os
import time
from setuptools import setup, find_packages
from io import open
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
with open('README.rst', encoding='utf-8') as f:
long_description = f.read()
if os.path.exists("./VERSION"... | [
"os.path.exists",
"setuptools.find_packages",
"io.open",
"os.path.abspath",
"time.gmtime"
] | [((294, 321), 'os.path.exists', 'os.path.exists', (['"""./VERSION"""'], {}), "('./VERSION')\n", (308, 321), False, 'import os\n'), ((215, 251), 'io.open', 'open', (['"""README.rst"""'], {'encoding': '"""utf-8"""'}), "('README.rst', encoding='utf-8')\n", (219, 251), False, 'from io import open\n'), ((415, 428), 'time.gm... |
from copy import copy, deepcopy
import numpy as np
from unittest import TestCase
from transition_system.arc_eager import ArcEager, ArcEagerDynamicOracle
def generate_all_projective_parses(size):
arc_eager = ArcEager(1)
initial = arc_eager.state(size)
stack = []
stack.append(initial)
parses = set... | [
"numpy.zeros",
"transition_system.arc_eager.ArcEagerDynamicOracle",
"transition_system.arc_eager.ArcEager",
"copy.deepcopy"
] | [((214, 225), 'transition_system.arc_eager.ArcEager', 'ArcEager', (['(1)'], {}), '(1)\n', (222, 225), False, 'from transition_system.arc_eager import ArcEager, ArcEagerDynamicOracle\n'), ((814, 860), 'numpy.zeros', 'np.zeros', (['(num_tokens, num_tokens)'], {'dtype': 'bool'}), '((num_tokens, num_tokens), dtype=bool)\n'... |
from unittest.mock import patch
from powerline_ifinfo import ifinfo
@patch("ifcfg.interfaces")
def test_interface_up(mock_interfaces):
mock_interfaces.return_value = {
"en0": {
"device": "en0",
"status": "active",
}
}
result = ifinfo.interface_up(None, "en0")
a... | [
"powerline_ifinfo.ifinfo.default_interface",
"unittest.mock.patch",
"powerline_ifinfo.ifinfo.interface_up"
] | [((72, 97), 'unittest.mock.patch', 'patch', (['"""ifcfg.interfaces"""'], {}), "('ifcfg.interfaces')\n", (77, 97), False, 'from unittest.mock import patch\n'), ((1484, 1516), 'unittest.mock.patch', 'patch', (['"""ifcfg.default_interface"""'], {}), "('ifcfg.default_interface')\n", (1489, 1516), False, 'from unittest.mock... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
""" A Flask server for MARO Node API Server.
Hosted by gunicorn at systemd.
"""
from flask import Flask
from .blueprints.containers import blueprint as container_blueprint
from .blueprints.status import blueprint as status_blueprint
app = Fl... | [
"flask.Flask"
] | [((318, 333), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (323, 333), False, 'from flask import Flask\n')] |
import sqlite3
conn = sqlite3.connect('rpg_db.sqlite3')
curs = conn.cursor()
count_characters = 'SELECT COUNT(*) FROM charactercreator_character;'
print(curs.execute(count_characters).fetchall() [0][0])
query = '''SELECT character_id, COUNT(distinct item_id)
FROM charactercreator_character_inventory
... | [
"sqlite3.connect"
] | [((23, 56), 'sqlite3.connect', 'sqlite3.connect', (['"""rpg_db.sqlite3"""'], {}), "('rpg_db.sqlite3')\n", (38, 56), False, 'import sqlite3\n')] |
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for
# full license information.
import time
import base64
import sys
sys.path.insert(0, "..")
import asyncio
from azure.iot.device.aio import IoTHubModuleClient
from azure.iot.device import MethodRespo... | [
"sys.path.insert",
"base64.b64decode",
"azure.iot.device.aio.IoTHubModuleClient.create_from_edge_environment",
"asyncio.gather",
"time.process_time",
"azure.iot.device.MethodResponse.create_from_method_request"
] | [((188, 212), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (203, 212), False, 'import sys\n'), ((359, 378), 'time.process_time', 'time.process_time', ([], {}), '()\n', (376, 378), False, 'import time\n'), ((5665, 5684), 'time.process_time', 'time.process_time', ([], {}), '()\n', (5682... |
"""Test module for the user profile endpoint"""
import os
import pytest
from unittest.mock import Mock
from tempfile import NamedTemporaryFile
from django.urls import resolve, reverse
from django.core.files.uploadedfile import SimpleUploadedFile
from rest_framework.test import APIClient
import cloudinary.uploader
fr... | [
"PIL.Image.open",
"unittest.mock.Mock",
"os.path.join",
"rest_framework.test.APIClient",
"tempfile.NamedTemporaryFile",
"django.urls.reverse",
"os.path.abspath",
"django.urls.resolve"
] | [((545, 568), 'django.urls.reverse', 'reverse', (['"""user:profile"""'], {}), "('user:profile')\n", (552, 568), False, 'from django.urls import resolve, reverse\n'), ((589, 610), 'django.urls.reverse', 'reverse', (['"""user:photo"""'], {}), "('user:photo')\n", (596, 610), False, 'from django.urls import resolve, revers... |
from rest_framework.routers import DefaultRouter
from chat.views import ChatViewSet
chats_router = DefaultRouter()
chats_router.register(r'', ChatViewSet, basename='chats')
urlpatterns = chats_router.urls
| [
"rest_framework.routers.DefaultRouter"
] | [((101, 116), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (114, 116), False, 'from rest_framework.routers import DefaultRouter\n')] |
# -*- coding: utf-8 -*-
"""Build FastAPI applications for mlflow model predictions.
Copyright (C) 2022, Auto Trader UK
"""
from inspect import signature
from fastapi import FastAPI
from mlflow.pyfunc import PyFuncModel # type: ignore
from fastapi_mlflow.predictors import build_predictor
def build_app(pyfunc_mode... | [
"fastapi_mlflow.predictors.build_predictor",
"fastapi.FastAPI",
"inspect.signature"
] | [((421, 430), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (428, 430), False, 'from fastapi import FastAPI\n'), ((447, 476), 'fastapi_mlflow.predictors.build_predictor', 'build_predictor', (['pyfunc_model'], {}), '(pyfunc_model)\n', (462, 476), False, 'from fastapi_mlflow.predictors import build_predictor\n'), ((498... |
import unittest
import mock
import os
from tornado.web import StaticFileHandler
import sandstone
from sandstone.app import SandstoneApplication
from sandstone.lib import ui_methods
from sandstone.lib.handlers.main import MainHandler
from sandstone.lib.handlers.pam_auth import PAMLoginHandler
from sandstone import sett... | [
"mock.patch",
"os.path.join",
"sandstone.app.SandstoneApplication"
] | [((732, 779), 'mock.patch', 'mock.patch', (['"""sandstone.settings.URL_PREFIX"""', '""""""'], {}), "('sandstone.settings.URL_PREFIX', '')\n", (742, 779), False, 'import mock\n'), ((784, 847), 'mock.patch', 'mock.patch', (['"""sandstone.settings.INSTALLED_APPS"""', 'INSTALLED_APPS'], {}), "('sandstone.settings.INSTALLED... |
import tensorflow as tf
from absl import flags
from absl import app
from absl import logging
from tokenization import FullTokenizer
from tokenization_en import load_subword_vocab
from transformer import Transformer, FileConfig
FLAGS = flags.FLAGS
MODEL_DIR = "/Users/livingmagic/Documents/deeplearning/models/bert-nmt... | [
"tensorflow.random.uniform",
"tensorflow.equal",
"tensorflow.shape",
"tensorflow.ones",
"absl.flags.DEFINE_integer",
"transformer.Transformer",
"absl.flags.mark_flag_as_required",
"absl.app.run",
"tensorflow.concat",
"tensorflow.argmax",
"transformer.FileConfig",
"tokenization.FullTokenizer",
... | [((347, 446), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""bert_config_file"""', "(MODEL_DIR + 'bert_config.json')", '"""The bert config file"""'], {}), "('bert_config_file', MODEL_DIR + 'bert_config.json',\n 'The bert config file')\n", (366, 446), False, 'from absl import flags\n'), ((443, 569), 'absl.f... |
import os
from subprocess import PIPE, call # noqa
import tempfile
import aiger
from aiger_analysis.common import extract_aig
def simplify(e, verbose=False):
# avoids confusion and guarantees deletion on exit
with tempfile.TemporaryDirectory() as tmpdirname:
aag_name = os.path.join(tmpdirname, 'inpu... | [
"tempfile.TemporaryDirectory",
"os.path.join",
"aiger.parser.load",
"subprocess.call",
"aiger_analysis.common.extract_aig"
] | [((226, 255), 'tempfile.TemporaryDirectory', 'tempfile.TemporaryDirectory', ([], {}), '()\n', (253, 255), False, 'import tempfile\n'), ((290, 327), 'os.path.join', 'os.path.join', (['tmpdirname', '"""input.aag"""'], {}), "(tmpdirname, 'input.aag')\n", (302, 327), False, 'import os\n'), ((441, 478), 'os.path.join', 'os.... |
#
# Python script to get the list of virtual addresses in an Identity Pool
#
# _author_ = <NAME> <<EMAIL>>
#
# Copyright (c) 2021 Dell EMC Corporation
#
# 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 Li... | [
"traceback.format_exc",
"requests.packages.urllib3.disable_warnings",
"argparse.ArgumentParser",
"json.dumps",
"requests.get",
"requests.delete",
"ast.literal_eval",
"urllib3.disable_warnings"
] | [((1641, 1708), 'urllib3.disable_warnings', 'urllib3.disable_warnings', (['urllib3.exceptions.InsecureRequestWarning'], {}), '(urllib3.exceptions.InsecureRequestWarning)\n', (1665, 1708), False, 'import urllib3\n'), ((1781, 1847), 'requests.packages.urllib3.disable_warnings', 'requests.packages.urllib3.disable_warnings... |
import copy
import os
import cv2
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
from PIL import Image
import img2cmplx as i2c
MPEG7_DATA = os.path.join('tests','data', 'mpeg7.png')
EMNIST_DATA = os.path.join('tests','data', 'emnist.png')
def store_an_mpeg7():
fname = os.path.join('d... | [
"cv2.imwrite",
"cv2.drawContours",
"matplotlib.pyplot.savefig",
"img2cmplx.io.EMNISTReader",
"matplotlib.pyplot.clf",
"os.path.join",
"img2cmplx.io.MPEG7Reader",
"networkx.get_node_attributes",
"cv2.imread"
] | [((170, 212), 'os.path.join', 'os.path.join', (['"""tests"""', '"""data"""', '"""mpeg7.png"""'], {}), "('tests', 'data', 'mpeg7.png')\n", (182, 212), False, 'import os\n'), ((226, 269), 'os.path.join', 'os.path.join', (['"""tests"""', '"""data"""', '"""emnist.png"""'], {}), "('tests', 'data', 'emnist.png')\n", (238, 26... |
from app import db
class Provider(db.Model):
__tablename__ = 'providers'
id = db.Column(db.Integer, nullable=False,
autoincrement=True, primary_key=True)
name = db.Column(db.String, nullable=False)
speciality = db.Column(db.String)
address = db.Column(db.String, nullable=False)... | [
"app.db.Column",
"app.db.CheckConstraint"
] | [((89, 164), 'app.db.Column', 'db.Column', (['db.Integer'], {'nullable': '(False)', 'autoincrement': '(True)', 'primary_key': '(True)'}), '(db.Integer, nullable=False, autoincrement=True, primary_key=True)\n', (98, 164), False, 'from app import db\n'), ((195, 231), 'app.db.Column', 'db.Column', (['db.String'], {'nullab... |
import cv2
import winsound
video = cv2.VideoCapture(0)
facedetect = cv2.CascadeClassifier(r'\mask_detection.xml')
count = 0
while True:
ret, frame = video.read()
faces = facedetect.detectMultiScale(frame, 1.3, 5)
for x, y, w, h in faces:
count = count + 1
winsound.PlaySound(r'\alert.wav', winsound.SND_ASYNC)
c... | [
"cv2.rectangle",
"cv2.imshow",
"cv2.putText",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.CascadeClassifier",
"winsound.PlaySound",
"cv2.waitKey"
] | [((35, 54), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (51, 54), False, 'import cv2\n'), ((68, 113), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""\\\\mask_detection.xml"""'], {}), "('\\\\mask_detection.xml')\n", (89, 113), False, 'import cv2\n'), ((581, 604), 'cv2.destroyAllWindows', 'cv... |
import datetime
import pytest
from star.models import Location
def round_datetime(dt, dateDelta=datetime.timedelta(minutes=1)):
"""Round a datetime object to a multiple of a timedelta
dt : datetime.datetime object, default now.
dateDelta : timedelta object, we round to a multiple of this, default 1
... | [
"datetime.datetime",
"star.models.Location",
"pytest.mark.parametrize",
"datetime.date",
"datetime.timedelta"
] | [((760, 845), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""sunset"""', '[[2016, 2, 16, 17, 58], [2015, 6, 16, 20, 34]]'], {}), "('sunset', [[2016, 2, 16, 17, 58], [2015, 6, 16, 20,\n 34]])\n", (783, 845), False, 'import pytest\n'), ((1188, 1266), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (... |
# pyright: strict
import random
from typing import Tuple, Optional, List
from .common import Player, PhaseBase
from ..card import Shape, Card, Joker, NormalCard
class PledgePhase(PhaseBase):
def __init__(self, min_count: int = 13, start_player: Player = 0, hands: Optional[List[List[Card]]] = None) -> None:
... | [
"random.shuffle"
] | [((542, 563), 'random.shuffle', 'random.shuffle', (['cards'], {}), '(cards)\n', (556, 563), False, 'import random\n')] |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2015, <NAME>
Contributed by <NAME> (<EMAIL>)
This file is part of BSD license
<https://opensource.org/licenses/BSD-3-Clause>
"""
import os
import datetime
import re
import json
import logging
from scrapy import Selector
from cameo.utility import Utility
from cameo.mod.yuwei.ut... | [
"os.path.exists",
"scrapy.Selector",
"datetime.datetime.strptime",
"re.match",
"cameo.mod.yuwei.utility.scrapyUtility.scrapyUtility.getRetailPrice",
"os.mkdir",
"os.path.basename",
"cameo.utility.Utility",
"re.sub",
"datetime.timedelta",
"logging.info",
"re.search"
] | [((501, 510), 'cameo.utility.Utility', 'Utility', ([], {}), '()\n', (508, 510), False, 'from cameo.utility import Utility\n'), ((3301, 3342), 're.match', 're.match', (['u"""^([0-9]*)人$"""', 'strRewardBacker'], {}), "(u'^([0-9]*)人$', strRewardBacker)\n", (3309, 3342), False, 'import re\n'), ((3493, 3556), 're.match', 'r... |
import argparse
import datetime
import netrc
import os
import subprocess
import threading
import time
import typing
import google.auth
import googleapiclient.discovery
from src.context import DataContext
TIMEOUT_MULTIPLIER = 10
API = googleapiclient.discovery.build('tpu', 'v1')
_, PROJECT = google.auth.default()
OL... | [
"argparse.ArgumentParser",
"netrc.netrc",
"time.sleep",
"threading.Semaphore",
"datetime.datetime.now",
"subprocess.call",
"os.system",
"src.context.DataContext.path.replace",
"time.time",
"threading.Thread",
"os.remove"
] | [((334, 370), 'src.context.DataContext.path.replace', 'DataContext.path.replace', (['"""/"""', '"""\\\\/"""'], {}), "('/', '\\\\/')\n", (358, 370), False, 'from src.context import DataContext\n'), ((1431, 1539), 'os.system', 'os.system', (['f"""gcloud alpha compute tpus tpu-vm scp {host} ubuntu@{host}:~/{filename} --zo... |
import struct
from .utilites import unpack_bitstring, pack_bitstring
# from six import int2byte, byte2int
# class ReadRegistersRequestBase(ModbusRequest):
class ReadRegistersRequestBase:
'''
Base class for reading a modbus register
'''
_rtu_frame_size = 8
function_code = None
def __init__(sel... | [
"struct.unpack",
"struct.pack"
] | [((924, 968), 'struct.pack', 'struct.pack', (['""">HH"""', 'self.address', 'self.count'], {}), "('>HH', self.address, self.count)\n", (935, 968), False, 'import struct\n'), ((1134, 1160), 'struct.unpack', 'struct.unpack', (['""">HH"""', 'data'], {}), "('>HH', data)\n", (1147, 1160), False, 'import struct\n'), ((4744, 4... |
"""
DNN Modules
The feed backward will be completed in the batch-wise operation
"""
import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from qtorch.quant import float_quantize
from torch.nn import init
from .function import *
class Conv2d(nn.Modul... | [
"torch.nn.functional.linear",
"torch.nn.functional.conv2d",
"torch.nn.functional.mse_loss",
"numpy.sqrt",
"torch.nn.init.ones_",
"torch.Tensor",
"torch.sqrt",
"torch.nn.init.zeros_",
"qtorch.quant.float_quantize",
"torch.matmul",
"torch.flip",
"torch.nn.functional.relu",
"torch.zeros_like",
... | [((1376, 1397), 'numpy.sqrt', 'np.sqrt', (['(2.0 / fan_in)'], {}), '(2.0 / fan_in)\n', (1383, 1397), True, 'import numpy as np\n'), ((4549, 4580), 'torch.flip', 'torch.flip', (['self.weight', '[2, 3]'], {}), '(self.weight, [2, 3])\n', (4559, 4580), False, 'import torch\n'), ((4642, 4715), 'torch.nn.functional.conv2d', ... |
from __future__ import division
import numpy as np
import scipy.stats as st
from numpy.testing import assert_array_almost_equal
from tensorprob import (
Exponential,
MigradOptimizer,
Mix2,
Mix3,
MixN,
Model,
Normal,
Parameter,
Poisson
)
def test_mix2_fit():
with Model() as mo... | [
"scipy.stats.expon.pdf",
"numpy.random.exponential",
"scipy.stats.norm.cdf",
"numpy.testing.assert_array_almost_equal",
"tensorprob.Exponential",
"tensorprob.Poisson",
"tensorprob.Normal",
"numpy.linspace",
"numpy.random.seed",
"numpy.concatenate",
"numpy.random.normal",
"tensorprob.Mix2",
"... | [((809, 827), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (823, 827), True, 'import numpy as np\n'), ((844, 877), 'numpy.random.exponential', 'np.random.exponential', (['(10)', '(200000)'], {}), '(10, 200000)\n', (865, 877), True, 'import numpy as np\n'), ((1032, 1063), 'numpy.random.normal', 'np.r... |