code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | [
"openerp.addons.decimal_precision.get_precision",
"openerp.osv.fields.many2one",
"openerp.osv.fields.date",
"openerp.osv.fields.selection",
"openerp.osv.fields.integer",
"openerp.tools.drop_view_if_exists"
] | [((1534, 1574), 'openerp.osv.fields.date', 'fields.date', (['"""Start Date"""'], {'readonly': '(True)'}), "('Start Date', readonly=True)\n", (1545, 1574), False, 'from openerp.osv import fields, osv\n'), ((1595, 1661), 'openerp.osv.fields.date', 'fields.date', (['"""End Date"""'], {'readonly': '(True)', 'help': '"""End... |
import time
from datetime import datetime
from app import db
class Board(db.Model):
__tablename__ = 'board'
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(64))
name = db.Column(db.String(64), unique=True)
ct = db.Column(db.DateTime, default=datetime.utcnow)
ut = db.... | [
"app.db.String",
"app.db.Column",
"datetime.datetime.utcnow"
] | [((125, 164), 'app.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (134, 164), False, 'from app import db\n'), ((260, 307), 'app.db.Column', 'db.Column', (['db.DateTime'], {'default': 'datetime.utcnow'}), '(db.DateTime, default=datetime.utcnow)\n', (269, 307), F... |
from pyspark import SparkConf,SparkContext
from pyspark.streaming import StreamingContext
from pyspark.sql import Row,SQLContext
import sys
import time
import pprint
#import requests
def aggregate_tweets_count(new_values, total_sum):
return sum(new_values) + (total_sum or 0)
def tmp(x):
y = x.split(';... | [
"pyspark.streaming.StreamingContext",
"pyspark.SparkContext",
"pyspark.SparkConf"
] | [((378, 389), 'pyspark.SparkConf', 'SparkConf', ([], {}), '()\n', (387, 389), False, 'from pyspark import SparkConf, SparkContext\n'), ((422, 445), 'pyspark.SparkContext', 'SparkContext', ([], {'conf': 'conf'}), '(conf=conf)\n', (434, 445), False, 'from pyspark import SparkConf, SparkContext\n'), ((453, 476), 'pyspark.... |
'''Train DCENet with PyTorch'''
# from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
import os
import json
import neptune
import argparse
import numpy as np
from loader import *
from utils.plots import *
from utils.utils impor... | [
"utils.ranking.gauss_rank",
"neptune.init",
"numpy.reshape",
"neptune.log_metric",
"argparse.ArgumentParser",
"neptune.create_experiment",
"numpy.argmax",
"models.DCENet",
"torch.cuda.is_available",
"numpy.random.seed",
"utils.datainfo.DataInfo",
"torch.utils.data.DataLoader",
"json.load",
... | [((7920, 7935), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (7933, 7935), False, 'import torch\n'), ((564, 633), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch Knowledge Distillation"""'}), "(description='PyTorch Knowledge Distillation')\n", (587, 633), False, 'import arg... |
""" generic classes defining structure of the filesystem API
"""
import os
import glob
import types
import itertools
import autofile
class DataDir():
""" a class implementing common data directory methods """
def __init__(self, name_, nargs=0, depth=1,
creation_side_effect_=(lambda _1, _2: N... | [
"os.makedirs",
"types.SimpleNamespace",
"os.path.join",
"autofile.read_file",
"os.getcwd",
"os.chdir",
"os.path.isfile",
"os.path.split",
"os.path.isdir",
"autofile.write_file",
"os.path.abspath",
"os.path.relpath"
] | [((891, 914), 'os.path.abspath', 'os.path.abspath', (['prefix'], {}), '(prefix)\n', (906, 914), False, 'import os\n'), ((1066, 1092), 'os.path.join', 'os.path.join', (['prefix', 'name'], {}), '(prefix, name)\n', (1078, 1092), False, 'import os\n'), ((1242, 1265), 'os.path.isdir', 'os.path.isdir', (['dir_path'], {}), '(... |
#!/usr/bin/python
import requests
from pyquery import PyQuery
def stringified_page(url):
'''
Request a webpage
'''
r = requests.get(url)
if r.status_code == 200:
return str(PyQuery(r.text))
else:
raise Exception(r.status_code)
| [
"pyquery.PyQuery",
"requests.get"
] | [((138, 155), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (150, 155), False, 'import requests\n'), ((205, 220), 'pyquery.PyQuery', 'PyQuery', (['r.text'], {}), '(r.text)\n', (212, 220), False, 'from pyquery import PyQuery\n')] |
from os import path, listdir, mkdir
from merge_db.save_merge import Database
from tqdm import tqdm
if __name__ == "__main__":
working_directory = "/Users/Mathieu/Desktop/"
db_folder = "{}/db2".format(working_directory)
# Be sure that the path of the folder containing the databases is correct.
asser... | [
"os.path.exists",
"os.listdir",
"merge_db.save_merge.Database",
"tqdm.tqdm",
"os.mkdir"
] | [((322, 344), 'os.path.exists', 'path.exists', (['db_folder'], {}), '(db_folder)\n', (333, 344), False, 'from os import path, listdir, mkdir\n'), ((697, 754), 'merge_db.save_merge.Database', 'Database', ([], {'folder': 'db_folder', 'database_name': 'list_db_name[0]'}), '(folder=db_folder, database_name=list_db_name[0])... |
def voto():
from datetime import datetime
nascimento = int(input('Informe o ano de nascimento: '))
while nascimento > datetime.now().year:
print('Erro! O ano de nascimento não pode exceder o ano atual.')
nascimento = int(input('Digite novamente: '))
if nascimento < datetime.now().yea... | [
"datetime.datetime.now"
] | [((130, 144), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (142, 144), False, 'from datetime import datetime\n'), ((353, 367), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (365, 367), False, 'from datetime import datetime\n'), ((302, 316), 'datetime.datetime.now', 'datetime.now', ([], {}), '... |
from unittest import TestCase
import os.path as osp
import numpy as np
from datumaro.components.annotation import Label, Points
from datumaro.components.dataset import Dataset
from datumaro.components.extractor import DatasetItem
from datumaro.plugins.lfw_format import LfwConverter, LfwImporter
from datumaro.util.ima... | [
"numpy.ones",
"datumaro.util.test_utils.compare_datasets",
"datumaro.util.test_utils.TestDir",
"datumaro.plugins.lfw_format.LfwConverter.convert",
"datumaro.components.annotation.Label",
"datumaro.plugins.lfw_format.LfwImporter.detect",
"os.path.dirname",
"numpy.zeros",
"datumaro.components.annotati... | [((7684, 7705), 'os.path.dirname', 'osp.dirname', (['__file__'], {}), '(__file__)\n', (7695, 7705), True, 'import os.path as osp\n'), ((9112, 9157), 'datumaro.components.dataset.Dataset.import_from', 'Dataset.import_from', (['DUMMY_DATASET_DIR', '"""lfw"""'], {}), "(DUMMY_DATASET_DIR, 'lfw')\n", (9131, 9157), False, 'f... |
import numpy as np
import pandas as pd
from collections import Counter
import re
import string
import itertools
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.linear_model impor... | [
"itertools.chain",
"sklearn.feature_extraction.text.TfidfTransformer",
"pandas.read_csv",
"numpy.array",
"nltk.stem.porter.PorterStemmer",
"numpy.divide",
"imblearn.under_sampling.RandomUnderSampler",
"nltk.corpus.stopwords.words",
"sklearn.feature_extraction.text.CountVectorizer",
"pandas.concat"... | [((849, 867), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (863, 867), True, 'import numpy as np\n'), ((1320, 1362), 'pandas.read_csv', 'pd.read_csv', (['filepath'], {'index_col': 'index_col'}), '(filepath, index_col=index_col)\n', (1331, 1362), True, 'import pandas as pd\n'), ((1553, 1638), 'sklear... |
import os
import shutil
import subprocess
import sys
import pytest
from assets.scripts.build_gallery import execute_shell_command
from great_expectations.data_context.util import file_relative_path
integration_test_matrix = [
{
"name": "pandas_two_batch_requests_two_validators",
"base_dir": file_... | [
"assets.scripts.build_gallery.execute_shell_command",
"subprocess.run",
"os.path.join",
"os.getcwd",
"os.chdir",
"pytest.mark.parametrize",
"shutil.copytree",
"shutil.copyfile",
"pytest.mark.skipif",
"great_expectations.data_context.util.file_relative_path"
] | [((789, 874), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""test_configuration"""', 'integration_test_matrix'], {'ids': 'idfn'}), "('test_configuration', integration_test_matrix, ids=idfn\n )\n", (812, 874), False, 'import pytest\n'), ((871, 945), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(sys.ver... |
# system
import sys
import os
import time
import copy
if os.name == 'posix':
import resource
import warnings
from tqdm import tqdm
# sci
import scipy as sp
from scipy import stats, signal, random
from scipy.optimize import curve_fit
import quantities as pq
import cv2
# ml
import sklearn
from sklearn.neighbors imp... | [
"scipy.around",
"neo.NixIO",
"scipy.pad",
"copy.deepcopy",
"neo.core.AnalogSignal",
"neo.core.SpikeTrain",
"os.remove",
"os.path.exists",
"scipy.stats.gaussian_kde",
"scipy.exp",
"sklearn.decomposition.PCA",
"scipy.concatenate",
"elephant.statistics.instantaneous_rate",
"sklearn.neighbors.... | [((474, 507), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (497, 507), False, 'import warnings\n'), ((513, 524), 'time.time', 'time.time', ([], {}), '()\n', (522, 524), False, 'import time\n'), ((2671, 2696), 'copy.deepcopy', 'copy.deepcopy', (['SpikeTrain'], {}), '(Spik... |
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.python.ops.array_ops.reshape",
"tensorflow.python.ops.check_ops.assert_equal",
"tensorflow.python.ops.ragged.ragged_tensor.convert_to_tensor_or_ragged_tensor",
"tensorflow.python.util.tf_export.tf_export",
"tensorflow.python.ops.array_ops.identity",
"tensorflow.python.ops.gen_count_ops.dense_c... | [((1181, 1209), 'tensorflow.python.util.tf_export.tf_export', 'tf_export', (['"""sparse.bincount"""'], {}), "('sparse.bincount')\n", (1190, 1209), False, 'from tensorflow.python.util.tf_export import tf_export\n'), ((6922, 6970), 'tensorflow.python.framework.ops.name_scope', 'ops.name_scope', (['name', '"""count"""', '... |
#!/usr/bin/env python
from TurbAn.Utilities.subs import *
def pgmultiplt(rc,variables,bs,fs,step,pgcmp,smooth,numsmooth):
import numpy as np
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore
rcd=rc.__dict__
if smooth == 'y':
from scipy.ndimage import gaussian_filter as gf
... | [
"scipy.ndimage.gaussian_filter",
"pyqtgraph.setConfigOptions",
"pyqtgraph.Qt.QtGui.QApplication",
"pyqtgraph.QtGui.QApplication.processEvents",
"pyqtgraph.GraphicsWindow",
"numpy.mod"
] | [((350, 372), 'pyqtgraph.Qt.QtGui.QApplication', 'QtGui.QApplication', (['[]'], {}), '([])\n', (368, 372), False, 'from pyqtgraph.Qt import QtGui, QtCore\n'), ((381, 422), 'pyqtgraph.GraphicsWindow', 'pg.GraphicsWindow', ([], {'title': '"""Multiplot-Test"""'}), "(title='Multiplot-Test')\n", (398, 422), True, 'import py... |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | [
"oslo_utils.uuidutils.generate_uuid",
"mock.patch",
"octavia.controller.healthmanager.health_manager.HealthManager",
"mock.MagicMock"
] | [((824, 849), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (847, 849), False, 'from oslo_utils import uuidutils\n'), ((1116, 1217), 'mock.patch', 'mock.patch', (['"""octavia.controller.worker.controller_worker.ControllerWorker.failover_amphora"""'], {}), "(\n 'octavia.controller... |
from rest_framework import status
from rest_framework.test import APIClient
from django.urls import reverse
from recipe_api.models import Ingredient
from recipe.serializers import IngridentSerializer
from django.test import TestCase
from django.contrib.auth import get_user_model
INGREDIENTS_URL = reverse('recipe:ingr... | [
"recipe_api.models.Ingredient.objects.create",
"django.contrib.auth.get_user_model",
"recipe_api.models.Ingredient.objects.filter",
"rest_framework.test.APIClient",
"recipe.serializers.IngridentSerializer",
"django.urls.reverse",
"recipe_api.models.Ingredient.objects.all"
] | [((300, 333), 'django.urls.reverse', 'reverse', (['"""recipe:ingredient-list"""'], {}), "('recipe:ingredient-list')\n", (307, 333), False, 'from django.urls import reverse\n'), ((472, 483), 'rest_framework.test.APIClient', 'APIClient', ([], {}), '()\n', (481, 483), False, 'from rest_framework.test import APIClient\n'),... |
'''
Name: app.py
Writer: <NAME>, Ainizer
Rule: Flask app
update: 21.01.06
'''
# External module.
from transformers import AutoModelForCausalLM, AutoTokenizer, top_k_top_p_filtering
from flask import Flask, request, Response, jsonify, render_template
import torch
from torch.nn import functional as F
# I... | [
"flask.render_template",
"torch.multinomial",
"flask.Flask",
"transformers.top_k_top_p_filtering",
"time.sleep",
"torch.cuda.is_available",
"transformers.AutoModelForCausalLM.from_pretrained",
"transformers.AutoTokenizer.from_pretrained",
"threading.Thread",
"queue.Queue",
"torch.nn.functional.s... | [((403, 418), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (408, 418), False, 'from flask import Flask, request, Response, jsonify, render_template\n'), ((463, 522), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['"""laxya007/gpt2_Marketingman"""'], {}), "('laxya007/gpt2... |
import datetime
import os
import sys
from configparser import SafeConfigParser, ConfigParser
import pkg_resources
import logging
from trustworthiness.definitions import OUTPUT_FOLDER
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
c... | [
"logging.getLogger",
"logging.StreamHandler",
"configparser.ConfigParser",
"logging.Formatter",
"os.environ.get",
"os.path.join",
"datetime.datetime.now",
"logging.FileHandler",
"os.path.abspath",
"os.path.expanduser"
] | [((596, 689), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s [%(threadName)-12.12s] [%(levelname)-5.5s] %(message)s"""'], {}), "(\n '%(asctime)s [%(threadName)-12.12s] [%(levelname)-5.5s] %(message)s')\n", (613, 689), False, 'import logging\n'), ((708, 737), 'logging.FileHandler', 'logging.FileHandler... |
#!/usr/bin/env python3
import os
import logging
#logging.basicConfig(level=logging.DEBUG)
from time import sleep
from keithley2600 import Keithley2600
import numpy as np
import saleae
np.set_printoptions(precision=2)
instrument_serial = 'USB0::fc00:db20:35b:7399::5::4309410\x00::0::INSTR'
dirname = os.path.abspath("t... | [
"os.path.exists",
"os.makedirs",
"numpy.set_printoptions",
"saleae.Saleae",
"os.path.abspath",
"numpy.save",
"numpy.arange",
"keithley2600.Keithley2600"
] | [((185, 217), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(2)'}), '(precision=2)\n', (204, 217), True, 'import numpy as np\n'), ((302, 328), 'os.path.abspath', 'os.path.abspath', (['"""traces/"""'], {}), "('traces/')\n", (317, 328), False, 'import os\n'), ((526, 552), 'numpy.arange', 'np.arange... |
import invoke
@invoke.task()
def check(c):
"""Run formatting, linting and testing."""
c.run("isort tinypubsub tests")
c.run("black tinypubsub tests")
c.run("flake8 tinypubsub tests")
c.run("mypy tinypubsub tests")
c.run("pytest tests")
| [
"invoke.task"
] | [((17, 30), 'invoke.task', 'invoke.task', ([], {}), '()\n', (28, 30), False, 'import invoke\n')] |
# -*- coding: utf-8 -*-
"""
Opening Files and Reading Data
Intro to Python Workshop
"""
# The open() function is the basic ticket to reading in and accessing data
# This function returns a file handler. We usually want to open and
# read data from files, and sometimes write data to them. It is good
# practi... | [
"matplotlib.pyplot.hist",
"matplotlib.pyplot.title",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.xlabel",
"csv.writer",
"google.colab.files.upload",
"os.getcwd",
"os.chdir",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"csv.reader",
... | [((758, 772), 'google.colab.files.upload', 'files.upload', ([], {}), '()\n', (770, 772), False, 'from google.colab import files\n'), ((787, 798), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (796, 798), False, 'import os\n'), ((800, 888), 'os.chdir', 'os.chdir', (['"""C:/Users/scottkelley/Dropbox/UNR_Service/PythonWorks... |
import pygame
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
def main():
def draw_stick_figure(screen, x, y):
# Head
pygame.draw.ellipse(screen, BLACK, [1 + x, y, 10, 10], 0)
# Legs
pygame.draw.line(screen, BLACK, [5 + x, 17 + y], [10 + x, 27 ... | [
"pygame.display.set_caption",
"pygame.quit",
"pygame.init",
"pygame.draw.line",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.draw.ellipse",
"pygame.time.Clock"
] | [((662, 675), 'pygame.init', 'pygame.init', ([], {}), '()\n', (673, 675), False, 'import pygame\n'), ((712, 741), 'pygame.display.set_mode', 'pygame.display.set_mode', (['size'], {}), '(size)\n', (735, 741), False, 'import pygame\n'), ((747, 784), 'pygame.display.set_caption', 'pygame.display.set_caption', (['"""My Gam... |
from django.contrib import admin
from django.contrib.auth import admin as auth_admin
from django.contrib.auth import get_user_model
from django.forms import ModelForm
from taggit.forms import TagField
from taggit_labels.widgets import LabelWidget
from taggit.models import Tag
from .site_admin import constellation_adm... | [
"django.contrib.auth.get_user_model",
"django.contrib.admin.register",
"taggit_labels.widgets.LabelWidget"
] | [((492, 508), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (506, 508), False, 'from django.contrib.auth import get_user_model\n'), ((768, 788), 'django.contrib.admin.register', 'admin.register', (['User'], {}), '(User)\n', (782, 788), False, 'from django.contrib import admin\n'), ((790, 836... |
"""
GitLab API:
https://docs.gitlab.com/ee/api/instance_level_ci_variables.html
https://docs.gitlab.com/ee/api/project_level_variables.html
https://docs.gitlab.com/ee/api/group_level_variables.html
"""
import re
import pytest
import responses
from gitlab.v4.objects import GroupVariable, ProjectVariable, Variable
k... | [
"responses.RequestsMock",
"re.compile"
] | [((533, 620), 're.compile', 're.compile', (['"""http://localhost/api/v4/(((groups|projects)/1)|(admin/ci))/variables"""'], {}), "(\n 'http://localhost/api/v4/(((groups|projects)/1)|(admin/ci))/variables')\n", (543, 620), False, 'import re\n'), ((643, 742), 're.compile', 're.compile', (['f"""http://localhost/api/v4/(... |
import logging
import random
import torch
import platalea.asr as M
import platalea.dataset as D
from platalea.experiments.config import get_argument_parser
args = get_argument_parser()
# Parsing arguments
args.enable_help()
args.parse()
# Setting general configuration
torch.manual_seed(args.seed)
random.seed(args.s... | [
"torch.manual_seed",
"platalea.asr.get_default_config",
"random.seed",
"platalea.experiments.config.get_argument_parser",
"logging.info",
"platalea.dataset.flickr8k_loader"
] | [((166, 187), 'platalea.experiments.config.get_argument_parser', 'get_argument_parser', ([], {}), '()\n', (185, 187), False, 'from platalea.experiments.config import get_argument_parser\n'), ((273, 301), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (290, 301), False, 'import torch\n')... |
from http import HTTPStatus
from typing import List, Literal, Type, Union
from flask import Flask, request
from werkzeug.datastructures import Headers
from werkzeug.wrappers import Response as BaseResponse
def _resolve_oas_object(
oas_data: dict,
obj: dict,
type_: Literal[
"schema",
"rb",... | [
"flask.request.args.to_dict",
"flask.request.files.to_dict",
"werkzeug.datastructures.Headers",
"flask.request.get_json",
"flask.request.form.to_dict",
"flask.request.values.to_dict",
"http.HTTPStatus",
"flask.request.headers.get"
] | [((1113, 1122), 'werkzeug.datastructures.Headers', 'Headers', ([], {}), '()\n', (1120, 1122), False, 'from werkzeug.datastructures import Headers\n'), ((1649, 1667), 'http.HTTPStatus', 'HTTPStatus', (['status'], {}), '(status)\n', (1659, 1667), False, 'from http import HTTPStatus\n'), ((5179, 5197), 'flask.request.get_... |
from django.utils.translation import ugettext_lazy as _
FULL_NAME_REQUIRED = _('Your name')
RESERVATION_REQUIRED = _('Hotel confirmation')
| [
"django.utils.translation.ugettext_lazy"
] | [((79, 93), 'django.utils.translation.ugettext_lazy', '_', (['"""Your name"""'], {}), "('Your name')\n", (80, 93), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((117, 140), 'django.utils.translation.ugettext_lazy', '_', (['"""Hotel confirmation"""'], {}), "('Hotel confirmation')\n", (118, 140), T... |
from collections import deque
from logging import getLogger, basicConfig, INFO
logger = getLogger(__name__)
basicConfig(level=INFO)
def arr_n_check(privacy, test_range, n_checks):
"""
returns the test_privacy tuple
seek for it to be symmetrical, therefore, equal number of observations on
eithe... | [
"logging.getLogger",
"collections.deque",
"logging.basicConfig"
] | [((94, 113), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (103, 113), False, 'from logging import getLogger, basicConfig, INFO\n'), ((115, 138), 'logging.basicConfig', 'basicConfig', ([], {'level': 'INFO'}), '(level=INFO)\n', (126, 138), False, 'from logging import getLogger, basicConfig, INFO\... |
from numpy import full, nan
from pandas import DataFrame, concat
from .call_function_with_multiprocess import call_function_with_multiprocess
from .compute_1d_array_context import compute_1d_array_context
from .split_dataframe import split_dataframe
def _make_context_matrix(
dataframe,
skew_t_pdf_fit_paramet... | [
"pandas.DataFrame",
"numpy.full"
] | [((535, 561), 'numpy.full', 'full', (['dataframe.shape', 'nan'], {}), '(dataframe.shape, nan)\n', (539, 561), False, 'from numpy import full, nan\n'), ((1788, 1863), 'pandas.DataFrame', 'DataFrame', (['context_matrix'], {'index': 'dataframe.index', 'columns': 'dataframe.columns'}), '(context_matrix, index=dataframe.ind... |
from flask import Flask
from flask import request
from check2PL import solve2PL
from checkConflict import solveConflict
from checkTimestamps import solveTimestamps
from utils import parse_schedule
app = Flask(__name__)
index_cached = open('../static/index.html', 'r').read()
@app.route("/2PL", methods=['GET', 'PO... | [
"flask.request.args.get",
"check2PL.solve2PL",
"flask.Flask",
"flask.request.form.get",
"os.path.isfile",
"checkTimestamps.solveTimestamps",
"utils.parse_schedule",
"checkConflict.solveConflict"
] | [((206, 221), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (211, 221), False, 'from flask import Flask\n'), ((382, 410), 'flask.request.args.get', 'request.args.get', (['"""schedule"""'], {}), "('schedule')\n", (398, 410), False, 'from flask import request\n'), ((429, 460), 'flask.request.args.get', 'req... |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | [
"paddle.fluid.layers.square",
"paddle.fluid.layers.create_global_var",
"paddle.fluid.layers.gather",
"paddle.fluid.layers.reduce_sum",
"numpy.array",
"paddle.fluid.layers.elementwise_add",
"paddle.fluid.layers.assign",
"paddle.fluid.layers.matmul",
"numpy.arange",
"paddle.fluid.layers.reshape"
] | [((865, 902), 'numpy.arange', 'np.arange', (['(0)', '(batch_size * batch_size)'], {}), '(0, batch_size * batch_size)\n', (874, 902), True, 'import numpy as np\n'), ((1675, 1728), 'paddle.fluid.layers.reshape', 'fluid.layers.reshape', (['feature'], {'shape': '[batch_size, -1]'}), '(feature, shape=[batch_size, -1])\n', (... |
#!/usr/bin/env python
import gzip
import shutil
import subprocess
import sys
import zlib
from io import BytesIO
from pathlib import Path
import zopfli.gzip
import zopfli.zlib
import zopfli.png
import pytest
class BaseTests(object):
data = (Path(__file__).parent.parent / "README.rst").read_bytes()
def test... | [
"pathlib.Path",
"subprocess.run",
"io.BytesIO",
"pytest.main",
"pytest.mark.parametrize",
"shutil.copy"
] | [((1568, 1838), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""kwargs"""', "[{}, {'verbose': True}, {'lossy_transparent': True}, {'lossy_8bit': True},\n {'use_zopfli': False}, {'filter_strategies': '01234mepb'}, {\n 'keepchunks': ['gAMA', 'bKGD']}, {'num_iterations': 30}, {\n 'num_iterations_large... |
################################################################################
# Copyright (c) 2009-2019, National Research Foundation (Square Kilometre Array)
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy
# of the... | [
"ephem.Date",
"katpoint.Timestamp"
] | [((3394, 3441), 'katpoint.Timestamp', 'katpoint.Timestamp', (['self.valid_timestamps[0][0]'], {}), '(self.valid_timestamps[0][0])\n', (3412, 3441), False, 'import katpoint\n'), ((3726, 3773), 'katpoint.Timestamp', 'katpoint.Timestamp', (['self.valid_timestamps[1][0]'], {}), '(self.valid_timestamps[1][0])\n', (3744, 377... |
from django.contrib import admin
from salary_calculator.models import Day, Salary, Month, Payout, Year
admin.site.register(Day)
admin.site.register(Salary)
admin.site.register(Month)
admin.site.register(Payout)
admin.site.register(Year)
| [
"django.contrib.admin.site.register"
] | [((105, 129), 'django.contrib.admin.site.register', 'admin.site.register', (['Day'], {}), '(Day)\n', (124, 129), False, 'from django.contrib import admin\n'), ((130, 157), 'django.contrib.admin.site.register', 'admin.site.register', (['Salary'], {}), '(Salary)\n', (149, 157), False, 'from django.contrib import admin\n'... |
import time
import rospy
import picamera
from rospy import Service
from std_srvs.srv import (Empty, EmptyRequest, EmptyResponse)
import threading
from tactics.ee3.EE3ClientConfigurableSampleRate import EE3ClientConfigurableSampleRate
class CameraController(EE3ClientConfigurableSampleRate):
# Operational variable
... | [
"std_srvs.srv.EmptyResponse",
"std_srvs.srv.EmptyRequest",
"rospy.Service",
"picamera.PiCamera",
"time.sleep",
"threading.Thread"
] | [((1015, 1076), 'rospy.Service', 'rospy.Service', (['"""/camera/start"""', 'Empty', 'self.__start_recording'], {}), "('/camera/start', Empty, self.__start_recording)\n", (1028, 1076), False, 'import rospy\n'), ((1117, 1176), 'rospy.Service', 'rospy.Service', (['"""/camera/stop"""', 'Empty', 'self.__stop_recording'], {}... |
# -*- coding:utf-8 -*-
from __future__ import (
absolute_import, division, print_function, unicode_literals,
)
import uuid
from functools import wraps
from django.db import connections
from django.db.utils import DEFAULT_DB_ALIAS
from django.utils import six
class override_mysql_variables(object):
"""
B... | [
"uuid.uuid1",
"django.utils.six.iteritems",
"functools.wraps"
] | [((1624, 1640), 'functools.wraps', 'wraps', (['test_func'], {}), '(test_func)\n', (1629, 1640), False, 'from functools import wraps\n'), ((2306, 2333), 'django.utils.six.iteritems', 'six.iteritems', (['self.options'], {}), '(self.options)\n', (2319, 2333), False, 'from django.utils import six\n'), ((1019, 1031), 'uuid.... |
from random import randint
from os import path
def filename_generator(name: str, suffix: str) -> str:
# in case you need a filename generator:
filename = name + f"_{randint(1000, 100000000)}." + suffix
while path.exists(filename):
filename = name + f"_{randint(1000, 100000000)}." + suffix
ret... | [
"os.path.exists",
"random.randint"
] | [((222, 243), 'os.path.exists', 'path.exists', (['filename'], {}), '(filename)\n', (233, 243), False, 'from os import path\n'), ((175, 199), 'random.randint', 'randint', (['(1000)', '(100000000)'], {}), '(1000, 100000000)\n', (182, 199), False, 'from random import randint\n'), ((275, 299), 'random.randint', 'randint', ... |
import numpy as np
import cv2
import sys
import subprocess
import os
import wave
from scipy import signal
from scipy.io import wavfile
import matplotlib.pyplot as plt
from python_speech_features import mfcc
from python_speech_features import delta
from python_speech_features import logfbank
import scipy.i... | [
"os.path.exists",
"os.makedirs",
"python_speech_features.mfcc",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"subprocess.call",
"cv2.CascadeClassifier",
"cv2.resize"
] | [((716, 742), 'os.path.exists', 'os.path.exists', (['"""./output"""'], {}), "('./output')\n", (730, 742), False, 'import os\n'), ((749, 772), 'os.makedirs', 'os.makedirs', (['"""./output"""'], {}), "('./output')\n", (760, 772), False, 'import os\n'), ((1004, 1064), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"... |
import os
import dash
def _init_app():
""" Intializes the dash app."""
this_dir = os.path.dirname(os.path.abspath(__file__))
css_file = os.path.join(this_dir, "stylesheet.css")
app = dash.Dash(
__name__,
external_stylesheets=[css_file],
suppress_callback_exceptions=True,
... | [
"os.path.abspath",
"os.path.join",
"dash.Dash"
] | [((152, 192), 'os.path.join', 'os.path.join', (['this_dir', '"""stylesheet.css"""'], {}), "(this_dir, 'stylesheet.css')\n", (164, 192), False, 'import os\n'), ((203, 294), 'dash.Dash', 'dash.Dash', (['__name__'], {'external_stylesheets': '[css_file]', 'suppress_callback_exceptions': '(True)'}), '(__name__, external_sty... |
from ctypes import CDLL, POINTER, byref, c_void_p, c_size_t
from numba import cuda
from numba.cuda import (HostOnlyCUDAMemoryManager, GetIpcHandleMixin,
MemoryPointer, MemoryInfo)
# Open the CUDA runtime DLL and create bindings for the cudaMalloc, cudaFree,
# and cudaMemGetInfo functions.
cud... | [
"numba.cuda.device_array",
"numba.cuda.MemoryInfo",
"ctypes.byref",
"ctypes.POINTER",
"numba.cuda.set_memory_manager",
"numba.cuda.MemoryPointer",
"ctypes.CDLL",
"numba.cuda.current_context",
"ctypes.c_size_t"
] | [((326, 346), 'ctypes.CDLL', 'CDLL', (['"""libcudart.so"""'], {}), "('libcudart.so')\n", (330, 346), False, 'from ctypes import CDLL, POINTER, byref, c_void_p, c_size_t\n'), ((402, 419), 'ctypes.POINTER', 'POINTER', (['c_size_t'], {}), '(c_size_t)\n', (409, 419), False, 'from ctypes import CDLL, POINTER, byref, c_void_... |
"""
Routines for solving the KS equations via Numerov's method
"""
# standard libs
import os
import shutil
# external libs
import numpy as np
from scipy.sparse.linalg import eigsh, eigs
from scipy.linalg import eigh, eig
from joblib import Parallel, delayed, dump, load
# from staticKS import Orbitals
# internal lib... | [
"numpy.argsort",
"numpy.array",
"numpy.exp",
"os.mkdir",
"joblib.load",
"joblib.dump",
"numpy.eye",
"numpy.size",
"numpy.fill_diagonal",
"numpy.shape",
"numpy.transpose",
"scipy.sparse.linalg.eigs",
"mathtools.normalize_orbs",
"os.path.join",
"joblib.Parallel",
"numpy.zeros",
"shutil... | [((1744, 1759), 'numpy.eye', 'np.eye', (['N'], {'k': '(-1)'}), '(N, k=-1)\n', (1750, 1759), True, 'import numpy as np\n'), ((1773, 1782), 'numpy.eye', 'np.eye', (['N'], {}), '(N)\n', (1779, 1782), True, 'import numpy as np\n'), ((1796, 1810), 'numpy.eye', 'np.eye', (['N'], {'k': '(1)'}), '(N, k=1)\n', (1802, 1810), Tru... |
from flask import jsonify, request, Response, json, Blueprint
import datetime
ap = Blueprint('endpoint', __name__)
parcels = []
# GET parcels
@ap.route('/api/v1/parcels')
def get_parcels():
'''
returns a list of all requests
'''
if len(parcels) == 0:
return jsonify({'msg': 'No parcels yet'})... | [
"flask.json.dumps",
"datetime.datetime.now",
"flask.request.get_json",
"flask.Blueprint",
"flask.jsonify"
] | [((85, 116), 'flask.Blueprint', 'Blueprint', (['"""endpoint"""', '__name__'], {}), "('endpoint', __name__)\n", (94, 116), False, 'from flask import jsonify, request, Response, json, Blueprint\n'), ((1084, 1102), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (1100, 1102), False, 'from flask import json... |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from typing import Dict, Iterable
from azure.ml.constants import API_VERSION_2020_09_01_PREVIEW
from azure.ml._datastore.datastore_utiliti... | [
"azure.ml._datastore.datastore_utilities.create_azure_blob_storage_request"
] | [((5528, 5844), 'azure.ml._datastore.datastore_utilities.create_azure_blob_storage_request', 'create_azure_blob_storage_request', (['container_name', 'account_name'], {'description': 'description', 'has_been_validated': 'has_been_validated', 'ident': 'ident', 'is_default': 'is_default', 'tags': 'tags', 'sas_token': 'sa... |
from django.urls import path
from qa_tools.views import create_test_user
urlpatterns = [
path('create_test_user/', create_test_user, name='create_test_user'),
]
| [
"django.urls.path"
] | [((96, 164), 'django.urls.path', 'path', (['"""create_test_user/"""', 'create_test_user'], {'name': '"""create_test_user"""'}), "('create_test_user/', create_test_user, name='create_test_user')\n", (100, 164), False, 'from django.urls import path\n')] |
"""
Methods here define logs for various activities that the moderators can take
via the moderator interface. A new log entry is created for every action.
"""
from datetime import datetime
from critiquebrainz import db
import sqlalchemy
ACTION_HIDE_REVIEW = "hide_review"
ACTION_BLOCK_USER = "block_user"
def create(... | [
"datetime.datetime.now",
"critiquebrainz.db.engine.connect",
"sqlalchemy.text"
] | [((958, 977), 'critiquebrainz.db.engine.connect', 'db.engine.connect', ([], {}), '()\n', (975, 977), False, 'from critiquebrainz import db\n'), ((2342, 2361), 'critiquebrainz.db.engine.connect', 'db.engine.connect', ([], {}), '()\n', (2359, 2361), False, 'from critiquebrainz import db\n'), ((3926, 3945), 'critiquebrain... |
"""Tests for util.config_util"""
import unittest
import random
from ample.util.config_util import AMPLEConfigOptions
from ample.util import argparse_util, options_processor
from ample.util.mrbump_util import REBUILD_MAX_PERMITTED_RESOLUTION, SHELXE_MAX_PERMITTED_RESOLUTION, SHELXE_MAX_PERMITTED_RESOLUTION_CC
__autho... | [
"random.uniform",
"ample.util.options_processor.process_mr_options",
"unittest.main",
"ample.util.config_util.AMPLEConfigOptions",
"ample.util.argparse_util.process_command_line"
] | [((3697, 3712), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3710, 3712), False, 'import unittest\n'), ((520, 540), 'ample.util.config_util.AMPLEConfigOptions', 'AMPLEConfigOptions', ([], {}), '()\n', (538, 540), False, 'from ample.util.config_util import AMPLEConfigOptions\n'), ((557, 630), 'ample.util.argpars... |
from appdirs import *
from pathlib import Path
import requests
from tqdm import tqdm
from enum import Enum
COVEO_INTERACTION_DATASET_S3_URL = 'https://reclist-datasets-6d3c836d-6djh887d.s3.us-west-2.amazonaws.com/coveo_sigir.zip'
SPOTIFY_PLAYLIST_DATASET_S3_URL = 'https://reclist-datasets-6d3c836d-6djh887d.s3.us-west-... | [
"requests.get",
"pathlib.Path"
] | [((707, 737), 'requests.get', 'requests.get', (['url'], {'stream': '(True)'}), '(url, stream=True)\n', (719, 737), False, 'import requests\n'), ((1347, 1362), 'pathlib.Path', 'Path', (['cache_dir'], {}), '(cache_dir)\n', (1351, 1362), False, 'from pathlib import Path\n')] |
import json
from http import HTTPStatus
from dictionaries.queries import SimpleQuery
class GermanDictionary():
"""
The German dictionary service.
"""
def __init__(self, route):
"""
Initializes the service
Parameters
----------
route : str
The path ... | [
"dictionaries.queries.SimpleQuery",
"json.dumps",
"json.loads"
] | [((3430, 3443), 'dictionaries.queries.SimpleQuery', 'SimpleQuery', ([], {}), '()\n', (3441, 3443), False, 'from dictionaries.queries import SimpleQuery\n'), ((3712, 3741), 'json.loads', 'json.loads', (['translations.text'], {}), '(translations.text)\n', (3722, 3741), False, 'import json\n'), ((4702, 4742), 'json.dumps'... |
import multiprocessing as mp
def g(y):
for x in range(y):
print('gen ', x)
yield x
def myfn(x):
print('fn ', x)
return x
if __name__ == '__main__':
pool = mp.Pool(processes=2)
# figure out if imap is effective
# res = pool.imap(myfn, g(15))
# input('pause')
# for ... | [
"multiprocessing.Pool"
] | [((194, 214), 'multiprocessing.Pool', 'mp.Pool', ([], {'processes': '(2)'}), '(processes=2)\n', (201, 214), True, 'import multiprocessing as mp\n')] |
#!/usr/bin/env python
from __future__ import division
from past.utils import old_div
import unittest
import os.path
import sys
from anuga.utilities.system_tools import get_pathname_from_package
from anuga.culvert_flows.culvert_routines import boyd_generalised_culvert_model
import numpy as num
class Test_culvert_ro... | [
"numpy.allclose",
"anuga.culvert_flows.culvert_routines.boyd_generalised_culvert_model",
"unittest.makeSuite",
"past.utils.old_div",
"unittest.TextTestRunner"
] | [((13929, 13988), 'unittest.makeSuite', 'unittest.makeSuite', (['Test_culvert_routines_box_10pct', '"""test"""'], {}), "(Test_culvert_routines_box_10pct, 'test')\n", (13947, 13988), False, 'import unittest\n'), ((14002, 14027), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (14025, 14027), Fals... |
import json
import pytest
from pytest_regressions import data_regression # noqa: F401
from pydantic import ValidationError
from yfs.lookup import ValidSymbol, ValidSymbolList
from yfs.paths import TEST_DIRECTORY
from yfs.exchanges import (
EuropeanExchanges,
SouthAmericanExchanges,
UnitedStatesExchanges... | [
"yfs.lookup.ValidSymbolList",
"pytest.mark.parametrize",
"yfs.lookup.ValidSymbol",
"pytest.raises",
"json.load"
] | [((1301, 1393), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""exchange_type,asset_type"""', 'valid_symbol_list_filter_parameters'], {}), "('exchange_type,asset_type',\n valid_symbol_list_filter_parameters)\n", (1324, 1393), False, 'import pytest\n'), ((713, 803), 'yfs.lookup.ValidSymbol', 'ValidSymbol'... |
from typing import Any, Dict
from discord_ritoman.lol.stats.match_stat import LoLMatchStat, lol_match_stat
@lol_match_stat("match_start")
class MatchStartStat(LoLMatchStat):
""""""
def process(
self, data: Dict[str, Any], timeline: Dict[str, Any], account_id: str,
) -> Any:
ret... | [
"discord_ritoman.lol.stats.match_stat.lol_match_stat"
] | [((114, 143), 'discord_ritoman.lol.stats.match_stat.lol_match_stat', 'lol_match_stat', (['"""match_start"""'], {}), "('match_start')\n", (128, 143), False, 'from discord_ritoman.lol.stats.match_stat import LoLMatchStat, lol_match_stat\n')] |
# API:
# GET: retrieve current page number
# POST: update current page number
from app import app
from flask import request
from flask_api import status
from exceptions import WrongPassword
from pprint import pprint
import sys
def failure(msg):
return { "success": False, "error": msg }
@app.route('/get-page'... | [
"app.app.server.update_pageName",
"app.app.route",
"app.app.server.get_pageName"
] | [((299, 321), 'app.app.route', 'app.route', (['"""/get-page"""'], {}), "('/get-page')\n", (308, 321), False, 'from app import app\n'), ((389, 429), 'app.app.route', 'app.route', (['"""/set-page"""'], {'methods': "['POST']"}), "('/set-page', methods=['POST'])\n", (398, 429), False, 'from app import app\n'), ((359, 384),... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Gothon.
Gothon runs GO Code from Python using IPC RPC JSON (non-HTTP) & subprocess."""
import json
import os
import signal
import socket
import subprocess
import sys
from glob import iglob
from itertools import count
from pathlib import Path
from shutil import whi... | [
"os.getpgid",
"sys.path_hooks.insert",
"socket.socket",
"sys.meta_path.insert",
"pathlib.Path",
"subprocess.Popen",
"glob.iglob",
"shutil.which",
"json.dumps",
"sys.getsizeof",
"time.sleep",
"uuid.uuid4",
"itertools.count",
"sys.modules.get"
] | [((6838, 6875), 'sys.path_hooks.insert', 'sys.path_hooks.insert', (['(0)', 'go_importer'], {}), '(0, go_importer)\n', (6859, 6875), False, 'import sys\n'), ((6880, 6916), 'sys.meta_path.insert', 'sys.meta_path.insert', (['(0)', 'go_importer'], {}), '(0, go_importer)\n', (6900, 6916), False, 'import sys\n'), ((1659, 166... |
from numpy import linalg
import numpy as np
from loguru import logger
class Regression:
def __init__(self, intercept=True):
self.beta = None
self.intercept = intercept
def fit(self, features, labels):
features = self._add_bias(features)
self._fit(features, labels)
def pre... | [
"numpy.identity",
"numpy.abs",
"numpy.linalg.solve",
"numpy.ones",
"numpy.hstack",
"numpy.linalg.inv",
"numpy.random.randn"
] | [((990, 1010), 'numpy.linalg.solve', 'linalg.solve', (['xx', 'xy'], {}), '(xx, xy)\n', (1002, 1010), False, 'from numpy import linalg\n'), ((555, 582), 'numpy.hstack', 'np.hstack', (['[ones, features]'], {}), '([ones, features])\n', (564, 582), True, 'import numpy as np\n'), ((1233, 1263), 'numpy.identity', 'np.identit... |
from __future__ import print_function
import os
import shutil
import tempfile
import atexit
import stat
def try_delete(filename):
try:
os.unlink(filename)
except:
pass
if not os.path.exists(filename): return
try:
shutil.rmtree(filename, ignore_errors=True)
except:
pass
if not os.path.exists... | [
"os.path.exists",
"shutil.rmtree",
"tempfile.mkdtemp",
"os.unlink",
"tempfile.NamedTemporaryFile",
"os.stat",
"atexit.register"
] | [((142, 161), 'os.unlink', 'os.unlink', (['filename'], {}), '(filename)\n', (151, 161), False, 'import os\n'), ((190, 214), 'os.path.exists', 'os.path.exists', (['filename'], {}), '(filename)\n', (204, 214), False, 'import os\n'), ((234, 277), 'shutil.rmtree', 'shutil.rmtree', (['filename'], {'ignore_errors': '(True)'}... |
"""
This module provides functions to get the dimensionality of a structure.
A number of different algorithms are implemented. These are based on the
following publications:
get_dimensionality_larsen:
- <NAME>, <NAME>, <NAME>, <NAME>. Definition of a
scoring parameter to identify low-dimensional materials compo... | [
"numpy.linalg.matrix_rank",
"pymatgen.core.structure.Molecule",
"numpy.argsort",
"numpy.array",
"networkx.weakly_connected_components",
"numpy.linalg.norm",
"copy.copy",
"numpy.repeat",
"numpy.where",
"pymatgen.core.periodic_table.Specie.from_string",
"itertools.product",
"numpy.dot",
"pymat... | [((8654, 8670), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (8665, 8670), False, 'from collections import defaultdict\n'), ((11037, 11077), 'numpy.argsort', 'np.argsort', (['[x[0] for x in seen_indices]'], {}), '([x[0] for x in seen_indices])\n', (11047, 11077), True, 'import numpy as np\n'), ((... |
from setuptools import setup, find_packages
CLASSIFIERS = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.6",
"To... | [
"setuptools.find_packages"
] | [((1727, 1742), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (1740, 1742), False, 'from setuptools import setup, find_packages\n')] |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | [
"oci.util.formatted_flat_dict"
] | [((2975, 3000), 'oci.util.formatted_flat_dict', 'formatted_flat_dict', (['self'], {}), '(self)\n', (2994, 3000), False, 'from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel\n')] |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from test.multiprocess_test_case import MultiProcessTestCase
import crypten
import torch
class TestDis... | [
"crypten.CrypTensor.set_grad_enabled",
"math.isclose",
"crypten.mpc.get_default_provider",
"crypten.mpc.set_default_provider",
"torch.ones"
] | [((3281, 3315), 'crypten.mpc.get_default_provider', 'crypten.mpc.get_default_provider', ([], {}), '()\n', (3313, 3315), False, 'import crypten\n'), ((3324, 3366), 'crypten.CrypTensor.set_grad_enabled', 'crypten.CrypTensor.set_grad_enabled', (['(False)'], {}), '(False)\n', (3359, 3366), False, 'import crypten\n'), ((337... |
import numpy as np
from deepscratch.dataloader.dataloader import DataLoader
class XOR(DataLoader):
def __init__(self):
self.x = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
self.y = np.array([[0], [1], [1], [0]]) | [
"numpy.array"
] | [((143, 185), 'numpy.array', 'np.array', (['[[0, 0], [0, 1], [1, 0], [1, 1]]'], {}), '([[0, 0], [0, 1], [1, 0], [1, 1]])\n', (151, 185), True, 'import numpy as np\n'), ((203, 233), 'numpy.array', 'np.array', (['[[0], [1], [1], [0]]'], {}), '([[0], [1], [1], [0]])\n', (211, 233), True, 'import numpy as np\n')] |
from django.contrib import admin
# Register your models here.
from .models import PageView
admin.site.register(PageView)
| [
"django.contrib.admin.site.register"
] | [((93, 122), 'django.contrib.admin.site.register', 'admin.site.register', (['PageView'], {}), '(PageView)\n', (112, 122), False, 'from django.contrib import admin\n')] |
from usl import EmployeeView
if __name__ == '__main__':
view=EmployeeView()
view.main()
| [
"usl.EmployeeView"
] | [((67, 81), 'usl.EmployeeView', 'EmployeeView', ([], {}), '()\n', (79, 81), False, 'from usl import EmployeeView\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import re
with open("./iterscheme/__init__.py", "r", encoding="utf8") as init:
version = re.search(r"__version__ = \"([0-9]+.[0-9]+)\""
, init.read()).group(1)
setup(name='iterscheme',
version=version,
d... | [
"setuptools.find_packages"
] | [((550, 565), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (563, 565), False, 'from setuptools import setup, find_packages\n')] |
import numpy as np
import pandas as pd
import os
reps = [ 1 , 2 , 3 , 4 , 5 ]
#reps = [ 1 ]
pwd = os.getcwd()
pkas = {}
for rep in reps:
allfiles = os.listdir(pwd+'/'+str(rep))
path = pwd + '/' + str(rep) + '/'
for filename in allfiles:
if( filename.split('.')[-1] == 'xvg' ):
fullpath = path + filename... | [
"numpy.array",
"pandas.read_csv",
"os.getcwd"
] | [((101, 112), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (110, 112), False, 'import os\n'), ((978, 1001), 'numpy.array', 'np.array', (['pkas[residue]'], {}), '(pkas[residue])\n', (986, 1001), True, 'import numpy as np\n'), ((650, 694), 'pandas.read_csv', 'pd.read_csv', (['fullpath'], {'sep': '"""\t"""', 'header': 'Non... |
import uuid
from firebase_admin import firestore
from lib.simple_logger import Logger
BATCH_SIZE = 500
_UUID_KEY_NAME = "uuid"
log = None
class FirestoreUuidTable(object):
"""
Mapping table between a string and a random UUID backed by Firestore
"""
def __init__(self, firebase_client, table_name, u... | [
"lib.simple_logger.Logger",
"uuid.uuid4"
] | [((413, 429), 'lib.simple_logger.Logger', 'Logger', (['__name__'], {}), '(__name__)\n', (419, 429), False, 'from lib.simple_logger import Logger\n'), ((5756, 5768), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (5766, 5768), False, 'import uuid\n')] |
from time import time
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse, JsonResponse, QueryDict
from django.shortcuts import redirect, get_object_or_404
from wagtail.admin.views.pages import PreviewOnEdit
from falmer.content.models import Previe... | [
"django.http.QueryDict",
"django.http.JsonResponse",
"falmer.content.models.PreviewData.preview_draft",
"django.http.HttpResponse",
"django.shortcuts.get_object_or_404",
"django.shortcuts.redirect",
"time.time"
] | [((2473, 2507), 'falmer.content.models.PreviewData.preview_draft', 'PreviewData.preview_draft', (['page_id'], {}), '(page_id)\n', (2498, 2507), False, 'from falmer.content.models import PreviewData\n'), ((1299, 1370), 'django.shortcuts.redirect', 'redirect', (['f"""{settings.MSL_SITE_HOST}{page.public_path}?preview={to... |
from unittest.mock import MagicMock
import pytest
import os
from typing import Dict
import sqlparse
from sql_translate import translation
def test_create_parent() -> None:
_Translator = translation._Translator()
@pytest.mark.parametrize(['statement', 'expected'], [
("", ""),
("\n\t\n\n\n\n", ""),
("... | [
"sql_translate.translation._Translator",
"unittest.mock.MagicMock",
"pytest.mark.parametrize",
"os.path.dirname",
"pytest.raises",
"sql_translate.translation.HiveToPresto"
] | [((221, 505), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["['statement', 'expected']", '[(\'\', \'\'), (\'\\n\\t\\n\\n\\n\\n\', \'\'), (\n "With a as (select b from c) INSERT INTO table d.e PARTITION (f=\'g\') SELECT d from a"\n ,\n "With a as (select b from c) INSERT INTO table d.e PARTITION (f=\'... |
from flask_restful import reqparse
from werkzeug.datastructures import FileStorage
blog_create_parser = reqparse.RequestParser(bundle_errors=True)
blog_create_parser.add_argument("title", type=str, required=True)
blog_create_parser.add_argument("content", type=str, required=True)
blog_create_parser.add_argument(
"... | [
"flask_restful.reqparse.RequestParser"
] | [((105, 147), 'flask_restful.reqparse.RequestParser', 'reqparse.RequestParser', ([], {'bundle_errors': '(True)'}), '(bundle_errors=True)\n', (127, 147), False, 'from flask_restful import reqparse\n')] |
from django.db import models
class Email(models.Model):
name = models.CharField(max_length=255, blank=True, null=True)
contact = models.CharField(max_length=255)
subject = models.CharField(max_length=255)
message = models.TextField()
meta = models.TextField(blank=True, null=True)
is_sent = mo... | [
"django.db.models.DateTimeField",
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((70, 125), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'blank': '(True)', 'null': '(True)'}), '(max_length=255, blank=True, null=True)\n', (86, 125), False, 'from django.db import models\n'), ((140, 172), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}... |
from __future__ import absolute_import
from sklearn import neural_network
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import random
import argparse
from sklearn.metrics import accuracy_score
class MLPModel():
def __init__(self, filename, stock_filename, company, activation='logistic',
... | [
"sklearn.neural_network.MLPRegressor",
"argparse.ArgumentParser",
"pandas.read_csv",
"numpy.asarray",
"pandas.to_datetime"
] | [((1466, 1491), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1489, 1491), False, 'import argparse\n'), ((386, 407), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (397, 407), True, 'import pandas as pd\n'), ((424, 451), 'pandas.read_csv', 'pd.read_csv', (['stock_filena... |
import numpy as np
import string
from keras.preprocessing.text import Tokenizer
samples = ['The cat sat on the mat.', 'The dog ate my homework.']
print("单词级别")
print("构建标记索引,为每个单词指定唯一索引,从 1 开始")
word_token_index = {}
for sample in samples:
for word in sample.split():
if word not in word_token_index:
... | [
"keras.preprocessing.text.Tokenizer"
] | [((1302, 1327), 'keras.preprocessing.text.Tokenizer', 'Tokenizer', ([], {'num_words': '(1000)'}), '(num_words=1000)\n', (1311, 1327), False, 'from keras.preprocessing.text import Tokenizer\n')] |
# nice snippet: https://gist.github.com/tonybruess/9405134
from collections import namedtuple
import re
from itertools import islice
social_platforms = """Twitter
Min: 1
Max: 15
Can contain: a-z A-Z 0-9 _
Facebook
Min: 5
Max: 50
Can contain: a-z A-Z 0-9 .
Reddit
Min: 3
Max: 20
Can contain: a-z A-Z ... | [
"itertools.islice",
"collections.namedtuple",
"re.compile"
] | [((408, 446), 'collections.namedtuple', 'namedtuple', (['"""Validator"""', '"""range regex"""'], {}), "('Validator', 'range regex')\n", (418, 446), False, 'from collections import namedtuple\n'), ((933, 966), 'itertools.islice', 'islice', (['raw_list_to_split', 'length'], {}), '(raw_list_to_split, length)\n', (939, 966... |
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import jax
from jax.interpreters import partial_eval
from jax.linear_util import wrap_init
class _ProvenanceJaxprTrace(partial_eval.DynamicJaxprTrace):
"""A JAX class to control the behavior of primitives on tracers."""
def ... | [
"jax.ShapeDtypeStruct",
"jax.util.safe_map",
"jax.linear_util.wrap_init",
"jax.core.new_main",
"jax.interpreters.partial_eval.trace_to_subjaxpr_dynamic",
"jax.tree_util.tree_flatten"
] | [((3855, 3897), 'jax.tree_util.tree_flatten', 'jax.tree_util.tree_flatten', (['(args, kwargs)'], {}), '((args, kwargs))\n', (3881, 3897), False, 'import jax\n'), ((3986, 4021), 'jax.linear_util.wrap_init', 'wrap_init', (['wrapped_fun.call_wrapped'], {}), '(wrapped_fun.call_wrapped)\n', (3995, 4021), False, 'from jax.li... |
import subprocess
import string
# first, use genXML.py in rigid-ipc/tools/ to generate MJCF file input for bullet,
# and compile Bullet with different time step sizes (can be modified in line 39 of
# /Users/minchen/Desktop/bullet3/examples/Importers/ImportMJCFDemo/ImportMJCFSetup.cpp,
# by default dt=0.01s)
# then, ... | [
"subprocess.call"
] | [((1950, 1991), 'subprocess.call', 'subprocess.call', (['[runCommand]'], {'shell': '(True)'}), '([runCommand], shell=True)\n', (1965, 1991), False, 'import subprocess\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2018-03-26 23:22
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mlp', '0003_auto_20180322_1651'),
]
operations = [
migrations.AlterField(
... | [
"django.db.models.CharField"
] | [((405, 728), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'choices': "[('<NAME>', '<NAME>'), ('<NAME>', '<NAME>'), ('<NAME>', '<NAME>'), (\n '<NAME>', '<NAME>'), ('<NAME>', '<NAME>'), ('<NAME>', '<NAME>'), (\n '<NAME>', '<NAME>'), ('<NAME>', '<NAME>'), ('<NAME>', '<NAME>'), (\n '... |
"""Script for testing the generated robot manipulators in a simply pybullet enviroment."""
# Author: <NAME>, <EMAIL>
# Date: 3-14-2022
#!/usr/bin/python3
import pybullet as p
import time
import pybullet_data
import os
import json
import glob
class sim_tester():
"""Simulator class to test different hands in."""
... | [
"pybullet_data.getDataPath",
"pybullet.setGravity",
"time.sleep",
"pybullet.disconnect",
"pybullet.connect",
"pybullet.getNumJoints",
"pybullet.getQuaternionFromEuler",
"pybullet.isConnected",
"glob.glob",
"pybullet.getJointInfo",
"pybullet.resetDebugVisualizerCamera",
"pybullet.addUserDebugPa... | [((2593, 2604), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (2602, 2604), False, 'import os\n'), ((2740, 2791), 'glob.glob', 'glob.glob', (['f"""{file_content[\'hand_model_output\']}*/"""'], {}), '(f"{file_content[\'hand_model_output\']}*/")\n', (2749, 2791), False, 'import glob\n'), ((750, 775), 'os.path.dirname', 'os... |
"""
This script generates multiple learning curves for different training sets.
It launches a script (e.g. trn_lrn_crv.py) that train ML model(s) on various training set sizes.
"""
from __future__ import print_function, division
import warnings
warnings.filterwarnings('ignore')
import os
import sys
from pathlib impo... | [
"pandas.read_parquet",
"argparse.ArgumentParser",
"os.makedirs",
"matplotlib.use",
"pathlib.Path",
"pandas.read_csv",
"classlogger.Logger",
"lrn_crv.LearningCurve",
"utils.dump_dict",
"sklearn.preprocessing.StandardScaler",
"datetime.datetime.now",
"pprint.pformat",
"sklearn.preprocessing.Ro... | [((247, 280), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (270, 280), False, 'import warnings\n'), ((508, 529), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (522, 529), False, 'import matplotlib\n'), ((1190, 1254), 'argparse.ArgumentParser', 'ar... |
import os
import sys
import boto3
import botocore
import json
import time
from debug import debug_print
from debug import error_print
from botoHelper import get_boto_client
def handler(event, context):
debug_print(json.dumps(event, indent=2))
s3_event = event["Records"][0]["s3"]
s3_bucket = s3_event["buck... | [
"json.dumps",
"time.time",
"debug.debug_print",
"botoHelper.get_boto_client"
] | [((389, 410), 'botoHelper.get_boto_client', 'get_boto_client', (['"""s3"""'], {}), "('s3')\n", (404, 410), False, 'from botoHelper import get_boto_client\n'), ((762, 794), 'botoHelper.get_boto_client', 'get_boto_client', (['"""stepfunctions"""'], {}), "('stepfunctions')\n", (777, 794), False, 'from botoHelper import ge... |
import os
import boto3
import base64
class KMSController():
def __init__(self, region=None, key_id=None):
if region is None:
region = os.environ.get('AWS_DEFAULT_REGION')
self.region = region
self.key_id = key_id
self.kms = boto3.client('kms', region_name=self.region)
... | [
"base64.b64decode",
"base64.b64encode",
"boto3.client",
"os.environ.get"
] | [((275, 319), 'boto3.client', 'boto3.client', (['"""kms"""'], {'region_name': 'self.region'}), "('kms', region_name=self.region)\n", (287, 319), False, 'import boto3\n'), ((524, 551), 'base64.b64encode', 'base64.b64encode', (['encrypted'], {}), '(encrypted)\n', (540, 551), False, 'import base64\n'), ((161, 197), 'os.en... |
import sampling_methods
import numpy as np
__all__ = ['Supervised', 'ActiveLearning']
class _Trainer():
def __init__(self, name, epoch, batch_size):
self.name = name
self.epoch = epoch
self.batch_size = batch_size
assert (type(epoch) is int and epoch > 0)
... | [
"numpy.concatenate"
] | [((3482, 3534), 'numpy.concatenate', 'np.concatenate', (['(learned_data, not_learned_data[:n])'], {}), '((learned_data, not_learned_data[:n]))\n', (3496, 3534), True, 'import numpy as np\n'), ((3570, 3626), 'numpy.concatenate', 'np.concatenate', (['(learned_labels, not_learned_labels[:n])'], {}), '((learned_labels, not... |
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"pathlib.Path",
"pipeline.backend.get_default_config"
] | [((1735, 1755), 'pipeline.backend.get_default_config', 'get_default_config', ([], {}), '()\n', (1753, 1755), False, 'from pipeline.backend import get_default_config\n'), ((1014, 1034), 'pipeline.backend.get_default_config', 'get_default_config', ([], {}), '()\n', (1032, 1034), False, 'from pipeline.backend import get_d... |
#!/usr/bin/env python
import clipboard
import webbrowser
import requests
import json
from subprocess import check_call
import sys
def openURL(url=''):
''' Open a URL if there's any on your clipboard'''
print(sys.platform)
webbrowser.open(clipboard.paste().strip())
print(f'on clipboard: {clipboard.paste().strip... | [
"clipboard.paste",
"subprocess.check_call"
] | [((441, 468), 'subprocess.check_call', 'check_call', (['cmd'], {'shell': '(True)'}), '(cmd, shell=True)\n', (451, 468), False, 'from subprocess import check_call\n'), ((245, 262), 'clipboard.paste', 'clipboard.paste', ([], {}), '()\n', (260, 262), False, 'import clipboard\n'), ((297, 314), 'clipboard.paste', 'clipboard... |
import numpy as np
from krippendorff import alpha
# Example from: <NAME>. "Content Analysis: An Introduction to Its Methodology".
# Fourth Edition. 2019. SAGE Publishing.
# Chapter 12, page 290.
# 4 observers (rows). 11 units (columns)
# np.nan is missing data (observer did not code unit)
reliability_data = np.array([... | [
"numpy.array",
"numpy.isclose",
"krippendorff.alpha"
] | [((310, 573), 'numpy.array', 'np.array', (['[[1.0, 2.0, 3.0, 3.0, 2.0, 1.0, 4.0, 1.0, 2.0, np.nan, np.nan], [1.0, 2.0, \n 3.0, 3.0, 2.0, 2.0, 4.0, 1.0, 2.0, 5.0, np.nan], [np.nan, 3.0, 3.0, 3.0,\n 2.0, 3.0, 4.0, 2.0, 2.0, 5.0, 1.0], [1.0, 2.0, 3.0, 3.0, 2.0, 4.0, 4.0,\n 1.0, 2.0, 5.0, 1.0]]'], {}), '([[1.0, 2.... |
#
# Turtle replacement module for execise assement
#
# <NAME>, 2013
#
import math
class TurtleCmd:
"Abstract class for turtle commands"
pass
class Forward(TurtleCmd):
def __init__(this, n):
this.arg = n
def __eq__(this,that):
return ((isinstance(that,Forward) and that.arg == this.ar... | [
"math.cos",
"math.sin"
] | [((3244, 3255), 'math.cos', 'math.cos', (['r'], {}), '(r)\n', (3252, 3255), False, 'import math\n'), ((3285, 3296), 'math.sin', 'math.sin', (['r'], {}), '(r)\n', (3293, 3296), False, 'import math\n')] |
from unittest import mock
from django.core.checks import Error
from django.db import connections, models
from django.test import SimpleTestCase
from django.test.utils import isolate_apps
def dummy_allow_migrate(db, app_label, **hints):
# Prevent checks from being run on the 'other' database, which doesn't have
... | [
"django.db.models.IntegerField",
"django.test.utils.isolate_apps",
"django.core.checks.Error",
"unittest.mock.patch.object",
"unittest.mock.patch"
] | [((400, 436), 'django.test.utils.isolate_apps', 'isolate_apps', (['"""invalid_models_tests"""'], {}), "('invalid_models_tests')\n", (412, 436), False, 'from django.test.utils import isolate_apps\n'), ((493, 581), 'unittest.mock.patch', 'mock.patch', (['"""django.db.models.fields.router.allow_migrate"""'], {'new': 'dumm... |
from redis import Redis
from rq import Queue
import logging
from ui import ui
import lgpio
logger = logging.getLogger(__name__)
class Wingnut:
def __init__(self):
self.log = logger
self.servoPin = 15
self.leftMotorPin1 = 33
self.leftMotorPin2 = 35
self.leftMotorEnablePin = ... | [
"logging.getLogger",
"ui.ui.app.run",
"redis.Redis"
] | [((101, 128), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (118, 128), False, 'import logging\n'), ((721, 756), 'ui.ui.app.run', 'ui.app.run', ([], {'host': '"""0.0.0.0"""', 'debug': '(1)'}), "(host='0.0.0.0', debug=1)\n", (731, 756), False, 'from ui import ui\n'), ((1029, 1036), 'redis... |
# encoding:utf-8
from utils import get_url
subreddit = 'hmmm'
t_channel = '@r_hmmm'
NSFW_EMOJI = u'\U0001F51E'
def send_post(submission, r2t):
what, url, ext = get_url(submission)
title = submission.title
link = submission.shortlink
text = '{}\n{}'.format(title, link)
if what not in ('img'):... | [
"utils.get_url"
] | [((171, 190), 'utils.get_url', 'get_url', (['submission'], {}), '(submission)\n', (178, 190), False, 'from utils import get_url\n')] |
# -*- coding: utf-8 -*-
"""
Rast_loadRasterByLocation.py
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU ... | [
"osgeo.gdal.Open",
"qgis.core.QgsPointXY",
"PyQt5.QtCore.QCoreApplication.translate",
"os.listdir",
"qgis.core.QgsRasterLayer",
"qgis.core.QgsCoordinateTransform",
"qgis.core.QgsApplication.locale",
"os.path.join",
"os.path.dirname",
"qgis.core.QgsProject.instance",
"lftools.geocapt.imgs.Imgs",
... | [((2492, 2515), 'qgis.core.QgsApplication.locale', 'QgsApplication.locale', ([], {}), '()\n', (2513, 2515), False, 'from qgis.core import QgsProcessing, QgsFeatureSink, QgsWkbTypes, QgsFields, QgsField, QgsFeature, QgsPointXY, QgsGeometry, QgsProcessingException, QgsProcessingAlgorithm, QgsProcessingParameterString, Qg... |
"""
Small script for reading automatic results of FINES automatic detection software and pushing the events to the database.
"""
import smtplib
import sys
import datetime
from nordb.nordic.nordicEvent import NordicEvent
from nordb.nordic.nordicMain import NordicMain
from nordb.nordic.nordicData import NordicData
def f... | [
"smtplib.SMTP",
"datetime.datetime.strptime",
"nordb.nordic.nordicMain.NordicMain",
"datetime.datetime.now",
"nordb.nordic.nordicEvent.NordicEvent",
"sys.exit",
"nordb.nordic.nordicData.NordicData"
] | [((3017, 3037), 'smtplib.SMTP', 'smtplib.SMTP', (['SERVER'], {}), '(SERVER)\n', (3029, 3037), False, 'import smtplib\n'), ((407, 417), 'sys.exit', 'sys.exit', ([], {}), '()\n', (415, 417), False, 'import sys\n'), ((1737, 1760), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1758, 1760), False, 'im... |
from pygame import image
from city.point import Point
class BusStop(Point):
def __init__(self, x=0.0, y=0.0, point_types=None, load=0):
if not point_types:
point_types = ['bus']
Point.__init__(self, x, y, point_types, load)
self.image = image.load('img/bus_stop.png')
| [
"pygame.image.load",
"city.point.Point.__init__"
] | [((212, 257), 'city.point.Point.__init__', 'Point.__init__', (['self', 'x', 'y', 'point_types', 'load'], {}), '(self, x, y, point_types, load)\n', (226, 257), False, 'from city.point import Point\n'), ((279, 309), 'pygame.image.load', 'image.load', (['"""img/bus_stop.png"""'], {}), "('img/bus_stop.png')\n", (289, 309),... |
import math
def amplitude_to_db(amplitude: float, reference: float = 1e-6) -> float:
"""
Convert amplitude from volts to decibel (dB).
Args:
amplitude: Amplitude in volts
reference: Reference amplitude. Defaults to 1 µV for dB(AE)
Returns:
Amplitude in dB(ref)
"""
ret... | [
"math.log10"
] | [((329, 362), 'math.log10', 'math.log10', (['(amplitude / reference)'], {}), '(amplitude / reference)\n', (339, 362), False, 'import math\n')] |
# Generated by Django 3.1.7 on 2021-10-16 11:33
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pos', '0013_auto_20211008_1717'),
]
operations = [
migrations.AlterField(
model_name='order',
name='... | [
"datetime.datetime"
] | [((370, 421), 'datetime.datetime', 'datetime.datetime', (['(2021)', '(10)', '(16)', '(13)', '(33)', '(49)', '(318361)'], {}), '(2021, 10, 16, 13, 33, 49, 318361)\n', (387, 421), False, 'import datetime\n')] |
from typing import List
from typing.io import BinaryIO
from enum import Enum
import requests
from requests_aws4auth import AWS4Auth
# http://developer.ivona.com/en/speechcloud/introduction.html#SpeechCloudEndpoints
class Region(Enum):
EuWest1 = 'eu-west-1' # EU, Dublin
UsEast1 = 'us-east-1' # US East, N. Vi... | [
"requests_aws4auth.AWS4Auth",
"requests.Session"
] | [((1776, 1794), 'requests.Session', 'requests.Session', ([], {}), '()\n', (1792, 1794), False, 'import requests\n'), ((1824, 1877), 'requests_aws4auth.AWS4Auth', 'AWS4Auth', (['access_key', 'secret_key', 'region.value', '"""tts"""'], {}), "(access_key, secret_key, region.value, 'tts')\n", (1832, 1877), False, 'from req... |
import time
import threading
import asyncio
from aiohttp import ClientSession
from aiohttp_proxy import ProxyConnector, ProxyType
class Checker(object):
def __init__(self, proxies: list, proxy_type: str, threads: int, timeout: int, savedir: str):
# Arguments:
self.proxies = set(proxi... | [
"asyncio.Queue",
"asyncio.Lock",
"time.sleep",
"threading.Thread",
"asyncio.get_event_loop",
"time.time",
"asyncio.ProactorEventLoop"
] | [((1199, 1213), 'asyncio.Lock', 'asyncio.Lock', ([], {}), '()\n', (1211, 1213), False, 'import asyncio\n'), ((3569, 3584), 'asyncio.Queue', 'asyncio.Queue', ([], {}), '()\n', (3582, 3584), False, 'import asyncio\n'), ((3678, 3702), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (3700, 3702), Fals... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# <NAME> <<EMAIL>> 40819903
#
# Plotting script.
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy
import os
def main(args):
myStuff = []
for i in range(0, 20):
myStuff.append( [i, i*2, i*3] )
filename = "testfile.txt"
prin... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.clf",
"numpy.array",
"matplotlib.pyplot.figure",
"os.system"
] | [((637, 654), 'os.system', 'os.system', (['"""sync"""'], {}), "('sync')\n", (646, 654), False, 'import os\n'), ((656, 690), 'os.system', 'os.system', (['"""optipng ../pics/*.png"""'], {}), "('optipng ../pics/*.png')\n", (665, 690), False, 'import os\n'), ((808, 843), 'numpy.array', 'numpy.array', (['M'], {'dtype': 'num... |
"""Module providing high-level tools for linearizing and finding chi^2 minimizing
solutions to systems of equations.
Solvers: LinearSolver, LogProductSolver, and LinProductSolver.
These generally follow the form:
> data = {'a1*x+b1*y': np.array([5.,7]), 'a2*x+b2*y': np.array([4.,6])}
> ls = LinearSolver(data, a1=1., ... | [
"tensorflow.math.imag",
"tensorflow.transpose",
"numpy.log",
"tensorflow.linalg.pinv",
"numpy.array",
"copy.deepcopy",
"numpy.linalg.norm",
"tensorflow.math.real",
"numpy.complex64",
"numpy.exp",
"numpy.issubdtype",
"numpy.empty",
"tensorflow.matmul",
"tensorflow.convert_to_tensor",
"ast... | [((11258, 11289), 'functools.reduce', 'reduce', (['np.promote_types', 'types'], {}), '(np.promote_types, types)\n', (11264, 11289), False, 'from functools import reduce\n'), ((28760, 28793), 'functools.reduce', 'reduce', (['(lambda x, y: x + y)', 'terms'], {}), '(lambda x, y: x + y, terms)\n', (28766, 28793), False, 'f... |
#! /usr/bin/env python3
# Import modules
import sys, os, time
from awsPseudoCi import *
import argparse, subprocess, shlex, json, hashlib
from datetime import datetime
h = "[AWS Pseudo CI] : "
def get_ami_from_ci_json():
"""
Get the ami from /tmp/awsCiInfo.json
"""
try:
with open("/tmp/a... | [
"os.listdir",
"argparse.ArgumentParser",
"os.path.join",
"os.path.dirname",
"datetime.datetime.now",
"os.path.basename",
"json.load",
"time.time"
] | [((1063, 1090), 'os.listdir', 'os.listdir', (['"""/tmp/dumpIni/"""'], {}), "('/tmp/dumpIni/')\n", (1073, 1090), False, 'import sys, os, time\n'), ((4781, 4806), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (4804, 4806), False, 'import argparse, subprocess, shlex, json, hashlib\n'), ((1392, 14... |
# -*- coding: utf-8 -*-
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | [
"fractions.gcd",
"projectq.cengines.DummyEngine",
"dirty_period_finding.gates.ModularBimultiplicationGate",
"dirty_period_finding.extensions.LimitedCapabilityEngine",
"projectq.cengines.DecompositionRuleSet"
] | [((1670, 1701), 'projectq.cengines.DummyEngine', 'DummyEngine', ([], {'save_commands': '(True)'}), '(save_commands=True)\n', (1681, 1701), False, 'from projectq.cengines import DummyEngine, DecompositionRuleSet\n'), ((2464, 2508), 'dirty_period_finding.gates.ModularBimultiplicationGate', 'ModularBimultiplicationGate', ... |
"""
Export module tests
"""
import unittest
from paperai.export import Export
# pylint: disable=C0411
from utils import Utils
class TestExport(unittest.TestCase):
"""
Export tests
"""
def testRun(self):
"""
Test export run
"""
Export.run(Utils.PATH + "/export.txt",... | [
"utils.Utils.hashfile",
"paperai.export.Export.run"
] | [((282, 332), 'paperai.export.Export.run', 'Export.run', (["(Utils.PATH + '/export.txt')", 'Utils.PATH'], {}), "(Utils.PATH + '/export.txt', Utils.PATH)\n", (292, 332), False, 'from paperai.export import Export\n'), ((371, 413), 'utils.Utils.hashfile', 'Utils.hashfile', (["(Utils.PATH + '/export.txt')"], {}), "(Utils.P... |