code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""
A class for loading neural networks in nnet format, as described in the readme.
The nnet format used is a slightly modified version of the ACAS Xu format (https://github.com/sisl/NNet).
Author: <NAME> <<EMAIL>>
"""
import numpy as np
import torch
import torch.nn as nn
from src.neural_networks.verinet_nn import ... | [
"torch.nn.Sigmoid",
"torch.nn.ReLU",
"numpy.prod",
"torch.nn.BatchNorm2d",
"torch.nn.Tanh",
"torch.nn.Sequential",
"numpy.float64",
"torch.Tensor",
"src.neural_networks.verinet_nn.VeriNetNN",
"torch.nn.Conv2d",
"numpy.array",
"numpy.empty",
"torch.nn.Linear",
"torch.FloatTensor",
"numpy.... | [((9765, 9794), 'numpy.empty', 'np.empty', (['(out_size, in_size)'], {}), '((out_size, in_size))\n', (9773, 9794), True, 'import numpy as np\n'), ((9810, 9828), 'numpy.empty', 'np.empty', (['out_size'], {}), '(out_size)\n', (9818, 9828), True, 'import numpy as np\n'), ((10700, 10827), 'numpy.empty', 'np.empty', (["(con... |
import cv2
from matplotlib import pyplot as plt
src=cv2.imread("Lenna.png",cv2.IMREAD_GRAYSCALE)
plt.title("Original Image")
plt.imshow(src,cmap='gray')
plt.show()
thresh=150
maxValue=255
th,img1=cv2.threshold(src,thresh,maxValue,cv2.THRESH_BINARY)
plt.title("Fixed Threshold")
plt.imshow(img1,cmap='gray')
plt.show()... | [
"matplotlib.pyplot.imshow",
"cv2.threshold",
"cv2.adaptiveThreshold",
"matplotlib.pyplot.title",
"cv2.imread",
"matplotlib.pyplot.show"
] | [((53, 98), 'cv2.imread', 'cv2.imread', (['"""Lenna.png"""', 'cv2.IMREAD_GRAYSCALE'], {}), "('Lenna.png', cv2.IMREAD_GRAYSCALE)\n", (63, 98), False, 'import cv2\n'), ((98, 125), 'matplotlib.pyplot.title', 'plt.title', (['"""Original Image"""'], {}), "('Original Image')\n", (107, 125), True, 'from matplotlib import pypl... |
#!/usr/bin/env python
from io import DEFAULT_BUFFER_SIZE
import subprocess
import shutil
import copy
import argparse
import datetime
import hashlib
import json
import logging
import os
import re
import sys
import time
from dataclasses import asdict, dataclass, field
from typing import Optional
from collections import ... | [
"logging.getLogger",
"re.compile",
"copy.copy",
"hashlib.sha1",
"os.walk",
"os.remove",
"dataclasses.asdict",
"argparse.ArgumentParser",
"subprocess.Popen",
"os.path.isdir",
"os.mkdir",
"dataclasses.field",
"os.rename",
"os.path.dirname",
"shutil.copyfile",
"logging.getLevelName",
"t... | [((406, 433), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (423, 433), False, 'import logging\n'), ((17557, 17577), 're.compile', 're.compile', (['"""^\\\\w+$"""'], {}), "('^\\\\w+$')\n", (17567, 17577), False, 'import re\n'), ((3104, 3131), 'dataclasses.field', 'field', ([], {'default_... |
import urllib2
import json
class Freegeoip(object):
#example response
#{"ip":"172.16.17.32",
# "country_code":"AU",
# "country_name":"Australia",
# "region_code":"QLD",
# "region_name":"Queensland",
# "city":"Brisbane",
# "zip_code":"4101",
# "time_zone":"Australia/Brisbane",
#... | [
"json.loads",
"urllib2.urlopen"
] | [((1122, 1142), 'urllib2.urlopen', 'urllib2.urlopen', (['url'], {}), '(url)\n', (1137, 1142), False, 'import urllib2\n'), ((1196, 1219), 'json.loads', 'json.loads', (['json_string'], {}), '(json_string)\n', (1206, 1219), False, 'import json\n')] |
import unittest
import numpy as np
from numpy import array
from bruges.models import reconcile, interpolate, panel
from bruges.models import wedge
class ModelTest(unittest.TestCase):
"""
Tests models.
"""
def test_reconcile(self):
a = np.array([2, 6, 7, 7, 3])
b = np.array([3, 7, 3])
... | [
"numpy.allclose",
"unittest.TextTestRunner",
"bruges.models.wedge",
"numpy.array",
"bruges.models.panel",
"numpy.array_equal",
"numpy.isnan",
"numpy.all",
"bruges.models.reconcile",
"bruges.models.interpolate",
"unittest.TestLoader"
] | [((262, 287), 'numpy.array', 'np.array', (['[2, 6, 7, 7, 3]'], {}), '([2, 6, 7, 7, 3])\n', (270, 287), True, 'import numpy as np\n'), ((300, 319), 'numpy.array', 'np.array', (['[3, 7, 3]'], {}), '([3, 7, 3])\n', (308, 319), True, 'import numpy as np\n'), ((335, 359), 'bruges.models.reconcile', 'reconcile', (['a', 'b'],... |
from django.urls import path
from youtube_search_api import views
urlpatterns = [
path('', views.index, name='index'),
path('search/', views.search, name='index')
]
| [
"django.urls.path"
] | [((87, 122), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (91, 122), False, 'from django.urls import path\n'), ((128, 171), 'django.urls.path', 'path', (['"""search/"""', 'views.search'], {'name': '"""index"""'}), "('search/', views.search, name=... |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 23 12:22:37 2020
@author: ninjaac
"""
#############################################################################################
#Array manupulation
"""def matchingStrings(s, q):
for query in q:
lenth = 0
for strings in s:
... | [
"numpy.zeros"
] | [((827, 852), 'numpy.zeros', 'np.zeros', (['(10)'], {'dtype': '"""int"""'}), "(10, dtype='int')\n", (835, 852), True, 'import numpy as np\n')] |
#
# Copyright (c) 2016 - 2022 Deephaven Data Labs and Patent Pending
#
""" Utilities for gathering Deephaven table data into Python objects """
import enum
from typing import Any, Type
import jpy
import numpy as np
from deephaven import DHError
_JGatherer = jpy.get_type("io.deephaven.integrations.learn.gather.Num... | [
"numpy.frombuffer",
"jpy.get_type",
"deephaven.DHError"
] | [((264, 324), 'jpy.get_type', 'jpy.get_type', (['"""io.deephaven.integrations.learn.gather.NumPy"""'], {}), "('io.deephaven.integrations.learn.gather.NumPy')\n", (276, 324), False, 'import jpy\n'), ((2727, 2763), 'numpy.frombuffer', 'np.frombuffer', (['buffer'], {'dtype': 'np_type'}), '(buffer, dtype=np_type)\n', (2740... |
import json
json_in='instances_test.json'
json_out=json_in.replace('.json','_sub.json')
with open(json_in) as f:
data=json.load(f)
new_data={}
new_data['info']=data['info']
new_data['licences']=data['licences']
new_data['categories']=data['categories']
images_subset=data['images'][:50]
images_subset_id=[]
for ... | [
"json.load",
"json.dump"
] | [((124, 136), 'json.load', 'json.load', (['f'], {}), '(f)\n', (133, 136), False, 'import json\n'), ((675, 727), 'json.dump', 'json.dump', (['new_data', 'f'], {'indent': '(4)', 'ensure_ascii': '(False)'}), '(new_data, f, indent=4, ensure_ascii=False)\n', (684, 727), False, 'import json\n')] |
from enum import Enum
from nltk.stem import PorterStemmer
from namex.constants import EntityTypes, DesignationPositionCodes
porter = PorterStemmer()
# Limit number of words to analyse
# TODO: We can set this to three later (in PROD), but this is way easier to test with a higher max limit
# eg. I can easily test for ... | [
"nltk.stem.PorterStemmer"
] | [((135, 150), 'nltk.stem.PorterStemmer', 'PorterStemmer', ([], {}), '()\n', (148, 150), False, 'from nltk.stem import PorterStemmer\n')] |
from random import randint
import os
# This class define the entire game board
# It will be used to create two boards, one for storing what the player sees and one for storing the underlying mines and mine numbers around a given block
# I'm new to classes in python (or anywhere else), so this file will be heavily comme... | [
"os.system",
"random.randint"
] | [((3712, 3730), 'os.system', 'os.system', (['"""clear"""'], {}), "('clear')\n", (3721, 3730), False, 'import os\n'), ((3774, 3790), 'os.system', 'os.system', (['"""cls"""'], {}), "('cls')\n", (3783, 3790), False, 'import os\n'), ((1493, 1529), 'random.randint', 'randint', (['(1)', '(self.width * self.height)'], {}), '(... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from sentry.testutils import TestCase, fixture
from sentry.interfaces import Query
class QueryTest(TestCase):
@fixture
def interface(self):
return Query(query='SELECT 1', engine='psycopg2')
def test_serialize_behavior(self):
... | [
"sentry.interfaces.Query"
] | [((230, 272), 'sentry.interfaces.Query', 'Query', ([], {'query': '"""SELECT 1"""', 'engine': '"""psycopg2"""'}), "(query='SELECT 1', engine='psycopg2')\n", (235, 272), False, 'from sentry.interfaces import Query\n')] |
#!/usr/bin/env python3
"""tests for max_rep.py"""
from subprocess import getstatusoutput, getoutput
import os
import random
import re
import string
import max_rep
prg = "./max_rep.py"
# --------------------------------------------------
def test_usage():
"""usage"""
rv1, out1 = getstatusoutput(prg)
asser... | [
"re.match",
"subprocess.getstatusoutput"
] | [((290, 310), 'subprocess.getstatusoutput', 'getstatusoutput', (['prg'], {}), '(prg)\n', (305, 310), False, 'from subprocess import getstatusoutput, getoutput\n'), ((341, 379), 're.match', 're.match', (['"""usage"""', 'out1', 're.IGNORECASE'], {}), "('usage', out1, re.IGNORECASE)\n", (349, 379), False, 'import re\n'), ... |
"""
The module implements metrics computation
based on Understand API
in three level of classes, files, and packages.
"""
__version__ = '0.1.0'
__author__ = 'Morteza'
import sys
import logging
logging.basicConfig(level=logging.DEBUG)
import progressbar
# -------------------
# For Windows os
# https://scitools.com/... | [
"logging.basicConfig",
"sys.path.insert",
"progressbar.progressbar",
"understand.open"
] | [((197, 237), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (216, 237), False, 'import logging\n'), ((540, 607), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""D:/program files/scitools/bin/pc-win64/python"""'], {}), "(0, 'D:/program files/scitools/bin/pc... |
import os
import torch
import pandas as pd
import numpy as np
import datetime
from tabulate import tabulate
def get_timestamp():
return datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
def rename(name):
"""
Sets a new `__name__`.
"""
def decorator(f):
f.__name__ = name
return f
... | [
"pandas.DataFrame",
"tabulate.tabulate",
"os.path.join",
"datetime.datetime.now"
] | [((942, 1013), 'os.path.join', 'os.path.join', (['output_dir', "('%d_%d_predictions.csv' % (r_shuffle, r_seed))"], {}), "(output_dir, '%d_%d_predictions.csv' % (r_shuffle, r_seed))\n", (954, 1013), False, 'import os\n'), ((398, 449), 'tabulate.tabulate', 'tabulate', (['df'], {'headers': '"""keys"""', 'tablefmt': 'table... |
import os
import numpy as np
import tensorflow as tf
from depth.self_supervised_sfm.utils import readlines
AUTOTUNE = tf.data.experimental.AUTOTUNE
########################
# Constants
#########################
KITTI_K = np.array([[0.58, 0, 0.5, 0], # fx/width
[0, 1.92, 0.5, 0],
... | [
"tensorflow.random.uniform",
"os.path.exists",
"tensorflow.image.decode_png",
"tensorflow.data.Dataset.from_tensor_slices",
"tensorflow.image.resize",
"tensorflow.convert_to_tensor",
"tensorflow.io.read_file",
"os.path.join",
"tensorflow.linalg.inv",
"numpy.array",
"os.path.isdir",
"depth.self... | [((225, 321), 'numpy.array', 'np.array', (['[[0.58, 0, 0.5, 0], [0, 1.92, 0.5, 0], [0, 0, 1, 0], [0, 0, 0, 1]]'], {'dtype': 'np.float'}), '([[0.58, 0, 0.5, 0], [0, 1.92, 0.5, 0], [0, 0, 1, 0], [0, 0, 0, 1]],\n dtype=np.float)\n', (233, 321), True, 'import numpy as np\n'), ((1276, 1295), 'depth.self_supervised_sfm.ut... |
from re import A
import boto3
import botocore
import click
import configparser
from csv import DictWriter
import io
import itertools
import json
import mimetypes
import os
import re
import sys
import textwrap
from . import policies
def bucket_exists(s3, bucket):
try:
s3.head_bucket(Bucket=bucket)
... | [
"csv.DictWriter",
"click.Choice",
"boto3.client",
"configparser.ConfigParser",
"re.compile",
"click.File",
"click.echo",
"click.ClickException",
"sys.stdin.buffer.read",
"click.progressbar",
"mimetypes.guess_type",
"click.group",
"click.option",
"json.dumps",
"click.argument",
"json.lo... | [((1725, 1738), 'click.group', 'click.group', ([], {}), '()\n', (1736, 1738), False, 'import click\n'), ((1740, 1762), 'click.version_option', 'click.version_option', ([], {}), '()\n', (1760, 1762), False, 'import click\n'), ((3567, 3617), 'click.argument', 'click.argument', (['"""buckets"""'], {'nargs': '(-1)', 'requi... |
import unittest
import unittest.mock
from programy.extensions.base import Extension
class MockExtension(Extension):
def execute(self,context, data):
raise NotImplementedError()
class ExtensionTests(unittest.TestCase):
def test_ensure_not_implemented(self):
bot = unittest.mock.Mock()
... | [
"unittest.mock.Mock"
] | [((295, 315), 'unittest.mock.Mock', 'unittest.mock.Mock', ([], {}), '()\n', (313, 315), False, 'import unittest\n')] |
import os
config = {
'project_path': os.getcwd() + '/../openfoam/run/Airfoil2D_full/'
} | [
"os.getcwd"
] | [((42, 53), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (51, 53), False, 'import os\n')] |
from ast import literal_eval
from textwrap import dedent
from aqt import mw
from aqt.utils import showInfo
from PyQt5.QtCore import QEvent, Qt
from PyQt5.QtWidgets import (QCompleter, QDialog, QGroupBox, QLabel, QLineEdit,
QPushButton, QVBoxLayout)
from . import beeline
from .anki_util im... | [
"textwrap.dedent",
"PyQt5.QtWidgets.QLineEdit",
"aqt.mw.beeline_dialog.show",
"aqt.mw.app.activeWindow",
"aqt.mw.col.decks.allNames",
"PyQt5.QtWidgets.QGroupBox",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QVBoxLayout",
"aqt.utils.showInfo",
"PyQt5.QtWidgets.QPushButton"
] | [((445, 469), 'aqt.mw.beeline_dialog.show', 'mw.beeline_dialog.show', ([], {}), '()\n', (467, 469), False, 'from aqt import mw\n'), ((3208, 3224), 'PyQt5.QtWidgets.QPushButton', 'QPushButton', (['txt'], {}), '(txt)\n', (3219, 3224), False, 'from PyQt5.QtWidgets import QCompleter, QDialog, QGroupBox, QLabel, QLineEdit, ... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
from functools import reduce
import operator
from seedot.compiler.antlr.seedotParser import seedotParser as SeeDotParser
import seedot.compiler.ast.ast as AST
from seedot.compiler.ast.astVisitor import ASTVisitor
class Ty... | [
"functools.reduce"
] | [((514, 549), 'functools.reduce', 'reduce', (['operator.mul', 'self.shape', '(1)'], {}), '(operator.mul, self.shape, 1)\n', (520, 549), False, 'from functools import reduce\n'), ((2259, 2298), 'functools.reduce', 'reduce', (['operator.mul', 'exprType.shape', '(1)'], {}), '(operator.mul, exprType.shape, 1)\n', (2265, 22... |
import importlib
import numpy as np
import pandas as pd
import nose
import pytest
import statsmodels.datasets
from statsmodels.datasets.utils import Dataset
exclude = ['check_internet', 'clear_data_home', 'get_data_home',
'get_rdataset', 'tests', 'utils', 'webuse']
datasets = []
for dataset_name in dir(st... | [
"pytest.mark.parametrize",
"importlib.import_module"
] | [((527, 576), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dataset_name"""', 'datasets'], {}), "('dataset_name', datasets)\n", (550, 576), False, 'import pytest\n'), ((623, 686), 'importlib.import_module', 'importlib.import_module', (["('statsmodels.datasets.' + dataset_name)"], {}), "('statsmodels.datas... |
import ecoblock_test.simulation as sim
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
NUMBER_OF_SIMULATIONS = 20
NUMBER_OF_SIMULATIONS_ID = 28
cost_record = []
flywheel_final_soc = []
def plot_hist(data):
plt.figure()
num_bins = 30
data.hist(bins=num_bins)
plt.xlabel('Cost in ... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"ecoblock_test.simulation.System",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.sum",
"matplotlib.pyplot.figure",
"pandas.DataFrame"
] | [((1136, 1181), 'pandas.DataFrame', 'pd.DataFrame', (['sim_id_list'], {'columns': "['sim_id']"}), "(sim_id_list, columns=['sim_id'])\n", (1148, 1181), True, 'import pandas as pd\n'), ((1367, 1410), 'pandas.DataFrame', 'pd.DataFrame', (['cost_record'], {'columns': "['cost']"}), "(cost_record, columns=['cost'])\n", (1379... |
from app import app
from flask import request, jsonify
from app.models.clients import post, put, delete, get, getAll
from app.models.products import addProduct, deleteProduct, getProducts
@app.route("/client/", methods=["GET"])
def getClient():
if "id" in request.args:
client_id = request.args.get("id")
... | [
"flask.request.args.get",
"app.models.products.getProducts",
"app.models.clients.get",
"app.models.clients.post",
"app.models.products.addProduct",
"app.models.products.deleteProduct",
"app.app.errorhandler",
"app.models.clients.delete",
"app.app.route",
"app.models.clients.getAll",
"app.models.... | [((191, 229), 'app.app.route', 'app.route', (['"""/client/"""'], {'methods': "['GET']"}), "('/client/', methods=['GET'])\n", (200, 229), False, 'from app import app\n'), ((416, 454), 'app.app.route', 'app.route', (['"""/clients"""'], {'methods': "['GET']"}), "('/clients', methods=['GET'])\n", (425, 454), False, 'from a... |
# Music World Sprite Ripper
# Version 1.0
# By Buu342
import os
import sys
import math
import numpy as np
from PIL import Image as im
from pathlib import Path
########################
# Globals
########################
# Start and end offsets in the uncompressed.pxo where sprites are located
# Values obtained... | [
"os.path.exists",
"os.listdir",
"math.ceil",
"pathlib.Path",
"PIL.Image.new",
"os.path.isdir",
"os.mkdir",
"sys.exit"
] | [((5348, 5406), 'PIL.Image.new', 'im.new', (['"""RGB"""', '(sprite.header.width, sprite.header.height)'], {}), "('RGB', (sprite.header.width, sprite.header.height))\n", (5354, 5406), True, 'from PIL import Image as im\n'), ((6153, 6180), 'os.path.exists', 'os.path.exists', (['"""Converted"""'], {}), "('Converted')\n", ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2022 F4PGA Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... | [
"pathlib.Path"
] | [((863, 884), 'pathlib.Path', 'Path', (['ctx.takes.eblif'], {}), '(ctx.takes.eblif)\n', (867, 884), False, 'from pathlib import Path\n'), ((1117, 1138), 'pathlib.Path', 'Path', (['ctx.takes.eblif'], {}), '(ctx.takes.eblif)\n', (1121, 1138), False, 'from pathlib import Path\n')] |
#! /usr/bin/env python3
#-*- coding:utf-8 -*-
import requests
from bs4 import BeautifulSoup
server = 'http://www.shicimingju.com'
def get_type_list():
target = 'http://www.shicimingju.com/shicimark'
req = requests.get(url = target)
html = req.text
div_bf = BeautifulSoup(html)
div = div_bf.find_a... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((217, 241), 'requests.get', 'requests.get', ([], {'url': 'target'}), '(url=target)\n', (229, 241), False, 'import requests\n'), ((277, 296), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html'], {}), '(html)\n', (290, 296), False, 'from bs4 import BeautifulSoup\n'), ((589, 613), 'requests.get', 'requests.get', ([], {'url'... |
"""Generates a pyglet window and starts a Tetrix session."""
import pyglet
from .colors import COLORS
from .trxconst import batch, background, side_frames
from .controller import Controller
from .grid import Grid
window = pyglet.window.Window(width=600, height=600, caption="Tetrix")
window_border = batch.add(12, pygl... | [
"pyglet.window.Window",
"pyglet.clock.unschedule",
"pyglet.app.run",
"pyglet.clock.schedule"
] | [((223, 284), 'pyglet.window.Window', 'pyglet.window.Window', ([], {'width': '(600)', 'height': '(600)', 'caption': '"""Tetrix"""'}), "(width=600, height=600, caption='Tetrix')\n", (243, 284), False, 'import pyglet\n'), ((2003, 2032), 'pyglet.clock.schedule', 'pyglet.clock.schedule', (['update'], {}), '(update)\n', (20... |
from sklearn.svm import OneClassSVM
from uq360.utils.transformers.feature_transformer import FeatureTransformer
class OneClassSVMTransformer(FeatureTransformer):
"""One-class SVM outlier-classifier based derived feature.
This transformer fits an SVM decision boundary enclosing the
full training set. This ... | [
"sklearn.svm.OneClassSVM"
] | [((532, 579), 'sklearn.svm.OneClassSVM', 'OneClassSVM', ([], {'nu': '(0.1)', 'kernel': '"""rbf"""', 'gamma': '"""auto"""'}), "(nu=0.1, kernel='rbf', gamma='auto')\n", (543, 579), False, 'from sklearn.svm import OneClassSVM\n')] |
# Generated by Django 3.2.9 on 2021-12-04 14:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0003_comment_image'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='profile_photo',
... | [
"django.db.models.ImageField"
] | [((335, 424), 'django.db.models.ImageField', 'models.ImageField', ([], {'blank': '(True)', 'null': '(True)', 'upload_to': '"""profiles/"""', 'verbose_name': '"""image"""'}), "(blank=True, null=True, upload_to='profiles/',\n verbose_name='image')\n", (352, 424), False, 'from django.db import migrations, models\n')] |
from __future__ import absolute_import
import logging
import os
import socket
from c2cwsgiutils import stats
import redis.sentinel
from tilecloud import TileStore
from tilecloud.store.queue import decode_message, encode_message
STREAM_GROUP = "tilecloud"
CONSUMER_NAME = socket.gethostname() + "-" + str(os.getpid())... | [
"logging.getLogger",
"tilecloud.store.queue.decode_message",
"c2cwsgiutils.stats.set_gauge",
"tilecloud.store.queue.encode_message",
"c2cwsgiutils.stats.increment_counter",
"os.getpid",
"socket.gethostname"
] | [((331, 358), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (348, 358), False, 'import logging\n'), ((275, 295), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (293, 295), False, 'import socket\n'), ((308, 319), 'os.getpid', 'os.getpid', ([], {}), '()\n', (317, 319), False... |
#
# Copyright (c) 2015-2021 <NAME> <tflorac AT ulthar.net>
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE... | [
"pyams_form.template.widget_template_config"
] | [((801, 910), 'pyams_form.template.widget_template_config', 'widget_template_config', ([], {'mode': 'INPUT_MODE', 'template': '"""templates/directory-host-input.pt"""', 'layer': 'IPyAMSLayer'}), "(mode=INPUT_MODE, template=\n 'templates/directory-host-input.pt', layer=IPyAMSLayer)\n", (823, 910), False, 'from pyams_... |
from setuptools import setup
setup(
name="cloaker",
version="0.0.1",
description="Simple keycloak client for python",
py_modules=["cloaker"],
package_dir={'': 'src'},
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programmi... | [
"setuptools.setup"
] | [((30, 448), 'setuptools.setup', 'setup', ([], {'name': '"""cloaker"""', 'version': '"""0.0.1"""', 'description': '"""Simple keycloak client for python"""', 'py_modules': "['cloaker']", 'package_dir': "{'': 'src'}", 'classifiers': "['Programming Language :: Python :: 3',\n 'Programming Language :: Python :: 3.6',\n ... |
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
def index(request):
return HttpResponse(status=200)
def get_user(request, id):
return HttpResponse(id)
@csrf_exempt
def create_user(request):
return HttpResponse(status=200)
| [
"django.http.HttpResponse"
] | [((123, 147), 'django.http.HttpResponse', 'HttpResponse', ([], {'status': '(200)'}), '(status=200)\n', (135, 147), False, 'from django.http import HttpResponse\n'), ((188, 204), 'django.http.HttpResponse', 'HttpResponse', (['id'], {}), '(id)\n', (200, 204), False, 'from django.http import HttpResponse\n'), ((257, 281),... |
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.utils.encoding import python_2_unicode_compatible
from django.db import models
from django.core.urlresolvers import reverse
@python_2_unicode_compatible
class Post(models.Model):
title = models.CharField('TITLE',max_l... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.core.urlresolvers.reverse",
"django.db.models.SlugField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((290, 330), 'django.db.models.CharField', 'models.CharField', (['"""TITLE"""'], {'max_length': '(50)'}), "('TITLE', max_length=50)\n", (306, 330), False, 'from django.db import models\n'), ((341, 442), 'django.db.models.SlugField', 'models.SlugField', (['"""SLUG"""'], {'unique': '(True)', 'allow_unicode': '(True)', '... |
import glob
from pathlib import Path
import json
import re
import os
import numpy as np
import pandas as pd
from isochrones.models import StellarModelGrid, ModelGridInterpolator
from isochrones.mist.models import MISTEvolutionTrackGrid
from isochrones.mist.bc import MISTBolometricCorrectionGrid
from isochrones.mags i... | [
"numpy.atleast_2d",
"pathlib.Path",
"os.path.join",
"numpy.broadcast",
"numpy.array",
"numpy.resize",
"isochrones.mags.interp_mag_4d",
"isochrones.mags.interp_mags_4d",
"pandas.DataFrame",
"isochrones.models.StellarModelGrid.df_all",
"numpy.broadcast_arrays",
"numpy.atleast_1d"
] | [((1999, 2028), 'isochrones.models.StellarModelGrid.df_all', 'StellarModelGrid.df_all', (['self'], {}), '(self)\n', (2022, 2028), False, 'from isochrones.models import StellarModelGrid, ModelGridInterpolator\n'), ((3353, 3387), 'pandas.DataFrame', 'pd.DataFrame', (['values'], {'columns': 'cols'}), '(values, columns=col... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-29 20:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('animals', '0001_initial'),
]
operations = [
migrations.AlterField(
... | [
"django.db.models.CharField"
] | [((407, 451), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(200)'}), '(blank=True, max_length=200)\n', (423, 451), False, 'from django.db import migrations, models\n'), ((585, 635), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""Unknown"""', 'max_leng... |
import unittest
import os
import cv2
# path of this file
test_path = os.path.split(os.path.abspath(__file__))[0] + '/'
class MukhamTest(unittest.TestCase):
"""
Tests for the required functionalities:
1. Dimension Error: allow only images of max size 1024x1024
2. Bounding box for the large... | [
"mukham.detector.detect_largest_face",
"os.path.abspath",
"os.path.isfile",
"unittest.main",
"cv2.imread",
"os.remove"
] | [((1947, 1962), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1960, 1962), False, 'import unittest\n'), ((540, 600), 'os.path.isfile', 'os.path.isfile', (["(test_path + 'data/faces/bryant_daughter.jpg')"], {}), "(test_path + 'data/faces/bryant_daughter.jpg')\n", (554, 600), False, 'import os\n'), ((1089, 1155), ... |
#!/usr/bin/env python
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 <NAME> <<EMAIL>> and <NAME> <<EMAIL>>
#
# This Source Code Form is subject to the terms of the Mozilla Public License
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
... | [
"pyigl.eigs",
"pyigl.cotmatrix",
"pyigl.eigen.MatrixXd",
"pyigl.glfw.Viewer",
"pyigl.read_triangle_mesh",
"os.getcwd",
"pyigl.massmatrix",
"shared.check_dependencies",
"pyigl.eigen.MatrixXi",
"pyigl.eigen.SparseMatrixd"
] | [((588, 620), 'shared.check_dependencies', 'check_dependencies', (['dependencies'], {}), '(dependencies)\n', (606, 620), False, 'from shared import TUTORIAL_SHARED_PATH, check_dependencies\n'), ((630, 650), 'pyigl.eigen.MatrixXd', 'igl.eigen.MatrixXd', ([], {}), '()\n', (648, 650), True, 'import pyigl as igl\n'), ((656... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 23 21:30:34 2017
@author: Aeolitus
"""
from PyQt5 import QtWidgets, QtCore, QtGui
import sys
import logging
import os.path
import MainWindow
import CharakterEditor
import DatenbankEdit
import CharakterMain
import DatenbankMain
from Wolke import Wolk... | [
"logging.basicConfig",
"PyQt5.QtWidgets.QWidget",
"logging.getLogger",
"PyQt5.QtGui.QIcon",
"EinstellungenWrapper.EinstellungenWrapper",
"PyQt5.QtWidgets.QMessageBox",
"PyQt5.QtCore.QCoreApplication.instance",
"DatenbankMain.Ui_Form",
"EinstellungenWrapper.EinstellungenWrapper.load",
"MainWindow.U... | [((473, 670), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""sephrasto.log"""', 'level': "loglevels[Wolke.Settings['Logging']]", 'format': '"""%(asctime)s | %(levelname)s | %(filename)s::%(funcName)s(%(lineno)d) | %(message)s"""'}), "(filename='sephrasto.log', level=loglevels[Wolke.\n Settings['... |
import sys
from cv2 import cv2
import numpy as np
import mss
from pynput.mouse import Button, Controller
while True:
stc = mss.mss()
scr = stc.grab(
{
"left": 744,
"top": 152,
"width": 420,
"height": 240,
}
)
frame = np.array(scr)
hsvframe = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
lower_white = np... | [
"cv2.cv2.setWindowProperty",
"cv2.cv2.inRange",
"sys.exit",
"mss.mss",
"cv2.cv2.waitKey",
"cv2.cv2.bitwise_and",
"cv2.cv2.destroyAllWindows",
"numpy.array",
"cv2.cv2.contourArea",
"cv2.cv2.findContours",
"pynput.mouse.Controller",
"cv2.cv2.cvtColor",
"cv2.cv2.boundingRect",
"cv2.cv2.imshow... | [((125, 134), 'mss.mss', 'mss.mss', ([], {}), '()\n', (132, 134), False, 'import mss\n'), ((238, 251), 'numpy.array', 'np.array', (['scr'], {}), '(scr)\n', (246, 251), True, 'import numpy as np\n'), ((264, 302), 'cv2.cv2.cvtColor', 'cv2.cvtColor', (['frame', 'cv2.COLOR_BGR2HSV'], {}), '(frame, cv2.COLOR_BGR2HSV)\n', (2... |
#!/usr/bin/env python
"""
Client library to communicate with a OpenRefine server.
"""
# Copyright (c) 2011 <NAME>, Real Programmers. All rights reserved.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Fo... | [
"facet.Engine",
"json.loads",
"urllib2.urlopen",
"urllib2.URLError",
"facet.Sorting",
"json.dumps",
"os.environ.get",
"re.match",
"time.sleep",
"urllib2.Request",
"urllib.urlencode",
"urllib.addbase.__init__",
"os.path.basename",
"history.HistoryEntry"
] | [((1013, 1062), 'os.environ.get', 'os.environ.get', (['"""GOOGLE_REFINE_HOST"""', '"""127.0.0.1"""'], {}), "('GOOGLE_REFINE_HOST', '127.0.0.1')\n", (1027, 1062), False, 'import os\n'), ((1112, 1156), 'os.environ.get', 'os.environ.get', (['"""GOOGLE_REFINE_PORT"""', '"""3333"""'], {}), "('GOOGLE_REFINE_PORT', '3333')\n"... |
'''
Created on Apr 3, 2021
@author: x2012x
'''
import logging
from google.cloud import texttospeech
import hashlib
import os
from errors.exceptions import TTSFailure
from services.base import BaseService
from errors.reasons import get_general_failure
from services.audio import PlayRequest
from pathlib import Path
log... | [
"logging.getLogger",
"os.path.exists",
"google.cloud.texttospeech.AudioConfig",
"pathlib.Path",
"errors.reasons.get_general_failure",
"errors.exceptions.TTSFailure",
"os.path.join",
"services.audio.PlayRequest",
"google.cloud.texttospeech.SynthesisInput",
"google.cloud.texttospeech.VoiceSelectionP... | [((326, 353), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (343, 353), False, 'import logging\n'), ((823, 921), 'google.cloud.texttospeech.TextToSpeechClient.from_service_account_file', 'texttospeech.TextToSpeechClient.from_service_account_file', (['"""resources/config/google-tts.json""... |
# Copyright (c) 2020 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the BSD 3-Clause License.
"""Implements a JSON :class:`~.SyncedCollection` backend."""
import errno
import json
import os
import uuid
import warnings
from collections.abc import Mapping, Sequence
fro... | [
"json.loads",
"json.dumps",
"os.replace",
"uuid.uuid4",
"os.path.split"
] | [((10515, 10544), 'os.path.split', 'os.path.split', (['self._filename'], {}), '(self._filename)\n', (10528, 10544), False, 'import os\n'), ((10716, 10750), 'os.replace', 'os.replace', (['fn_tmp', 'self._filename'], {}), '(fn_tmp, self._filename)\n', (10726, 10750), False, 'import os\n'), ((9813, 9829), 'json.loads', 'j... |
import bpy
import addon_utils
import importlib
import sys
from . utils import current_addon_exists, get_addon_name
class RunAddon(bpy.types.Operator):
bl_idname = "code_autocomplete.run_addon"
bl_label = "Run Addon"
bl_description = "Unregister, reload and register it again."
bl_options = {"REGISTER"}
... | [
"sys.modules.get",
"addon_utils.enable",
"importlib.reload",
"bpy.ops.code_autocomplete.save_files",
"addon_utils.disable"
] | [((445, 483), 'bpy.ops.code_autocomplete.save_files', 'bpy.ops.code_autocomplete.save_files', ([], {}), '()\n', (481, 483), False, 'import bpy\n'), ((540, 567), 'sys.modules.get', 'sys.modules.get', (['addon_name'], {}), '(addon_name)\n', (555, 567), False, 'import sys\n'), ((676, 706), 'addon_utils.enable', 'addon_uti... |
# import Criv pre-processing script
import prep_file
# -- Load parameters from user_param.txt
param = prep_file.read_input_file()
# -- Plot model geometry
# output saved in CrivApp/output/model.png
prep_file.build_model(param)
# -- Calculate Xfar
# output saved in CrivApp/output/plot_xfar.png
prep_file.compute_Xfar(... | [
"prep_file.plot_CRIV",
"prep_file.CRIV_distrib",
"prep_file.build_model",
"prep_file.read_input_file",
"prep_file.write_CRIV",
"prep_file.compute_Xfar",
"prep_file.CRIV_dist_plot",
"prep_file.compute_CRIV"
] | [((103, 130), 'prep_file.read_input_file', 'prep_file.read_input_file', ([], {}), '()\n', (128, 130), False, 'import prep_file\n'), ((200, 228), 'prep_file.build_model', 'prep_file.build_model', (['param'], {}), '(param)\n', (221, 228), False, 'import prep_file\n'), ((297, 326), 'prep_file.compute_Xfar', 'prep_file.com... |
# coding=utf-8
###
# Patient.py -
# This file contains the definition of class Patient used to handle patients scans, store their lesions
# and survival time.
# Patient.py also implements handy function to pre process a pile of dicom image e.g. conversion to SUV
#
# Author : <NAME> - <EMAIL>
#
# Created on : 16/02/201... | [
"SimpleITK.GetImageFromArray",
"pydicom.dcmread",
"dicom_numpy.combine_slices",
"numpy.log",
"os.path.join",
"SimpleITK.GetArrayFromImage",
"os.walk"
] | [((1532, 1563), 'pydicom.dcmread', 'pydicom.dcmread', (['pathToDcmSlice'], {}), '(pathToDcmSlice)\n', (1547, 1563), False, 'import pydicom\n'), ((2107, 2138), 'pydicom.dcmread', 'pydicom.dcmread', (['pathToDcmSlice'], {}), '(pathToDcmSlice)\n', (2122, 2138), False, 'import pydicom\n'), ((2988, 3009), 'os.walk', 'os.wal... |
#!/usr/bin/python2.7
#manage-downloads - adds/removes downloads to the catalogue
#TODO:
# test it all \0/
import os,json,sys
import hashlib,uuid
from downloadhygeine import DownloadHygeine,Util,crypto
color={"green":"\33[92m","blue":"\33[96m","red":"\33[31m","yellow":"\33[93m","white":"\33[98m"}
def add(dh):
downl... | [
"os.path.exists",
"os.path.getsize",
"os.getenv",
"hashlib.new",
"downloadhygeine.DownloadHygeine",
"json.dumps",
"uuid.uuid4",
"os.chdir",
"sys.exit",
"os.remove"
] | [((4822, 4859), 'os.path.exists', 'os.path.exists', (["dh.conf['localclone']"], {}), "(dh.conf['localclone'])\n", (4836, 4859), False, 'import os, json, sys\n'), ((8858, 8875), 'downloadhygeine.DownloadHygeine', 'DownloadHygeine', ([], {}), '()\n', (8873, 8875), False, 'from downloadhygeine import DownloadHygeine, Util... |
import numpy as np
import open3d as o3d
from argparse import ArgumentParser
import os
parser = ArgumentParser()
parser.add_argument("--red",type=float, default= 0.5)
parser.add_argument("--blue", type=float, default = 0.4)
parser.add_argument("--green", type=float, default = 0.4)
parser.add_argument("--scan_folder",ty... | [
"numpy.savez",
"os.listdir",
"numpy.cross",
"argparse.ArgumentParser",
"numpy.asarray",
"numpy.linalg.norm",
"numpy.argmax",
"numpy.zeros",
"open3d.geometry.PointCloud",
"open3d.io.read_point_cloud",
"numpy.argmin",
"open3d.utility.Vector3dVector"
] | [((96, 112), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (110, 112), False, 'from argparse import ArgumentParser\n'), ((1944, 1995), 'os.listdir', 'os.listdir', (['f"""./pointcloud_raw/{args.scan_folder}/"""'], {}), "(f'./pointcloud_raw/{args.scan_folder}/')\n", (1954, 1995), False, 'import os\n'), (... |
import random
import string
from datetime import datetime, timedelta
from google.appengine.api import mail
from google.appengine.ext import ndb
from consts.account_permissions import AccountPermissions
from consts.auth_type import AuthType
from controllers.suggestions.suggestions_review_base_controller import \
S... | [
"models.event.Event.get_by_id",
"random.choice",
"models.suggestion.Suggestion.get_by_id",
"models.suggestion.Suggestion.query",
"datetime.datetime.now",
"google.appengine.ext.ndb.Key",
"template_engine.jinja2_engine.render",
"datetime.timedelta",
"helpers.outgoing_notification_helper.OutgoingNotifi... | [((1048, 1074), 'models.event.Event.get_by_id', 'Event.get_by_id', (['event_key'], {}), '(event_key)\n', (1063, 1074), False, 'from models.event import Event\n'), ((3191, 3287), 'template_engine.jinja2_engine.render', 'jinja2_engine.render', (['"""suggestions/suggest_apiwrite_review_list.html"""', 'self.template_values... |
from sqlalchemy import create_engine
from sqlalchemy.orm import declarative_base
from sqlalchemy import Column, String, Integer, Sequence, Date, ForeignKey, Text
from sqlalchemy.orm import sessionmaker, relationship
engine = create_engine('sqlite:///data.db', echo=True)
Base = declarative_base()
class Country(Base):... | [
"sqlalchemy.orm.relationship",
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.create_engine",
"sqlalchemy.orm.declarative_base",
"sqlalchemy.ForeignKey",
"sqlalchemy.String",
"sqlalchemy.Sequence",
"sqlalchemy.Column"
] | [((226, 271), 'sqlalchemy.create_engine', 'create_engine', (['"""sqlite:///data.db"""'], {'echo': '(True)'}), "('sqlite:///data.db', echo=True)\n", (239, 271), False, 'from sqlalchemy import create_engine\n'), ((279, 297), 'sqlalchemy.orm.declarative_base', 'declarative_base', ([], {}), '()\n', (295, 297), False, 'from... |
"""Define inputters reading from TFRecord files."""
import tensorflow as tf
from opennmt.inputters.inputter import Inputter
from opennmt.utils import compat
import numpy as np
from collections import defaultdict
import yaml
class Feature:
def __init__(self, name, shape, where):
self.name = name
s... | [
"tensorflow.data.TFRecordDataset",
"tensorflow.placeholder",
"tensorflow.concat",
"yaml.safe_load",
"collections.defaultdict",
"tensorflow.reshape",
"tensorflow.cast",
"opennmt.utils.compat.tf_compat"
] | [((860, 877), 'collections.defaultdict', 'defaultdict', (['bool'], {}), '(bool)\n', (871, 877), False, 'from collections import defaultdict\n'), ((1208, 1242), 'tensorflow.data.TFRecordDataset', 'tf.data.TFRecordDataset', (['data_file'], {}), '(data_file)\n', (1231, 1242), True, 'import tensorflow as tf\n'), ((2113, 21... |
from unittest import mock
from urllib.parse import urlparse
import pytest
from activity_stream.test.util.hawk import get_hawk_header
pytestmark = pytest.mark.django_db
class TestActivityStreamEndpoint:
def test_full_page_has_next_link(
self,
wrapped_union_queryset,
logged_in_client,
... | [
"unittest.mock.patch",
"urllib.parse.urlparse",
"activity_stream.test.util.hawk.get_hawk_header"
] | [((648, 725), 'unittest.mock.patch', 'mock.patch', (['"""django.conf.settings.HAWK_CREDENTIALS"""', 'hawk_credentials_setting'], {}), "('django.conf.settings.HAWK_CREDENTIALS', hawk_credentials_setting)\n", (658, 725), False, 'from unittest import mock\n'), ((1460, 1537), 'unittest.mock.patch', 'mock.patch', (['"""djan... |
'''
A simple neural network to solve 2 input XOR
'''
import numpy as np
import tensorflow as tf
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import OneHotEncoder
X = np.array([
[0, 0],
[0, 1],
[1, 0],
[1, 1]
], "float32")
y = np.array([
[0],
[1],
[1],
... | [
"tensorflow.cast",
"tensorflow.train.AdamOptimizer",
"tensorflow.summary.merge_all",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.OneHotEncoder",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.global_variables_initializer",
"numpy.array",
"tensorflow.argmax",
"... | [((204, 257), 'numpy.array', 'np.array', (['[[0, 0], [0, 1], [1, 0], [1, 1]]', '"""float32"""'], {}), "([[0, 0], [0, 1], [1, 0], [1, 1]], 'float32')\n", (212, 257), True, 'import numpy as np\n'), ((281, 320), 'numpy.array', 'np.array', (['[[0], [1], [1], [0]]', '"""int32"""'], {}), "([[0], [1], [1], [0]], 'int32')\n", ... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"itertools.islice",
"asyncio.wait"
] | [((697, 726), 'itertools.islice', 'itertools.islice', (['pending', '(16)'], {}), '(pending, 16)\n', (713, 726), False, 'import itertools\n'), ((851, 909), 'asyncio.wait', 'asyncio.wait', (['running'], {'return_when': 'asyncio.FIRST_COMPLETED'}), '(running, return_when=asyncio.FIRST_COMPLETED)\n', (863, 909), False, 'im... |
from collections import Counter
class Solution:
def isScramble(self, s1: str, s2: str) -> bool:
if s1 == s2:
return True
#print(s1, s2)
if Counter(s1) != Counter(s2):
return False
for i in range(1, len(s1)):
if self.isScramble(s1[ :i], s2[ :i]) & s... | [
"collections.Counter"
] | [((179, 190), 'collections.Counter', 'Counter', (['s1'], {}), '(s1)\n', (186, 190), False, 'from collections import Counter\n'), ((194, 205), 'collections.Counter', 'Counter', (['s2'], {}), '(s2)\n', (201, 205), False, 'from collections import Counter\n')] |
'''
Applying Stochastic Gradient Descent for Linear Regression
'''
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
X = 2 * np.random.rand(100,1)
y = 4 + 3 * X + np.random.randn(100,1)
X_b = np.c_[np.ones((100,1)), X]
eta = .1
m = 100
n_epochs = 50
# Learning schedule hyperparameters
t0, t1 = 5... | [
"numpy.ones",
"numpy.random.rand",
"sklearn.linear_model.SGDRegressor",
"numpy.random.randint",
"numpy.random.randn"
] | [((420, 441), 'numpy.random.randn', 'np.random.randn', (['(2)', '(1)'], {}), '(2, 1)\n', (435, 441), True, 'import numpy as np\n'), ((871, 920), 'sklearn.linear_model.SGDRegressor', 'SGDRegressor', ([], {'max_iter': '(50)', 'penalty': 'None', 'eta0': '(0.1)'}), '(max_iter=50, penalty=None, eta0=0.1)\n', (883, 920), Fal... |
#!/usr/bin/env python
### shared_qvm.py
###
### Author: <NAME>
###
### Copyright (c) 2017 Rigetti Computing
### This file shows a minimal example of how to use the --shared
### option with QVM from Python.
from __future__ import print_function
import posix_ipc as pos
import mmap
import ctypes
import numpy as np
impo... | [
"pyquil.api.QVMConnection",
"mmap.mmap",
"ctypes.POINTER",
"numpy.sqrt",
"socket.socket",
"numpy.isclose",
"numpy.ctypeslib.as_array",
"posix_ipc.SharedMemory",
"pyquil.quil.Program",
"ctypes.c_void_p.from_buffer",
"pyquil.gates.X",
"numpy.ctypeslib.ndpointer",
"sys.exit"
] | [((491, 540), 'socket.socket', 'socket.socket', (['socket.AF_UNIX', 'socket.SOCK_STREAM'], {}), '(socket.AF_UNIX, socket.SOCK_STREAM)\n', (504, 540), False, 'import socket\n'), ((794, 816), 'posix_ipc.SharedMemory', 'pos.SharedMemory', (['name'], {}), '(name)\n', (810, 816), True, 'import posix_ipc as pos\n'), ((825, 8... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | [
"aiida.work.defaults.serial_engine.submit",
"aiida.work.process.FunctionProcess.build",
"functools.wraps"
] | [((1516, 1537), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (1531, 1537), False, 'import functools\n'), ((1930, 1967), 'aiida.work.process.FunctionProcess.build', 'FunctionProcess.build', (['func'], {}), '(func, **kwargs)\n', (1951, 1967), False, 'from aiida.work.process import FunctionProcess\n')... |
from pathlib import Path
from unittest.mock import patch
import pytest
from isort import finders, settings
from isort.finders import FindersManager
class TestFindersManager:
def test_init(self):
assert FindersManager(settings.DEFAULT_CONFIG)
class ExceptionOnInit(finders.BaseFinder):
... | [
"isort.finders.FindersManager",
"unittest.mock.patch",
"isort.settings.Config"
] | [((218, 257), 'isort.finders.FindersManager', 'FindersManager', (['settings.DEFAULT_CONFIG'], {}), '(settings.DEFAULT_CONFIG)\n', (232, 257), False, 'from isort.finders import FindersManager\n'), ((458, 587), 'unittest.mock.patch', 'patch', (['"""isort.finders.FindersManager._default_finders_classes"""', '(FindersManag... |
import numpy as np
n = int(input().strip())
array = np.array([[float(x) for x in input().strip().split()] for _ in range(n)], dtype = float)
print(np.linalg.det(array)) | [
"numpy.linalg.det"
] | [((149, 169), 'numpy.linalg.det', 'np.linalg.det', (['array'], {}), '(array)\n', (162, 169), True, 'import numpy as np\n')] |
import Vertx.DeliveryOption as DeliveryOption
import unittest
import json
class TestDeliveryOption(unittest.TestCase):
('testing DeliveryOption')
def test_addHeader(self):
do = DeliveryOption.DeliveryOption()
do.addHeader('type', 'text')
header = {'type': 'text', }
self.assert... | [
"unittest.main",
"Vertx.DeliveryOption.DeliveryOption"
] | [((1051, 1066), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1064, 1066), False, 'import unittest\n'), ((196, 227), 'Vertx.DeliveryOption.DeliveryOption', 'DeliveryOption.DeliveryOption', ([], {}), '()\n', (225, 227), True, 'import Vertx.DeliveryOption as DeliveryOption\n'), ((539, 570), 'Vertx.DeliveryOption.D... |
import matplotlib.pyplot as plt
class Painter:
def __init__(self):
self.viapoint = (0.5, 0.5)
def draw(self, x, y, t):
n_dims = len(x)-1
plt.xlim(0.0, 1.0)
plt.ylim(0.0, 1.0)
plt.scatter(x[0:n_dims], y[0:n_dims], c='b')
plt.plot(x, y, 'g')
plt.text(-0.8... | [
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim"
] | [((172, 190), 'matplotlib.pyplot.xlim', 'plt.xlim', (['(0.0)', '(1.0)'], {}), '(0.0, 1.0)\n', (180, 190), True, 'import matplotlib.pyplot as plt\n'), ((199, 217), 'matplotlib.pyplot.ylim', 'plt.ylim', (['(0.0)', '(1.0)'], {}), '(0.0, 1.0)\n', (207, 217), True, 'import matplotlib.pyplot as plt\n'), ((226, 270), 'matplot... |
#Created by JetBrains PyCharm
#Project Name: SoundAnalyzer with RaspberryPi
#Author: <NAME>
#University: Cergy-Pontoise
#E-mail : <EMAIL>
import asyncio
import os, errno
import pyaudio
import spl_lib as spl
from scipy.signal import lfilter
import numpy
import time
class MicUSB:
#CHUNKS[1] was 9600
CHUNKS = [... | [
"spl_lib.rms_flat",
"asyncio.get_event_loop",
"spl_lib.A_weighting",
"scipy.signal.lfilter",
"pyaudio.PyAudio",
"numpy.fromstring",
"time.time"
] | [((500, 521), 'spl_lib.A_weighting', 'spl.A_weighting', (['RATE'], {}), '(RATE)\n', (515, 521), True, 'import spl_lib as spl\n'), ((567, 584), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (582, 584), False, 'import pyaudio\n'), ((1245, 1256), 'time.time', 'time.time', ([], {}), '()\n', (1254, 1256), False, '... |
# ------------------------------------------------------------------------------
# CodeHawk Binary Analyzer
# Author: <NAME>
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2016-2020 Kestrel Technology LLC
# Copyright (c) 2020 <NAME>
# Copy... | [
"chb.app.Operand.Operand.__init__",
"chb.mips.MIPSDictionaryRecord.MIPSDictionaryRecord.__init__"
] | [((2223, 2268), 'chb.mips.MIPSDictionaryRecord.MIPSDictionaryRecord.__init__', 'MIPSDictionaryRecord.__init__', (['self', 'd', 'ixval'], {}), '(self, d, ixval)\n', (2252, 2268), False, 'from chb.mips.MIPSDictionaryRecord import MIPSDictionaryRecord\n'), ((2277, 2299), 'chb.app.Operand.Operand.__init__', 'Operand.__init... |
import struct
struct1 = struct.Struct('@i13sf')
print(f"Format - {struct1.format}")
print(f'Size : ', struct1.size)
| [
"struct.Struct"
] | [((25, 48), 'struct.Struct', 'struct.Struct', (['"""@i13sf"""'], {}), "('@i13sf')\n", (38, 48), False, 'import struct\n')] |
import asyncio
import ipaddress
import logging
import os
from pathlib import Path
from aiohttp import web
from notedrive.magnet import settings
from notedrive.magnet.core import Magnet2Torrent
from notedrive.magnet.dht.network import Server as DHTServer
from notedrive.magnet.server import routes
from notedrive.magnet... | [
"logging.getLogger",
"notedrive.magnet.core.Magnet2Torrent",
"logging.basicConfig",
"logging.StreamHandler",
"notedrive.magnet.dht.network.Server",
"pathlib.Path",
"ipaddress.IPv4Address",
"os.makedirs",
"aiohttp.web.Application",
"notedrive.magnet.dht.network.Server.load_state",
"os.path.isfile... | [((443, 475), 'ipaddress.IPv4Address', 'ipaddress.IPv4Address', (['"""0.0.0.0"""'], {}), "('0.0.0.0')\n", (464, 475), False, 'import ipaddress\n'), ((891, 908), 'aiohttp.web.Application', 'web.Application', ([], {}), '()\n', (906, 908), False, 'from aiohttp import web\n'), ((1087, 1111), 'asyncio.get_event_loop', 'asyn... |
import six
from collections import deque, defaultdict
import numpy as np
from pybot.utils.itertools_recipes import chunks
def concat_chunked_dicts(dlist):
"""
Concatenate individual arrays in dictionary
TODO: defaultdict is the right way to do it, except for
conversion to dict in the final retur... | [
"six.iteritems",
"collections.defaultdict",
"numpy.concatenate",
"pybot.utils.itertools_recipes.chunks"
] | [((384, 401), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (395, 401), False, 'from collections import deque, defaultdict\n'), ((511, 531), 'six.iteritems', 'six.iteritems', (['batch'], {}), '(batch)\n', (524, 531), False, 'import six\n'), ((851, 879), 'pybot.utils.itertools_recipes.chunks', 'c... |
import shutil
from ngslite.fasta import FastaParser
from ngslite.dataclass import GenericFeature
from ngslite.genbank_parse import get_seqname, get_circular, \
split_features_text, get_feature_type, get_feature_location, \
get_feature_attributes, get_sequence, is_valid_first_line_of_feature, \
constru... | [
"ngslite.dataclass.GenericFeature",
"ngslite.genbank_parse.genbank_to_gff",
"ngslite.genbank_parse.is_valid_first_line_of_feature",
"ngslite.genbank_parse.get_seqname",
"ngslite.genbank_parse.get_feature_attributes",
"ngslite.genbank_parse.get_feature_location",
"ngslite.genbank_parse.get_sequence",
"... | [((6094, 6121), 'shutil.rmtree', 'shutil.rmtree', (['self.workdir'], {}), '(self.workdir)\n', (6107, 6121), False, 'import shutil\n'), ((6131, 6157), 'shutil.rmtree', 'shutil.rmtree', (['self.outdir'], {}), '(self.outdir)\n', (6144, 6157), False, 'import shutil\n'), ((6405, 6439), 'ngslite.genbank_parse.split_features_... |
from unityagents import UnityEnvironment
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ggplot')
import torch
from collections import deque
from maddpg import MADDPG
env = UnityEnvironment(file_name="Tennis_Linux/Tennis.x86_64")
# get the default brain
brain_name = env.brain_names[0]
brain = env.br... | [
"numpy.mean",
"collections.deque",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.style.use",
"numpy.any",
"numpy.max",
"unityagents.UnityEnvironment",
"matplotlib.pyplot.figure",
"numpy.zeros",
"maddpg.MADDPG",
"matplotlib.pyplot.show"
] | [((92, 115), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (105, 115), True, 'import matplotlib.pyplot as plt\n'), ((192, 248), 'unityagents.UnityEnvironment', 'UnityEnvironment', ([], {'file_name': '"""Tennis_Linux/Tennis.x86_64"""'}), "(file_name='Tennis_Linux/Tennis.x86_64')... |
#!/usr/bin/env python3
# Copyright 2018-present, Bill & <NAME> Foundation
#
# 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 requir... | [
"os.path.dirname",
"os.path.join",
"argparse.ArgumentParser",
"core.auth.Auth.encode_jwt"
] | [((684, 709), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (699, 709), False, 'import os\n'), ((726, 756), 'os.path.join', 'os.path.join', (['script_dir', '""".."""'], {}), "(script_dir, '..')\n", (738, 756), False, 'import os\n'), ((903, 928), 'argparse.ArgumentParser', 'argparse.ArgumentP... |
"""
A sample frontend server. Hosts a web page to display messages
"""
import json
import os
import datetime
from flask import Flask, render_template, redirect, url_for, request, jsonify
import ptvsd
import requests
import bleach
# pylint: disable=C0103
app = Flask(__name__)
app.config["BACKEND_URI"] = 'http://{}/mess... | [
"flask.render_template",
"bleach.clean",
"json.loads",
"os.getenv",
"flask.Flask",
"os.environ.get",
"requests.get",
"flask.url_for",
"datetime.datetime.today",
"flask.jsonify"
] | [((261, 276), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (266, 276), False, 'from flask import Flask, render_template, redirect, url_for, request, jsonify\n'), ((338, 392), 'os.environ.get', 'os.environ.get', (['"""GUESTBOOK_API_ADDR"""', '"""localhost:8080"""'], {}), "('GUESTBOOK_API_ADDR', 'localhost... |
import argparse
from pathlib import Path
from http.client import responses as RESPONSE_CODES
import re
import time
import pyttsx3
import requests
from bs4 import BeautifulSoup
URL_TOC = "https://katalepsis.net/table-of-contents/"
CHAPTER_PATTERN = re.compile(r"[0-9]+.[0-9]+")
def check_status_code(r):
if r.statu... | [
"argparse.ArgumentParser",
"re.compile",
"pyttsx3.init",
"pathlib.Path",
"requests.get",
"argparse.ArgumentTypeError",
"bs4.BeautifulSoup"
] | [((251, 278), 're.compile', 're.compile', (['"""[0-9]+.[0-9]+"""'], {}), "('[0-9]+.[0-9]+')\n", (261, 278), False, 'import re\n'), ((540, 561), 'requests.get', 'requests.get', (['URL_TOC'], {}), '(URL_TOC)\n', (552, 561), False, 'import requests\n'), ((597, 636), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r.content', '""... |
"""Tests for SystemConfigurationModel class.
Note: Do not need to test matching module names because module names cannot be the same
by definition of dict.
"""
from typing import (
Any,
Dict,
)
import pytest
from pydantic import ValidationError
from pytest_lazyfixture import lazy_fixture # type: ignore[impor... | [
"pytest_lazyfixture.lazy_fixture",
"emulation_system.compose_file_creator.input.configuration_file.SystemConfigurationModel.from_file",
"emulation_system.compose_file_creator.input.configuration_file.SystemConfigurationModel.from_dict",
"pytest.raises"
] | [((3590, 3629), 'emulation_system.compose_file_creator.input.configuration_file.SystemConfigurationModel.from_dict', 'SystemConfigurationModel.from_dict', (['obj'], {}), '(obj)\n', (3624, 3629), False, 'from emulation_system.compose_file_creator.input.configuration_file import DuplicateHardwareNameError, SystemConfigur... |
import tkinter as tk, os
dirname = os.path.dirname(__file__)
path = os.path.join(dirname, 'files to change')
window = tk.Tk(className = 'Extension Changer')
window.geometry('800x250')
textBoxFrame = tk.Frame(master = window, width = 30, height = 10)
extensionToChangeTo = tk.Entry(width = 30)
def changeExtension(end... | [
"tkinter.Entry",
"os.rename",
"os.path.join",
"tkinter.Button",
"os.path.dirname",
"tkinter.Tk",
"tkinter.Label",
"tkinter.Frame",
"os.walk"
] | [((36, 61), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (51, 61), False, 'import tkinter as tk, os\n'), ((69, 109), 'os.path.join', 'os.path.join', (['dirname', '"""files to change"""'], {}), "(dirname, 'files to change')\n", (81, 109), False, 'import tkinter as tk, os\n'), ((120, 156), 't... |
#! /usr/bin/env python3
import logging
import time
import os
import threading
import senzing_accountant
from senzing_accountant import Accountant
__all__ = []
__version__ = "1.0.0" # See https://www.python.org/dev/peps/pep-0396/
__date__ = '2021-05-17'
__updated__ = '2021-05-18'
log_format = '%(asctime)s %(message... | [
"logging.basicConfig",
"threading.Thread.__init__",
"senzing_accountant.Accountant",
"threading.current_thread"
] | [((1055, 1110), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': 'log_format', 'level': 'log_level'}), '(format=log_format, level=log_level)\n', (1074, 1110), False, 'import logging\n'), ((1232, 1257), 'senzing_accountant.Accountant', 'Accountant', ([], {'hint': '"""Tester"""'}), "(hint='Tester')\n", (1242... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 21 15:50:29 2017
@author: BallBlueMeercat
"""
#import csv
#with open('Amanullah.txt') as f:
# reader = csv.reader(f, delimiter="\t")
# d = list(reader)
#print(d[5][:]) # 248
#import pandas as pd
#pd.read_csv('Amanullah.txt', delim_whitespace=... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.asarray",
"results.load",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((36606, 36618), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (36616, 36618), True, 'import matplotlib.pyplot as plt\n'), ((36619, 36644), 'matplotlib.pyplot.scatter', 'plt.scatter', (['zpicks1', 'mag'], {}), '(zpicks1, mag)\n', (36630, 36644), True, 'import matplotlib.pyplot as plt\n'), ((36644, 36664)... |
import logging
from pathlib import os
def get_file_handler(
log_name: str, mode: int, formatter: logging.Formatter, save_path: str = "./logs"
):
os.makedirs(save_path, exist_ok=True)
# file logs
file_handler = logging.FileHandler(
filename=os.path.join(save_path, log_name), mode="a"
)
... | [
"logging.getLogger",
"logging.StreamHandler",
"pathlib.os.makedirs",
"logging.Formatter",
"pathlib.os.path.join"
] | [((155, 192), 'pathlib.os.makedirs', 'os.makedirs', (['save_path'], {'exist_ok': '(True)'}), '(save_path, exist_ok=True)\n', (166, 192), False, 'from pathlib import os\n'), ((499, 610), 'logging.Formatter', 'logging.Formatter', (['"""[pid=%(process)s] - [%(asctime)s] - [%(name)s] - [%(levelname)s] - [%(message)s]"""'],... |
# -*- coding: utf-8 -*-
# Copyright: 2016-2018, <NAME>
# These sources are released under the terms of the MIT license: see LICENSE
import time, os, signal, random, math
from threading import Lock, Thread, Event
from logger import Logger
import RPi.GPIO as GPIO
OPEN_FRONT_DOOR_OUTPUT = 4 # Pin 5
OPEN_APARTMENT_DO... | [
"signal.signal",
"RPi.GPIO.add_event_detect",
"signal.setitimer",
"threading.Lock",
"logger.Logger.get",
"RPi.GPIO.setup",
"RPi.GPIO.setwarnings",
"RPi.GPIO.output",
"time.sleep",
"os.geteuid",
"threading.Event",
"RPi.GPIO.remove_event_detect",
"random.randint",
"RPi.GPIO.setmode"
] | [((393, 399), 'threading.Lock', 'Lock', ([], {}), '()\n', (397, 399), False, 'from threading import Lock, Thread, Event\n'), ((6747, 6771), 'logger.Logger.get', 'Logger.get', ([], {'verbose': '(True)'}), '(verbose=True)\n', (6757, 6771), False, 'from logger import Logger\n'), ((701, 721), 'random.randint', 'random.rand... |
# adjust_vec.py Demo of Adjusters linked to a dial
# Released under the MIT License (MIT). See LICENSE.
# Copyright (c) 2021 <NAME>
# hardware_setup must be imported before other modules because of RAM use.
import hardware_setup # Create a display instance
import cmath
from gui.core.ugui import Screen, ssd
from gui... | [
"gui.widgets.Dial",
"gui.widgets.Pointer",
"gui.core.writer.CWriter",
"gui.widgets.CloseButton",
"cmath.rect",
"gui.widgets.Adjuster",
"gui.widgets.Label",
"gui.core.ugui.Screen.change"
] | [((1490, 1515), 'gui.core.ugui.Screen.change', 'Screen.change', (['BaseScreen'], {}), '(BaseScreen)\n', (1503, 1515), False, 'from gui.core.ugui import Screen, ssd\n'), ((593, 625), 'gui.core.writer.CWriter', 'CWriter', (['ssd', 'font', 'GREEN', 'BLACK'], {}), '(ssd, font, GREEN, BLACK)\n', (600, 625), False, 'from gui... |
from pokemonmeu import PokemonNaoExisteException
import requests
"""
def nivel_do_pokemon(nome, experiencia):
url = f'https://pokeapi.co/api/v2/pokemon-species/{nome}/'.lower()
resp = requests.get(url)
if resp.status_code == 200:
dic = resp.json()
curva_url = dic['growth_rate']['url']
... | [
"requests.get"
] | [((1769, 1786), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1781, 1786), False, 'import requests\n'), ((2086, 2113), 'requests.get', 'requests.get', (['url_evolution'], {}), '(url_evolution)\n', (2098, 2113), False, 'import requests\n')] |
from matrix.server import MatrixServer
from matrix._weechat import MockConfig
import matrix.globals as G
G.CONFIG = MockConfig()
class TestClass(object):
def test_address_parsing(self):
homeserver = MatrixServer._parse_url("example.org", 8080)
assert homeserver.hostname == "example.org"
as... | [
"matrix.server.MatrixServer._parse_url",
"matrix._weechat.MockConfig"
] | [((117, 129), 'matrix._weechat.MockConfig', 'MockConfig', ([], {}), '()\n', (127, 129), False, 'from matrix._weechat import MockConfig\n'), ((213, 257), 'matrix.server.MatrixServer._parse_url', 'MatrixServer._parse_url', (['"""example.org"""', '(8080)'], {}), "('example.org', 8080)\n", (236, 257), False, 'from matrix.s... |
import ccxt
import time
import os
import sys
home_path = '../'
src_path = home_path + 'src/'
sys.path.append(os.path.abspath(src_path))
from func_get import get_json, get_time, get_exchange, get_cash_value, check_end_date
from func_update import append_error_log, update_timestamp
from func_rebalance import... | [
"func_get.get_time",
"func_rebalance.get_sequence_loop",
"func_get.get_cash_value",
"func_rebalance.reset_order_loop",
"func_update.append_error_log",
"func_get.check_end_date",
"os.getcwd",
"time.sleep",
"func_rebalance.rebalance",
"func_update.update_timestamp",
"func_get.get_exchange",
"fun... | [((117, 142), 'os.path.abspath', 'os.path.abspath', (['src_path'], {}), '(src_path)\n', (132, 142), False, 'import os\n'), ((634, 661), 'func_get.get_exchange', 'get_exchange', (['config_system'], {}), '(config_system)\n', (646, 661), False, 'from func_get import get_json, get_time, get_exchange, get_cash_value, check_... |
from importlib import import_module
from os import environ
import typing as t
from . import global_settings
from ..errors.server import SettingsFileNotFoundError, ImproperlyConfigured
from ..errors.misc import DataTypeMismatchError
__all__ = ("get_settings_module", "settings")
ENVIRONMENT_VARIABLE = "NAVYCUT_SETTINGS... | [
"os.environ.get",
"importlib.import_module"
] | [((433, 472), 'os.environ.get', 'environ.get', (['ENVIRONMENT_VARIABLE', 'None'], {}), '(ENVIRONMENT_VARIABLE, None)\n', (444, 472), False, 'from os import environ\n'), ((1332, 1367), 'importlib.import_module', 'import_module', (['self.SETTINGS_MODULE'], {}), '(self.SETTINGS_MODULE)\n', (1345, 1367), False, 'from impor... |
# %% [markdown]
# ##
import os
import time
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib.patches import Circle
from mpl_toolkits.axes_grid1 import make_axes_locatable
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
from sci... | [
"numpy.log10",
"pandas.read_csv",
"src.io.savecsv",
"numpy.empty",
"numpy.random.seed",
"pandas.DataFrame",
"numpy.isinf",
"src.io.savefig",
"numpy.random.choice",
"hyppo.ksample.KSample",
"time.time",
"numpy.median",
"src.io.readcsv",
"sklearn.metrics.pairwise_distances",
"joblib.Parall... | [((962, 982), 'numpy.random.seed', 'np.random.seed', (['(8888)'], {}), '(8888)\n', (976, 982), True, 'import numpy as np\n'), ((1522, 1577), 'src.io.readcsv', 'readcsv', (["('meta' + basename)"], {'foldername': 'exp', 'index_col': '(0)'}), "('meta' + basename, foldername=exp, index_col=0)\n", (1529, 1577), False, 'from... |
import sys
import socket
import struct
import time
import threading
class server_msi( object ):
def __recv( self, sckt ):
msg = sckt.recv( self.slen )
try:
cmd = msg[0:1]
who = int( msg[1:4] )
dst = int( msg[4:7] )
siz = int( msg[7:17] )
... | [
"socket.socket",
"threading.Lock",
"sys.stderr.flush",
"time.sleep",
"sys.stderr.write",
"struct.unpack",
"threading.Thread",
"socket.gethostname"
] | [((3555, 3571), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (3569, 3571), False, 'import threading\n'), ((5496, 5540), 'socket.socket', 'socket.socket', (['self.kind', 'socket.SOCK_STREAM'], {}), '(self.kind, socket.SOCK_STREAM)\n', (5509, 5540), False, 'import socket\n'), ((6153, 6197), 'socket.socket', 'soc... |
# Generated by Django 2.1.8 on 2019-06-02 06:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rooms', '0008_room_location'),
]
operations = [
migrations.AddField(
model_name='room',
name='type',
fie... | [
"django.db.models.CharField"
] | [((323, 377), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(20)', 'null': '(True)'}), '(blank=True, max_length=20, null=True)\n', (339, 377), False, 'from django.db import migrations, models\n')] |
import sys, os, random, json, uuid, time, argparse, logging, logging.config
import numpy as np
from random import randint
from collections import defaultdict as ddict, Counter
from orderedset import OrderedSet
from pprint import pprint
# PyTorch related imports
import torch
from torch.nn import functional as F
from to... | [
"logging.getLogger",
"logging.StreamHandler",
"logging.config.dictConfig",
"logging.Formatter",
"torch.stack",
"torch.Tensor",
"torch.rfft",
"torch.nn.init.xavier_normal_",
"numpy.set_printoptions"
] | [((531, 563), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(4)'}), '(precision=4)\n', (550, 563), True, 'import numpy as np\n'), ((1400, 1438), 'logging.config.dictConfig', 'logging.config.dictConfig', (['config_dict'], {}), '(config_dict)\n', (1425, 1438), False, 'import sys, os, random, json, ... |
# Importamos smtplib
import smtplib
# Importamos los modulos necesarios
from email.mime.text import MIMEText
def send_mail(user, pwd, to_who, subjet, message):
# Creamos el mensaje
msg = MIMEText(message)
# Conexion con el server
msg['Subject'] = subjet
msg['From'] = user
msg['To'] = to_who... | [
"smtplib.SMTP",
"email.mime.text.MIMEText"
] | [((198, 215), 'email.mime.text.MIMEText', 'MIMEText', (['message'], {}), '(message)\n', (206, 215), False, 'from email.mime.text import MIMEText\n'), ((359, 394), 'smtplib.SMTP', 'smtplib.SMTP', (['"""smtp.gmail.com"""', '(587)'], {}), "('smtp.gmail.com', 587)\n", (371, 394), False, 'import smtplib\n')] |
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import handler404, handler500
from . import views
urlpatterns = [
url(r'^$', views.index_view, name='index'),
url(r'^activito-admin/', inc... | [
"django.conf.urls.include",
"django.conf.urls.url"
] | [((244, 285), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.index_view'], {'name': '"""index"""'}), "('^$', views.index_view, name='index')\n", (247, 285), False, 'from django.conf.urls import include, url\n'), ((348, 404), 'django.conf.urls.url', 'url', (['"""^contact/$"""', 'views.contact_us_view'], {'name': '"... |
#!/usr/bin/env python3
"""
Assumes the input to be json files
"""
import json
import sys
def read_files(filename_lst):
assert filename_lst, "Got no files to read"
print("Readin these files:", filename_lst, file=sys.stderr)
all_data = []
for fname in filename_lst:
with open(fname, "r") as f:
... | [
"json.load"
] | [((347, 359), 'json.load', 'json.load', (['f'], {}), '(f)\n', (356, 359), False, 'import json\n')] |
#!/usr/bin/env python
from mkt.constants import regions
from mkt.developers.cron import exclude_new_region
def run():
exclude_new_region([regions.TWN])
| [
"mkt.developers.cron.exclude_new_region"
] | [((125, 158), 'mkt.developers.cron.exclude_new_region', 'exclude_new_region', (['[regions.TWN]'], {}), '([regions.TWN])\n', (143, 158), False, 'from mkt.developers.cron import exclude_new_region\n')] |
from kedro.pipeline import Pipeline
from phantasyfootballer.pipelines import data_engineering as de
def create_full_pipeline():
# TODO: this will be the full pipeline from getting data, to preparing the data, to setting up the features and finally executing the predictors
return Pipeline([de.create_pipeline(... | [
"phantasyfootballer.pipelines.data_engineering.create_pipeline"
] | [((301, 321), 'phantasyfootballer.pipelines.data_engineering.create_pipeline', 'de.create_pipeline', ([], {}), '()\n', (319, 321), True, 'from phantasyfootballer.pipelines import data_engineering as de\n')] |
# encoding: utf-8
"""
time: 2019/03/16/01/36
function: 用来启动爬虫项目
"""
from scrapy.cmdline import execute
import sys
import os
print(os.path.dirname(os.path.abspath("__file__")))
sys.path.append(os.path.dirname(os.path.abspath("__file__")))
# execute(['scrapy', 'crawl', ''])
| [
"os.path.abspath"
] | [((149, 176), 'os.path.abspath', 'os.path.abspath', (['"""__file__"""'], {}), "('__file__')\n", (164, 176), False, 'import os\n'), ((211, 238), 'os.path.abspath', 'os.path.abspath', (['"""__file__"""'], {}), "('__file__')\n", (226, 238), False, 'import os\n')] |
"""
This module provides a function to evaluate potential outliers in the aseg.stats
values.
"""
# ------------------------------------------------------------------------------
# subfunctions
def readAsegStats(path_aseg_stats):
"""
A function to read aseg.stats files.
"""
# read file
with open... | [
"csv.DictWriter",
"numpy.mean",
"os.path.join",
"pandas.DataFrame.from_dict",
"numpy.std",
"numpy.percentile",
"qatoolspython.outlierDetection.readAsegStats"
] | [((11106, 11164), 'os.path.join', 'os.path.join', (['subjects_dir', 'subject', '"""stats"""', '"""aseg.stats"""'], {}), "(subjects_dir, subject, 'stats', 'aseg.stats')\n", (11118, 11164), False, 'import os\n'), ((11186, 11216), 'qatoolspython.outlierDetection.readAsegStats', 'readAsegStats', (['path_aseg_stats'], {}), ... |
# -*- coding: utf-8 -*-
"""
This file is covered by the LICENSING file in the root of this project.
"""
import sys
sys.path.append("..")
from flask import g
from hackathon.hmongo.models import User, UserProfile
from hackathon.hackathon_response import internal_server_error, not_found
from hackathon import Component... | [
"hackathon.hmongo.models.UserProfile",
"hackathon.hackathon_response.internal_server_error",
"sys.path.append",
"hackathon.hmongo.models.User.objects.get"
] | [((117, 138), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (132, 138), False, 'import sys\n'), ((495, 523), 'hackathon.hmongo.models.User.objects.get', 'User.objects.get', ([], {'id': 'user_id'}), '(id=user_id)\n', (511, 523), False, 'from hackathon.hmongo.models import User, UserProfile\n'), (... |
#!/usr/bin/env python
# coding:utf8
# -*- coding: utf-8 -*-
"""
Main Program: Run MODIS AGGREGATION IN PARALLEL
Created on 2019
@author: <NAME>
"""
import os
import sys
import h5py
import timeit
import random
import numpy as np
from mpi4py import MPI
from netCDF4 import Dataset
def read_filelist(loc_dir,prefix,yr,... | [
"numpy.dstack",
"numpy.unique",
"numpy.where",
"timeit.default_timer",
"netCDF4.Dataset",
"numpy.min",
"random.seed",
"h5py.File",
"numpy.append",
"numpy.array",
"numpy.zeros",
"os.popen",
"numpy.split",
"numpy.max",
"sys.exit",
"numpy.meshgrid",
"numpy.int",
"numpy.arange"
] | [((673, 693), 'netCDF4.Dataset', 'Dataset', (['fname1', '"""r"""'], {}), "(fname1, 'r')\n", (680, 693), False, 'from netCDF4 import Dataset\n'), ((702, 746), 'numpy.array', 'np.array', (["ncfile.variables['Cloud_Mask_1km']"], {}), "(ncfile.variables['Cloud_Mask_1km'])\n", (710, 746), True, 'import numpy as np\n'), ((88... |
import itertools
import operator
import re
import bs4
from pudzu.utils import *
# Various utilities for BeautifulSoup
# helper functions since: (a) bs4 tags need to be compared with is, not eq; (b) they're iterable
def remove_duplicate_tags(l):
"""Remove duplicate tags from a list (using object identity rather... | [
"itertools.chain",
"re.search",
"re.compile"
] | [((1490, 1509), 're.compile', 're.compile', (['pattern'], {}), '(pattern)\n', (1500, 1509), False, 'import re\n'), ((1311, 1346), 'itertools.chain', 'itertools.chain', (['[tag]', 'tag.parents'], {}), '([tag], tag.parents)\n', (1326, 1346), False, 'import itertools\n'), ((1541, 1562), 're.search', 're.search', (['patter... |
# -*- coding: utf-8 -*-
""" utils/hosts.py is for the tools that handle setting the MilMove hostnames and setting up TLS certs. """
import logging
import os
from typing import Optional
from locust.env import Environment
from .base import ImplementationError, ValueEnum
from .constants import LOCAL_MTLS_CERT, LOCAL_MTL... | [
"logging.getLogger",
"os.path.join",
"os.getenv",
"os.remove"
] | [((369, 396), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (386, 396), False, 'import logging\n'), ((1961, 2004), 'os.getenv', 'os.getenv', (['"""BASE_DOMAIN"""', '"""loadtest.dp3.us"""'], {}), "('BASE_DOMAIN', 'loadtest.dp3.us')\n", (1970, 2004), False, 'import os\n'), ((8383, 8450), '... |
#Usage
# python neural_style_transfer.py --image images/1.jpg --model models/instance_norm/starry_night.t7
import argparse
import numpy
import cv2
import time
import imutils
ap = argparse.ArgumentParser()
ap.add_argument("-m", "--model", required = True,
help = "path to neural style transfer model")
ap.add_argum... | [
"cv2.dnn.blobFromImage",
"cv2.dnn.readNetFromTorch",
"argparse.ArgumentParser",
"cv2.imshow",
"imutils.resize",
"cv2.waitKey",
"time.time",
"cv2.imread"
] | [((182, 207), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (205, 207), False, 'import argparse\n'), ((480, 519), 'cv2.dnn.readNetFromTorch', 'cv2.dnn.readNetFromTorch', (["args['model']"], {}), "(args['model'])\n", (504, 519), False, 'import cv2\n'), ((573, 598), 'cv2.imread', 'cv2.imread', (... |