code stringlengths 21 1.03M | apis list | extract_api stringlengths 74 8.23M |
|---|---|---|
import sys
from google.cloud import vision_v1
from google.cloud.vision_v1 import enums
import io
import json
from google.cloud import storage
import os
def sample_batch_annotate_files(storage_uri):
# os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = r"C:\Users\user\Desktop\doc_ai\rmi-insights-3e257c9c456c.... | [
"google.cloud.vision_v1.ImageAnnotatorClient",
"google.cloud.storage.Client"
] | [((421, 453), 'google.cloud.vision_v1.ImageAnnotatorClient', 'vision_v1.ImageAnnotatorClient', ([], {}), '()\n', (451, 453), False, 'from google.cloud import vision_v1\n'), ((1631, 1647), 'google.cloud.storage.Client', 'storage.Client', ([], {}), '()\n', (1645, 1647), False, 'from google.cloud import storage\n')] |
# Based on ULN2003 driver lib: https://github.com/zhcong/ULN2003-for-ESP32
from utime import sleep_ms
from machine import Pin
from LogicalPins import physical_pin
STEPPER_INST = None
class StepperULN2003:
FULL_ROTATION = int(4075.7728395061727 / 8) # http://www.jangeox.be/2013/10/stepper-motor-28byj-48_25.html
... | [
"utime.sleep_ms",
"LogicalPins.physical_pin"
] | [((3304, 3327), 'LogicalPins.physical_pin', 'physical_pin', (['"""stppr_1"""'], {}), "('stppr_1')\n", (3316, 3327), False, 'from LogicalPins import physical_pin\n'), ((3340, 3363), 'LogicalPins.physical_pin', 'physical_pin', (['"""stppr_2"""'], {}), "('stppr_2')\n", (3352, 3363), False, 'from LogicalPins import physica... |
"""
coding:utf-8
file: setting_window.py
@author: jiangwei
@contact: <EMAIL>
@time: 2020/6/27 23:07
@desc:
"""
import sys
from ui.setting_window import Ui_Form
from PyQt5.QtWidgets import QWidget, QApplication
from util.common_util import SYS_STYLE
class SettingWindow(Ui_Form, QWidget):
def __init__(self):
... | [
"PyQt5.QtWidgets.QApplication"
] | [((863, 885), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (875, 885), False, 'from PyQt5.QtWidgets import QWidget, QApplication\n')] |
import os
from testtools import TestCase
from testtools.matchers import Contains
from . import makeprefs
from mock import Mock, patch
from StringIO import StringIO
from twisted.internet import defer
class CommandTest(TestCase):
def setUp(self):
super(CommandTest, self).setUp()
self.prefs = makepr... | [
"os.path.join",
"mock.patch.object",
"testtools.matchers.Contains",
"twisted.internet.defer.succeed",
"mock.patch",
"mock.Mock",
"lacli.main.LaCommand"
] | [((663, 704), 'mock.patch', 'patch', (['"""sys.stdin"""'], {'new_callable': 'StringIO'}), "('sys.stdin', new_callable=StringIO)\n", (668, 704), False, 'from mock import Mock, patch\n'), ((945, 987), 'mock.patch', 'patch', (['"""sys.stdout"""'], {'new_callable': 'StringIO'}), "('sys.stdout', new_callable=StringIO)\n", (... |
import pytest
from hyper_prompt.theme import BasicTheme
@pytest.mark.parametrize(
"test, result",
[
("RESET", BasicTheme.RESET),
("TEST_FG", BasicTheme.FG),
("TEST_BG", BasicTheme.BG)
]
)
def test_get_key(test, result):
assert BasicTheme({}).get(test) == result
| [
"pytest.mark.parametrize",
"hyper_prompt.theme.BasicTheme"
] | [((59, 190), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""test, result"""', "[('RESET', BasicTheme.RESET), ('TEST_FG', BasicTheme.FG), ('TEST_BG',\n BasicTheme.BG)]"], {}), "('test, result', [('RESET', BasicTheme.RESET), (\n 'TEST_FG', BasicTheme.FG), ('TEST_BG', BasicTheme.BG)])\n", (82, 190), Fal... |
#setup cython code
from setuptools import setup, find_packages
from Cython.Build import cythonize
import numpy
import os
import codecs
def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
return fp.read()
def get_version(rel_pa... | [
"os.path.join",
"os.path.dirname",
"setuptools.find_packages",
"numpy.get_include",
"Cython.Build.cythonize"
] | [((182, 207), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (197, 207), False, 'import os\n'), ((812, 827), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (825, 827), False, 'from setuptools import setup, find_packages\n'), ((842, 946), 'Cython.Build.cythonize', 'cythonize', ... |
import torch
import torch.nn as nn
class NCSNSampler(nn.Module):
def __init__(self, score, sigmas, alphas, n_steps_each: int):
super().__init__()
self.score = score
self.sigmas = sigmas
self.alphas = alphas
self.n_steps_each = n_steps_each
def forward(self, x_T: torch.... | [
"torch.randn_like",
"torch.ones_like"
] | [((405, 428), 'torch.ones_like', 'torch.ones_like', (['x_T[0]'], {}), '(x_T[0])\n', (420, 428), False, 'import torch\n'), ((576, 597), 'torch.randn_like', 'torch.randn_like', (['x_T'], {}), '(x_T)\n', (592, 597), False, 'import torch\n')] |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
def calculate_profit_from_columns(row):
profit = 0
if row['Buy']:
profit = row['Difference']
elif row['Sell']:
profit = row['Difference'] * -1
return profit
def convert_date(row):
r... | [
"numpy.array",
"matplotlib.pyplot.subplots",
"datetime.datetime.strptime"
] | [((326, 381), 'datetime.datetime.strptime', 'datetime.strptime', (["row['Datetime']", '"""%Y-%m-%d %H:%M:%S"""'], {}), "(row['Datetime'], '%Y-%m-%d %H:%M:%S')\n", (343, 381), False, 'from datetime import datetime\n'), ((1665, 1687), 'numpy.array', 'np.array', (['wealth_array'], {}), '(wealth_array)\n', (1673, 1687), Tr... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 5 16:07:58 2016
@author: Administrator
"""
import unittest
from app import create_app,db
from app.models import User,Role
from flask import url_for
import re
class FlaskClientTestCase(unittest.TestCase):
def setUp(self):
self.app = create_app... | [
"flask.url_for",
"app.models.Role.insert_roles",
"app.create_app",
"app.db.create_all",
"app.models.User.query.filter_by",
"re.search",
"app.db.drop_all",
"app.db.session.remove"
] | [((310, 331), 'app.create_app', 'create_app', (['"""testing"""'], {}), "('testing')\n", (320, 331), False, 'from app import create_app, db\n'), ((425, 440), 'app.db.create_all', 'db.create_all', ([], {}), '()\n', (438, 440), False, 'from app import create_app, db\n'), ((450, 469), 'app.models.Role.insert_roles', 'Role.... |
import cv2
import imagezmq
import simplejpeg
# Instantiate and provide the first publisher address
image_hub = imagezmq.ImageHub(open_port="tcp://192.168.12.29:5555", REQ_REP=False)
# image_hub.connect('tcp://192.168.86.38:5555') # second publisher address
while True: # show received images
# sender_name, ima... | [
"cv2.imshow",
"simplejpeg.decode_jpeg",
"cv2.waitKey",
"imagezmq.ImageHub"
] | [((112, 182), 'imagezmq.ImageHub', 'imagezmq.ImageHub', ([], {'open_port': '"""tcp://192.168.12.29:5555"""', 'REQ_REP': '(False)'}), "(open_port='tcp://192.168.12.29:5555', REQ_REP=False)\n", (129, 182), False, 'import imagezmq\n'), ((411, 463), 'simplejpeg.decode_jpeg', 'simplejpeg.decode_jpeg', (['jpg_buffer'], {'col... |
from __future__ import division
import gzip
import matplotlib.pyplot as plt
import numpy as np
import random
import math
def Randomize_Weights(weight_vector: np.ndarray):
rand_weights = weight_vector
for j in range(0,len(weight_vector)):
rand_weights[j][::1] = float(random.randint(-100, 100) / 100)... | [
"numpy.reshape",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.imshow",
"math.log",
"numpy.dtype",
"matplotlib.pyplot.show",
"numpy.inner",
"numpy.zeros",
"gzip.GzipFile",
"math.exp",
"numpy.argmax",
"random.randint"
] | [((500, 512), 'numpy.zeros', 'np.zeros', (['(10)'], {}), '(10)\n', (508, 512), True, 'import numpy as np\n'), ((998, 1020), 'numpy.zeros', 'np.zeros', (['(10000, 784)'], {}), '((10000, 784))\n', (1006, 1020), True, 'import numpy as np\n'), ((2000, 2010), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2008, 20... |
# External Import
from django.contrib import admin
# Internal Import
from .models import Post
admin.site.register(Post)
| [
"django.contrib.admin.site.register"
] | [((96, 121), 'django.contrib.admin.site.register', 'admin.site.register', (['Post'], {}), '(Post)\n', (115, 121), False, 'from django.contrib import admin\n')] |
import json
twinkle_twinkle = ['c4','c4','g4','g4','a4','a4','g4',\
'f4','f4','e4','e4','d4','d4','c4',\
'g5','g5','f4','f4','e4','e4','d4',\
'g5','g5','f4','f4','e4','e4','d4',\
'c4','c4','g4','g4','a4','a4','g4',\
'f4','f4','e4','e4','d4... | [
"json.dump"
] | [((3553, 3575), 'json.dump', 'json.dump', (['notes', 'file'], {}), '(notes, file)\n', (3562, 3575), False, 'import json\n')] |
# Generated by Django 2.1.1 on 2018-11-01 00:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('GestiRED', '0020_phase_observation'),
]
operations = [
migrations.RemoveField(
model_name='phase',
name='observation... | [
"django.db.models.CharField",
"django.db.migrations.RemoveField"
] | [((235, 297), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""phase"""', 'name': '"""observation"""'}), "(model_name='phase', name='observation')\n", (257, 297), False, 'from django.db import migrations, models\n'), ((456, 488), 'django.db.models.CharField', 'models.CharField', ([]... |
from PyQt5.QtWidgets import QMainWindow, QStatusBar
from PyQt5.QtCore import QObject, QEvent
from PyQt5 import QtCore
class MainWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
mousePressed = QtCore.pyqtSignal(str)
def eventFilter(self, obj: 'QObject', event: 'QEven... | [
"PyQt5.QtCore.pyqtSignal",
"PyQt5.QtWidgets.QMainWindow.__init__"
] | [((239, 261), 'PyQt5.QtCore.pyqtSignal', 'QtCore.pyqtSignal', (['str'], {}), '(str)\n', (256, 261), False, 'from PyQt5 import QtCore\n'), ((190, 216), 'PyQt5.QtWidgets.QMainWindow.__init__', 'QMainWindow.__init__', (['self'], {}), '(self)\n', (210, 216), False, 'from PyQt5.QtWidgets import QMainWindow, QStatusBar\n')] |
# Generated by Django 2.0.9 on 2018-12-05 11:07
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('users', '0006_auto_20181202_1125'),
('student', '0005_auto_20181203_1208'),
('bge', '000... | [
"django.db.models.NullBooleanField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.ImageField",
"django.db.models.FileField",
"django.db.models.DateTimeField",
"django.db.models.DateField",
"django.db.models.AutoField",
"django.db.models.TextField",
"django.db.m... | [((8718, 8822), 'django.db.models.OneToOneField', 'models.OneToOneField', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""branch.HostFamily"""'}), "(null=True, on_delete=django.db.models.deletion.CASCADE,\n to='branch.HostFamily')\n", (8738, 8822), False, 'from django.db import mi... |
#!/usr/bin/env python3
#
# submit_one_Door43_test.py
# Written: Jan 2019
# Last modified: 2019-12-09 RJH
#
# Python imports
import os
import sys
import json
import logging
import subprocess
# ======================================================================
# User settings
USE_LOCALCOMPOSE_URL = Tr... | [
"os.path.join",
"subprocess.Popen",
"json.loads",
"os.path.isfile",
"webbrowser.open",
"logging.critical",
"sys.exit"
] | [((993, 1043), 'os.path.join', 'os.path.join', (['TEST_FOLDER', "(TEST_FILENAME + '.json')"], {}), "(TEST_FOLDER, TEST_FILENAME + '.json')\n", (1005, 1043), False, 'import os\n'), ((1090, 1114), 'os.path.isfile', 'os.path.isfile', (['filepath'], {}), '(filepath)\n', (1104, 1114), False, 'import os\n'), ((6905, 6915), '... |
'''entre no programa com a altura e largura de uma parede
em mtr calcule a area e a quantidade de tinta necessária para
pintá-la considerando que cada litro de tinta pinta 2m²'''
from math import ceil
cores = {'limpa': '\033[m', 'azul': '\033[1;34m'}
print('{:-^40}'.format('CALCULO DE ÁREA'))
largura = float(input('D... | [
"math.ceil"
] | [((722, 733), 'math.ceil', 'ceil', (['tinta'], {}), '(tinta)\n', (726, 733), False, 'from math import ceil\n')] |
import numpy as np
import sympy as sp
import pandas as pd
import sys
#give input equation
expr = sp.sympify("x_1**2 + x_2*x_3")
#get number of columns from X dataframe and y dataframe
num_of_columns = 3+1 #dataframe features len(X.columns) +1
num_of_y_columns = 2 #dataframe features len(Y.columns) +1
#create equation v... | [
"pandas.DataFrame",
"sympy.sympify",
"sympy.symarray",
"sympy.lambdify"
] | [((97, 127), 'sympy.sympify', 'sp.sympify', (['"""x_1**2 + x_2*x_3"""'], {}), "('x_1**2 + x_2*x_3')\n", (107, 127), True, 'import sympy as sp\n'), ((390, 422), 'sympy.symarray', 'sp.symarray', (['"""x"""', 'num_of_columns'], {}), "('x', num_of_columns)\n", (401, 422), True, 'import sympy as sp\n'), ((456, 490), 'sympy.... |
"""
Read sample documents from mongo db and write sample metadata files
to iRODS.
"""
import argparse
from itertools import islice
import json
import os
import pprint
import re
import sys
import time
import pymongo
import imicrobe.util.irods as irods
def write_sample_metadata_files(target_root, file_limit):
"""... | [
"imicrobe.util.irods.irods_collection_exists",
"pprint.pformat",
"imicrobe.util.irods.irods_session_manager",
"re.compile",
"argparse.ArgumentParser",
"json.dumps",
"imicrobe.util.irods.irods_data_object_exists",
"pymongo.MongoClient",
"time.time",
"os.path.split"
] | [((955, 1010), 're.compile', 're.compile', (['"""\\\\.(fa|fna|fasta|fastq)(\\\\.tar)?(\\\\.gz)?$"""'], {}), "('\\\\.(fa|fna|fasta|fastq)(\\\\.tar)?(\\\\.gz)?$')\n", (965, 1010), False, 'import re\n'), ((1017, 1028), 'time.time', 'time.time', ([], {}), '()\n', (1026, 1028), False, 'import time\n'), ((2947, 2958), 'time.... |
import json
import pathlib
import random
import jsonpickle
class BankAccount:
def __init__(self, ssn, balance=0):
self._ssn = ssn
self._balance = balance
@property
def ssn(self):
return self._ssn
@property
def balance(self):
return self._balance
@st... | [
"jsonpickle.decode",
"json.load",
"pathlib.Path",
"random.randint"
] | [((1156, 1184), 'random.randint', 'random.randint', (['(10000)', '(99999)'], {}), '(10000, 99999)\n', (1170, 1184), False, 'import random\n'), ((2109, 2139), 'random.randint', 'random.randint', (['(100000)', '(200000)'], {}), '(100000, 200000)\n', (2123, 2139), False, 'import random\n'), ((543, 563), 'json.load', 'json... |
#!/usr/bin/env python3
import sys
import argparse
import bz2
import pickle
import numpy
import textwrap
import tabulate
import copy
import math
import operator
import collections
import profileLib
import statistics
from xopen import xopen
def error(baseline, value, totalBaseline, totalValue, weight, fullTotalBaselin... | [
"tabulate.tabulate",
"copy.deepcopy",
"bz2.BZ2File.open",
"numpy.append",
"argparse.ArgumentParser",
"statistics.mean",
"numpy.sum",
"numpy.where",
"textwrap.fill",
"numpy.concatenate",
"numpy.empty",
"numpy.insert",
"numpy.array",
"sys.exit",
"xopen.xopen",
"operator.itemgetter"
] | [((4375, 4969), 'numpy.array', 'numpy.array', (["[['relative_error', 'Relative Error', relativeError], ['error', 'Error',\n error], ['absolute_error', 'Absolute Error', absoluteError], [\n 'weighted_error', 'Weighted Error', weightedError], [\n 'absolute_weighted_error', 'Absolute Weighted Error',\n absolut... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth.models import AbstractBaseUser
from django.db import models
# Create your models here.
class Account(AbstractBaseUser):
email = models.EmailField(unique=True)
username = models.CharField(max_length=40, unique=True)
... | [
"django.db.models.DateTimeField",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.EmailField"
] | [((228, 258), 'django.db.models.EmailField', 'models.EmailField', ([], {'unique': '(True)'}), '(unique=True)\n', (245, 258), False, 'from django.db import models\n'), ((274, 318), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(40)', 'unique': '(True)'}), '(max_length=40, unique=True)\n', (290, ... |
# -*- coding: utf-8 -*-
"""
> :warning: This file is only for use by the Simmate team. Users should instead
access data via the load_remote_archive method.
This file is for pulling AFLOW data into the Simmate database.
AFLOW's supported REST API can be accessed via "AFLUX API". This is a separate
python package, w... | [
"pymatgen.io.ase.AseAtomsAdaptor.get_structure",
"aflow.control.Query",
"tqdm.tqdm"
] | [((3358, 3368), 'tqdm.tqdm', 'tqdm', (['data'], {}), '(data)\n', (3362, 3368), False, 'from tqdm import tqdm\n'), ((3548, 3592), 'pymatgen.io.ase.AseAtomsAdaptor.get_structure', 'AseAtomsAdaptor.get_structure', (['structure_ase'], {}), '(structure_ase)\n', (3577, 3592), False, 'from pymatgen.io.ase import AseAtomsAdapt... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "<NAME>"
__email__ = "<EMAIL>"
import datetime
import numpy as np
import pandas as pd
class DataType(object):
INT = 1
STRING = 2
DECIMAL = 3
TIMESTAMP = 4
DATE = 5
ARRAY = 6
_converted_types = {
DataType.INT: int,
DataType... | [
"numpy.dtype"
] | [((384, 397), 'numpy.dtype', 'np.dtype', (['"""O"""'], {}), "('O')\n", (392, 397), True, 'import numpy as np\n')] |
#!/usr/bin/env python
import sys
# import all necessary stuff
import osg
import osgDB
import osgGA
import osgViewer
# create a root node
node = osg.Group()
# needed for python
filepath = osgDB.getLibraryFilePathList()
for item in sys.path: filepath.append(item)
osgDB.setLibraryFilePathList(filepath)
loadedmodel = ... | [
"osgDB.getLibraryFilePathList",
"osgDB.setLibraryFilePathList",
"osgViewer.ThreadingHandler",
"osgViewer.Viewer",
"osgViewer.StatsHandler",
"osgViewer.HelpHandler",
"osg.Group",
"osgDB.readNodeFile",
"osgViewer.WindowSizeHandler"
] | [((147, 158), 'osg.Group', 'osg.Group', ([], {}), '()\n', (156, 158), False, 'import osg\n'), ((191, 221), 'osgDB.getLibraryFilePathList', 'osgDB.getLibraryFilePathList', ([], {}), '()\n', (219, 221), False, 'import osgDB\n'), ((266, 304), 'osgDB.setLibraryFilePathList', 'osgDB.setLibraryFilePathList', (['filepath'], {... |
import json
import csv
labels = ["E10","E11","E12","E13","E14","E15","E16","E17","E18","E19","E20","E21","E22","E23","E24","E25","E26","E27","E28","E29","E30","E31","E32","E33","E34","E35","E36","E37","E38","E39","E40","E41","E42","E43","E44","E45","E46","E47","E48","E49","E50","E51","E52","E53","E54","E55","E56","E57... | [
"csv.writer",
"json.load"
] | [((612, 625), 'csv.writer', 'csv.writer', (['f'], {}), '(f)\n', (622, 625), False, 'import csv\n'), ((1193, 1206), 'csv.writer', 'csv.writer', (['f'], {}), '(f)\n', (1203, 1206), False, 'import csv\n'), ((1850, 1863), 'csv.writer', 'csv.writer', (['f'], {}), '(f)\n', (1860, 1863), False, 'import csv\n'), ((513, 525), '... |
# Generated by Django 3.2.7 on 2021-10-08 08:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('firearm', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='firearm',
name='opType',
fi... | [
"django.db.models.CharField",
"django.db.models.TextField"
] | [((324, 352), 'django.db.models.TextField', 'models.TextField', ([], {'default': '""""""'}), "(default='')\n", (340, 352), False, 'from django.db import migrations, models\n'), ((481, 512), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (497, 512), False, 'from djan... |
"""
This file is part of LiberaForms.
# SPDX-FileCopyrightText: 2021 LiberaForms.org
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
import os, shutil
def ensure_uploads_dir_tree(app):
uploads_dir = app.config['UPLOADS_DIR']
media_dir = os.path.join(uploads_dir, app.config['MEDIA_DIR'])
attachment_dir ... | [
"os.path.join",
"os.path.isdir",
"os.makedirs"
] | [((250, 300), 'os.path.join', 'os.path.join', (['uploads_dir', "app.config['MEDIA_DIR']"], {}), "(uploads_dir, app.config['MEDIA_DIR'])\n", (262, 300), False, 'import os, shutil\n'), ((322, 377), 'os.path.join', 'os.path.join', (['uploads_dir', "app.config['ATTACHMENT_DIR']"], {}), "(uploads_dir, app.config['ATTACHMENT... |
import datetime
import pytz
from sqlalchemy import DateTime
from sqlalchemy.types import TypeDecorator
def tzware_datetime():
"""
Return a timezone aware datetime.
:return: Datetime
"""
return datetime.datetime.now(pytz.utc)
class AwareDateTime(TypeDecorator):
"""
A DateTime type which... | [
"datetime.datetime.now",
"sqlalchemy.DateTime"
] | [((217, 248), 'datetime.datetime.now', 'datetime.datetime.now', (['pytz.utc'], {}), '(pytz.utc)\n', (238, 248), False, 'import datetime\n'), ((471, 494), 'sqlalchemy.DateTime', 'DateTime', ([], {'timezone': '(True)'}), '(timezone=True)\n', (479, 494), False, 'from sqlalchemy import DateTime\n')] |
from multiprocessing import Pool
import pandas as pd
import os
from model_based_analysis_tools import *
base_dir = '../../'
in_dirs = {
'data':'new-processed-model-processed-1en01',
'synthetic-data':'new-synthetic-model-processed-1en01',
'score-matched-data':'new-synthetic-score-matched-model-processed-1... | [
"os.listdir",
"os.makedirs"
] | [((559, 579), 'os.makedirs', 'os.makedirs', (['out_dir'], {}), '(out_dir)\n', (570, 579), False, 'import os\n'), ((718, 747), 'os.listdir', 'os.listdir', (['(base_dir + in_dir)'], {}), '(base_dir + in_dir)\n', (728, 747), False, 'import os\n')] |
import sys
import numpy as np
import scipy as sp
import pandas as pd
import networkx as nx
import gensim.parsing.preprocessing as gpp
import sklearn.metrics.pairwise as smp
from .persistent_homology import PersistentHomology
__all__ = ['Model']
class Model(PersistentHomology):
"""
Attributes
----------
... | [
"numpy.random.choice",
"numpy.append",
"numpy.argwhere",
"sys.stdout.flush",
"numpy.delete",
"numpy.random.binomial",
"numpy.zeros",
"numpy.array",
"pandas.DataFrame",
"numpy.argsort",
"scipy.sparse.hstack"
] | [((1666, 1680), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1678, 1680), True, 'import pandas as pd\n'), ((7272, 7310), 'numpy.random.binomial', 'np.random.binomial', (['point[0]', 'point[1]'], {}), '(point[0], point[1])\n', (7290, 7310), True, 'import numpy as np\n'), ((7329, 7382), 'numpy.random.choice', '... |
import numpy as np
from scipy.special import expit
class NeuralNet:
def __init__(self, input_qty, hidden_dts, output_qty):
"""
input_qty : Quantidade de entradas que a rede vai receber.
hidden_dts : Uma tuple contedo os detalhes das camadas escondidas.
Primeiro valo... | [
"numpy.reshape",
"numpy.asarray",
"numpy.random.uniform",
"numpy.maximum",
"scipy.special.expit",
"numpy.dot"
] | [((661, 679), 'numpy.asarray', 'np.asarray', (['inputs'], {}), '(inputs)\n', (671, 679), True, 'import numpy as np\n'), ((1579, 1608), 'numpy.reshape', 'np.reshape', (['weights', 'newshape'], {}), '(weights, newshape)\n', (1589, 1608), True, 'import numpy as np\n'), ((2075, 2106), 'numpy.random.uniform', 'np.random.uni... |
import gzip
from collections import OrderedDict
from typing import Dict, Tuple
import numpy as np
import tensorflow as tf
from tensorflow.python.lib.io import file_io
def random_normal_initializer(_, dim):
return np.random.normal(0, 0.01, dim)
def zero_initializer(_, dim):
return np.zeros(dim)
def read_v... | [
"tensorflow.python.lib.io.file_io.FileIO",
"numpy.std",
"numpy.random.normal",
"collections.OrderedDict",
"numpy.zeros",
"gzip.open"
] | [((220, 250), 'numpy.random.normal', 'np.random.normal', (['(0)', '(0.01)', 'dim'], {}), '(0, 0.01, dim)\n', (236, 250), True, 'import numpy as np\n'), ((294, 307), 'numpy.zeros', 'np.zeros', (['dim'], {}), '(dim)\n', (302, 307), True, 'import numpy as np\n'), ((665, 678), 'collections.OrderedDict', 'OrderedDict', ([],... |
# MIT License
#
# Copyright (c) 2021 <NAME> and <NAME> and <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy... | [
"torch.rand",
"torch.nn.functional.softmax",
"openspeech.modules.wrapper.Linear",
"torch.nn.Conv1d",
"torch.sigmoid"
] | [((2769, 2842), 'torch.nn.Conv1d', 'nn.Conv1d', ([], {'in_channels': '(1)', 'out_channels': 'attn_dim', 'kernel_size': '(3)', 'padding': '(1)'}), '(in_channels=1, out_channels=attn_dim, kernel_size=3, padding=1)\n', (2778, 2842), True, 'import torch.nn as nn\n'), ((2869, 2902), 'openspeech.modules.wrapper.Linear', 'Lin... |
TOKEN = ""
# YOUR BOT TOKEN
guildid = []
# YOUR GUILD ID
import discord
from discord.ext import commands
# pip install -U git+https://github.com/Rapptz/discord.py.git (recommended)
from discord_slash import SlashContext, SlashCommand
from discord_slash.model import SlashCommandOptionType
from discord_slash.ut... | [
"discord_slash.utils.manage_commands.create_choice",
"discord.PermissionOverwrite",
"discord.ext.commands.Bot",
"discord_slash.utils.manage_commands.create_option",
"discord_slash.SlashCommand"
] | [((460, 492), 'discord.ext.commands.Bot', 'commands.Bot', ([], {'command_prefix': '"""!"""'}), "(command_prefix='!')\n", (472, 492), False, 'from discord.ext import commands\n'), ((501, 538), 'discord_slash.SlashCommand', 'SlashCommand', (['bot'], {'sync_commands': '(True)'}), '(bot, sync_commands=True)\n', (513, 538),... |
import pyopencl as cl
import numpy
from pyPaSWAS.Core.SmithWaterman import SmithWaterman
from pyPaSWAS.Core import STOP_DIRECTION, LEFT_DIRECTION, NO_DIRECTION, UPPER_DIRECTION, UPPER_LEFT_DIRECTION
from pyPaSWAS.Core.PaSWAS import CPUcode
from pyPaSWAS.Core.PaSWAS import GPUcode
from pyPaSWAS.Core.StartingPoint impor... | [
"numpy.uint32",
"pyPaSWAS.Core.PaSWAS.CPUcode",
"pyopencl.Program",
"pyPaSWAS.Core.PaSWAS.GPUcode",
"pyPaSWAS.Core.SmithWaterman.SmithWaterman.__init__",
"pyopencl.CommandQueue",
"numpy.int32",
"numpy.zeros",
"pyopencl.enqueue_fill_buffer",
"pyopencl.Buffer",
"numpy.array",
"pyopencl.get_platf... | [((509, 562), 'pyPaSWAS.Core.SmithWaterman.SmithWaterman.__init__', 'SmithWaterman.__init__', (['self', 'logger', 'score', 'settings'], {}), '(self, logger, score, settings)\n', (531, 562), False, 'from pyPaSWAS.Core.SmithWaterman import SmithWaterman\n'), ((3137, 3155), 'pyopencl.get_platforms', 'cl.get_platforms', ([... |
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
import board
from adafruit_turtle import turtle
turtle = turtle(board.DISPLAY)
turtle.pendown()
for _ in range(32):
turtle.circle(50, steps=6)
turtle.right(11.1111)
while True:
pass
| [
"adafruit_turtle.turtle",
"adafruit_turtle.turtle.pendown",
"adafruit_turtle.turtle.circle",
"adafruit_turtle.turtle.right"
] | [((153, 174), 'adafruit_turtle.turtle', 'turtle', (['board.DISPLAY'], {}), '(board.DISPLAY)\n', (159, 174), False, 'from adafruit_turtle import turtle\n'), ((175, 191), 'adafruit_turtle.turtle.pendown', 'turtle.pendown', ([], {}), '()\n', (189, 191), False, 'from adafruit_turtle import turtle\n'), ((217, 243), 'adafrui... |
import gym
from typing import Tuple
def configure_env(name: str) -> Tuple[gym.Env, bool, int, int, int]:
environment = gym.make(name)
is_discrete_env = type(environment.action_space) == gym.spaces.discrete.Discrete
if is_discrete_env:
action_dims = 1
num_actions = environment.action_space... | [
"gym.make"
] | [((125, 139), 'gym.make', 'gym.make', (['name'], {}), '(name)\n', (133, 139), False, 'import gym\n')] |
import re
import shlex
from typing import List
from typing import Union
from lxml.etree import Element
from lxml.etree import SubElement
from xapiparser.exception import ParseError
from xapiparser.exception import UnsupportedError
COMMANDS = ('xCommand', 'xStatus', 'xConfiguration')
UNSUPPORTED = ('xGetxml', 'xEvent... | [
"xapiparser.exception.ParseError",
"lxml.etree.Element",
"lxml.etree.SubElement",
"xapiparser.exception.UnsupportedError",
"re.search",
"shlex.split"
] | [((467, 483), 'shlex.split', 'shlex.split', (['cmd'], {}), '(cmd)\n', (478, 483), False, 'import shlex\n'), ((1215, 1235), 'lxml.etree.Element', 'Element', (['expr[0][1:]'], {}), '(expr[0][1:])\n', (1222, 1235), False, 'from lxml.etree import Element\n'), ((3470, 3498), 'xapiparser.exception.ParseError', 'ParseError', ... |
import logging
from django.apps import AppConfig
class CrashbinAppConfig(AppConfig):
name = "crashbin_app"
def ready(self) -> None:
logging.basicConfig(level=logging.INFO)
# pylint: disable=unused-import
import crashbin_app.signals # noqa
from crashbin_app import utils
... | [
"crashbin_app.utils.load_plugins",
"logging.basicConfig"
] | [((152, 191), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (171, 191), False, 'import logging\n'), ((324, 344), 'crashbin_app.utils.load_plugins', 'utils.load_plugins', ([], {}), '()\n', (342, 344), False, 'from crashbin_app import utils\n')] |
"""Main module."""
import argparse
import io
import os
import pathlib
import subprocess
import shutil
import sys
from tempfile import mkstemp
import stat
import re
import yaml
import dataclasses as dc
import datetime
import tarfile
import hashlib
import time
from .wheel_utils import parse_wheel_filename
from .utils ... | [
"os.path.join",
"os.listdir",
"os.getcwd",
"os.system",
"os.path.splitext",
"argparse.ArgumentParser",
"os.mkdir",
"os.chmod",
"os.path.exists",
"os.path.split",
"os.chdir",
"os.stat",
"os.path.relpath"
] | [((1199, 1210), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1208, 1210), False, 'import os\n'), ((1237, 1269), 'os.path.join', 'os.path.join', (['self.curdir', '"""out"""'], {}), "(self.curdir, 'out')\n", (1249, 1269), False, 'import os\n'), ((1502, 1578), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'d... |
import unittest
from gruve import io
class TestIO(unittest.TestCase):
def test_dotEnv_exists(self):
actual = list(io.apiKeys())
self.assertGreater(len(actual), 0)
def test_getApiKey_present(self):
actual = io.getApiKey('OPENFDA_API_KEY')
self.assertTrue(actual)
def test_ge... | [
"gruve.io.apiKeys",
"gruve.io.getApiKey",
"unittest.main"
] | [((449, 464), 'unittest.main', 'unittest.main', ([], {}), '()\n', (462, 464), False, 'import unittest\n'), ((240, 271), 'gruve.io.getApiKey', 'io.getApiKey', (['"""OPENFDA_API_KEY"""'], {}), "('OPENFDA_API_KEY')\n", (252, 271), False, 'from gruve import io\n'), ((127, 139), 'gruve.io.apiKeys', 'io.apiKeys', ([], {}), '... |
### 第二批数据:1:敏感语料(短语) 2:微博评论原文(senti100k,处理特殊字符),各6754条,测试集比例0.1
# 处理方式:
# 1.去掉表情符号,如:[哈哈] [鼓掌] [good]
# 2.去掉话题标记,如:##
# 3.去掉转发评论重的用户名等
# 4.去掉一些网址、无意义的词,如:转发微博等。
import pandas as pd
import re
def clean(text):
text = re.sub(r"(回复)?(//)?\s*@\S*?\s*(:| |$)", " ", text) # 去除正文中的@和回复/转发中的用户名
text = re.sub(r"\[\S+... | [
"re.compile",
"pandas.read_excel",
"pandas.read_csv",
"pandas.DataFrame",
"re.sub"
] | [((885, 993), 'pandas.read_excel', 'pd.read_excel', (['"""/Users/leo/Data/项目数据/文德数慧-文本内容审核/分类实验/数据/网络信息语料 文德 20210122.xlsx"""'], {'sheet_name': '"""测试集"""'}), "(\n '/Users/leo/Data/项目数据/文德数慧-文本内容审核/分类实验/数据/网络信息语料 文德 20210122.xlsx',\n sheet_name='测试集')\n", (898, 993), True, 'import pandas as pd\n'), ((992, 1068), ... |
# -*- coding: utf-8 -*-
"""
=============================
Aligning two matrices with the procrustes function
=============================
In this example, we load in some synthetic data, rotate it, and then use the
procustes function to get the datasets back in alignment. The procrustes
function uses linear transfor... | [
"hypertools.plot",
"hypertools.tools.procrustes",
"hypertools.load"
] | [((526, 544), 'hypertools.load', 'hyp.load', (['"""spiral"""'], {}), "('spiral')\n", (534, 544), True, 'import hypertools as hyp\n'), ((724, 779), 'hypertools.plot', 'hyp.plot', (['aligned', "['-', '--']"], {'title': '"""After alignment"""'}), "(aligned, ['-', '--'], title='After alignment')\n", (732, 779), True, 'impo... |
#!/usr/bin/env python
import re
import sys
import ez_setup
ez_setup.use_setuptools()
from setuptools import setup, Extension
define_macros = []
import ctypes
if ctypes.sizeof(ctypes.c_double) == 8:
dv = ctypes.c_double(9006104071832581.0)
iv = ctypes.cast(ctypes.pointer(dv), ctypes.POINTER(ctypes.c_uint64))... | [
"ez_setup.use_setuptools",
"ctypes.POINTER",
"ctypes.pointer",
"ctypes.sizeof",
"re.search",
"ctypes.c_double",
"setuptools.Extension"
] | [((60, 85), 'ez_setup.use_setuptools', 'ez_setup.use_setuptools', ([], {}), '()\n', (83, 85), False, 'import ez_setup\n'), ((165, 195), 'ctypes.sizeof', 'ctypes.sizeof', (['ctypes.c_double'], {}), '(ctypes.c_double)\n', (178, 195), False, 'import ctypes\n'), ((211, 246), 'ctypes.c_double', 'ctypes.c_double', (['(900610... |
"""
Interface to OpenSSL object identifier database.
It is primarily intended to deal with OIDs which are compiled into the
database or defined in the openssl configuration files.
But see create() function.
OpenSSL maintains database of OIDs, which contain long and short
human-readable names, which correspond to Oid... | [
"ctypescrypto.libcrypto.OBJ_nid2sn",
"ctypescrypto.libcrypto.OBJ_nid2ln",
"ctypescrypto.libcrypto.OBJ_cleanup",
"ctypescrypto.libcrypto.OBJ_obj2txt",
"ctypescrypto.libcrypto.OBJ_create",
"ctypescrypto.exception.LibCryptoError",
"ctypes.create_string_buffer",
"ctypescrypto.libcrypto.OBJ_nid2obj",
"ct... | [((5327, 5376), 'ctypescrypto.libcrypto.OBJ_create', 'libcrypto.OBJ_create', (['dotted', 'shortname', 'longname'], {}), '(dotted, shortname, longname)\n', (5347, 5376), False, 'from ctypescrypto import libcrypto, pyver, bintype, chartype, inttype\n'), ((3803, 3834), 'ctypescrypto.libcrypto.OBJ_nid2obj', 'libcrypto.OBJ_... |
from abc import ABC, abstractmethod
from copy import deepcopy
import logging
from typing import Tuple, List, Dict
import numpy as np
import gym
from gridworld.log import logger
class ComponentEnv(gym.Env, ABC):
"""Base class for any environment used in the multiagent simulation."""
def __init__(
s... | [
"copy.deepcopy",
"gym.spaces.Dict"
] | [((2545, 2610), 'gym.spaces.Dict', 'gym.spaces.Dict', (['{e.name: e.observation_space for e in self.envs}'], {}), '({e.name: e.observation_space for e in self.envs})\n', (2560, 2610), False, 'import gym\n'), ((2653, 2713), 'gym.spaces.Dict', 'gym.spaces.Dict', (['{e.name: e.action_space for e in self.envs}'], {}), '({e... |
import logging
from logging.handlers import RotatingFileHandler
log_format = '%(asctime)s - %(name)s - %(levelname)s - ' \
'%(funcName)s(%(lineno)d)- %(message)s'
"""
author: <NAME> <EMAIL>
"""
def set_up_logging(log_file, is_debug=False):
handlers = [get_console_handler(), get_log_file_handler(log... | [
"logging.Formatter",
"logging.getLogger",
"logging.basicConfig",
"logging.handlers.RotatingFileHandler",
"logging.StreamHandler",
"logging.info"
] | [((404, 474), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'level', 'format': 'log_format', 'handlers': 'handlers'}), '(level=level, format=log_format, handlers=handlers)\n', (423, 474), False, 'import logging\n'), ((503, 550), 'logging.info', 'logging.info', (["('started logging to: ' + log_file)"], {}... |
from django.shortcuts import render
from django.shortcuts import redirect
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.views.generic import View
from .models import Post, Tag
from .utils import *
from .forms import TagForm, PostForm
from django.contrib.auth.mixins import ... | [
"django.shortcuts.render",
"django.core.paginator.Paginator",
"django.db.models.Q"
] | [((1324, 1355), 'django.core.paginator.Paginator', 'Paginator', (['posts', 'posts_on_page'], {}), '(posts, posts_on_page)\n', (1333, 1355), False, 'from django.core.paginator import Paginator\n'), ((1890, 1941), 'django.shortcuts.render', 'render', (['request', '"""blog/index.html"""'], {'context': 'context'}), "(reque... |
# o-------------------------------------------o
# | <NAME> |
# | Zendesk Internship challenge |
# | 11 / 24 / 2021 |
# o-------------------------------------------o
# used for handling get requests and auth
import requests
from requests.auth import AuthBas... | [
"requests.auth.AuthBase",
"requests.auth.HTTPBasicAuth",
"requests.get"
] | [((455, 465), 'requests.auth.AuthBase', 'AuthBase', ([], {}), '()\n', (463, 465), False, 'from requests.auth import AuthBase, HTTPBasicAuth\n'), ((2331, 2465), 'requests.get', 'requests.get', (['f"""https://{subdomain}.zendesk.com/api/v2/incremental/tickets/cursor.json?start_time={0}"""'], {'auth': 'auth', 'timeout': '... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 15 17:19:48 2019
@author: <NAME>
"""
#Functions for Rydberg library
import numpy as np
import SIunits as SIunits
import AtomData as atoms
import MatlabHacks as mfuncs
import WignerFuncs as Wigner
def numerovfunc(atom,nn,ll,jj):
'''Function fo... | [
"AtomData.Rb87decaypaths",
"numpy.power",
"numpy.copy",
"numpy.where",
"numpy.sum",
"numpy.zeros",
"numpy.log",
"numpy.arange",
"numpy.absolute",
"numpy.sqrt",
"numpy.flip",
"numpy.sin",
"AtomData.Rb87blackbody",
"numpy.multiply",
"MatlabHacks.combvec",
"WignerFuncs.Wigner3j",
"Matla... | [((702, 713), 'numpy.log', 'np.log', (['r_i'], {}), '(r_i)\n', (708, 713), True, 'import numpy as np\n'), ((745, 756), 'numpy.log', 'np.log', (['r_o'], {}), '(r_o)\n', (751, 756), True, 'import numpy as np\n'), ((766, 794), 'numpy.arange', 'np.arange', (['x_i', '(x_o + hh)', 'hh'], {}), '(x_i, x_o + hh, hh)\n', (775, 7... |
import math
import datetime
from django.conf import settings
from django.db import models
from django.db.models import Count, Sum, Avg
from django.db.models.signals import post_save, pre_save
from django.dispatch import Signal, receiver
from angalabiri.shop.models.productmodels import (
Product,
ProductFile,
... | [
"paystackapi.product.Product.create",
"django.db.models.signals.post_save.connect",
"django.dispatch.receiver",
"angalabiri.utils.models.unique_slug_generator",
"angalabiri.shop.models.productmodels.ProductVariation"
] | [((646, 680), 'django.dispatch.receiver', 'receiver', (['pre_save'], {'sender': 'Product'}), '(pre_save, sender=Product)\n', (654, 680), False, 'from django.dispatch import Signal, receiver\n'), ((1461, 1523), 'django.db.models.signals.post_save.connect', 'post_save.connect', (['product_post_saved_receiver'], {'sender'... |
from aiohttp import hdrs, BasicAuth
from tests.conftest import USERNAME, PASSWORD
async def test_any_views_respond_401_when_auth_forced(aiohttp_client, app_factory): # noqa
app = app_factory(auth_force=True)
client = await aiohttp_client(app)
resp = await client.get('/')
assert resp.statu... | [
"aiohttp.BasicAuth"
] | [((1733, 1762), 'aiohttp.BasicAuth', 'BasicAuth', (['USERNAME', 'PASSWORD'], {}), '(USERNAME, PASSWORD)\n', (1742, 1762), False, 'from aiohttp import hdrs, BasicAuth\n'), ((2060, 2104), 'aiohttp.BasicAuth', 'BasicAuth', (['USERNAME', "(PASSWORD + '<PASSWORD>')"], {}), "(USERNAME, PASSWORD + '<PASSWORD>')\n", (2069, 210... |
# -*- coding: utf-8 -*-
############################################################################
#
# Copyright © 2013, 2015 OnlineGroups.net and Contributors.
# 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 th... | [
"urllib.quote",
"Products.Five.browser.pagetemplatefile.ZopeTwoPageTemplateFile",
"gs.errormesg.baseerror.BaseErrorPage.__init__",
"zope.component.createObject"
] | [((1360, 1393), 'Products.Five.browser.pagetemplatefile.ZopeTwoPageTemplateFile', 'ZopeTwoPageTemplateFile', (['fileName'], {}), '(fileName)\n', (1383, 1393), False, 'from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile\n'), ((2116, 2149), 'Products.Five.browser.pagetemplatefile.ZopeTwoPageTemplat... |
# Generated by Django 2.2 on 2019-11-23 14:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('courses', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='course',
name='learn_times',
... | [
"django.db.models.IntegerField"
] | [((326, 384), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)', 'verbose_name': '"""需要学习时长(分钟数)"""'}), "(default=0, verbose_name='需要学习时长(分钟数)')\n", (345, 384), False, 'from django.db import migrations, models\n')] |
#!/usr/bin/env python
# Class autogenerated from /home/sam/Downloads/aldebaran_sw/nao/naoqi-sdk-2.1.4.13-linux64/include/alproxies/alsegmentation3dproxy.h
# by <NAME> <Sammy.Pfeiffer at student.uts.edu.au> generator
# You need an ALBroker running
from naoqi import ALProxy
class ALSegmentation3D(object):
def __i... | [
"naoqi.ALProxy"
] | [((451, 478), 'naoqi.ALProxy', 'ALProxy', (['"""ALSegmentation3D"""'], {}), "('ALSegmentation3D')\n", (458, 478), False, 'from naoqi import ALProxy\n'), ((611, 638), 'naoqi.ALProxy', 'ALProxy', (['"""ALSegmentation3D"""'], {}), "('ALSegmentation3D')\n", (618, 638), False, 'from naoqi import ALProxy\n'), ((875, 902), 'n... |
import datetime
from fp17 import treatments
def annotate(bcds1):
bcds1.patient.surname = "BULWELL"
bcds1.patient.forename = "LILY"
bcds1.patient.address = ["18 HIGH STREET"]
bcds1.patient.sex = 'F'
bcds1.patient.date_of_birth = datetime.date(1968, 4, 28)
bcds1.date_of_acceptance = datetime.d... | [
"datetime.date"
] | [((251, 277), 'datetime.date', 'datetime.date', (['(1968)', '(4)', '(28)'], {}), '(1968, 4, 28)\n', (264, 277), False, 'import datetime\n'), ((310, 335), 'datetime.date', 'datetime.date', (['(2017)', '(4)', '(1)'], {}), '(2017, 4, 1)\n', (323, 335), False, 'import datetime\n'), ((367, 392), 'datetime.date', 'datetime.d... |
import math
import pandas as pd
from dataclasses import dataclass
from typing import Dict, List, Optional, Tuple
# document id -> judgement for that document
JudgedDocuments = Dict[str, float]
@dataclass
class JudgedQuery:
query: str
judgements: JudgedDocuments
def __post_init__(self):
self.do... | [
"math.isnan",
"pandas.read_csv",
"math.log"
] | [((935, 1023), 'pandas.read_csv', 'pd.read_csv', (['filename'], {'header': '(0)', 'dtype': "{'query': str, 'docid': str, 'rating': float}"}), "(filename, header=0, dtype={'query': str, 'docid': str, 'rating':\n float})\n", (946, 1023), True, 'import pandas as pd\n'), ((764, 782), 'math.log', 'math.log', (['(i + 2)',... |
import requests
from flask import Flask, request, render_template
from forms.analysis import AnalysisForm
from utils.rest import invoke_get_request, get_chart_url
from utils import config
app = Flask(__name__)
app.config['SECRET_KEY'] = 'ebs-salinization-bentre'
@app.route('/')
@app.route('/index')
def home():
... | [
"utils.config.get_config",
"utils.rest.invoke_get_request",
"forms.analysis.AnalysisForm",
"flask.request.args.get",
"flask.render_template",
"utils.rest.get_chart_url",
"flask.Flask"
] | [((197, 212), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (202, 212), False, 'from flask import Flask, request, render_template\n'), ((327, 341), 'forms.analysis.AnalysisForm', 'AnalysisForm', ([], {}), '()\n', (339, 341), False, 'from forms.analysis import AnalysisForm\n'), ((353, 392), 'flask.render_t... |
"""
Test sphinx extensions.
"""
from code_annotations.contrib.sphinx.extensions.base import find_annotations, quote_value
def test_collect_pii_for_sphinx():
annotations = find_annotations(
"tests/extensions/python_test_files/simple_success.pyt",
"tests/test_configurations/.annotations_test",
... | [
"code_annotations.contrib.sphinx.extensions.base.quote_value",
"code_annotations.contrib.sphinx.extensions.base.find_annotations"
] | [((177, 312), 'code_annotations.contrib.sphinx.extensions.base.find_annotations', 'find_annotations', (['"""tests/extensions/python_test_files/simple_success.pyt"""', '"""tests/test_configurations/.annotations_test"""', '""".. pii:"""'], {}), "('tests/extensions/python_test_files/simple_success.pyt',\n 'tests/test_c... |
import pandas as pd
import numpy as np
import tensorflow as tf
import dask
import scipy
import time
from functools import partial
from abc import ABCMeta, abstractmethod
from sklearn.decomposition import PCA
from sklearn.preprocessing import scale
from sklearn.linear_model import LinearRegression
im... | [
"tensorflow.train.AdamOptimizer",
"numpy.isnan",
"numpy.zeros",
"numpy.square",
"numpy.ones",
"numpy.reshape",
"tensorflow.Session",
"sklearn.preprocessing.scale",
"numpy.linalg.pinv",
"tensorflow.global_variables_initializer",
"tensorflow.placeholder",
"pandas.Series",
"tensorflow.add_n",
... | [((1143, 1220), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': "[None, self.nbUnitsPerLayer['Input Layer']]"}), "(tf.float32, shape=[None, self.nbUnitsPerLayer['Input Layer']])\n", (1157, 1220), True, 'import tensorflow as tf\n'), ((3515, 3571), 'tensorflow.matmul', 'tf.matmul', (['factorTensor'... |
import itertools
from copy import deepcopy
def print_result(unique_permutations):
result = []
for perm in list(sorted(unique_permutations)):
pair_list = []
for pair in perm:
pair_str = f'|{pair[0]}-{pair[1]}|'
pair_list.append(pair_str)
result.append(' # '.join(... | [
"itertools.permutations",
"copy.deepcopy"
] | [((632, 651), 'copy.deepcopy', 'deepcopy', (['all_sizes'], {}), '(all_sizes)\n', (640, 651), False, 'from copy import deepcopy\n'), ((564, 611), 'itertools.permutations', 'itertools.permutations', (['all_sizes', 'sticks_count'], {}), '(all_sizes, sticks_count)\n', (586, 611), False, 'import itertools\n'), ((867, 920), ... |
from django import forms
from .models import File
from captcha.fields import ReCaptchaField
from captcha.widgets import ReCaptchaV3
# Model form
class FileUploadModelForm(forms.ModelForm):
class Meta:
model = File
labels = {
'file': ''
}
fields = ['file']
widget... | [
"django.forms.ClearableFileInput",
"django.forms.ValidationError",
"captcha.widgets.ReCaptchaV3"
] | [((346, 403), 'django.forms.ClearableFileInput', 'forms.ClearableFileInput', ([], {'attrs': "{'class': 'form-control'}"}), "(attrs={'class': 'form-control'})\n", (370, 403), False, 'from django import forms\n'), ((572, 626), 'django.forms.ValidationError', 'forms.ValidationError', (['""".xls以外の拡張子ファイルはアップロードいただけません。"""... |
import torch
import pickle
import cv2
import random
import numpy as np
import math
from torch.utils.data import DataLoader,Dataset
from albumentations import (
Blur,GaussianBlur,MedianBlur,
HueSaturationValue,
RandomBrightnessContrast,
Normalize,
OneOf, Compose,
NoOp,
)
M... | [
"torch.FloatTensor",
"random.random",
"numpy.array",
"tqdm.tqdm",
"albumentations.Normalize",
"torch.from_numpy",
"cv2.imread",
"fer_pytorch.config.default_cfg.get_fer_cfg_defaults",
"cv2.cvtColor",
"math.sqrt",
"torch.zeros",
"albumentations.RandomBrightnessContrast",
"albumentations.HueSat... | [((335, 510), 'numpy.array', 'np.array', (['[0.2435, 0.3053, 0.3996, 0.3032, 0.5115, 0.3064, 0.6159, 0.2999, 0.738, \n 0.2975, 0.4218, 0.6247, 0.6028, 0.6202, 0.5181, 0.4753, 0.5136, 0.8485]', 'np.float32'], {}), '([0.2435, 0.3053, 0.3996, 0.3032, 0.5115, 0.3064, 0.6159, 0.2999, \n 0.738, 0.2975, 0.4218, 0.6247, ... |
from discord.ext import commands
class AdminCog:
def __init__(self, bot):
self.bot = bot
@commands.command(name = "ban")
async def ban(self, ctx):
print("Here")
await ctx.send("Works")
def setup(bot):
bot.add_cog(AdminCog(bot)) | [
"discord.ext.commands.command"
] | [((108, 136), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""ban"""'}), "(name='ban')\n", (124, 136), False, 'from discord.ext import commands\n')] |
#!/usr/bin/python3
#-*- encoding: Utf-8 -*-
from struct import pack, unpack, unpack_from, calcsize
from collections import OrderedDict
from logging import warning, info
from time import sleep
from ctypes import *
from protocol.messages import *
"""
This module exposes a class from which a module may inherit in or... | [
"logging.info.rel_time.decode",
"logging.info.ver_dir.decode",
"logging.info.comp_time.decode",
"logging.info.rel_date.decode",
"struct.unpack",
"logging.info.comp_date.decode"
] | [((1785, 1813), 'logging.info.ver_dir.decode', 'info.ver_dir.decode', (['"""ascii"""'], {}), "('ascii')\n", (1804, 1813), False, 'from logging import warning, info\n'), ((2692, 2722), 'struct.unpack', 'unpack', (['"""<B2xII"""', 'payload[:11]'], {}), "('<B2xII', payload[:11])\n", (2698, 2722), False, 'from struct impor... |
from sqlalchemy import Column, Integer, String, Float, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
base = declarative_base()
class Video(base):
__tablename__ = "video"
id = Column(Integer, primary_key=True)
media_id = Column(Integer, Foreign... | [
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.orm.relationship",
"sqlalchemy.Column",
"sqlalchemy.ForeignKey"
] | [((170, 188), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (186, 188), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((248, 281), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (254, 281), False, 'f... |
# coding=utf-8
__author__ = "<NAME>"
from abc import ABC
import torch
from omegaconf import DictConfig, OmegaConf
from pytorch_lightning import Trainer
from torch.nn import L1Loss
from mridc.collections.common.losses.ssim import SSIMLoss
from mridc.collections.common.parts.fft import fft2c, ifft2c
from mridc.collect... | [
"torch.nn.L1Loss",
"mridc.collections.common.losses.ssim.SSIMLoss",
"mridc.core.classes.common.typecheck",
"mridc.collections.reconstruction.models.primaldual.pd.DualNet",
"omegaconf.OmegaConf.to_container",
"mridc.collections.common.parts.utils.complex_conj",
"torch.tensor",
"mridc.collections.recons... | [((6103, 6114), 'mridc.core.classes.common.typecheck', 'typecheck', ([], {}), '()\n', (6112, 6114), False, 'from mridc.core.classes.common import typecheck\n'), ((1544, 1585), 'omegaconf.OmegaConf.to_container', 'OmegaConf.to_container', (['cfg'], {'resolve': '(True)'}), '(cfg, resolve=True)\n', (1566, 1585), False, 'f... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import uuid
from botbuilder.schema import (
Activity,
ActivityEventNames,
ActivityTypes,
ConversationReference,
)
def get_continuation_activity(reference: ConversationReference) -> Activity:
return Activi... | [
"uuid.uuid1"
] | [((428, 440), 'uuid.uuid1', 'uuid.uuid1', ([], {}), '()\n', (438, 440), False, 'import uuid\n')] |
'''
Created on Feb 6, 2015
@author: cmccully
'''
from __future__ import absolute_import, division, print_function
from future.utils import iteritems
import time
import om10
import numpy as np
import re
import json
import os
import pandas as pd
import copy
import gzip
import shutil
from lsst.utils import getPackageDir
... | [
"lsst.utils.getPackageDir",
"json.dumps",
"shutil.copyfileobj",
"numpy.where",
"os.remove",
"numpy.isnan",
"pandas.read_csv",
"numpy.radians",
"numpy.arange",
"numpy.argsort",
"lsst.sims.catUtils.supernovae.SNObject",
"numpy.log10",
"numpy.random.RandomState",
"numpy.sqrt",
"numpy.logica... | [((3640, 3651), 'time.time', 'time.time', ([], {}), '()\n', (3649, 3651), False, 'import time\n'), ((3674, 3699), 'lsst.utils.getPackageDir', 'getPackageDir', (['"""Twinkles"""'], {}), "('Twinkles')\n", (3687, 3699), False, 'from lsst.utils import getPackageDir\n'), ((3719, 3762), 'os.path.join', 'os.path.join', (['twi... |
from collections import deque
import numpy as np
import imutils
import cv2
import numpy as np
import time
import wiringpi as wp
import time
import serial
wp.wiringPiSetupGpio()
def motor(x, y, pwm): #FUNCTION FOR THE MOTOR PINS AND ITS PWM
wp.pinMode(x, 1)
wp.pinMode(y, 1... | [
"cv2.imshow",
"cv2.boundingRect",
"cv2.cv.fromarray",
"wiringpi.pinMode",
"serial.Serial",
"cv2.cvtColor",
"numpy.ones",
"cv2.countNonZero",
"wiringpi.digitalRead",
"cv2.morphologyEx",
"wiringpi.softPwmWrite",
"wiringpi.wiringPiSetupGpio",
"wiringpi.softPwmCreate",
"cv2.cv.InitFont",
"cv... | [((183, 205), 'wiringpi.wiringPiSetupGpio', 'wp.wiringPiSetupGpio', ([], {}), '()\n', (203, 205), True, 'import wiringpi as wp\n'), ((885, 909), 'numpy.array', 'np.array', (['[73, 170, 151]'], {}), '([73, 170, 151])\n', (893, 909), True, 'import numpy as np\n'), ((924, 949), 'numpy.array', 'np.array', (['[179, 255, 255... |
from django.db import models
from hashlib import blake2b
from django.utils import timezone
class Placement(models.Model):
placement_name = models.CharField(max_length=300)
company = models.CharField(max_length=300)
role = models.CharField(max_length=100)
description = models.TextField()
eligible_b... | [
"django.db.models.DateTimeField",
"django.db.models.JSONField",
"django.utils.timezone.now",
"django.db.models.TextField",
"hashlib.blake2b",
"django.db.models.CharField"
] | [((145, 177), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(300)'}), '(max_length=300)\n', (161, 177), False, 'from django.db import models\n'), ((192, 224), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(300)'}), '(max_length=300)\n', (208, 224), False, 'from django.d... |
import numpy as np
def arr2dic(arr, thresh=None):
"""Keep the index and the values of an array if they are larger than the threshold.
Args:
arr (:obj:`numpy.array` of :obj:`float`): Array of numbers.
thresh (:obj:`int`): Keep values larger than the threshold.
Returns:
(:obj:`dict... | [
"numpy.where"
] | [((434, 457), 'numpy.where', 'np.where', (['(arr >= thresh)'], {}), '(arr >= thresh)\n', (442, 457), True, 'import numpy as np\n')] |
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import os
import re
SIGNALS_RE = '^signals'
MUX_ROOT = '/sys/kernel/debug/omap_mux'
def use_omapmux():
"""Whether or not to utiliz... | [
"os.path.join",
"re.match",
"os.listdir",
"logging.getLogger",
"os.path.isfile",
"os.path.exists",
"os.path.isdir"
] | [((633, 653), 'os.listdir', 'os.listdir', (['MUX_ROOT'], {}), '(MUX_ROOT)\n', (643, 653), False, 'import os\n'), ((571, 595), 'os.path.exists', 'os.path.exists', (['MUX_ROOT'], {}), '(MUX_ROOT)\n', (585, 595), False, 'import os\n'), ((675, 707), 'os.path.join', 'os.path.join', (['MUX_ROOT', 'mux_file'], {}), '(MUX_ROOT... |
__all__ = ('tokenize',)
import collections
import re
from dumbc.errors import DumbValueError
from dumbc.ast import ast
Token = collections.namedtuple('Token', ('kind', 'value', 'loc'))
KEYWORDS = {
'func',
'return',
'if',
'else',
'while',
'break',
'continue',
'as',
'var'
}
... | [
"dumbc.errors.DumbValueError",
"collections.namedtuple",
"dumbc.ast.ast.Location",
"re.compile"
] | [((131, 188), 'collections.namedtuple', 'collections.namedtuple', (['"""Token"""', "('kind', 'value', 'loc')"], {}), "('Token', ('kind', 'value', 'loc'))\n", (153, 188), False, 'import collections\n'), ((2010, 2034), 're.compile', 're.compile', (['tokens_regex'], {}), '(tokens_regex)\n', (2020, 2034), False, 'import re... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2020 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... | [
"packages.fetchai.protocols.fipa.message.FipaMessage",
"packages.fetchai.protocols.fipa.serialization.FipaSerializer",
"aea.protocols.default.serialization.DefaultSerializer",
"aea.protocols.default.message.DefaultMessage",
"typing.cast"
] | [((2080, 2106), 'typing.cast', 'cast', (['FipaMessage', 'message'], {}), '(FipaMessage, message)\n', (2084, 2106), False, 'from typing import Optional, cast\n'), ((2185, 2224), 'typing.cast', 'cast', (['Dialogues', 'self.context.dialogues'], {}), '(Dialogues, self.context.dialogues)\n', (2189, 2224), False, 'from typin... |
"""
Contributed by blha303
API key can be retrieved from the android app with Root Browser
(/data/data/au.gov.wa.pta.transperth/com.jeppesen.transperth.xml)
Please don't abuse this service, you'll ruin it for the rest of us.
"""
from lxml.etree import fromstring
import datetime
import dateutil.parser
import logging
... | [
"logging.basicConfig",
"lxml.etree.fromstring"
] | [((388, 428), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (407, 428), False, 'import logging\n'), ((1110, 1125), 'lxml.etree.fromstring', 'fromstring', (['xml'], {}), '(xml)\n', (1120, 1125), False, 'from lxml.etree import fromstring\n')] |
import json
import os
from pathlib import Path
from typing import List, NewType, Optional, Tuple, Union
from starkware.starknet.services.api.contract_definition import ContractDefinition
from starkware.cairo.lang.compiler.constants import MAIN_SCOPE, LIBS_DIR_ENVVAR
from starkware.cairo.lang.cairo_constants import DEF... | [
"starkware.starknet.services.api.contract_definition.ContractDefinition.loads",
"starkware.starknet.compiler.compile.assemble_starknet_contract",
"pathlib.Path",
"starkware.cairo.lang.compiler.cairo_compile.get_module_reader",
"os.getenv",
"starkware.starknet.compiler.starknet_pass_manager.starknet_pass_m... | [((681, 712), 'typing.NewType', 'NewType', (['"""CairoSourceCode"""', 'str'], {}), "('CairoSourceCode', str)\n", (688, 712), False, 'from typing import List, NewType, Optional, Tuple, Union\n'), ((729, 758), 'typing.NewType', 'NewType', (['"""CairoFilename"""', 'str'], {}), "('CairoFilename', str)\n", (736, 758), False... |
import torch
import torch.optim as optim
import torch.nn as nn
from torch.autograd import Variable
from torch.utils.data import DataLoader
from neurotorch.datasets.dataset import AlignedVolume, TorchVolume
import torch.cuda
import numpy as np
class Trainer(object):
"""
Trains a PyTorch neural network with a g... | [
"torch.load",
"neurotorch.datasets.dataset.TorchVolume",
"torch.nn.BCEWithLogitsLoss",
"numpy.random.shuffle",
"torch.autograd.Variable",
"numpy.random.permutation",
"torch.from_numpy",
"torch.no_grad",
"torch.stack",
"numpy.stack",
"torch.cat"
] | [((1583, 1610), 'neurotorch.datasets.dataset.TorchVolume', 'TorchVolume', (['aligned_volume'], {}), '(aligned_volume)\n', (1594, 1610), False, 'from neurotorch.datasets.dataset import AlignedVolume, TorchVolume\n'), ((3123, 3159), 'numpy.random.permutation', 'np.random.permutation', (['valid_indexes'], {}), '(valid_ind... |
#<NAME>
#Weekly task 8
#A program that displays a plot of the functions
#f(x)=x, g(x)=x2 and h(x)=x3 in the range [0, 4] on the one set of axes.
#Type ipython into command line.
#Type %logstart to activate auto-logging.
#When working with plots, import numpy
#numpy provides a data structure when working w... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.title",
"matplotlib.pyplot.legend",
"numpy.arange",
"matplotlib.pyplot.plot"
] | [((763, 787), 'numpy.arange', 'np.arange', (['(0.0)', '(5.0)', '(1.0)'], {}), '(0.0, 5.0, 1.0)\n', (772, 787), True, 'import numpy as np\n'), ((931, 961), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'x', '"""g"""'], {'label': '"""x"""'}), "(x, x, 'g', label='x')\n", (939, 961), True, 'import matplotlib.pyplot as plt\n... |
import logging
from Config import *
from DiscordClient import DiscordClient
logger = logging.getLogger('discord')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(filename='discord.log', encoding='utf-8', mode='w')
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message... | [
"DiscordClient.DiscordClient",
"logging.getLogger",
"logging.FileHandler",
"logging.Formatter"
] | [((90, 118), 'logging.getLogger', 'logging.getLogger', (['"""discord"""'], {}), "('discord')\n", (107, 118), False, 'import logging\n'), ((162, 233), 'logging.FileHandler', 'logging.FileHandler', ([], {'filename': '"""discord.log"""', 'encoding': '"""utf-8"""', 'mode': '"""w"""'}), "(filename='discord.log', encoding='u... |
import os
import shutil
from glob import glob
from logging import getLogger
from os.path import join, basename, isdir, isfile
from typing import Dict, List
import dirsync
from deepmerge.exception import InvalidMerge
from deprecated.classic import deprecated
from orjson import JSONDecodeError
from pydantic import Valid... | [
"app.setup.init_data.init_entries.init_entries",
"app.util.language.get_language_code_from_domain_path",
"os.path.isfile",
"app.util.files.read_orjson",
"app.settings.env_settings",
"os.makedirs",
"glob.glob",
"dirsync.sync",
"app.services.schemas.validate",
"app.setup.init_data.plugin_import.init... | [((1137, 1156), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (1146, 1156), False, 'from logging import getLogger\n'), ((1211, 1249), 'os.path.join', 'join', (['INIT_DOMAINS_FOLDER', 'domain_name'], {}), '(INIT_DOMAINS_FOLDER, domain_name)\n', (1215, 1249), False, 'from os.path import join, base... |
"""Run, agentq, run!
Module for running agentq through a session.
"""
import sys
sys.path.insert(0, '/home/aaron/src/github.com/AAorris/agentq')
import gym
import tensorflow as tf
from agentq import actor, utils
def cartpole():
env = gym.make('CartPole-v1')
state = env.reset()
observations = tf.placeh... | [
"gym.make",
"agentq.utils.run_episode",
"sys.path.insert",
"agentq.actor.create_actor",
"tensorflow.placeholder"
] | [((82, 145), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/home/aaron/src/github.com/AAorris/agentq"""'], {}), "(0, '/home/aaron/src/github.com/AAorris/agentq')\n", (97, 145), False, 'import sys\n'), ((243, 266), 'gym.make', 'gym.make', (['"""CartPole-v1"""'], {}), "('CartPole-v1')\n", (251, 266), False, 'import ... |
from subprocess import CalledProcessError
import os
import re
from vee import log
from vee.cli import style_note, style_warning, style_error, style
from vee.environment import Environment
from vee.exceptions import CliMixin
from vee.git import GitRepo
from vee.manifest import Manifest, Header
from vee.packageset impor... | [
"os.path.join",
"os.path.basename",
"vee.log.warning",
"vee.manifest.Manifest",
"os.path.dirname",
"vee.log.error",
"os.symlink",
"vee.packageset.PackageSet",
"os.path.exists",
"os.path.lexists",
"vee.environment.Environment",
"os.unlink",
"vee.cli.style_note",
"re.split"
] | [((785, 829), 'os.path.join', 'os.path.join', (['self.work_tree', '"""manifest.txt"""'], {}), "(self.work_tree, 'manifest.txt')\n", (797, 829), False, 'import os\n'), ((1211, 1249), 'vee.environment.Environment', 'Environment', ([], {'repo': 'self', 'home': 'self.home'}), '(repo=self, home=self.home)\n', (1222, 1249), ... |
from train import train_and_classify
from utils import split_train_test
from features import zcr_features
GEN_SPLIT_CASE = False
def start_test():
feat = zcr_features('training/training-a/a0001.wav')
# print(feat)
return
def start():
"""
starting function
:return: None
"""
folder =... | [
"train.train_and_classify",
"features.zcr_features",
"utils.split_train_test"
] | [((162, 207), 'features.zcr_features', 'zcr_features', (['"""training/training-a/a0001.wav"""'], {}), "('training/training-a/a0001.wav')\n", (174, 207), False, 'from features import zcr_features\n'), ((418, 462), 'train.train_and_classify', 'train_and_classify', (['folder'], {'all_folders': '(True)'}), '(folder, all_fo... |
#!/usr/bin/env python3
import korali
import sys
import argparse
sys.path.append("_model/")
from model import *
k = korali.Engine()
e = korali.Experiment()
# Parsing arguments
parser = argparse.ArgumentParser(description='Runs the Aphros Fishbone experiment with Korali.')
parser.add_argument('--resultFolder', '-r', he... | [
"sys.path.append",
"argparse.ArgumentParser",
"korali.Experiment",
"korali.Engine"
] | [((64, 90), 'sys.path.append', 'sys.path.append', (['"""_model/"""'], {}), "('_model/')\n", (79, 90), False, 'import sys\n'), ((116, 131), 'korali.Engine', 'korali.Engine', ([], {}), '()\n', (129, 131), False, 'import korali\n'), ((136, 155), 'korali.Experiment', 'korali.Experiment', ([], {}), '()\n', (153, 155), False... |
'''Unit test package for module "tws._OrderState".'''
__copyright__ = "Copyright (c) 2008 <NAME>"
__version__ = "$Id$"
import unittest
from tws import OrderState
class test_OrderState(unittest.TestCase):
'''Test type "tws.OrderState"'''
def test_init(self):
test1 = OrderState()
test2 = Or... | [
"tws.OrderState"
] | [((289, 301), 'tws.OrderState', 'OrderState', ([], {}), '()\n', (299, 301), False, 'from tws import OrderState\n'), ((318, 379), 'tws.OrderState', 'OrderState', (['"""ab"""', '"""cd"""', '"""ef"""', '"""gh"""', '(3.5)', '(4.5)', '(5.5)', '"""ij"""', '"""kl"""'], {}), "('ab', 'cd', 'ef', 'gh', 3.5, 4.5, 5.5, 'ij', 'kl')... |
from Machine import Machine
from typing import Set, Dict
class MachineCluster:
def __init__(self, mach_type: str, stable_state_set: Set[str], time_out: int):
self.time_out = time_out
self.mach_type = mach_type
self.stable_state_set = stable_state_set
self.machine_dict: Dict[int, M... | [
"Machine.Machine"
] | [((726, 791), 'Machine.Machine', 'Machine', (['mach_type', 'mach_id', 'self.stable_state_set', 'self.time_out'], {}), '(mach_type, mach_id, self.stable_state_set, self.time_out)\n', (733, 791), False, 'from Machine import Machine\n')] |
"""
STATUS:OK/NOK
STATUS:OK pymkts can write nanoseconds and query correctly
BUG: when writing with csv_writer on the 1Sec and 1Min timeframe, you can only write microseconds and it will return Nanoseconds. If you write nanoseconds, the nanoseconds will not be parsed and the returned Nanoseconds field will be 0.
MIGRAT... | [
"random.seed",
"subprocess.run",
"pandas.to_datetime",
"pandas.Timedelta",
"pandas.testing.assert_frame_equal",
"pandas.Timestamp",
"pathlib.Path",
"shutil.which",
"pytest.xfail",
"pytest.mark.parametrize",
"os.getenv",
"pandas.read_csv",
"numpy.random.seed",
"pymarketstore.Params",
"tim... | [((889, 1216), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""symbol,timeframe,size,start,window"""', "[('PYW_TEST_01VA', '1Min', 400, '2016-01-01 10:00:00', '5s'), (\n 'PYW_TEST_02VA', '1Min', 800, '2016-01-01 10:00:00', '5s'), (\n 'PYW_TEST_03VA', '1Sec', 400, '2016-01-01 10:00:00', '5s'), (\n '... |
from ..world_object import WorldObject, COLLIDER, TRIGGER
from unittest.mock import Mock
import unittest
class TestWorldObject(unittest.TestCase):
"""Test functionality of the ``WorldObject`` class."""
def test_register_collider(self):
"""Registering a collider creates a new object."""
geomet... | [
"unittest.mock.Mock"
] | [((325, 331), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (329, 331), False, 'from unittest.mock import Mock\n'), ((592, 598), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (596, 598), False, 'from unittest.mock import Mock\n'), ((937, 943), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (941, 943), False, 'from... |
from flask_restx import Model, fields
eventModel = Model(
"Event",
{
"id": fields.String(
description="Event ID - League, Event, and Date of Event Concatenated with Spaces Removed",
readonly=True,
example="TestLeagueCarse2000-01-01",
),
"name": field... | [
"flask_restx.fields.Boolean",
"flask_restx.fields.String"
] | [((93, 260), 'flask_restx.fields.String', 'fields.String', ([], {'description': '"""Event ID - League, Event, and Date of Event Concatenated with Spaces Removed"""', 'readonly': '(True)', 'example': '"""TestLeagueCarse2000-01-01"""'}), "(description=\n 'Event ID - League, Event, and Date of Event Concatenated with S... |
from brownie import AdvancedCollectible, network
from scripts.helpful_scripts import get_camPos
from metadata.sample_metadata import metadata_template
from pathlib import Path
from scripts.upload_to_pinata import upload_to_pinata
import json
# import requests
def main():
advanced_collectible = AdvancedCollectibl... | [
"scripts.upload_to_pinata.upload_to_pinata",
"brownie.network.show_active",
"json.dump",
"pathlib.Path"
] | [((672, 693), 'brownie.network.show_active', 'network.show_active', ([], {}), '()\n', (691, 693), False, 'from brownie import AdvancedCollectible, network\n'), ((791, 815), 'pathlib.Path', 'Path', (['metadata_file_path'], {}), '(metadata_file_path)\n', (795, 815), False, 'from pathlib import Path\n'), ((1603, 1640), 'j... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import datetime
class Migration(migrations.Migration):
dependencies = [
('index', '0003_auto_20170416_2031'),
]
operations = [
migrations.AlterField(
model_name='staticco... | [
"datetime.datetime"
] | [((403, 452), 'datetime.datetime', 'datetime.datetime', (['(2017)', '(4)', '(16)', '(20)', '(32)', '(22)', '(79799)'], {}), '(2017, 4, 16, 20, 32, 22, 79799)\n', (420, 452), False, 'import datetime\n'), ((667, 717), 'datetime.datetime', 'datetime.datetime', (['(2017)', '(4)', '(16)', '(20)', '(32)', '(26)', '(221448)']... |
import inspect
import os
from datetime import date
from itertools import chain
import sphinx_py3doc_enhanced_theme
from docutils import nodes
from docutils.parsers.rst import Directive
from docutils.parsers.rst.directives import unchanged
from docutils.statemachine import ViewList
from pkg_resources import get_distrib... | [
"docutils.nodes.literal",
"datetime.date.today",
"docutils.nodes.paragraph",
"docutils.nodes.colspec",
"pkg_resources.get_distribution",
"inspect.getmembers",
"sphinx.util.docstrings.prepare_docstring",
"docutils.nodes.entry",
"docutils.nodes.tbody",
"docutils.nodes.container",
"inspect.signatur... | [((1286, 1312), 'os.getenv', 'os.getenv', (['"""SSL_CERT_FILE"""'], {}), "('SSL_CERT_FILE')\n", (1295, 1312), False, 'import os\n'), ((536, 560), 'pkg_resources.get_distribution', 'get_distribution', (['"""toxn"""'], {}), "('toxn')\n", (552, 560), False, 'from pkg_resources import get_distribution\n'), ((856, 868), 'da... |
from distutils.core import setup
import glob
bin_files = glob.glob("bin/*.py") + glob.glob("bin/*.txt")
# The main call
setup(name='despyfitsutils',
version='1.0.1',
license="GPL",
description="A set of handy Python fitsfile-related utility functions for DESDM",
author="<NAME>, <NAME>",
... | [
"distutils.core.setup",
"glob.glob"
] | [((122, 459), 'distutils.core.setup', 'setup', ([], {'name': '"""despyfitsutils"""', 'version': '"""1.0.1"""', 'license': '"""GPL"""', 'description': '"""A set of handy Python fitsfile-related utility functions for DESDM"""', 'author': '"""<NAME>, <NAME>"""', 'author_email': '"""<EMAIL>"""', 'packages': "['despyfitsuti... |
import unittest
from os import path
from glob import glob
def sensor_stypes(sensor):
'''
STYPE and lenght infos for each measurement for each sensor type.
'''
kinds = {
"ers_co2": {
0x01: 2,
0x02: 1,
0x04: 2,
0x05: 1,
0x06: 2,
... | [
"os.path.split",
"glob.glob",
"unittest.main"
] | [((3550, 3565), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3563, 3565), False, 'import unittest\n'), ((2932, 2955), 'glob.glob', 'glob', (['"""assets/binary/*"""'], {}), "('assets/binary/*')\n", (2936, 2955), False, 'from glob import glob\n'), ((3129, 3144), 'os.path.split', 'path.split', (['dir'], {}), '(dir... |
from hypothesis import given, note
from hypothesis.strategies import booleans, floats, from_type
import numpy as np
from pysketcher import Angle
from tests.utils import given_inferred
class TestAngle:
@given_inferred
def test_range(self, x: Angle):
assert -np.pi < x
assert x <= np.pi
@gi... | [
"hypothesis.note",
"hypothesis.strategies.booleans",
"hypothesis.strategies.from_type",
"pysketcher.Angle",
"hypothesis.strategies.floats"
] | [((1225, 1232), 'hypothesis.note', 'note', (['c'], {}), '(c)\n', (1229, 1232), False, 'from hypothesis import given, note\n'), ((1029, 1045), 'hypothesis.strategies.from_type', 'from_type', (['Angle'], {}), '(Angle)\n', (1038, 1045), False, 'from hypothesis.strategies import booleans, floats, from_type\n'), ((1047, 109... |
import random
from PIL import Image, ImageFont, ImageDraw, ImageFilter
def get_random_color():
return (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
def validate_picture(length):
msg = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890'
width = 130
... | [
"random.choice",
"PIL.ImageFont.truetype",
"PIL.ImageDraw.Draw",
"random.randint"
] | [((429, 464), 'PIL.ImageFont.truetype', 'ImageFont.truetype', (['"""arial.ttf"""', '(40)'], {}), "('arial.ttf', 40)\n", (447, 464), False, 'from PIL import Image, ImageFont, ImageDraw, ImageFilter\n'), ((498, 516), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['im'], {}), '(im)\n', (512, 516), False, 'from PIL import Image... |
from sys import argv, stderr
from dependencies import Game
class ToManyPlayersError(Exception):
pass
def read_args():
arguments = argv[1:]
try:
players = abs(int(arguments[0]))
if players > 7:
raise ToManyPlayersError
return players
except IndexError:
stde... | [
"dependencies.Game",
"sys.stderr.write"
] | [((561, 584), 'dependencies.Game', 'Game', (['number_of_players'], {}), '(number_of_players)\n', (565, 584), False, 'from dependencies import Game\n'), ((316, 367), 'sys.stderr.write', 'stderr.write', (['"""python3 main.py NUMBER_OF_PLAYERS\n"""'], {}), "('python3 main.py NUMBER_OF_PLAYERS\\n')\n", (328, 367), False, '... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.