code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from __future__ import absolute_import
from django.test import TestCase
from django.contrib.auth.models import User
from django.core.files import File
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db import IntegrityError
from datetime import date
from .models import Event, Talk, Slide, Link... | [
"django.contrib.auth.models.User.objects.get_or_create",
"django.core.files.uploadedfile.SimpleUploadedFile",
"datetime.date"
] | [((533, 575), 'django.contrib.auth.models.User.objects.get_or_create', 'User.objects.get_or_create', ([], {'username': '"""foo"""'}), "(username='foo')\n", (559, 575), False, 'from django.contrib.auth.models import User\n'), ((2533, 2575), 'django.contrib.auth.models.User.objects.get_or_create', 'User.objects.get_or_cr... |
# Generated by Django 3.1.4 on 2021-01-03 04:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='HabixUser',
fields=[
... | [
"django.db.models.OneToOneField",
"django.db.models.DateField",
"django.db.models.IntegerField",
"django.db.models.BigIntegerField",
"django.db.models.PositiveIntegerField",
"django.db.models.CharField"
] | [((340, 412), 'django.db.models.BigIntegerField', 'models.BigIntegerField', ([], {'max_length': '(20)', 'primary_key': '(True)', 'serialize': '(False)'}), '(max_length=20, primary_key=True, serialize=False)\n', (362, 412), False, 'from django.db import migrations, models\n'), ((444, 490), 'django.db.models.IntegerField... |
"""
Class for starting and stopping named timers.
This class is based on a similar java class in cyberaide, and java cog kit.
"""
import time
class StopWatch(object):
"""
A class to measure times between events.
"""
# Timer start dict
timer_start = {}
# Timer end dict
timer_end = {}
... | [
"time.time"
] | [((659, 670), 'time.time', 'time.time', ([], {}), '()\n', (668, 670), False, 'import time\n'), ((882, 893), 'time.time', 'time.time', ([], {}), '()\n', (891, 893), False, 'import time\n')] |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
DATABASE_URI = os.environ.get('DATABASE_URI') or 'sqlite:///' + os.path.join(basedir, 'data-dev.sqlite')
SMTP_ADDRESS = os.environ.get('EMAIL_SMTP_ADDRESS') or 'localhost'
SMTP_USERNAME = os.environ.get('SMTP_USERNAME') or ''
... | [
"os.path.join",
"os.path.dirname",
"os.environ.get"
] | [((36, 61), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (51, 61), False, 'import os\n'), ((98, 128), 'os.environ.get', 'os.environ.get', (['"""DATABASE_URI"""'], {}), "('DATABASE_URI')\n", (112, 128), False, 'import os\n'), ((207, 243), 'os.environ.get', 'os.environ.get', (['"""EMAIL_SMTP_... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 18 14:42:02 2020
@author: figueroa
"""
import sys
import numpy as np
import warnings
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import RBF, WhiteKernel, ConstantKernel as C
from scipy import l... | [
"scipy.linalg.cholesky",
"numpy.array",
"sklearn.gaussian_process.kernels.WhiteKernel",
"numpy.save",
"numpy.arange",
"sklearn.gaussian_process.GaussianProcessRegressor",
"scipy.linalg.cho_solve",
"numpy.mean",
"sklearn.gaussian_process.kernels.ConstantKernel",
"numpy.max",
"numpy.exp",
"numpy... | [((453, 469), 'numpy.random.seed', 'np.random.seed', ([], {}), '()\n', (467, 469), True, 'import numpy as np\n'), ((470, 503), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (493, 503), False, 'import warnings\n'), ((1289, 1376), 'sklearn.gaussian_process.GaussianProcessRe... |
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import json
import os
from sheetsite.site_queue import app
import smtplib
@app.task
def notify_one(email, subject, page, text):
print("send [%s] / %s / %s" % (email, subject, page))
server_ssl = smtplib.SMTP_SSL("smtp.gmail.... | [
"premailer.transform",
"smtplib.SMTP_SSL",
"os.path.join",
"daff.DiffRender",
"email.mime.multipart.MIMEMultipart",
"jinja2.PackageLoader",
"email.mime.text.MIMEText"
] | [((291, 330), 'smtplib.SMTP_SSL', 'smtplib.SMTP_SSL', (['"""smtp.gmail.com"""', '(465)'], {}), "('smtp.gmail.com', 465)\n", (307, 330), False, 'import smtplib\n'), ((488, 516), 'email.mime.multipart.MIMEMultipart', 'MIMEMultipart', (['"""alternative"""'], {}), "('alternative')\n", (501, 516), False, 'from email.mime.mu... |
import cv2
cap = cv2.VideoCapture("max_heli.mp4")
# tracker = cv2.TrackerMOSSE_create()
tracker = cv2.TrackerCSRT_create()
success,img = cap.read()
bbox = cv2.selectROI("Tracking",img,False)
tracker.init(img,bbox)
def drawBox(img,bbox):
x ,y ,w ,h = int(bbox[0]),int(bbox[1]),int(bbox[2]),int(bbox[3])
cv2.rec... | [
"cv2.rectangle",
"cv2.putText",
"cv2.imshow",
"cv2.waitKey",
"cv2.getTickCount",
"cv2.VideoCapture",
"cv2.selectROI",
"cv2.getTickFrequency",
"cv2.TrackerCSRT_create"
] | [((18, 50), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""max_heli.mp4"""'], {}), "('max_heli.mp4')\n", (34, 50), False, 'import cv2\n'), ((100, 124), 'cv2.TrackerCSRT_create', 'cv2.TrackerCSRT_create', ([], {}), '()\n', (122, 124), False, 'import cv2\n'), ((157, 194), 'cv2.selectROI', 'cv2.selectROI', (['"""Tracking""... |
from netqasm.lang.encoding import COMMAND_BYTES, COMMANDS
from netqasm.lang.parsing import parse_text_subroutine
def test_command_length():
for command_class in COMMANDS:
length = len(bytes(command_class()))
print(f"{command_class.__name__}: {len(bytes(command_class()))}")
assert length ==... | [
"netqasm.lang.parsing.parse_text_subroutine"
] | [((874, 907), 'netqasm.lang.parsing.parse_text_subroutine', 'parse_text_subroutine', (['subroutine'], {}), '(subroutine)\n', (895, 907), False, 'from netqasm.lang.parsing import parse_text_subroutine\n'), ((1494, 1527), 'netqasm.lang.parsing.parse_text_subroutine', 'parse_text_subroutine', (['subroutine'], {}), '(subro... |
# a = 'a b c'
# # print(a.strip())
# print(a)
# # print(a.strip())
# print(a.split(' '))
import re
word = '--?' # note2
p = re.compile(r'\w+')
word = p.findall(word) # ['grandfather']
print(word)
print(word[0])
print(word[0].lower())
# # list index out of range数组越界
# a = [1,2,3,4]
# print(a[4]) | [
"re.compile"
] | [((126, 144), 're.compile', 're.compile', (['"""\\\\w+"""'], {}), "('\\\\w+')\n", (136, 144), False, 'import re\n')] |
'''This module manages the auxiliary vertical lines'''
from __future__ import absolute_import
from PyQt5 import QtWidgets as qtw
from PyQt5 import QtCore as qtc
from PyQt5 import QtGui as qtg
from ..design.auxVlines_design import Ui_MainWindow
from .aux_line import AuxLine
from ..validators import NumValidator... | [
"PyQt5.QtCore.pyqtSignal",
"PyQt5.QtGui.QIcon",
"PyQt5.QtWidgets.QDoubleSpinBox",
"PyQt5.QtWidgets.QComboBox",
"PyQt5.QtGui.QColor",
"PyQt5.QtCore.pyqtSlot",
"PyQt5.QtWidgets.QTreeWidgetItem",
"PyQt5.QtWidgets.QColorDialog.getColor",
"PyQt5.QtGui.QPixmap",
"PyQt5.QtWidgets.QLineEdit"
] | [((387, 403), 'PyQt5.QtCore.pyqtSignal', 'qtc.pyqtSignal', ([], {}), '()\n', (401, 403), True, 'from PyQt5 import QtCore as qtc\n'), ((8621, 8659), 'PyQt5.QtCore.pyqtSlot', 'qtc.pyqtSlot', (['qtw.QTreeWidgetItem', 'int'], {}), '(qtw.QTreeWidgetItem, int)\n', (8633, 8659), True, 'from PyQt5 import QtCore as qtc\n'), ((9... |
from unittest.mock import Mock
from irrd.utils.test_utils import flatten_mock_calls
from ..submit_email import run
def test_submit_email_success(capsys, monkeypatch):
mock_handle_email = Mock()
monkeypatch.setattr('irrd.scripts.submit_email.handle_email_submission', lambda data: mock_handle_email)
mock_h... | [
"irrd.utils.test_utils.flatten_mock_calls",
"unittest.mock.Mock"
] | [((194, 200), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (198, 200), False, 'from unittest.mock import Mock\n'), ((393, 399), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (397, 399), False, 'from unittest.mock import Mock\n'), ((889, 895), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (893, 895), False, 'from... |
# -*- coding: utf-8 -*-
# @Author: ifredom
# @Date: 2017-07-11 11:06:56
# @Last Modified time: 2017-07-11 12:08:31
import requests
url = "http://www.baidu.com"
def getHtmlText(url):
r = requests.get(url)
r.encoding = r.apparent_encoding
return r.text
text = getHtmlText(url)
print(text)
| [
"requests.get"
] | [((194, 211), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (206, 211), False, 'import requests\n')] |
# Implementation based on tf.keras.callbacks.py and tf.keras.utils.generic_utils.py
# https://github.com/tensorflow/tensorflow/blob/2b96f3662bd776e277f86997659e61046b56c315/tensorflow/python/keras/callbacks.py
# https://github.com/tensorflow/tensorflow/blob/2b96f3662bd776e277f86997659e61046b56c315/tensorflow/python/ker... | [
"numpy.ceil",
"numpy.log10",
"numpy.floor",
"copy.copy",
"sys.stdout.isatty",
"sys.stdout.flush",
"time.time",
"sys.stdout.write"
] | [((6671, 6682), 'time.time', 'time.time', ([], {}), '()\n', (6680, 6682), False, 'import time\n'), ((8688, 8699), 'time.time', 'time.time', ([], {}), '()\n', (8697, 8699), False, 'import time\n'), ((12602, 12613), 'time.time', 'time.time', ([], {}), '()\n', (12611, 12613), False, 'import time\n'), ((4286, 4301), 'copy.... |
import serial
import math
from usefulFuncs import *
import numpy as np
import time
###
class IMUArduino:
def __init__(self):
self.ser = serial.Serial(port='/dev/ttyACM0', baudrate = 115200)
self.bias =[-19.575, 16.65]
self.scale = [0.963556851, 1.039308176]
# N, W, S_H, S_L, E
... | [
"serial.Serial",
"math.atan2",
"time.time"
] | [((150, 201), 'serial.Serial', 'serial.Serial', ([], {'port': '"""/dev/ttyACM0"""', 'baudrate': '(115200)'}), "(port='/dev/ttyACM0', baudrate=115200)\n", (163, 201), False, 'import serial\n'), ((823, 834), 'time.time', 'time.time', ([], {}), '()\n', (832, 834), False, 'import time\n'), ((3159, 3170), 'time.time', 'time... |
from __future__ import absolute_import
import json
from six import string_types
from jet_bridge_base.fields.field import Field
class JSONField(Field):
field_error_messages = {
'invalid': 'not a valid JSON'
}
def to_internal_value_item(self, value):
if isinstance(value, string_types):
... | [
"json.loads"
] | [((358, 375), 'json.loads', 'json.loads', (['value'], {}), '(value)\n', (368, 375), False, 'import json\n')] |
def print_something():
print('something')
def get_git_hash(filepath):
import subprocess
return subprocess.check_output(["git", "rev-list", "-1", "--abbrev-commit", "HEAD", filepath]).strip()
| [
"subprocess.check_output"
] | [((102, 193), 'subprocess.check_output', 'subprocess.check_output', (["['git', 'rev-list', '-1', '--abbrev-commit', 'HEAD', filepath]"], {}), "(['git', 'rev-list', '-1', '--abbrev-commit', 'HEAD',\n filepath])\n", (125, 193), False, 'import subprocess\n')] |
#!/usr/bin/python
'''
Distance calculation substitute for cosmolopy
All formula used are from
https://arxiv.org/pdf/astro-ph/9905116.pdf
'''
import numpy as np
from scipy.integrate import quad
class cosmo_distance(object):
def __init__(self, **cosmology):
'''
To initiate, cosmological parameters ... | [
"numpy.abs",
"numpy.size",
"numpy.sqrt",
"numpy.atleast_1d"
] | [((1724, 1801), 'numpy.sqrt', 'np.sqrt', (['(self.om0 * (1.0 + z) ** 3.0 + self.ok0 * (1.0 + z) ** 2.0 + self.ode)'], {}), '(self.om0 * (1.0 + z) ** 3.0 + self.ok0 * (1.0 + z) ** 2.0 + self.ode)\n', (1731, 1801), True, 'import numpy as np\n'), ((2304, 2320), 'numpy.atleast_1d', 'np.atleast_1d', (['z'], {}), '(z)\n', (2... |
import numpy as np
import argparse
import logging
import time
SUFFIX = '_shuffle.txt'
def load_input(filename):
t = time.time()
with open(filename) as f:
data = f.readlines()
logging.info('load %d lines in %.4f s', len(data), time.time() - t)
t = time.time()
np.random.shuffle(data)
lo... | [
"logging.basicConfig",
"time.time",
"argparse.ArgumentParser",
"numpy.random.shuffle"
] | [((123, 134), 'time.time', 'time.time', ([], {}), '()\n', (132, 134), False, 'import time\n'), ((274, 285), 'time.time', 'time.time', ([], {}), '()\n', (283, 285), False, 'import time\n'), ((290, 313), 'numpy.random.shuffle', 'np.random.shuffle', (['data'], {}), '(data)\n', (307, 313), True, 'import numpy as np\n'), ((... |
from __future__ import division
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import time
import nupic
from nupic.encoders import RandomDistributedScalarEncoder
from nupic.encoders.date import DateEncoder
from nupic.algorithms.spatial_pooler import SpatialPooler
from nupic.algorithms.temporal... | [
"numpy.concatenate"
] | [((835, 861), 'numpy.concatenate', 'np.concatenate', (['[res, enc]'], {}), '([res, enc])\n', (849, 861), True, 'import numpy as np\n')] |
from collections import OrderedDict
from ConvRNN import CLSTM_cell
# build model
# in_channels=v[0], out_channels=v[1], kernel_size=v[2], stride=v[3], padding=v[4]
convlstm_encoder_params_large = [
[
OrderedDict({'conv1_leaky_1': [5, 64, 3, 1, 1]}),
OrderedDict({'conv2_leaky_1': [128, 128, 3, 2, 1... | [
"collections.OrderedDict",
"ConvRNN.CLSTM_cell"
] | [((214, 262), 'collections.OrderedDict', 'OrderedDict', (["{'conv1_leaky_1': [5, 64, 3, 1, 1]}"], {}), "({'conv1_leaky_1': [5, 64, 3, 1, 1]})\n", (225, 262), False, 'from collections import OrderedDict\n'), ((272, 323), 'collections.OrderedDict', 'OrderedDict', (["{'conv2_leaky_1': [128, 128, 3, 2, 1]}"], {}), "({'conv... |
import xlrd
import functools
from django import forms
from django.core.exceptions import ValidationError
from django.template.loader import render_to_string
from .base import (BasePriceList, hourly_rates_only_validator,
min_price_validator)
from .spreadsheet_utils import generate_column_index_map, ... | [
"django.forms.CharField",
"django.core.exceptions.ValidationError",
"django.forms.IntegerField",
"functools.partial",
"django.template.loader.render_to_string",
"django.forms.DecimalField"
] | [((3413, 3453), 'django.forms.CharField', 'forms.CharField', ([], {'label': '"""SIN(s) Proposed"""'}), "(label='SIN(s) Proposed')\n", (3428, 3453), False, 'from django import forms\n'), ((3475, 3538), 'django.forms.CharField', 'forms.CharField', ([], {'label': '"""SERVICE PROPOSED (e.g. Job Title/Task)"""'}), "(label='... |
import pathlib
from click.testing import CliRunner
from desist.cli.container import create, run
# FIXME: make these parametric over `[Docker, Singularity]`
def test_container_create(tmpdir):
runner = CliRunner()
path = pathlib.Path(tmpdir)
with runner.isolated_filesystem():
result = runner.invok... | [
"click.testing.CliRunner",
"pathlib.Path"
] | [((208, 219), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (217, 219), False, 'from click.testing import CliRunner\n'), ((231, 251), 'pathlib.Path', 'pathlib.Path', (['tmpdir'], {}), '(tmpdir)\n', (243, 251), False, 'import pathlib\n'), ((538, 549), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n',... |
import requests
import json
from stream import Stream
game_to_id = {}
def prepare_game_id_cache(games):
for game in games:
if game in game_to_id:
continue
payload = {
'q': game,
'liveonly': True
}
r = requests.get('https://www.h... | [
"requests.get",
"stream.Stream"
] | [((293, 356), 'requests.get', 'requests.get', (['"""https://www.hitbox.tv/api/games"""'], {'params': 'payload'}), "('https://www.hitbox.tv/api/games', params=payload)\n", (305, 356), False, 'import requests\n'), ((1014, 1086), 'requests.get', 'requests.get', (['"""https://www.hitbox.tv/api/media/live/list"""'], {'param... |
""" Navigation Tree for docnado
python -m doctest .\navtree.py
"""
import re
def parse_nav_string(nav):
""" Parse a nav string and pull out the `name` and `weight` of each nav item.
>>> parse_nav_string('Foo>Bar>Baz')
[('Foo', 0), ('Bar', 0), ('Baz', 0)]
>>> parse_nav_string('Foo __99__>Bar>Baz')
... | [
"re.search"
] | [((618, 646), 're.search', 're.search', (['NAV_PARSER', 'chunk'], {}), '(NAV_PARSER, chunk)\n', (627, 646), False, 'import re\n')] |
import requests
import json
import csv
import os
import LastRead
def api_call(payload):
auth = requests.post("https://api.mangadex.org/auth/login", json=payload)
token = auth.json()["token"]["session"]
bearer = {"Authorization": f"Bearer {token}"}
offset = 0
follow_list = []
initial = {"limit"... | [
"LastRead.lastread",
"requests.post",
"csv.writer",
"requests.get",
"os.getcwd"
] | [((101, 167), 'requests.post', 'requests.post', (['"""https://api.mangadex.org/auth/login"""'], {'json': 'payload'}), "('https://api.mangadex.org/auth/login', json=payload)\n", (114, 167), False, 'import requests\n'), ((2053, 2079), 'LastRead.lastread', 'LastRead.lastread', (['payload'], {}), '(payload)\n', (2070, 2079... |
import sys
import pandas as pd
# Auto-detect terminal width.
pd.options.display.width = None
pd.options.display.max_rows = 500000
pd.options.display.max_colwidth = 200
if len(sys.argv) < 2:
print("Usage: python dump.py <DataFrame file> [List of Event Types]")
sys.exit()
file = sys.argv[1]
df = pd.read_pick... | [
"pandas.read_pickle",
"sys.exit"
] | [((308, 347), 'pandas.read_pickle', 'pd.read_pickle', (['file'], {'compression': '"""bz2"""'}), "(file, compression='bz2')\n", (322, 347), True, 'import pandas as pd\n'), ((271, 281), 'sys.exit', 'sys.exit', ([], {}), '()\n', (279, 281), False, 'import sys\n')] |
#!/usr/bin/env python
'''
Optimize the geometry of excited states using CASSCF or CASCI
Note when optiming the excited states, states may flip and this may cause
convergence issue in geometry optimizer.
'''
from pyscf import gto
from pyscf import scf, mcscf
mol = gto.Mole()
mol.atom="N; N 1, 1.1"
mol.basis= "6-31g"... | [
"pyscf.gto.Mole",
"pyscf.mcscf.CASSCF",
"pyscf.mcscf.CASCI",
"pyscf.scf.RHF",
"copy.copy",
"pyscf.mcscf.addons.state_average_mix_"
] | [((268, 278), 'pyscf.gto.Mole', 'gto.Mole', ([], {}), '()\n', (276, 278), False, 'from pyscf import gto\n'), ((451, 472), 'pyscf.mcscf.CASCI', 'mcscf.CASCI', (['mf', '(4)', '(4)'], {}), '(mf, 4, 4)\n', (462, 472), False, 'from pyscf import scf, mcscf\n'), ((620, 641), 'pyscf.mcscf.CASCI', 'mcscf.CASCI', (['mf', '(4)', ... |
import os
import argparse
import torch
import random
import numpy as np
from shutil import copyfile
from src.config import Config
from src.grad_match import GradientMatch, GradientMatch2
from src.create_data_list import create_data_list
def load_config(mode = None):
parser = argparse.ArgumentParser()
parser.ad... | [
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"os.path.exists",
"src.grad_match.GradientMatch",
"src.create_data_list.create_data_list",
"argparse.ArgumentParser",
"os.makedirs",
"src.config.Config",
"os.path.join",
"random.seed",
"shutil.copyfile",
"torch.cuda.is_available",
"numpy.ran... | [((281, 306), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (304, 306), False, 'import argparse\n'), ((927, 1026), 'src.create_data_list.create_data_list', 'create_data_list', (['args.train_img_path', 'args.test_img_path', 'args.eval_img_path', '"""./list_folder"""'], {}), "(args.train_img_pat... |
# !/usr/env/python
# Simple script to generate libpsl.pc from libpsl.pc.in
# for Visual Studio builds
import sys
import argparse
from replace import replace_multi
from pc_base import BasePCItems
def main(argv):
parser = argparse.ArgumentParser(description='Setup basic libpsl.pc file info')
parser... | [
"pc_base.BasePCItems",
"replace.replace_multi",
"argparse.ArgumentParser"
] | [((238, 308), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Setup basic libpsl.pc file info"""'}), "(description='Setup basic libpsl.pc file info')\n", (261, 308), False, 'import argparse\n'), ((479, 492), 'pc_base.BasePCItems', 'BasePCItems', ([], {}), '()\n', (490, 492), False, 'from ... |
from compas.geometry import Frame
from compas_fab.backends import RosClient
from compas_fab.robots import Configuration
import math
group = "robot11_eaXYZ"
frame_WCF = Frame([19.823254, 6.008556, 0.922020],
[-1.0, 0.0, 0.0],
[0.0, 1.0, 0.0])
frame_WCF_mm = Frame([19823.254, 6008.5... | [
"compas_fab.robots.Configuration",
"compas.geometry.Frame",
"compas_fab.backends.RosClient",
"math.radians"
] | [((170, 242), 'compas.geometry.Frame', 'Frame', (['[19.823254, 6.008556, 0.92202]', '[-1.0, 0.0, 0.0]', '[0.0, 1.0, 0.0]'], {}), '([19.823254, 6.008556, 0.92202], [-1.0, 0.0, 0.0], [0.0, 1.0, 0.0])\n', (175, 242), False, 'from compas.geometry import Frame\n'), ((296, 367), 'compas.geometry.Frame', 'Frame', (['[19823.25... |
import struct
import logging
from twisted.protocols.basic import IntNStringReceiver
from byte_buffer import ByteBuffer
from utility import DataConstants
__author__ = 'pryormic'
logger = logging.getLogger(__name__)
# TCP connection of client.
# Expects incoming packets to be prefixed with size of subsequent data.
# P... | [
"logging.getLogger",
"struct.calcsize",
"byte_buffer.ByteBuffer.buildFromIterable"
] | [((188, 215), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (205, 215), False, 'import logging\n'), ((533, 562), 'struct.calcsize', 'struct.calcsize', (['structFormat'], {}), '(structFormat)\n', (548, 562), False, 'import struct\n'), ((1415, 1449), 'byte_buffer.ByteBuffer.buildFromIterab... |
from Game.StartGame import chess
from Utilities.ConsleControl import clearScreen
from Utilities.PrintChess import printChess
def GetStep():
x = -1
y = -1
try:
x = int(input("请输入你想下棋的行数:"))
y = int(input("请输入你想下棋的列数:"))
global temp
temp = chess[x - 1][y - 1]
... | [
"Utilities.PrintChess.printChess",
"Utilities.ConsleControl.clearScreen"
] | [((527, 540), 'Utilities.ConsleControl.clearScreen', 'clearScreen', ([], {}), '()\n', (538, 540), False, 'from Utilities.ConsleControl import clearScreen\n'), ((550, 567), 'Utilities.PrintChess.printChess', 'printChess', (['chess'], {}), '(chess)\n', (560, 567), False, 'from Utilities.PrintChess import printChess\n'), ... |
"""
batch notifications
"""
import glob
import time
from omegaconf import OmegaConf
from plyer import notification
import time
title = "Time to relax your EYES"
message = "Relax your eyes"
app_name = "Opticcca"
timeout = 2
ticker = "Notification ticker"
app_icon = r"../statics/Icons/eyes/eyes_on_fire.ico"
toast = Fals... | [
"plyer.notification.notify",
"time.sleep"
] | [((343, 356), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (353, 356), False, 'import time\n'), ((374, 493), 'plyer.notification.notify', 'notification.notify', ([], {'title': 'title', 'message': 'message', 'app_icon': 'app_icon', 'app_name': 'app_name', 'ticker': 'ticker', 'toast': 'toast'}), '(title=title, mes... |
import sys
import warnings
from fractions import Fraction
from attr import attrs, attrib, Factory
import lxml.etree
from lxml.etree import QName
from lxml.builder import ElementMaker
from six import viewkeys, iteritems, reraise
from .adm import ADM
from .elements import (
AudioBlockFormatObjects, AudioBlockFormat... | [
"attr.attrs",
"six.viewkeys",
"fractions.Fraction",
"attr.attrib",
"sys.exc_info",
"attr.Factory",
"lxml.etree.QName",
"six.iteritems",
"lxml.builder.ElementMaker"
] | [((2289, 2305), 'attr.attrs', 'attrs', ([], {'cmp': '(False)'}), '(cmp=False)\n', (2294, 2305), False, 'from attr import attrs, attrib, Factory\n'), ((2427, 2435), 'attr.attrib', 'attrib', ([], {}), '()\n', (2433, 2435), False, 'from attr import attrs, attrib, Factory\n'), ((2450, 2458), 'attr.attrib', 'attrib', ([], {... |
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
from helpers import fetch_page
from operators import BaseCheck
from bs4 import BeautifulSoup
class CheckCoolblue(BaseCheck):
"""Check the Coolblue stock."""
@apply_defaults
def __init__(self, link: str, descript... | [
"bs4.BeautifulSoup"
] | [((923, 957), 'bs4.BeautifulSoup', 'BeautifulSoup', (['page', '"""html.parser"""'], {}), "(page, 'html.parser')\n", (936, 957), False, 'from bs4 import BeautifulSoup\n')] |
import pymongo
def data_seve(mydict):
myclient = pymongo.MongoClient("mongodb://localhost:27017/")
mydb = myclient["cralwer"]
mycol = mydb["data"]
for m in mydict:
if m in mycol.find():
pass
else:
x = mycol.insert_one(m)
def data_get():
... | [
"pymongo.MongoClient"
] | [((57, 106), 'pymongo.MongoClient', 'pymongo.MongoClient', (['"""mongodb://localhost:27017/"""'], {}), "('mongodb://localhost:27017/')\n", (76, 106), False, 'import pymongo\n'), ((331, 380), 'pymongo.MongoClient', 'pymongo.MongoClient', (['"""mongodb://localhost:27017/"""'], {}), "('mongodb://localhost:27017/')\n", (35... |
"""
Copyright Declaration (C)
From: https://github.com/leeykang/
Use and modification of information, comment(s) or code provided in this document
is granted if and only if this copyright declaration, located between lines 1 to
9 of this document, is preserved at the top of any document where such
information, co... | [
"numpy.ones_like",
"scipy.stats.poisson.pmf",
"numpy.abs",
"os.path.join",
"matplotlib.pyplot.close",
"scipy.stats.poisson.cdf",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.array_equal",
"multiprocessing.Pool",
"copy.deepcopy",
"os.path.abspath",
"numpy.maximum",
"numpy.zeros_like",
... | [((4138, 4193), 'numpy.zeros', 'np.zeros', (['(self.num_locations, self.num_locations)', 'int'], {}), '((self.num_locations, self.num_locations), int)\n', (4146, 4193), True, 'import numpy as np\n'), ((4227, 4282), 'numpy.zeros', 'np.zeros', (['(self.num_locations, self.num_locations)', 'int'], {}), '((self.num_locatio... |
# -*- coding: utf-8 -*-
# Author: <NAME> <<EMAIL>>
import pickle
import os
import pytest
import numpy as np
from renormalizer.model import MolList, MolList2, ModelTranslator, Mol, Phonon
from renormalizer.mps import Mpo, Mps
from renormalizer.tests.parameter import mol_list, ph_phys_dim, omega_quantities
from renorm... | [
"renormalizer.tests.parameter_PBI.construct_mol",
"renormalizer.mps.Mps.random",
"renormalizer.tests.parameter.mol_list.switch_scheme",
"renormalizer.mps.Mpo",
"numpy.array",
"renormalizer.mps.Mpo.exact_propagator",
"renormalizer.mps.Mps.gs",
"renormalizer.mps.Mpo.onsite",
"numpy.linalg.eigh",
"nu... | [((398, 477), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dt, space, shift"""', "([30, 'GS', 0.0], [30, 'EX', 0.0])"], {}), "('dt, space, shift', ([30, 'GS', 0.0], [30, 'EX', 0.0]))\n", (421, 477), False, 'import pytest\n'), ((777, 824), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""scheme... |
# @<NAME>, SRA 2019
# This Foolbox module has been modified to reflect our "augmented"
# projection algorithm
# Please replace the "iterative_projected_gradient.py" file under
# foolbox Python library directory
from __future__ import division
import numpy as np
from abc import abstractmethod
import logging
import warn... | [
"numpy.clip",
"logging.getLogger",
"pandas.read_csv",
"numpy.array",
"os.listdir",
"matplotlib.pyplot.plot",
"warnings.warn",
"numpy.abs",
"logging.warning",
"numpy.square",
"os.path.isfile",
"numpy.sign",
"matplotlib.pyplot.show",
"numpy.copy",
"math.ceil",
"urllib.parse.urlparse",
... | [((1187, 1204), 'os.getenv', 'os.getenv', (['"""HOME"""'], {}), "('HOME')\n", (1196, 1204), False, 'import os\n'), ((2244, 2277), 'os.listdir', 'os.listdir', (['self.BASE_CRAWLED_DIR'], {}), '(self.BASE_CRAWLED_DIR)\n', (2254, 2277), False, 'import os\n'), ((4304, 4339), 'scipy.spatial.distance.cdist', 'distance.cdist'... |
# !/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) 2012-2015 <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 rig... | [
"pycast.common.timeseries.TimeSeries"
] | [((4097, 4109), 'pycast.common.timeseries.TimeSeries', 'TimeSeries', ([], {}), '()\n', (4107, 4109), False, 'from pycast.common.timeseries import TimeSeries\n')] |
# 2-external/library.py
from subprocess import Popen, PIPE
import sys
# getInfo processes the request/response and returns info
def getInfo(content, isRequest, helpers):
if isRequest:
return helpers.analyzeRequest(content)
else:
return helpers.analyzeResponse(content)
# getBody re... | [
"subprocess.Popen",
"sys.stdout.write"
] | [((1282, 1345), 'subprocess.Popen', 'Popen', (["['python', script, arg1, arg2]"], {'stdout': 'PIPE', 'stderr': 'PIPE'}), "(['python', script, arg1, arg2], stdout=PIPE, stderr=PIPE)\n", (1287, 1345), False, 'from subprocess import Popen, PIPE\n'), ((1464, 1485), 'sys.stdout.write', 'sys.stdout.write', (['err'], {}), '(e... |
'''
Tests for API Utilities. These are codes shared with other
files in core.
'''
from scisheets.core import helpers_test as ht
import mysite.settings as settings
from CommonUtil.util import stripFileExtension
from scisheets.core.helpers_test import TEST_DIR
import api_util as api_util
from extended_array import Exte... | [
"api_util.copyTableToFile",
"os.path.exists",
"api_util.readObjectFromFile",
"os.path.join",
"CommonUtil.util.stripFileExtension",
"numpy.array",
"api_util.writeObjectToFile",
"scisheets.core.helpers_test.createTable",
"unittest.main",
"scisheets.core.helpers_test.setupTableInitialization",
"api... | [((2638, 2653), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2651, 2653), False, 'import unittest\n'), ((718, 751), 'scisheets.core.helpers_test.setupTableInitialization', 'ht.setupTableInitialization', (['self'], {}), '(self)\n', (745, 751), True, 'from scisheets.core import helpers_test as ht\n'), ((877, 897)... |
"""Provide XBlock urls"""
from django.conf.urls import url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from workbench import views
admin.autodiscover()
urlpatterns = [
url(r'^$', views.index, name='workbench_index'),
url(
r'^scenario/(?P<sce... | [
"django.contrib.staticfiles.urls.staticfiles_urlpatterns",
"django.conf.urls.url",
"django.contrib.admin.autodiscover"
] | [((193, 213), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (211, 213), False, 'from django.contrib import admin\n'), ((1769, 1794), 'django.contrib.staticfiles.urls.staticfiles_urlpatterns', 'staticfiles_urlpatterns', ([], {}), '()\n', (1792, 1794), False, 'from django.contrib.staticfile... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-06-05 06:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("statistics", "0010_existing_case_timings_count")]
operations = [
migrations.AlterField(m... | [
"django.db.models.BigIntegerField"
] | [((377, 401), 'django.db.models.BigIntegerField', 'models.BigIntegerField', ([], {}), '()\n', (399, 401), False, 'from django.db import migrations, models\n')] |
import pandas as pd
import os
import numpy as np
from matplotlib import pyplot as plt
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from model import LSTM
from prepare_data import Data, Dataset
stock = "MC.PA"
input_size = 4
output_size = 1
nb_neurons = 200
learning_rate = 0.001
nb_epoc... | [
"numpy.mean",
"os.listdir",
"model.LSTM",
"torch.load",
"prepare_data.Data",
"os.path.join",
"matplotlib.pyplot.plot",
"torch.nn.MSELoss",
"torch.no_grad",
"torch.zeros",
"torch.utils.data.DataLoader",
"prepare_data.Dataset",
"matplotlib.pyplot.title",
"torch.FloatTensor",
"matplotlib.py... | [((905, 917), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (915, 917), True, 'import torch.nn as nn\n'), ((1919, 1935), 'prepare_data.Data', 'Data', (['self.stock'], {}), '(self.stock)\n', (1923, 1935), False, 'from prepare_data import Data, Dataset\n'), ((2332, 2373), 'prepare_data.Dataset', 'Dataset', (['train... |
"""
@author: <NAME>
"""
# REFERENCES:
# https://pymotw.com/2/asynchat/
# tuple unpacking https://stackoverflow.com/questions/1993727/expanding-tuples-into-arguments
# https://pymotw.com/2/asyncore/
import asyncore
import logging
import socket
import threading #would multiprocessing be better?
import time
packet_... | [
"__main__.qt.QTcpSocket",
"threading.current_thread",
"asyncore.dispatcher.__init__",
"asyncore.loop",
"time.sleep",
"threading.Thread"
] | [((10093, 10107), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (10103, 10107), False, 'import time\n'), ((10177, 10191), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (10187, 10191), False, 'import time\n'), ((3657, 3683), 'threading.current_thread', 'threading.current_thread', ([], {}), '()\n', (3681,... |
#!/usr/bin/python
#coding=utf-8
from cStringIO import StringIO
class StringBuilder:
_file_str = None
def __init__(self):
self._file_str = StringIO()
def append(self, str):
self._file_str.write(str)
def __str__(self):
return self._file_str.getvalue() | [
"cStringIO.StringIO"
] | [((169, 179), 'cStringIO.StringIO', 'StringIO', ([], {}), '()\n', (177, 179), False, 'from cStringIO import StringIO\n')] |
import os
import numpy as np
import holoviews as hv
import pandas as pd
import logging
from bokeh.models import HoverTool
import holoviews as hv
import datashader as ds
from holoviews.operation.datashader import aggregate, datashade, dynspread
import colorcet as cc
import param
import parambokeh
from lsst.pipe.ta... | [
"datashader.mean",
"param.ObjectSelector",
"lsst.pipe.tasks.functors.PsfSdssTraceSizeDiff",
"holoviews.operation.histogram",
"numpy.isfinite",
"holoviews.streams.RangeXY",
"holoviews.Dimension",
"lsst.pipe.tasks.functors.PsfHsmTraceSizeDiff",
"os.listdir",
"lsst.pipe.tasks.functors.RAColumn",
"p... | [((670, 689), 'lsst.pipe.tasks.functors.Mag', 'Mag', (['"""base_PsfFlux"""'], {}), "('base_PsfFlux')\n", (673, 689), False, 'from lsst.pipe.tasks.functors import Mag, CustomFunctor, DeconvolvedMoments, StarGalaxyLabeller, RAColumn, DecColumn, Column, SdssTraceSize, PsfSdssTraceSizeDiff, HsmTraceSize, PsfHsmTraceSizeDif... |
from numpy import loadtxt
from io import StringIO
class Parser(object):
integer_variables = ('numServers', 'numVms', 'numRes', 'numNodes', 'numServiceChains')
list_variables = ('lat', 'P_max', 'P_min', 'P')
matrix_variables = ('req', 'av', 'al', 'sc')
list_vector_variables = ('Edges', 'VmDemands')
... | [
"io.StringIO"
] | [((1361, 1388), 'io.StringIO', 'StringIO', (['var_content[1:-1]'], {}), '(var_content[1:-1])\n', (1369, 1388), False, 'from io import StringIO\n'), ((1536, 1553), 'io.StringIO', 'StringIO', (['content'], {}), '(content)\n', (1544, 1553), False, 'from io import StringIO\n'), ((1716, 1733), 'io.StringIO', 'StringIO', (['... |
import logging
import os
from os.path import isfile, join
import numpy as np
from data_io import file_reading
from data_io import x_y_spliting
#import matplotlib.pyplot as plt
def data_plot(data_file, class_column=0, delimiter=' '):
x_matrix, attr_num = file_reading(data_file, delimiter, True)
x_matrix, y_vect... | [
"numpy.unique",
"numpy.where",
"numpy.delete",
"numpy.array",
"data_io.x_y_spliting",
"data_io.file_reading"
] | [((259, 299), 'data_io.file_reading', 'file_reading', (['data_file', 'delimiter', '(True)'], {}), '(data_file, delimiter, True)\n', (271, 299), False, 'from data_io import file_reading\n'), ((325, 361), 'data_io.x_y_spliting', 'x_y_spliting', (['x_matrix', 'class_column'], {}), '(x_matrix, class_column)\n', (337, 361),... |
#!/usr/bin/env python
import itertools
import optparse
from anytree import NodeMixin, RenderTree
from util_mm import createClauseList, createTempRel, readIntervalDict
class TableauBase(object):
test = 1
class TableauBranch(TableauBase):
def __init__(self):
self.closed = False
class TableauNode(TableauBase,... | [
"util_mm.createTempRel",
"itertools.product",
"optparse.OptionParser",
"anytree.RenderTree",
"util_mm.createClauseList",
"sys.exit",
"util_mm.readIntervalDict"
] | [((14341, 14364), 'optparse.OptionParser', 'optparse.OptionParser', ([], {}), '()\n', (14362, 14364), False, 'import optparse\n'), ((15154, 15185), 'util_mm.createClauseList', 'createClauseList', (['lines1', 'tRels'], {}), '(lines1, tRels)\n', (15170, 15185), False, 'from util_mm import createClauseList, createTempRel,... |
from docusign_rooms import RoomsApi, RolesApi, RoomForCreate, FieldDataForCreate
from flask import session, request
from ...utils import create_rooms_api_client
class Eg001Controller:
@staticmethod
def get_args():
"""Get required session and request arguments"""
return {
"account_... | [
"docusign_rooms.RoomsApi",
"docusign_rooms.RolesApi",
"docusign_rooms.FieldDataForCreate",
"flask.request.form.get"
] | [((979, 999), 'docusign_rooms.RolesApi', 'RolesApi', (['api_client'], {}), '(api_client)\n', (987, 999), False, 'from docusign_rooms import RoomsApi, RolesApi, RoomForCreate, FieldDataForCreate\n'), ((1859, 1879), 'docusign_rooms.RoomsApi', 'RoomsApi', (['api_client'], {}), '(api_client)\n', (1867, 1879), False, 'from ... |
import pytz
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect, render
from django.views.decorators.cache import cache_page
from pano.puppetdb import puppetdb
from pano.puppetdb.puppetdb import set_server, get_server
from pano.settings import AVAILABLE_SOURCES, CACHE_TIME,... | [
"django.shortcuts.render",
"django.shortcuts.redirect",
"django.views.decorators.cache.cache_page",
"pano.puppetdb.puppetdb.set_server"
] | [((384, 406), 'django.views.decorators.cache.cache_page', 'cache_page', (['CACHE_TIME'], {}), '(CACHE_TIME)\n', (394, 406), False, 'from django.views.decorators.cache import cache_page\n'), ((957, 1003), 'django.shortcuts.render', 'render', (['request', '"""pano/radiator.html"""', 'context'], {}), "(request, 'pano/radi... |
# 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 or agreed to in writing, software
# distributed under the... | [
"logging.getLogger",
"sushy.utils.get_sub_resource_path_by",
"sushy.resources.common.StatusField",
"sushy.resources.base.MappedField",
"sushy.resources.base.Field"
] | [((878, 905), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (895, 905), False, 'import logging\n'), ((962, 993), 'sushy.resources.base.Field', 'base.Field', (['"""Id"""'], {'required': '(True)'}), "('Id', required=True)\n", (972, 993), False, 'from sushy.resources import base\n'), ((1042... |
from cs5460a import cs5460a
from machine import SPI, Pin, Timer
from machine import UART
from m5310a import ZW_Net
import dht, machine
# import micropython
import gc
import utime
from ucollections import deque
dht = dht.DHT11(machine.Pin(33))
Relay = machine.Pin(26, machine.Pin.OUT)
pmos = machine.Pin(21, machine.Pin.... | [
"ucollections.deque",
"_thread.allocate_lock",
"dht.temperature",
"machine.Timer",
"utime.sleep_ms",
"machine.Pin",
"_thread.start_new_thread",
"machine.UART",
"utime.ticks_ms",
"gc.collect",
"dht.humidity",
"m5310a.ZW_Net",
"dht.measure",
"cs5460a.cs5460a"
] | [((252, 284), 'machine.Pin', 'machine.Pin', (['(26)', 'machine.Pin.OUT'], {}), '(26, machine.Pin.OUT)\n', (263, 284), False, 'import dht, machine\n'), ((292, 324), 'machine.Pin', 'machine.Pin', (['(21)', 'machine.Pin.OUT'], {}), '(21, machine.Pin.OUT)\n', (303, 324), False, 'import dht, machine\n'), ((350, 381), 'machi... |
# Copyright (c) 2018 <NAME> <<EMAIL>>
# Copyright (c) 2018 <NAME>
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
''' Score '''
from datetime import datetime, timezone
from zold.time import NowTime, DatetimeTime
class TestDateTime:
''' Тести... | [
"datetime.datetime",
"zold.time.DatetimeTime",
"zold.time.NowTime"
] | [((438, 492), 'datetime.datetime', 'datetime', (['(2018)', '(6)', '(19)', '(14)', '(17)', '(22)'], {'tzinfo': 'timezone.utc'}), '(2018, 6, 19, 14, 17, 22, tzinfo=timezone.utc)\n', (446, 492), False, 'from datetime import datetime, timezone\n'), ((506, 524), 'zold.time.DatetimeTime', 'DatetimeTime', (['time'], {}), '(ti... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
'''
Workflow for getting subject info
presumes fmriprep has run, expects directories to exist for
both BIDS data and fmriprep output
'''
from __future__ import ... | [
"bids.layout.models.Tag",
"bids.layout.models.Entity",
"os.path.dirname",
"collections.defaultdict",
"bids.layout.models.FileAssociation",
"json.load"
] | [((5482, 5506), 'os.path.dirname', 'os.path.dirname', (['dirname'], {}), '(dirname)\n', (5497, 5506), False, 'import os\n'), ((9015, 9052), 'bids.layout.models.Tag', 'Tag', (['bf', 'all_entities[md_key]', 'md_val'], {}), '(bf, all_entities[md_key], md_val)\n', (9018, 9052), False, 'from bids.layout.models import Tag, F... |
import re
import random
import asyncio
import discord
from discord.ext import commands
from cogs.utils.util import GetMessage
time_regex = re.compile(r"(?:(\d{1,5})(h|s|m|d))+?")
time_dict = {"h": 3600, "s": 1, "m": 60, "d": 86400}
def convert(argument):
args = argument.lower()
matches = re.findall(time_re... | [
"discord.ext.commands.has_permissions",
"random.choice",
"re.compile",
"discord.ext.commands.guild_only",
"cogs.utils.util.GetMessage",
"asyncio.sleep",
"discord.ext.commands.BadArgument",
"re.findall",
"discord.Embed",
"discord.ext.commands.command"
] | [((142, 181), 're.compile', 're.compile', (['"""(?:(\\\\d{1,5})(h|s|m|d))+?"""'], {}), "('(?:(\\\\d{1,5})(h|s|m|d))+?')\n", (152, 181), False, 'import re\n'), ((302, 330), 're.findall', 're.findall', (['time_regex', 'args'], {}), '(time_regex, args)\n', (312, 330), False, 'import re\n'), ((828, 900), 'discord.ext.comma... |
#! /usr/bin/env python3
import argparse
import sys
import os
sys.path.append(os.path.dirname(__file__))
import prophylelib as pro
script_dir = os.path.dirname(os.path.realpath(__file__))
bwa = os.path.join(script_dir, "prophyle_index", "bwa", "bwa")
prophyle_index = os.path.join(script_dir, "prophyle_index", "prophy... | [
"argparse.ArgumentParser",
"os.path.join",
"os.path.realpath",
"os.path.dirname",
"prophylelib.run_safe"
] | [((196, 252), 'os.path.join', 'os.path.join', (['script_dir', '"""prophyle_index"""', '"""bwa"""', '"""bwa"""'], {}), "(script_dir, 'prophyle_index', 'bwa', 'bwa')\n", (208, 252), False, 'import os\n'), ((270, 330), 'os.path.join', 'os.path.join', (['script_dir', '"""prophyle_index"""', '"""prophyle_index"""'], {}), "(... |
from setuptools import setup
setup(name='rescaleforvis',
version='1.0',
description='Maps each number of a short list to a whole number, such that the order of the magnitudes of the differences between any two numbers is preserved.',
url='https://github.com/garryFromGermany/rescale_for_vis',
... | [
"setuptools.setup"
] | [((32, 443), 'setuptools.setup', 'setup', ([], {'name': '"""rescaleforvis"""', 'version': '"""1.0"""', 'description': '"""Maps each number of a short list to a whole number, such that the order of the magnitudes of the differences between any two numbers is preserved."""', 'url': '"""https://github.com/garryFromGermany... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import os
import re
from datetime import datetime
from flask import abort, flash, redirect, render_template, request, url_for
from flask_login import current_user, login_required, login_user, logout_user
from subprocess import check_output
from twicorder imp... | [
"flask.render_template",
"flask.request.args.get",
"twicorder.utils.TwiLogger.exception",
"re.compile",
"twicorder.web.browser.forms.LoginForm",
"twicorder.web.browser.app.template_filter",
"os.path.exists",
"os.listdir",
"flask.flash",
"twicorder.web.browser.forms.RegistrationForm",
"json.dumps... | [((2384, 2421), 'twicorder.web.browser.app.template_filter', 'app.template_filter', (['"""date_to_millis"""'], {}), "('date_to_millis')\n", (2403, 2421), False, 'from twicorder.web.browser import app, db\n'), ((2590, 2634), 'twicorder.web.browser.app.route', 'app.route', (['"""/login"""'], {'methods': "['GET', 'POST']"... |
"""
-------------------------------------
# -*- coding: utf-8 -*-
# @Time : 2021/4/16 12:03:46
# @Author : Giyn
# @Email : <EMAIL>
# @File : mobility_model_construction.py
# @Software: PyCharm
-------------------------------------
"""
import numpy as np
from utils import ProgressBar
def markov_model(trajs:... | [
"utils.ProgressBar",
"numpy.zeros",
"numpy.random.laplace"
] | [((613, 639), 'numpy.zeros', 'np.zeros', (['(n_grid, n_grid)'], {}), '((n_grid, n_grid))\n', (621, 639), True, 'import numpy as np\n'), ((1012, 1082), 'utils.ProgressBar', 'ProgressBar', (['n_grid', '"""Generate midpoint transition probability matrix"""'], {}), "(n_grid, 'Generate midpoint transition probability matrix... |
from collections import deque
from threading import Condition
from typing import BinaryIO, Deque, Optional
from pytils.mixins import DaemonHandler
from ._base import IOReceiver, IOSender
__all__ = [
'QueuedReceiver',
'QueuedSender',
]
_DEFAULT_MAX_QUEUE_SIZE = 4096
class QueuedSender(DaemonHandler, IOSende... | [
"threading.Condition",
"collections.deque"
] | [((493, 504), 'threading.Condition', 'Condition', ([], {}), '()\n', (502, 504), False, 'from threading import Condition\n'), ((527, 555), 'collections.deque', 'deque', ([], {'maxlen': 'max_queue_size'}), '(maxlen=max_queue_size)\n', (532, 555), False, 'from collections import deque\n'), ((1337, 1348), 'threading.Condit... |
#
# Copyright (c) 2015 Autodesk Inc.
# 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 applicable l... | [
"logging.getLogger",
"ochopod.core.utils.shell"
] | [((811, 839), 'logging.getLogger', 'logging.getLogger', (['"""ochopod"""'], {}), "('ochopod')\n", (828, 839), False, 'import logging\n'), ((1502, 1516), 'ochopod.core.utils.shell', 'shell', (['snippet'], {}), '(snippet)\n', (1507, 1516), False, 'from ochopod.core.utils import shell\n')] |
#!/usr/bin/env python
"""
Wrapper to matplotlib to show an arc spectrum
"""
def parse_args(options=None, return_parser=False):
import argparse
parser = argparse.ArgumentParser(description='Show the result of wavelength calibration',
formatter_class=argparse.ArgumentDefaults... | [
"argparse.ArgumentParser",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.clf",
"linetools.utils.loadjson",
"matplotlib.pyplot.show"
] | [((161, 307), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Show the result of wavelength calibration"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description=\n 'Show the result of wavelength calibration', formatter_class=argparse.\n ArgumentDefaultsHelpF... |
import os
import scipy.io as sio
import torch
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms
import h5py
import numpy as np
import time
import pdb
from core.ProceLDataset import ProceLDataset
from global_setting import data_path_tr,data_path_tst
class FeatureVGGDataset(Dataset):
... | [
"torchvision.transforms.CenterCrop",
"os.listdir",
"time.clock",
"scipy.io.loadmat",
"os.path.join",
"h5py.File",
"os.path.isfile",
"torch.tensor",
"torch.utils.data.DataLoader",
"torchvision.transforms.Resize",
"torchvision.transforms.ToTensor",
"core.ProceLDataset.ProceLDataset",
"torch.ze... | [((1537, 1557), 'os.listdir', 'os.listdir', (['root_dir'], {}), '(root_dir)\n', (1547, 1557), False, 'import os\n'), ((3864, 3916), 'core.ProceLDataset.ProceLDataset', 'ProceLDataset', (['frame_path'], {'transform': 'self.transforms'}), '(frame_path, transform=self.transforms)\n', (3877, 3916), False, 'from core.ProceL... |
try:
import unittest2 as unittest
except ImportError:
import unittest
try:
from unittest import mock
except ImportError:
import mock
from qrcode.console_scripts import main
class ScriptTest(unittest.TestCase):
@mock.patch('os.isatty', lambda *args: True)
@mock.patch('qrcode.main.QRCode.print... | [
"mock.Mock",
"mock.patch",
"qrcode.console_scripts.main"
] | [((235, 278), 'mock.patch', 'mock.patch', (['"""os.isatty"""', '(lambda *args: True)'], {}), "('os.isatty', lambda *args: True)\n", (245, 278), False, 'import mock\n'), ((284, 328), 'mock.patch', 'mock.patch', (['"""qrcode.main.QRCode.print_ascii"""'], {}), "('qrcode.main.QRCode.print_ascii')\n", (294, 328), False, 'im... |
from kivy.lang.builder import Builder
from akivymd.uix.behaviors.addwidget import AKAddWidgetAnimationBehavior
from kivy.uix.screenmanager import Screen
from kivymd.uix.list import OneLineListItem, MDList
Builder.load_string(
"""
<AddWidgetBehavior>:
name: 'AddWidgetBehavior'
BoxLayout:
orientation... | [
"kivymd.uix.list.OneLineListItem",
"kivy.lang.builder.Builder.load_string"
] | [((206, 596), 'kivy.lang.builder.Builder.load_string', 'Builder.load_string', (['"""\n<AddWidgetBehavior>:\n name: \'AddWidgetBehavior\'\n BoxLayout:\n orientation: \'vertical\'\n MDToolbar:\n title: root.name\n left_action_items:[[\'arrow-left\' , lambda x:app.show_screen(\'Ho... |
import os
import time
import demisto_client
from demisto_client.demisto_api.rest import ApiException
from demisto_sdk.commands.common.tools import (LOG_COLORS, print_color,
print_error)
class PlaybookRunner:
"""PlaybookRunner is a class that's designed to run a play... | [
"demisto_sdk.commands.common.tools.print_error",
"demisto_client.configure",
"os.environ.get",
"time.sleep",
"demisto_sdk.commands.common.tools.print_color",
"time.time",
"demisto_client.demisto_api.CreateIncidentRequest"
] | [((1239, 1296), 'demisto_client.configure', 'demisto_client.configure', ([], {'base_url': 'url', 'verify_ssl': 'verify'}), '(base_url=url, verify_ssl=verify)\n', (1263, 1296), False, 'import demisto_client\n'), ((3872, 3922), 'demisto_client.demisto_api.CreateIncidentRequest', 'demisto_client.demisto_api.CreateIncident... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-13 10:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('aa_stripe', '0005_auto_20170613_0614'),
]
operations = [
migrations.AddFiel... | [
"django.db.models.DateTimeField",
"django.db.models.DateField"
] | [((415, 469), 'django.db.models.DateField', 'models.DateField', ([], {'null': '(True)', 'blank': '(True)', 'db_index': '(True)'}), '(null=True, blank=True, db_index=True)\n', (431, 469), False, 'from django.db import migrations, models\n'), ((606, 664), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'n... |
from django import template
from django.utils.encoding import force_text
register = template.Library()
@register.filter
def pk_list(ship_set):
ship_list = []
for ship in ship_set:
ship_list.append(ship.user.pk)
return ship_list
| [
"django.template.Library"
] | [((85, 103), 'django.template.Library', 'template.Library', ([], {}), '()\n', (101, 103), False, 'from django import template\n')] |
# Copyright 2019 Xilinx 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 or agreed to in writing, ... | [
"sys.path.insert",
"scipy.ndimage.filters.gaussian_filter",
"math.sqrt",
"numpy.array",
"numpy.logical_and.reduce",
"caffe.set_mode_cpu",
"numpy.divide",
"numpy.multiply",
"argparse.ArgumentParser",
"numpy.delete",
"json.dumps",
"numpy.subtract",
"numpy.linspace",
"numpy.vstack",
"numpy.... | [((977, 1002), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1000, 1002), False, 'import argparse\n'), ((1764, 1798), 'os.path.join', 'os.path.join', (['args.caffe', '"""python"""'], {}), "(args.caffe, 'python')\n", (1776, 1798), False, 'import os\n'), ((2278, 2339), 'numpy.tile', 'np.tile', ... |
#!/usr/bin/env python
import operator
import tkinter as tk
import random
import time
def rgb(color):
color_html = "#%02x%02x%02x" % tuple(map(int, color))
return(color_html)
class RGBMatrix(tk.Frame):
def __init__(self, *args, **kw):
tk.Frame.__init__(self, *args, **kw)
width, hei... | [
"tkinter.Canvas",
"tkinter.Tk",
"random.randint",
"tkinter.Frame.__init__"
] | [((2232, 2253), 'random.randint', 'random.randint', (['(1)', '(36)'], {}), '(1, 36)\n', (2246, 2253), False, 'import random\n'), ((2393, 2400), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (2398, 2400), True, 'import tkinter as tk\n'), ((266, 302), 'tkinter.Frame.__init__', 'tk.Frame.__init__', (['self', '*args'], {}), '(s... |
from fabric.contrib.project import rsync_project
from fabric.api import run
def sync_files():
rsync_project(remote_dir='/var/www/vhosts/ludumdare.pl/ldpoznan',
local_dir='ldpoznan/',
exclude=['local_settings.py', '*.pyc', '*.wsgi', '*/static/*'],
delete=True,
extra_opts='')
def reload_wsgi():
run('touch /v... | [
"fabric.api.run",
"fabric.contrib.project.rsync_project"
] | [((97, 286), 'fabric.contrib.project.rsync_project', 'rsync_project', ([], {'remote_dir': '"""/var/www/vhosts/ludumdare.pl/ldpoznan"""', 'local_dir': '"""ldpoznan/"""', 'exclude': "['local_settings.py', '*.pyc', '*.wsgi', '*/static/*']", 'delete': '(True)', 'extra_opts': '""""""'}), "(remote_dir='/var/www/vhosts/ludumd... |
# -*- coding: utf-8 -*-
import gnupg
from flask import (
Blueprint,
Response,
abort,
current_app,
json,
redirect,
request,
send_from_directory,
url_for,
)
from ..ext import cache, db
from ..models import (
Architecture,
Build,
Description,
DisplayName,
Download,
... | [
"flask.send_from_directory",
"flask.json.dumps",
"flask.url_for",
"flask.request.values.get",
"flask.abort",
"flask.Blueprint",
"gnupg.GPG"
] | [((383, 409), 'flask.Blueprint', 'Blueprint', (['"""nas"""', '__name__'], {}), "('nas', __name__)\n", (392, 409), False, 'from flask import Blueprint, Response, abort, current_app, json, redirect, request, send_from_directory, url_for\n'), ((8251, 8309), 'flask.send_from_directory', 'send_from_directory', (["current_ap... |
import argparse
import json
import os
from pprint import pprint
import numpy as np
from sklearn.metrics import precision_recall_fscore_support
from a2t.topic_classification.mlm import MLMTopicClassifier
from a2t.topic_classification.mnli import (
NLITopicClassifier,
NLITopicClassifierWithMappingHead,
)
from a... | [
"argparse.ArgumentParser",
"os.makedirs",
"json.dump",
"numpy.argmax",
"numpy.argsort",
"numpy.array",
"json.load",
"pprint.pprint",
"numpy.save"
] | [((711, 818), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""run_evaluation"""', 'description': '"""Run a evaluation for each configuration."""'}), "(prog='run_evaluation', description=\n 'Run a evaluation for each configuration.')\n", (734, 818), False, 'import argparse\n'), ((1488, 1504), ... |
import ROOT as root
import numpy as np
import time
import uncertainties.unumpy as unp
from uncertainties import ufloat
from uncertainties.unumpy import nominal_values as noms
from uncertainties.unumpy import std_devs as stds
from uncertainties import correlated_values
from array import array
import os
##############... | [
"ROOT.TColor.GetColor",
"ROOT.TProfile2D",
"array.array",
"ROOT.TLegend",
"os.getcwd",
"ROOT.gStyle.SetOptTitle",
"uncertainties.unumpy.nominal_values",
"uncertainties.unumpy.std_devs",
"ROOT.TCanvas",
"uncertainties.unumpy.uarray"
] | [((429, 508), 'ROOT.TProfile2D', 'root.TProfile2D', (['"""qMap_Ag_C0_V0"""', '"""qMap_Ag_C0 (V0)"""', '(52)', '(0)', '(52)', '(80)', '(0)', '(80)', '(0)', '(0)'], {}), "('qMap_Ag_C0_V0', 'qMap_Ag_C0 (V0)', 52, 0, 52, 80, 0, 80, 0, 0)\n", (444, 508), True, 'import ROOT as root\n'), ((7617, 7648), 'ROOT.TColor.GetColor',... |
'''
Author: <NAME>
'''
import numpy as np
from qpsolvers import solve_qp
def linear(x1,x2,p = None):
return np.dot(x1,x2)
def polynomial(x1,x2,d):
return ( 1+np.dot(x1,x2) )**d
def rbf(x1,x2,l):
return np.exp( -np.divide(np.dot(x1-x2,x1-x2), 2*(l**2 ) ) )
def ND_hyperplane(x1,svecto... | [
"numpy.identity",
"numpy.mean",
"numpy.multiply",
"numpy.ones",
"qpsolvers.solve_qp",
"numpy.where",
"numpy.size",
"numpy.asarray",
"numpy.dot",
"numpy.outer",
"numpy.zeros",
"numpy.empty",
"numpy.sign"
] | [((122, 136), 'numpy.dot', 'np.dot', (['x1', 'x2'], {}), '(x1, x2)\n', (128, 136), True, 'import numpy as np\n'), ((1429, 1452), 'numpy.asarray', 'np.asarray', (['data[:, :2]'], {}), '(data[:, :2])\n', (1439, 1452), True, 'import numpy as np\n'), ((1471, 1494), 'numpy.asarray', 'np.asarray', (['data[:, 2:]'], {}), '(da... |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 7 14:28:52 2017
@author: ning
This script is to do two things,
1. converting epochs to power spectrograms
2. fit and test a linear model to the data
"""
import numpy as np
from matplotlib import pyplot as plt
import os
import mne
from glob import glob
fr... | [
"sklearn.model_selection.StratifiedShuffleSplit",
"numpy.sqrt",
"numpy.array",
"matplotlib.rc",
"numpy.arange",
"os.path.exists",
"numpy.mean",
"mne.decoding.LinearModel",
"numpy.linspace",
"mne.read_epochs",
"numpy.concatenate",
"mne.time_frequency.read_tfrs",
"os.mkdir",
"sklearn.preproc... | [((1132, 1174), 'os.chdir', 'os.chdir', (['"""D:/Ning - spindle/training set"""'], {}), "('D:/Ning - spindle/training set')\n", (1140, 1174), False, 'import os\n'), ((1888, 1910), 'numpy.concatenate', 'np.concatenate', (['labels'], {}), '(labels)\n', (1902, 1910), True, 'import numpy as np\n'), ((2591, 2619), 'numpy.co... |
import contextlib
import tempfile
import urllib
import urllib.request as request
from urllib.error import ContentTooShortError
from urllib.request import Request
_url_tempfiles = []
def urlretrieve(req, filename=None, reporthook=None, data=None):
if isinstance(req, str):
headers = {
'User-Age... | [
"urllib.request.Request",
"urllib.request.urlopen",
"urllib.error.ContentTooShortError",
"tempfile.NamedTemporaryFile"
] | [((469, 502), 'urllib.request.Request', 'Request', ([], {'url': 'url', 'headers': 'headers'}), '(url=url, headers=headers)\n', (476, 502), False, 'from urllib.request import Request\n'), ((1648, 1748), 'urllib.error.ContentTooShortError', 'ContentTooShortError', (["('retrieval incomplete: got only %i out of %i bytes' %... |
# -!- coding: utf-8 -!-
import re
import requests
import urllib.parse
import html.parser
import random
regex1 = re.compile(r'<td class="ptitle"><a title=".*?>(.*)<\/a>')
postcontent = 'method=backpu_list&type=json&page_name=%s¤tPage=1'
headers = {'Content-Type': 'application/x-www-form-urlencoded',
... | [
"re.findall",
"requests.session",
"random.choice",
"re.compile"
] | [((120, 177), 're.compile', 're.compile', (['"""<td class="ptitle"><a title=".*?>(.*)<\\\\/a>"""'], {}), '(\'<td class="ptitle"><a title=".*?>(.*)<\\\\/a>\')\n', (130, 177), False, 'import re\n'), ((1074, 1113), 're.compile', 're.compile', (['"""divstyle"> ○(.*?)<br \\\\/>"""'], {}), '(\'divstyle"> ○(.*?)<br \\\\/>\')\... |
from IPython.core.display import Image as image
from PIL import Image
def save_and_display(arr, fname):
pilimg = Image.fromarray(arr)
pilimg.save(fname)
return image(filename=fname, width=600) | [
"IPython.core.display.Image",
"PIL.Image.fromarray"
] | [((118, 138), 'PIL.Image.fromarray', 'Image.fromarray', (['arr'], {}), '(arr)\n', (133, 138), False, 'from PIL import Image\n'), ((173, 205), 'IPython.core.display.Image', 'image', ([], {'filename': 'fname', 'width': '(600)'}), '(filename=fname, width=600)\n', (178, 205), True, 'from IPython.core.display import Image a... |
from math import factorial as f
import sys
while True:
a = sys.stdin.readline()
a = a[:-1]
if a == '0':
break
L = len(a)
S = 0
for i in range(len(a)):
S+= f(len(a)-i)*int(a[i])
print(S) | [
"sys.stdin.readline"
] | [((63, 83), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (81, 83), False, 'import sys\n')] |
"""Handle all public pages."""
from .logic import get_google_auth_flow
from .logic import get_google_authorize_uri
from .logic import get_google_person
from flask import Blueprint
from flask import request
from flask import redirect
from oauth2client import client
from quupod.models import User
from quupod.models imp... | [
"quupod.models.User.query.get",
"quupod.models.User",
"quupod.models.User.query.filter_by",
"flask_login.login_user",
"flask_login.logout_user",
"flask.request.form.get",
"quupod.views.url_for",
"flask.Blueprint",
"quupod.models.Queue.query.all"
] | [((502, 560), 'flask.Blueprint', 'Blueprint', (['"""public"""', '__name__'], {'template_folder': '"""templates"""'}), "('public', __name__, template_folder='templates')\n", (511, 560), False, 'from flask import Blueprint\n'), ((1932, 1950), 'quupod.models.User.query.get', 'User.query.get', (['id'], {}), '(id)\n', (1946... |
# 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 or agreed to in writing, software
# distributed under t... | [
"keystone.common.sql.DateTimeInt",
"sqlalchemy.ForeignKey",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.MetaData",
"sqlalchemy.String",
"sqlalchemy.Column"
] | [((657, 671), 'sqlalchemy.MetaData', 'sql.MetaData', ([], {}), '()\n', (669, 671), True, 'import sqlalchemy as sql\n'), ((792, 864), 'sqlalchemy.Column', 'sql.Column', (['"""internal_id"""', 'sql.Integer'], {'primary_key': '(True)', 'nullable': '(False)'}), "('internal_id', sql.Integer, primary_key=True, nullable=False... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""objetos.py: Objetos e utilidades necessários para a implementação do algoritmo"""
__copyright__ = "Copyright (c) 2021 <NAME> & <NAME>. MIT. See attached LICENSE.txt file"
from math import sqrt
from copy import deepcopy
from sys import maxsize as int_inf
from typing i... | [
"numpy.power",
"dataclasses.dataclass",
"copy.deepcopy",
"pandas.DataFrame",
"dataclasses.field"
] | [((655, 677), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (664, 677), False, 'from dataclasses import dataclass, field\n'), ((911, 933), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (920, 933), False, 'from dataclasses import dataclass, fi... |
import pandas as pd
from dashboard import models
# Functions utiles
def handle_upload_csv(f):
pass
def load_csv(fileurl=''):
file = '.' + fileurl
df = pd.read_csv(file)
return df
def detect_file_type(filename):
if filename[-3:] == 'csv':
filetype = 'csv'
elif filena... | [
"dashboard.models.Analyse_Specific.objects.filter",
"pandas.read_csv"
] | [((176, 193), 'pandas.read_csv', 'pd.read_csv', (['file'], {}), '(file)\n', (187, 193), True, 'import pandas as pd\n'), ((726, 782), 'dashboard.models.Analyse_Specific.objects.filter', 'models.Analyse_Specific.objects.filter', ([], {'NomDataset_id': 'id'}), '(NomDataset_id=id)\n', (764, 782), False, 'from dashboard imp... |
#!/usr/bin/env python
# coding: utf-8
# # riot-api-test
#
# Use the "Run" button to execute the code.
# In[224]:
get_ipython().system('pip install jovian --upgrade --quiet')
# In[5]:
import jovian
import requests
from statistics import mean
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"]=20,20
... | [
"statistics.mean",
"matplotlib.pyplot.text",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.xlabel",
"requests.get",
"matplotlib.pyplot.figure",
"jovian.commit",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((384, 422), 'jovian.commit', 'jovian.commit', ([], {'project': '"""riot-api-test"""'}), "(project='riot-api-test')\n", (397, 422), False, 'import jovian\n'), ((436, 567), 'requests.get', 'requests.get', (['"""https://na1.api.riotgames.com/tft/league/v1/challenger?api_key=RGAPI-d913efd4-80db-476d-9842-0a6690eaf6e1"""'... |
import math
def adição(x, y):
return x+y
def subtração(x, y):
return x-y
def multiplicação(x, y):
return x*y
def divisão(x, y):
return x/y
def potencia(x, y):
return x**y
def raiz(x, y):
return math.sqrt(x)
print("\n***** Python Calculator *****")
print('Escolha uma operação (1/2/3/4/5/6)... | [
"math.sqrt"
] | [((224, 236), 'math.sqrt', 'math.sqrt', (['x'], {}), '(x)\n', (233, 236), False, 'import math\n')] |
import FWCore.ParameterSet.Config as cms
from SimGeneral.MixingModule.mixObjects_cfi import *
process = cms.Process("PRODVAL1")
process.load("DQM.SiStripCommon.DaqMonitorROOTBackEnd_cfi")
process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService",
moduleSeeds = cms.PSet(
mix = cms.... | [
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.PSet",
"FWCore.ParameterSet.Config.double",
"FWCore.ParameterSet.Config.int32",
"FWCore.ParameterSet.Config.untracked.int32",
"FWCore.ParameterSet.Config.untracked.uint32",
"FWCore.ParameterSet.Config.Process",
"FWCore.ParameterSet.Confi... | [((106, 129), 'FWCore.ParameterSet.Config.Process', 'cms.Process', (['"""PRODVAL1"""'], {}), "('PRODVAL1')\n", (117, 129), True, 'import FWCore.ParameterSet.Config as cms\n'), ((2312, 2348), 'FWCore.ParameterSet.Config.Path', 'cms.Path', (['(process.mix + process.test)'], {}), '(process.mix + process.test)\n', (2320, 2... |
import argparse
import os
import time
import datetime
import yaml
import tensorflow as tf
import numpy as np
import src.core as core
from src.retina_net import config_utils
from src.core import constants
from src.retina_net.builders import dataset_handler_builder
from src.retina_net.models.retinanet_model import Reti... | [
"tensorflow.data.experimental.cardinality",
"yaml.load",
"tensorflow.GradientTape",
"src.retina_net.models.retinanet_model.RetinaNetModel",
"tensorflow.cast",
"tensorflow.clip_by_global_norm",
"argparse.ArgumentParser",
"src.retina_net.config_utils.setup",
"tensorflow.concat",
"src.core.model_dir"... | [((615, 677), 'src.retina_net.builders.dataset_handler_builder.build_dataset', 'dataset_handler_builder.build_dataset', (['dataset_config', '"""train"""'], {}), "(dataset_config, 'train')\n", (652, 677), False, 'from src.retina_net.builders import dataset_handler_builder\n'), ((1620, 1716), 'tensorflow.keras.optimizers... |
#!/usr/bin/env python
"""
arith_parse.py - Parse shell arithmetic, which is based on C.
"""
from core import tdop
from core import util
from osh.meta import Id
from core import word
from osh.meta import ast
p_die = util.p_die
def NullIncDec(p, w, bp):
""" ++x or ++x[1] """
right = p.ParseUntil(bp)
child = tdo... | [
"core.tdop.ParserSpec",
"osh.meta.ast.FuncCall",
"core.tdop.IsCallable",
"osh.meta.ast.UnaryAssign",
"osh.meta.ast.ArithUnary",
"core.tdop.IsIndexable",
"osh.meta.ast.TernaryOp",
"core.tdop.ToLValue",
"core.tdop.ParseError",
"core.word.ArithId"
] | [((317, 337), 'core.tdop.ToLValue', 'tdop.ToLValue', (['right'], {}), '(right)\n', (330, 337), False, 'from core import tdop\n'), ((578, 618), 'osh.meta.ast.ArithUnary', 'ast.ArithUnary', (['Id.Node_UnaryPlus', 'right'], {}), '(Id.Node_UnaryPlus, right)\n', (592, 618), False, 'from osh.meta import ast\n'), ((738, 779),... |
import os
import sys
import json
import random
import numpy as np
import torch
from tqdm import tqdm, trange
from scipy.sparse import coo_matrix
from torch.utils.data import DataLoader, SequentialSampler, TensorDataset
import blink.candidate_ranking.utils as utils
from blink.common.params import BlinkParser
from blin... | [
"torch.LongTensor",
"blink.joint.joint_eval.evaluation.compute_linking_metrics",
"os.path.exists",
"blink.joint.joint_eval.evaluation._get_global_maximum_spanning_tree",
"json.dumps",
"numpy.random.seed",
"scipy.sparse.coo_matrix",
"blink.common.params.BlinkParser",
"torch.utils.data.SequentialSampl... | [((986, 1013), 'torch.LongTensor', 'torch.LongTensor', (['mod_input'], {}), '(mod_input)\n', (1002, 1013), False, 'import torch\n'), ((1197, 1222), 'tqdm.trange', 'trange', (['contexts.shape[0]'], {}), '(contexts.shape[0])\n', (1203, 1222), False, 'from tqdm import tqdm, trange\n'), ((1663, 1696), 'torch.cat', 'torch.c... |
from celery import Celery
# celery app instance
celery_app = Celery(__name__)
celery_app.config_from_object('config')
| [
"celery.Celery"
] | [((62, 78), 'celery.Celery', 'Celery', (['__name__'], {}), '(__name__)\n', (68, 78), False, 'from celery import Celery\n')] |
import bcrypt
from passlib.context import CryptContext
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
def generate_salt() -> str:
return bcrypt.gensalt().decode()
def verify_password(plain_password: str, hashed_password: str) -> bool:
return pwd_context.verify(plain_password, hashed_pass... | [
"bcrypt.gensalt",
"passlib.context.CryptContext"
] | [((70, 121), 'passlib.context.CryptContext', 'CryptContext', ([], {'schemes': "['bcrypt']", 'deprecated': '"""auto"""'}), "(schemes=['bcrypt'], deprecated='auto')\n", (82, 121), False, 'from passlib.context import CryptContext\n'), ((163, 179), 'bcrypt.gensalt', 'bcrypt.gensalt', ([], {}), '()\n', (177, 179), False, 'i... |
import socket
import threading
import os
################################################################
class Room: # Room class
def __init__(self):
self.chatUsers = [] # 채팅방 접속 유저 리스트 (채팅방)
self.waitUsers = [] # 재접속을 기다리는 유저 리스트 (대기열)
def add_chatUser(self, c): # 채팅방에 유저 추가
self.ch... | [
"os.remove",
"threading.Thread",
"socket.socket",
"os.getcwd"
] | [((4515, 4564), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (4528, 4564), False, 'import socket\n'), ((5088, 5122), 'threading.Thread', 'threading.Thread', ([], {'target': 'c.readMsg'}), '(target=c.readMsg)\n', (5104, 5122), False, 'import ... |
# Generated by Django 2.0.3 on 2018-04-27 22:24
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('REST', '0010_auto_20180427_2144'),
]
operations = [
migrations.RemoveField(
model_name='user',
name='username',
),
... | [
"django.db.migrations.RemoveField"
] | [((224, 282), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""user"""', 'name': '"""username"""'}), "(model_name='user', name='username')\n", (246, 282), False, 'from django.db import migrations\n')] |
from pipeline import traversal_folder, run_IC3, parse_raw_output1, \
parse_raw_output2, parse_raw_output3, get_AC_rate, parse_raw_output4, test_IF_samples_abc, write_file_print
from rand_init_sampler import read_aig_latch
import time
import os
'''
Run Init2 to get IV/Frame, and also get the initial sample overlap ... | [
"pipeline.traversal_folder",
"os.path.exists",
"time.localtime",
"pipeline.test_IF_samples_abc",
"pipeline.write_file_print",
"pipeline.run_IC3",
"os.path.split",
"random.seed",
"pipeline.get_AC_rate",
"random.getrandbits",
"pipeline.parse_raw_output2",
"pipeline.parse_raw_output4",
"pipelin... | [((1398, 1427), 'pipeline.traversal_folder', 'traversal_folder', (['folder_path'], {}), '(folder_path)\n', (1414, 1427), False, 'from pipeline import traversal_folder, run_IC3, parse_raw_output1, parse_raw_output2, parse_raw_output3, get_AC_rate, parse_raw_output4, test_IF_samples_abc, write_file_print\n'), ((4876, 490... |
from flask import Flask
# Create app object
app = Flask(__name__)
@app.route('/')
def hello():
return "hello"
@app.route('/user')
def user():
return "Teckat"
@app.route('/name/<name>')
def name(name):
print(name)
return name
if __name__ == "__main__":
app.run(debug=True)
| [
"flask.Flask"
] | [((52, 67), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (57, 67), False, 'from flask import Flask\n')] |
"""Implements Load checkpoint."""
from abc import ABC
import torch
from torchflare.callbacks.callback import Callbacks
from torchflare.callbacks.states import CallbackOrder
class LoadCheckpoint(Callbacks, ABC):
"""Class to load checkpoint."""
def __init__(self, path_to_model: str = None):
"""Constr... | [
"torch.device"
] | [((619, 648), 'torch.device', 'torch.device', (['self.exp.device'], {}), '(self.exp.device)\n', (631, 648), False, 'import torch\n')] |