code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Copyright 2018 <NAME>
#
# 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 wr... | [
"os.path.abspath",
"typed_python.Codebase.Codebase.FromRootlevelPath",
"os.makedirs",
"object_database.Indexed",
"os.path.exists",
"threading.Lock",
"os.path.join",
"typed_python.Codebase.Codebase.Instantiate",
"logging.getLogger",
"object_database.current_transaction"
] | [((980, 996), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (994, 996), False, 'import threading\n'), ((1821, 1833), 'object_database.Indexed', 'Indexed', (['str'], {}), '(str)\n', (1828, 1833), False, 'from object_database import Schema, Indexed, Index, core_schema, SubscribeLazilyByDefault\n'), ((2160, 2172),... |
import requests
from insurance_claims.record_types import *
base_url = 'http://127.0.0.1:5000/'
class App():
def evaluate(self, save_dataset=False):
calculated_claims_value = self._calculate_claims_value()
classified_claims_value = self._classify_claims_value(calculated_claims_value)
cl... | [
"requests.post"
] | [((834, 861), 'requests.post', 'requests.post', (['url'], {'json': '{}'}), '(url, json={})\n', (847, 861), False, 'import requests\n'), ((1121, 1152), 'requests.post', 'requests.post', (['url'], {'json': 'claims'}), '(url, json=claims)\n', (1134, 1152), False, 'import requests\n'), ((1444, 1492), 'requests.post', 'requ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
from yabab import app, db
app.config.from_object('app_conf')
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
if __name__ ==... | [
"yabab.app.config.from_object",
"flask.ext.migrate.Migrate",
"flask.ext.script.Manager"
] | [((176, 210), 'yabab.app.config.from_object', 'app.config.from_object', (['"""app_conf"""'], {}), "('app_conf')\n", (198, 210), False, 'from yabab import app, db\n'), ((222, 238), 'flask.ext.migrate.Migrate', 'Migrate', (['app', 'db'], {}), '(app, db)\n', (229, 238), False, 'from flask.ext.migrate import Migrate, Migra... |
from .joint_representation import Joint_Representaion_Learner
from .seq2seq import Seq2Seq
from .rnn import Hierarchical_Encoder#Encoder_Baseline, LSTM_Decoder
from .bert import BertEncoder, BertDecoder, NVADecoder, DirectDecoder, APDecoder, SignalDecoder, Signal3Decoder, Signal2Decoder, NVDecoder, MSDecoder, ARDecode... | [
"torch.nn.Linear"
] | [((9905, 9964), 'torch.nn.Linear', 'nn.Linear', (["opt['dim_hidden']", "opt['vocab_size']"], {'bias': '(False)'}), "(opt['dim_hidden'], opt['vocab_size'], bias=False)\n", (9914, 9964), True, 'import torch.nn as nn\n')] |
import logging
from .wrapper import PipelineWrapper
import os
import json
logging.basicConfig(level=logging.INFO)
def main():
wrapper = PipelineWrapper()
config = wrapper.get_config()
output = wrapper.run(json.dumps({"data": "hello"}))
with open(os.path.join(config["output_path"], "output.txt"), 'w') a... | [
"logging.info",
"os.path.join",
"logging.basicConfig",
"json.dumps"
] | [((74, 113), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (93, 113), False, 'import logging\n'), ((363, 383), 'logging.info', 'logging.info', (['output'], {}), '(output)\n', (375, 383), False, 'import logging\n'), ((218, 247), 'json.dumps', 'json.dumps', (["{'... |
import sys
from copy import copy
import numpy as np
from moviepy.audio.io.ffmpeg_audiowriter import ffmpeg_audiowrite
from moviepy.decorators import requires_duration
from moviepy.Clip import Clip
# optimize range in function of Python's version
if sys.version_info < (3,):
range = xrange
class AudioClip(Clip)... | [
"numpy.minimum",
"moviepy.Clip.Clip.__init__",
"numpy.zeros",
"numpy.arange",
"numpy.array",
"moviepy.audio.io.ffmpeg_audiowriter.ffmpeg_audiowrite"
] | [((1488, 1507), 'moviepy.Clip.Clip.__init__', 'Clip.__init__', (['self'], {}), '(self)\n', (1501, 1507), False, 'from moviepy.Clip import Clip\n'), ((3164, 3251), 'moviepy.audio.io.ffmpeg_audiowriter.ffmpeg_audiowrite', 'ffmpeg_audiowrite', (['self', 'filename', 'fps', 'nbytes', 'buffersize', 'codec', 'bitrate', 'verbo... |
import os
import swamp
import unittest
import joblib
from operator import itemgetter
from swamp.utils import remove, create_tempfile
from swamp.search.searchtarget import SearchTarget
TOPCONS_DUMY = """TOPCONS predicted topology:
iiiiiiiiiiiiiiMMMMMMMMMMMMMMMMMMMMMooooooMMMMMMMMMMMMMMMMMMMMMiiiiiiiiiiMMMMMMMMMMMMMMMMM... | [
"swamp.utils.create_tempfile",
"os.path.dirname",
"joblib.dump",
"operator.itemgetter",
"os.path.join"
] | [((34178, 34203), 'swamp.utils.create_tempfile', 'create_tempfile', (['PDB_DUMY'], {}), '(PDB_DUMY)\n', (34193, 34203), False, 'from swamp.utils import remove, create_tempfile\n'), ((34271, 34301), 'swamp.utils.create_tempfile', 'create_tempfile', (['CONPRED_DUMMY'], {}), '(CONPRED_DUMMY)\n', (34286, 34301), False, 'fr... |
import frappe
from frappe.utils import cstr, unique
@frappe.whitelist()
def title_field(doctype, name):
meta = frappe.get_meta(doctype)
if meta.title_field:
return frappe.db.get_value(doctype, name, meta.title_field or 'name')
else:
return name | [
"frappe.whitelist",
"frappe.db.get_value",
"frappe.get_meta"
] | [((57, 75), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (73, 75), False, 'import frappe\n'), ((118, 142), 'frappe.get_meta', 'frappe.get_meta', (['doctype'], {}), '(doctype)\n', (133, 142), False, 'import frappe\n'), ((176, 238), 'frappe.db.get_value', 'frappe.db.get_value', (['doctype', 'name', "(meta.ti... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import collections
import threading
import sys
import os
import stat
import shutil
import fcntl
import termios
import struct
import copy
import signal
import time
import fcntl
from functools import partial
this = sys.modules[__name__]
this.__progress_running = False
th... | [
"sys.stdout.write",
"functools.partial",
"time.time",
"os.environ.get",
"sys.stdout.isatty",
"sys.stdout.flush",
"signal.alarm",
"signal.signal"
] | [((351, 370), 'sys.stdout.isatty', 'sys.stdout.isatty', ([], {}), '()\n', (368, 370), False, 'import sys\n'), ((1145, 1163), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (1161, 1163), False, 'import sys\n'), ((1643, 1661), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (1659, 1661), False, 'impo... |
#!/usr/bin/env python
# This Software (Dioptra) is being made available as a public service by the
# National Institute of Standards and Technology (NIST), an Agency of the United
# States Department of Commerce. This software was developed in part by employees of
# NIST and in part by NIST contractors. Copyright in po... | [
"mlflow.start_run",
"pathlib.Path.cwd",
"mitre.securingai.sdk.utilities.logging.configure_structlog",
"mitre.securingai.sdk.utilities.logging.StderrLogStream",
"click.option",
"prefect.utilities.logging.get_logger",
"mitre.securingai.sdk.utilities.logging.set_logging_level",
"click.command",
"mitre.... | [((2350, 2379), 'structlog.stdlib.get_logger', 'structlog.stdlib.get_logger', ([], {}), '()\n', (2377, 2379), False, 'import structlog\n'), ((2751, 2766), 'click.command', 'click.command', ([], {}), '()\n', (2764, 2766), False, 'import click\n'), ((2984, 3115), 'click.option', 'click.option', (['"""--image-size"""'], {... |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2018
# <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either ... | [
"telegram.InputTextMessageContent",
"telegram.InlineQueryResultVoice",
"telegram.InlineKeyboardButton",
"pytest.fixture",
"telegram.InlineQueryResultLocation"
] | [((954, 983), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""class"""'}), "(scope='class')\n", (968, 983), False, 'import pytest\n'), ((1031, 1597), 'telegram.InlineQueryResultLocation', 'InlineQueryResultLocation', (['TestInlineQueryResultLocation.id', 'TestInlineQueryResultLocation.latitude', 'TestInlineQuery... |
# -*- coding: utf-8 -*-
# Copyright 2019 <NAME>
# https://www.tu-ilmenau.de/it-ems/
#
# 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
#
# ... | [
"subprocess.Popen",
"os.path.dirname",
"os.path.exists",
"re.match",
"os.path.isfile"
] | [((2334, 2360), 'os.path.isfile', 'os.path.isfile', (['""".version"""'], {}), "('.version')\n", (2348, 2360), False, 'import os\n'), ((3809, 3856), 're.match', 're.match', (['"""[.+\\\\d+]+\\\\d*[abr]\\\\d*"""', 'fullVersion'], {}), "('[.+\\\\d+]+\\\\d*[abr]\\\\d*', fullVersion)\n", (3817, 3856), False, 'import re\n'),... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2016 PPMessage.
# <NAME>, <EMAIL>.
# All rights reserved
#
# db/sqlpsql.py
#
from .sqlnone import SqlNone
from ppmessage.core.constant import SQL
from ppmessage.core.singleton import singleton
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm import scoped_sess... | [
"sqlalchemy.create_engine"
] | [((1214, 1254), 'sqlalchemy.create_engine', 'create_engine', (['db_string'], {'echo_pool': '(True)'}), '(db_string, echo_pool=True)\n', (1227, 1254), False, 'from sqlalchemy import create_engine\n')] |
# see ()[https://stackoverflow.com/a/40749716]
from xml.dom.minidom import parseString
html_string = """
<!DOCTYPE html>
<html><head><title>title</title></head><body><p>test</p></body></html>
"""
# extract the text value of the document's <p> tag:
doc = parseString(html_string)
paragraph = doc.getElementsByTagName("... | [
"xml.dom.minidom.parseString"
] | [((257, 281), 'xml.dom.minidom.parseString', 'parseString', (['html_string'], {}), '(html_string)\n', (268, 281), False, 'from xml.dom.minidom import parseString\n')] |
import joblib
import numpy as np
import pandas as pd
np.random.seed(0)
df_tracks = pd.read_hdf('df_data/df_tracks.hdf')
df_playlists = pd.read_hdf('df_data/df_playlists.hdf')
df_playlists_info = pd.read_hdf('df_data/df_playlists_info.hdf')
df_playlists_test = pd.read_hdf('df_data/df_playlists_test.hdf')
df_playlists_... | [
"numpy.random.seed",
"pandas.read_hdf",
"joblib.dump",
"numpy.hstack",
"numpy.random.choice",
"pandas.concat"
] | [((54, 71), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (68, 71), True, 'import numpy as np\n'), ((85, 121), 'pandas.read_hdf', 'pd.read_hdf', (['"""df_data/df_tracks.hdf"""'], {}), "('df_data/df_tracks.hdf')\n", (96, 121), True, 'import pandas as pd\n'), ((137, 176), 'pandas.read_hdf', 'pd.read_hdf'... |
"""
This module is special.
``Reader`` does not produce ``ReaderBasedN`` interface as other containers.
Because ``Reader`` can be used with two or three type arguments:
- ``RequiresContext[value, env]``
- ``RequiresContextResult[value, error, env]``
Because the second type argument changes its meaning
based on the u... | [
"typing.TypeVar"
] | [((1170, 1191), 'typing.TypeVar', 'TypeVar', (['"""_FirstType"""'], {}), "('_FirstType')\n", (1177, 1191), False, 'from typing import TYPE_CHECKING, Any, Callable, Type, TypeVar\n'), ((1206, 1228), 'typing.TypeVar', 'TypeVar', (['"""_SecondType"""'], {}), "('_SecondType')\n", (1213, 1228), False, 'from typing import TY... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 8 17:03:07 2018
@author: jeremiasknoblauch
Description: Plots pics from Air Pollution Data London
"""
import csv
import numpy as np
from Evaluation_tool import EvaluationTool
from matplotlib import pyplot as plt
import matplotlib.dates as mdates
... | [
"Evaluation_tool.EvaluationTool",
"csv.reader",
"numpy.zeros",
"datetime.date",
"matplotlib.pyplot.subplots",
"numpy.var",
"numpy.mean",
"numpy.array",
"datetime.timedelta",
"numpy.linspace",
"numpy.where",
"matplotlib.pyplot.subplots_adjust",
"numpy.union1d"
] | [((4958, 4985), 'numpy.zeros', 'np.zeros', (['(T, num_stations)'], {}), '((T, num_stations))\n', (4966, 4985), True, 'import numpy as np\n'), ((5080, 5101), 'numpy.mean', 'np.mean', (['data'], {'axis': '(0)'}), '(data, axis=0)\n', (5087, 5101), True, 'import numpy as np\n'), ((8052, 8068), 'Evaluation_tool.EvaluationTo... |
#! usr/bin/env python
from math import sqrt
for run in range(6):
file1 = open("../data/times_just_C_run_{}.txt".format(run))
file2 = open("../data/times_poy_processor_{}.txt".format(run))
C_times_str = file1.readlines()
POY_times_str = file2.readlines()
if len(C_times_str) < 11 or len(POY_time... | [
"math.sqrt"
] | [((1569, 1583), 'math.sqrt', 'sqrt', (['variance'], {}), '(variance)\n', (1573, 1583), False, 'from math import sqrt\n')] |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
import re
from . import SwedishLegalStore, Trips
class KommitteStore(SwedishLegalStore):
def basefile_to_pathfrag(self, basefile):
# "Ju 2012:01" ... | [
"re.compile"
] | [((805, 849), 're.compile', 're.compile', (['"""(\\\\w+ \\\\d{4}:\\\\w+)"""', 're.UNICODE'], {}), "('(\\\\w+ \\\\d{4}:\\\\w+)', re.UNICODE)\n", (815, 849), False, 'import re\n')] |
from wordsalad.input import split_germanic, group_words
import unittest
class TestTokenisation(unittest.TestCase):
def test_split_germanic_punctuation_treated_like_one_word(self):
txt = "abc. def.,"
res = list(split_germanic(txt))
self.assertListEqual(["abc", ".", "def", ".", ","], r... | [
"wordsalad.input.split_germanic",
"wordsalad.input.group_words"
] | [((2194, 2231), 'wordsalad.input.group_words', 'group_words', (['words'], {'size': '(3)', 'empty': '"""E"""'}), "(words, size=3, empty='E')\n", (2205, 2231), False, 'from wordsalad.input import split_germanic, group_words\n'), ((2498, 2513), 'wordsalad.input.group_words', 'group_words', (['[]'], {}), '([])\n', (2509, 2... |
r"""Summary objects at the end of training procedures."""
import numpy as np
import pickle
import torch
class TrainingSummary:
def __init__(self,
model_best,
model_final,
epochs,
epoch_best,
losses_train,
losses_test=None,
identifier=None):
self.i... | [
"torch.save",
"torch.load",
"numpy.log"
] | [((927, 952), 'torch.save', 'torch.save', (['summary', 'path'], {}), '(summary, path)\n', (937, 952), False, 'import torch\n'), ((998, 1014), 'torch.load', 'torch.load', (['path'], {}), '(path)\n', (1008, 1014), False, 'import torch\n'), ((1855, 1879), 'numpy.log', 'np.log', (['self.losses_test'], {}), '(self.losses_te... |
from decimal import Decimal
from django.db import models
# Create your models here.
class Orders(models.Model):
order_id = models.CharField( max_length=200, blank=False, null=True, unique=True)
ship_date = models.DateField(auto_now_add=False, auto_now=False, null=True)
customer = models.CharField("Company Name",m... | [
"django.db.models.CharField",
"django.db.models.DecimalField",
"django.db.models.DateField",
"decimal.Decimal"
] | [((127, 196), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'blank': '(False)', 'null': '(True)', 'unique': '(True)'}), '(max_length=200, blank=False, null=True, unique=True)\n', (143, 196), False, 'from django.db import models\n'), ((211, 274), 'django.db.models.DateField', 'models.Dat... |
#!/usr/bin/env python
#
# Copyright 2021 CRS4 - Center for Advanced Studies, Research and Development
# in Sardinia
#
# 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.ap... | [
"lorem_text.lorem.words",
"random.choice"
] | [((1914, 1937), 'random.choice', 'random.choice', (['_actions'], {}), '(_actions)\n', (1927, 1937), False, 'import random\n'), ((1374, 1388), 'lorem_text.lorem.words', 'lorem.words', (['(3)'], {}), '(3)\n', (1385, 1388), False, 'from lorem_text import lorem\n'), ((887, 905), 'lorem_text.lorem.words', 'lorem.words', (['... |
# -*- coding: UTF-8 -*-
# vim: set expandtab sw=4 ts=4 sts=4:
#
# phpMyAdmin web site
#
# Copyright (C) 2008 - 2016 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either vers... | [
"django.contrib.admin.site.register"
] | [((1449, 1489), 'django.contrib.admin.site.register', 'admin.site.register', (['Planet', 'PlanetAdmin'], {}), '(Planet, PlanetAdmin)\n', (1468, 1489), False, 'from django.contrib import admin\n'), ((1490, 1526), 'django.contrib.admin.site.register', 'admin.site.register', (['Post', 'PostAdmin'], {}), '(Post, PostAdmin)... |
from functools import reduce
import scipy.ndimage as nd
import numpy as np
def convert_to_img_frame(img, node_position, mesh, borders, settings):
local_node_pos = np.zeros((2, mesh.element_def.n_nodes), dtype=settings.precision)
# Partition image
image_frame = extract_subframe(img, borders, settings.pad)... | [
"numpy.meshgrid",
"numpy.ones_like",
"numpy.ceil",
"numpy.floor",
"numpy.zeros",
"numpy.einsum",
"numpy.min",
"numpy.max",
"numpy.where",
"numpy.arange",
"numpy.linspace",
"functools.reduce",
"scipy.ndimage.map_coordinates"
] | [((169, 234), 'numpy.zeros', 'np.zeros', (['(2, mesh.element_def.n_nodes)'], {'dtype': 'settings.precision'}), '((2, mesh.element_def.n_nodes), dtype=settings.precision)\n', (177, 234), True, 'import numpy as np\n'), ((624, 651), 'numpy.linspace', 'np.linspace', (['(0.0)', '(1.0)', 'seed'], {}), '(0.0, 1.0, seed)\n', (... |
import speech_recognition as sr
import re
TEXT_TO_NUMBER = {
'0': 0,
'zero': 0,
'1': 1,
'one': 1,
'2': 2,
'two': 2,
'to': 2,
'too': 2,
'3': 3,
'three': 3,
'tree': 3,
'4': 4,
'four': 4,
'for': 4,
'5': 5,
'five': 5,
}
def text_to_number(text, keyword):
... | [
"re.findall",
"speech_recognition.Recognizer",
"speech_recognition.Microphone"
] | [((610, 625), 'speech_recognition.Recognizer', 'sr.Recognizer', ([], {}), '()\n', (623, 625), True, 'import speech_recognition as sr\n'), ((645, 660), 'speech_recognition.Microphone', 'sr.Microphone', ([], {}), '()\n', (658, 660), True, 'import speech_recognition as sr\n'), ((494, 530), 're.findall', 're.findall', (["(... |
from urllib.parse import urlparse
import requests
import re
def url_syntax(url_changes):
url_search_http = re.search("http", url_changes)
if url_search_http is None:
url_http = "http://" + url_changes
else:
url_http = url_changes
return url_http # Returns the url with 'http://... | [
"urllib.parse.urlparse",
"re.search",
"requests.get"
] | [((117, 147), 're.search', 're.search', (['"""http"""', 'url_changes'], {}), "('http', url_changes)\n", (126, 147), False, 'import re\n'), ((734, 755), 'requests.get', 'requests.get', ([], {'url': 'URL'}), '(url=URL)\n', (746, 755), False, 'import requests\n'), ((623, 638), 'urllib.parse.urlparse', 'urlparse', (['check... |
import pytest
from mixer.backend.django import mixer
from projects.models import Project, ProjectMembership
from users.models import User
@pytest.mark.django_db
class TestProject:
def test_project_create(self):
user = mixer.blend(User, username='test')
proj = mixer.blend(Project, owner = user)
... | [
"mixer.backend.django.mixer.blend"
] | [((232, 266), 'mixer.backend.django.mixer.blend', 'mixer.blend', (['User'], {'username': '"""test"""'}), "(User, username='test')\n", (243, 266), False, 'from mixer.backend.django import mixer\n'), ((282, 314), 'mixer.backend.django.mixer.blend', 'mixer.blend', (['Project'], {'owner': 'user'}), '(Project, owner=user)\n... |
from .Crop import Crop
from .Gaussian_blur import Gaussian_blur
from .Gaussian_noise import Gaussian_noise
from .Jpeg_compression import JpegCompression
from .Combination import Combination_attack
import torch
def attack_initializer(attack_method, is_train):
if (attack_method == 'Crop'):
attack = Crop([0.... | [
"torch.cuda.is_available"
] | [((672, 697), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (695, 697), False, 'import torch\n'), ((839, 864), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (862, 864), False, 'import torch\n')] |
import zipfile
import pandas as pd
"""
Lay of the land:
"""
class UserHandler(object):
# This Object is used to access the directory that saves the results
def __init__(self, user_directory_path, pathToMixture):
self.user_directory_path = user_directory_path
self.username = None
sel... | [
"zipfile.is_zipfile",
"zipfile.ZipFile"
] | [((505, 537), 'zipfile.is_zipfile', 'zipfile.is_zipfile', (['zipfile_path'], {}), '(zipfile_path)\n', (523, 537), False, 'import zipfile\n'), ((560, 594), 'zipfile.ZipFile', 'zipfile.ZipFile', (['zipfile_path', '"""r"""'], {}), "(zipfile_path, 'r')\n", (575, 594), False, 'import zipfile\n')] |
# -*- coding: utf-8 -*-
import os
import random
from torch.utils.data import Dataset
from PIL import Image
import numpy as np
from datasets.data_io import get_transform, read_all_lines
from datasets.data_io import *
import torchvision.transforms as transforms
import torch
import torch.nn as nn
class LapaPngPng(Da... | [
"torchvision.transforms.ColorJitter",
"torch.ones",
"torch.stack",
"random.randint",
"datasets.data_io.read_all_lines",
"torchvision.transforms.ToTensor",
"PIL.Image.open",
"torch.squeeze",
"torch.clamp",
"numpy.array",
"torch.rand",
"torchvision.transforms.Resize",
"os.path.join",
"torch.... | [((1218, 1247), 'datasets.data_io.read_all_lines', 'read_all_lines', (['list_filename'], {}), '(list_filename)\n', (1232, 1247), False, 'from datasets.data_io import get_transform, read_all_lines\n'), ((2742, 2775), 'torch.clamp', 'torch.clamp', (['left_image_aug', '(0)', '(1)'], {}), '(left_image_aug, 0, 1)\n', (2753,... |
import os
import logging
import argparse
TMP_ARTIFACTS = '/tmp_artifacts'
X_TRAIN_FILENAME = os.path.join(TMP_ARTIFACTS, 'x_train.npy')
TRAIN_DF_FILENAME = os.path.join(TMP_ARTIFACTS, 'train.pkl')
TRAIN_DF_HTML_FILENAME = os.path.join(TMP_ARTIFACTS, 'train.html')
TEST_PRED_DF_FILENAME = os.path.join(TMP_ARTIFACTS,... | [
"os.path.join",
"argparse.ArgumentParser",
"logging.basicConfig"
] | [((96, 138), 'os.path.join', 'os.path.join', (['TMP_ARTIFACTS', '"""x_train.npy"""'], {}), "(TMP_ARTIFACTS, 'x_train.npy')\n", (108, 138), False, 'import os\n'), ((160, 200), 'os.path.join', 'os.path.join', (['TMP_ARTIFACTS', '"""train.pkl"""'], {}), "(TMP_ARTIFACTS, 'train.pkl')\n", (172, 200), False, 'import os\n'), ... |
# Confidential, Copyright 2020, Sony Corporation of America, All rights reserved.
from typing import List, Optional, Sequence, Union
import numpy as np
from tqdm import trange
from .setup_sim_env import make_gym_env
from ..data.interfaces import ExperimentDataSaver, StageSchedule
from ..environment import PandemicSi... | [
"numpy.random.RandomState",
"tqdm.trange"
] | [((1163, 1197), 'numpy.random.RandomState', 'np.random.RandomState', (['random_seed'], {}), '(random_seed)\n', (1184, 1197), True, 'import numpy as np\n'), ((1810, 1859), 'tqdm.trange', 'trange', (['max_episode_length'], {'desc': '"""Simulating day"""'}), "(max_episode_length, desc='Simulating day')\n", (1816, 1859), F... |
import torch
import torch.nn.functional as F
from torch.nn import Linear
from torch_geometric.nn import global_add_pool
class DeepMultisets(torch.nn.Module):
def __init__(self, dim_features, dim_target, config):
super(DeepMultisets, self).__init__()
hidden_units = config['hidden_units']
... | [
"torch_geometric.nn.global_add_pool",
"torch.nn.Linear"
] | [((338, 372), 'torch.nn.Linear', 'Linear', (['dim_features', 'hidden_units'], {}), '(dim_features, hidden_units)\n', (344, 372), False, 'from torch.nn import Linear\n'), ((399, 433), 'torch.nn.Linear', 'Linear', (['hidden_units', 'hidden_units'], {}), '(hidden_units, hidden_units)\n', (405, 433), False, 'from torch.nn ... |
from pytest import fail, mark, yield_fixture, raises
try:
# in case of PyPI installation, this will work:
from giftgrab.tests.utils import FileChecker
except ImportError:
# in case of installation from source, this will work:
from utils import FileChecker
from time import sleep
from pygiftgrab import Vi... | [
"utils.FileChecker",
"pytest.yield_fixture",
"pygiftgrab.VideoSourceFactory.get_instance",
"time.sleep",
"pytest.raises",
"pytest.mark.usefixtures"
] | [((443, 473), 'pytest.yield_fixture', 'yield_fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (456, 473), False, 'from pytest import fail, mark, yield_fixture, raises\n'), ((840, 869), 'pytest.mark.usefixtures', 'mark.usefixtures', (['"""peri_test"""'], {}), "('peri_test')\n", (856, 869), False, 'from... |
VERSION = "1.0.0"
HOST = "192.168.1.217"
PORT = 4578
CERT = "cert.pem"
KEY = "priv.key"
RESTARTS = 5
TARGET_SERVER = "mc.koolkidz.club"
API_URL = "https://api.mcsrvstat.us/2/" + TARGET_SERVER
print("\n----------------------------------------------")
print("Command SSL Socket Server", VERSION)
print("-------------------... | [
"threading.Thread",
"threading.Thread.__init__",
"ssl.SSLContext",
"socket.socket",
"IPR.checkIP",
"time.sleep",
"logging.config.fileConfig",
"logging.getLogger"
] | [((685, 772), 'logging.config.fileConfig', 'logging.config.fileConfig', ([], {'fname': '"""log_config.conf"""', 'disable_existing_loggers': '(False)'}), "(fname='log_config.conf', disable_existing_loggers\n =False)\n", (710, 772), False, 'import logging\n'), ((774, 799), 'logging.getLogger', 'logging.getLogger', (['... |
import numpy as np
from math import *
from interpolation import InterpVec
class Target(object):
@classmethod
def get_simple_target(cls, pos, vel):
velocity_vectors = [[0, np.array(vel)]]
vel_interp = InterpVec(velocity_vectors)
target = cls(vel_interp=vel_interp)
paramet... | [
"interpolation.InterpVec",
"numpy.array",
"numpy.degrees",
"numpy.sqrt"
] | [((233, 260), 'interpolation.InterpVec', 'InterpVec', (['velocity_vectors'], {}), '(velocity_vectors)\n', (242, 260), False, 'from interpolation import InterpVec\n'), ((336, 365), 'numpy.array', 'np.array', (['[pos[0], pos[1], 0]'], {}), '([pos[0], pos[1], 0])\n', (344, 365), True, 'import numpy as np\n'), ((831, 861),... |
import unittest
import json
from tornado.websocket import websocket_connect
from tornado import gen
from malcolm.core import Process, call_with_params, Queue, Context, \
ResponseError
from malcolm.modules.builtin.blocks import proxy_block
from malcolm.modules.demo.blocks import hello_block, counter_block
from mal... | [
"malcolm.core.call_with_params",
"json.loads",
"json.dumps",
"malcolm.core.Queue",
"malcolm.core.Process",
"tornado.websocket.websocket_connect"
] | [((511, 526), 'malcolm.core.Process', 'Process', (['"""proc"""'], {}), "('proc')\n", (518, 526), False, 'from malcolm.core import Process, call_with_params, Queue, Context, ResponseError\n'), ((548, 604), 'malcolm.core.call_with_params', 'call_with_params', (['hello_block', 'self.process'], {'mri': '"""hello"""'}), "(h... |
"""
IPYthon Magics Extension to play audio without displaying the audio widget.
"""
from yaserver import QUOTES_LOCATION, YASERVER_URI
import os
import random
import pathlib
import inspect
from typing import Optional
from IPython import get_ipython
from IPython.display import Audio, display
from IPython.core.magic i... | [
"random.choice",
"IPython.display.display",
"IPython.core.magic_arguments.magic_arguments",
"IPython.core.magic_arguments.parse_argstring",
"IPython.core.ultratb.AutoFormattedTB",
"IPython.core.magic_arguments.argument",
"os.listdir"
] | [((821, 863), 'IPython.core.ultratb.AutoFormattedTB', 'AutoFormattedTB', ([], {'mode': '"""Plain"""', 'tb_offset': '(1)'}), "(mode='Plain', tb_offset=1)\n", (836, 863), False, 'from IPython.core.ultratb import AutoFormattedTB\n'), ((1528, 1545), 'IPython.core.magic_arguments.magic_arguments', 'magic_arguments', ([], {}... |
import tensorflow as tf
import readcifar10
slim = tf.contrib.slim
import os
import resnet
# 定义网络结构
# image:一张图像
# 返回10维的向量
def model(image, keep_prob=0.8, is_training=True):
batch_norm_params = {
"is_training": is_training,
"epsilon": 1e-5, # 防止除以0
"decay": 0.997, # 衰减系数
'scale':... | [
"os.mkdir",
"tensorflow.train.Coordinator",
"tensorflow.get_collection",
"tensorflow.local_variables_initializer",
"tensorflow.global_variables",
"tensorflow.Variable",
"tensorflow.train.latest_checkpoint",
"tensorflow.add_n",
"os.path.exists",
"tensorflow.placeholder",
"tensorflow.cast",
"ten... | [((1977, 2030), 'tensorflow.get_collection', 'tf.get_collection', (['tf.GraphKeys.REGULARIZATION_LOSSES'], {}), '(tf.GraphKeys.REGULARIZATION_LOSSES)\n', (1994, 2030), True, 'import tensorflow as tf\n'), ((2059, 2076), 'tensorflow.add_n', 'tf.add_n', (['reg_set'], {}), '(reg_set)\n', (2067, 2076), True, 'import tensorf... |
from django.contrib import admin
from . import models
class UserFieldFilter(admin.ModelAdmin):
fields = ['role']
admin.site.register(models.User, UserFieldFilter)
admin.site.register(models.Role)
| [
"django.contrib.admin.site.register"
] | [((121, 170), 'django.contrib.admin.site.register', 'admin.site.register', (['models.User', 'UserFieldFilter'], {}), '(models.User, UserFieldFilter)\n', (140, 170), False, 'from django.contrib import admin\n'), ((171, 203), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Role'], {}), '(models.Rol... |
import pytest
from gitlabform import EXIT_INVALID_INPUT
from gitlabform.configuration.projects_and_groups import ConfigurationProjectsAndGroups
from gitlabform.filter import NonEmptyConfigsProvider
def test_error_on_missing_key():
config_yaml = """
---
# no key at all
"""
with pytest.raises(Syst... | [
"pytest.raises",
"gitlabform.configuration.projects_and_groups.ConfigurationProjectsAndGroups",
"gitlabform.filter.NonEmptyConfigsProvider"
] | [((302, 327), 'pytest.raises', 'pytest.raises', (['SystemExit'], {}), '(SystemExit)\n', (315, 327), False, 'import pytest\n'), ((358, 415), 'gitlabform.configuration.projects_and_groups.ConfigurationProjectsAndGroups', 'ConfigurationProjectsAndGroups', ([], {'config_string': 'config_yaml'}), '(config_string=config_yaml... |
import logging
from cliff import command
from smiley import db
from smiley import output
class Show(command.Command):
"""Show the details of one run.
Includes summaries of the thread resource consumption, when
multiple threads are present.
"""
log = logging.getLogger(__name__)
def get_par... | [
"smiley.db.DB",
"smiley.output.dump_dictionary",
"logging.getLogger"
] | [((276, 303), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (293, 303), False, 'import logging\n'), ((742, 769), 'smiley.db.DB', 'db.DB', (['parsed_args.database'], {}), '(parsed_args.database)\n', (747, 769), False, 'from smiley import db\n'), ((1148, 1197), 'smiley.output.dump_dictiona... |
# encoding:utf-8
"""
@Time : 2020-05-22 21:14
@Author : <EMAIL>
@File : rnn-start.py
@Software: PyCharm
"""
import d2lzh as d2l
import math
from mxnet import autograd, nd
from mxnet.gluon import loss as gloss
import time
def to_onehot(X, size):
return [nd.one_hot(x, size) for x in X.T]
def get_params():
... | [
"math.exp",
"mxnet.autograd.record",
"d2lzh.load_data_jay_lyrics",
"mxnet.gluon.loss.SoftmaxCrossEntropyLoss",
"mxnet.nd.zeros",
"mxnet.nd.one_hot",
"mxnet.nd.random.normal",
"time.time",
"mxnet.nd.arange",
"mxnet.nd.concat",
"mxnet.nd.array",
"mxnet.nd.dot",
"d2lzh.sgd",
"d2lzh.try_gpu"
] | [((505, 535), 'mxnet.nd.zeros', 'nd.zeros', (['num_hiddens'], {'ctx': 'ctx'}), '(num_hiddens, ctx=ctx)\n', (513, 535), False, 'from mxnet import autograd, nd\n'), ((591, 621), 'mxnet.nd.zeros', 'nd.zeros', (['num_outputs'], {'ctx': 'ctx'}), '(num_outputs, ctx=ctx)\n', (599, 621), False, 'from mxnet import autograd, nd\... |
from dataclasses import dataclass, field
from decimal import Decimal
from enum import Enum
from typing import Dict, List, Optional, Union
from xsdata.models.datatype import XmlDate
from models.xlink import TypeType
from models.xml import LangValue
__NAMESPACE__ = "http://www.w3.org/XML/2004/xml-schema-test-suite/"
c... | [
"dataclasses.field"
] | [((2042, 2093), 'dataclasses.field', 'field', ([], {'default': 'None', 'metadata': "{'type': 'Attribute'}"}), "(default=None, metadata={'type': 'Attribute'})\n", (2047, 2093), False, 'from dataclasses import dataclass, field\n'), ((2178, 2266), 'dataclasses.field', 'field', ([], {'default_factory': 'dict', 'metadata': ... |
import sublime
# Settings variables
try:
from . import settings as S
except:
import settings as S
def load_project_values():
try:
settings = sublime.active_window().active_view().settings()
# Use 'xdebug' as key which contains dictionary with project values for package
S.CONFIG_PR... | [
"sublime.active_window",
"sublime.load_settings"
] | [((528, 574), 'sublime.load_settings', 'sublime.load_settings', (['S.FILE_PACKAGE_SETTINGS'], {}), '(S.FILE_PACKAGE_SETTINGS)\n', (549, 574), False, 'import sublime\n'), ((1490, 1536), 'sublime.load_settings', 'sublime.load_settings', (['S.FILE_PACKAGE_SETTINGS'], {}), '(S.FILE_PACKAGE_SETTINGS)\n', (1511, 1536), False... |
import argparse
import codecs
parser = argparse.ArgumentParser(description='Conveter of the Google sentence compression dataset')
parser.add_argument("-s", "--sent-file", dest="file_sent", type=str, help="path to the sentence file")
parser.add_argument("-p", "--pos-file", dest="file_pos", type=str, help="path to the p... | [
"codecs.open",
"argparse.ArgumentParser"
] | [((40, 135), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Conveter of the Google sentence compression dataset"""'}), "(description=\n 'Conveter of the Google sentence compression dataset')\n", (63, 135), False, 'import argparse\n'), ((567, 616), 'codecs.open', 'codecs.open', (['opts... |
from django.shortcuts import render
from accounts.models import Member
from search.models import Image, Tag, Category
import datetime
def parse_tags(tag, img):
data = tag.split(',')
for d in data:
num_records = Tag.objects.filter(tag_name__iexact=d).count()
if num_records == 0:
... | [
"search.models.Image.objects.filter",
"datetime.date.today",
"accounts.models.Member.objects.get",
"search.models.Tag.objects.get",
"django.shortcuts.render",
"search.models.Tag.objects.filter"
] | [((513, 563), 'accounts.models.Member.objects.get', 'Member.objects.get', ([], {'username': 'request.user.username'}), '(username=request.user.username)\n', (531, 563), False, 'from accounts.models import Member\n'), ((676, 697), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (695, 697), False, 'import... |
import os
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import time
from collections import namedtuple
import caffe
from lib import run_net
from lib import score_util
from datasets.pascal_voc import Pascal
PV = Pascal('C:\\ALISURE\\Data\\voc\\VOCdevkit\\VOC2012')
val_set = PV.get_data_se... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.imshow",
"numpy.zeros",
"matplotlib.pyplot.axis",
"datasets.pascal_voc.Pascal",
"matplotlib.pyplot.figure",
"lib.score_util.score_out_gt",
"collections.namedtuple",
"lib.score_util.score_out_gt_bdry",
"PIL.Image.fromarray",
"caffe.Net",
"lib.score_u... | [((243, 295), 'datasets.pascal_voc.Pascal', 'Pascal', (['"""C:\\\\ALISURE\\\\Data\\\\voc\\\\VOCdevkit\\\\VOC2012"""'], {}), "('C:\\\\ALISURE\\\\Data\\\\voc\\\\VOCdevkit\\\\VOC2012')\n", (249, 295), False, 'from datasets.pascal_voc import Pascal\n'), ((1270, 1338), 'collections.namedtuple', 'namedtuple', (['"""Method"""... |
import os
import pytest
from itertools import combinations
from compas.datastructures import Network
from coop_assembly.help_functions import find_point_id
from coop_assembly.help_functions import find_point_id, tet_surface_area, \
tet_volume, distance_point_triangle
from coop_assembly.geometry_generation.tet_seq... | [
"coop_assembly.geometry_generation.execute.execute_from_points",
"compas.datastructures.Network.from_data",
"coop_assembly.geometry_generation.tet_sequencing.point2point_shortest_distance_tet_sequencing",
"os.path.dirname",
"coop_assembly.geometry_generation.tet_sequencing.point2triangle_tet_sequencing",
... | [((1068, 1124), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""test_set_name"""', "['YJ_12_bars']"], {}), "('test_set_name', ['YJ_12_bars'])\n", (1091, 1124), False, 'import pytest\n'), ((1128, 1169), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""radius"""', '[3.17]'], {}), "('radius', [3.17]... |
""" This function saves figures in PNG format.
from etutils.viz.savefig import savefig
A=savefig(data, <optional>)
INPUT:
data: fig object
OPTIONAL
OUTPUT
BOOLEAN
[0]: If not succesful
[1]: If succesful
DESCRIPTION
This function saves figures in PNG format.
EXAMPLE
from e... | [
"os.mkdir",
"os.path.split",
"os.path.exists"
] | [((1188, 1217), 'os.path.split', 'path.split', (["Param['filepath']"], {}), "(Param['filepath'])\n", (1198, 1217), False, 'from os import path\n'), ((1229, 1249), 'os.path.exists', 'path.exists', (['getpath'], {}), '(getpath)\n', (1240, 1249), False, 'from os import path\n'), ((1270, 1284), 'os.mkdir', 'mkdir', (['getp... |
from app.models import db
from app.models.projects import Project
class Team(db.Model):
__tablename__ = 'teams'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String)
logo = db.Column(db.String)
tokens = db.Column(db.Integer)
description = db.Column(db.String)
id_assign... | [
"app.models.db.Column",
"app.models.db.ForeignKey",
"app.models.db.relationship"
] | [((128, 167), 'app.models.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (137, 167), False, 'from app.models import db\n'), ((179, 199), 'app.models.db.Column', 'db.Column', (['db.String'], {}), '(db.String)\n', (188, 199), False, 'from app.models import db\n')... |
#!/usr/bin/env python3
import os
from fetch import fetch
def main():
ip_list = fetch()
print('# PKU free ip')
for ip, _, netmask in ip_list:
print('route', ip, netmask, 'net_gateway')
if __name__ == '__main__':
main()
| [
"fetch.fetch"
] | [((87, 94), 'fetch.fetch', 'fetch', ([], {}), '()\n', (92, 94), False, 'from fetch import fetch\n')] |
from django.urls import path
from core import views
app_name = 'core'
urlpatterns = [
path('', views.index, name='index'),
path('noticias/', views.noticiaListView.as_view(), name='noticiaListView'),
path('noticias/new/', views.noticiaCadastro, name='noticiaCadastro'),
path('noticias/<int:id>/', views.noticiaDetal... | [
"core.views.noticiaListView.as_view",
"django.urls.path"
] | [((88, 123), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (92, 123), False, 'from django.urls import path\n'), ((204, 272), 'django.urls.path', 'path', (['"""noticias/new/"""', 'views.noticiaCadastro'], {'name': '"""noticiaCadastro"""'}), "('noti... |
import os.path as path
import sys
import numpy as np
thisdir = path.dirname(path.realpath(__file__))
sys.path.append(path.join(thisdir, '..'))
import dataset
import model
from graph_server import GraphServer
name = sys.argv[1]
build_dir = path.join(thisdir, '..', 'outputs', 'builds')
clusters = model.load(path.jo... | [
"graph_server.GraphServer",
"os.path.realpath",
"os.path.join",
"dataset.news.fetch"
] | [((244, 289), 'os.path.join', 'path.join', (['thisdir', '""".."""', '"""outputs"""', '"""builds"""'], {}), "(thisdir, '..', 'outputs', 'builds')\n", (253, 289), True, 'import os.path as path\n'), ((506, 532), 'dataset.news.fetch', 'dataset.news.fetch', (['(100000)'], {}), '(100000)\n', (524, 532), False, 'import datase... |
#!/usr/bin/env python3
from pygmy.core.initialize import initialize
initialize()
from pygmy.rest.manage import app
if __name__ == '__main__':
app.run()
| [
"pygmy.rest.manage.app.run",
"pygmy.core.initialize.initialize"
] | [((68, 80), 'pygmy.core.initialize.initialize', 'initialize', ([], {}), '()\n', (78, 80), False, 'from pygmy.core.initialize import initialize\n'), ((147, 156), 'pygmy.rest.manage.app.run', 'app.run', ([], {}), '()\n', (154, 156), False, 'from pygmy.rest.manage import app\n')] |
from django.conf import settings
from django.http import HttpResponse
from rest_framework import generics, status
from rest_framework.response import Response
from rest_framework.decorators import api_view, permission_classes
from datachimp.models.machinelearning_model import MachineLearningModel
from datachimp.model... | [
"datachimp.models.machinelearning_model.MachineLearningModel.objects.get",
"datachimp.models.machinelearning_model.MachineLearningModel.objects.all",
"datachimp.models.machinelearning_model.MachineLearningModel.objects.select_related",
"datachimp.utils.data_utils.execute_query",
"datachimp.serializers.machi... | [((2651, 2668), 'rest_framework.decorators.api_view', 'api_view', (["['GET']"], {}), "(['GET'])\n", (2659, 2668), False, 'from rest_framework.decorators import api_view, permission_classes\n'), ((2670, 2729), 'rest_framework.decorators.permission_classes', 'permission_classes', (['(HasProjectMembership, IsAuthenticated... |
"""camera_fusion CameraCorrected class tests."""
import cv2
import os
import sys
import filecmp
import pytest
import numpy as np
import shutil
import time
import unittest.mock as mock
sys.path.insert(
0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import camera_fusion # noqa
class Vc(object... | [
"numpy.load",
"numpy.save",
"shutil.copytree",
"shutil.rmtree",
"os.path.isdir",
"numpy.testing.assert_array_equal",
"os.path.dirname",
"time.sleep",
"unittest.mock.patch",
"camera_fusion.CameraCorrected",
"numpy.array",
"numpy.testing.assert_allclose"
] | [((1520, 1556), 'camera_fusion.CameraCorrected', 'camera_fusion.CameraCorrected', (['(0)', '(11)'], {}), '(0, 11)\n', (1549, 1556), False, 'import camera_fusion\n'), ((1690, 1715), 'numpy.array', 'np.array', (['[[1], [0], [0]]'], {}), '([[1], [0], [0]])\n', (1698, 1715), True, 'import numpy as np\n'), ((1727, 1752), 'n... |
from sqlalchemy.engine import create_engine
from sqlalchemy.orm.session import Session
def setup_module():
global transaction, connection, engine
# Connect to the database and create the schema within a transaction
engine = create_engine('postgresql:///yourdb')
connection = engine.connect()
tran... | [
"sqlalchemy.orm.session.Session",
"sqlalchemy.engine.create_engine"
] | [((240, 277), 'sqlalchemy.engine.create_engine', 'create_engine', (['"""postgresql:///yourdb"""'], {}), "('postgresql:///yourdb')\n", (253, 277), False, 'from sqlalchemy.engine import create_engine\n'), ((701, 720), 'sqlalchemy.orm.session.Session', 'Session', (['connection'], {}), '(connection)\n', (708, 720), False, ... |
import base64
import json
import logging
import mimetypes
import email.encoders as encoder
import socket
from email.mime.audio import MIMEAudio
from email.mime.base import MIMEBase
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from django.con... | [
"json.loads",
"email.mime.text.MIMEText",
"email.mime.base.MIMEBase",
"email.encoders.encode_base64",
"email.mime.multipart.MIMEMultipart",
"socket.error",
"logging.getLogger",
"mimetypes.guess_type"
] | [((490, 517), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (507, 517), False, 'import logging\n'), ((2037, 2080), 'json.loads', 'json.loads', (['settings.GOOGLE_SERVICE_ACCOUNT'], {}), '(settings.GOOGLE_SERVICE_ACCOUNT)\n', (2047, 2080), False, 'import json\n'), ((2253, 2268), 'email.mi... |
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from mayan.apps.smart_settings.classes import Namespace
from .literals import DEFAULT_MAXIMUM_TITLE_LENGTH
namespace = Namespace(label=_('Appearance'), name='appearance')
setting_max_title_length = namespace.add_setting... | [
"django.utils.translation.ugettext_lazy"
] | [((235, 250), 'django.utils.translation.ugettext_lazy', '_', (['"""Appearance"""'], {}), "('Appearance')\n", (236, 250), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((425, 500), 'django.utils.translation.ugettext_lazy', '_', (['"""Maximum number of characters that will be displayed as the view t... |
"""
Functions to plot data using the `cartopy` library.
These require the `shapely` and `cartopy` libraries to be installed.
CartoPy is sometimes difficult to install.
"""
import numpy as N
from cartopy import crs, feature
from shapely.geometry import Polygon
from ..error.axes import hyperbolic_axes
from ..stereonet i... | [
"cartopy.crs.PlateCarree",
"numpy.diag",
"shapely.geometry.Polygon"
] | [((504, 513), 'numpy.diag', 'N.diag', (['d'], {}), '(d)\n', (510, 513), True, 'import numpy as N\n'), ((625, 674), 'shapely.geometry.Polygon', 'Polygon', (["sheets['upper']", "[sheets['lower'][::-1]]"], {}), "(sheets['upper'], [sheets['lower'][::-1]])\n", (632, 674), False, 'from shapely.geometry import Polygon\n'), ((... |
# Copyright 2021 Dynatrace LLC
#
# 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 t... | [
"collections.defaultdict",
"boto3.client"
] | [((966, 989), 'collections.defaultdict', 'defaultdict', (['(lambda : 0)'], {}), '(lambda : 0)\n', (977, 989), False, 'from collections import defaultdict\n'), ((1034, 1057), 'collections.defaultdict', 'defaultdict', (['(lambda : 0)'], {}), '(lambda : 0)\n', (1045, 1057), False, 'from collections import defaultdict\n'),... |
import argparse
import importlib
import os
from fairseq.models import MODEL_REGISTRY, ARCH_MODEL_INV_REGISTRY
# automatically import any Python files in the models/ directory
models_dir = os.path.dirname(__file__)
for file in os.listdir(models_dir):
path = os.path.join(models_dir, file)
if not file.startswith('_... | [
"argparse.ArgumentParser",
"importlib.import_module",
"os.path.isdir",
"os.path.dirname",
"os.path.join",
"os.listdir"
] | [((191, 216), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (206, 216), False, 'import os\n'), ((229, 251), 'os.listdir', 'os.listdir', (['models_dir'], {}), '(models_dir)\n', (239, 251), False, 'import os\n'), ((262, 292), 'os.path.join', 'os.path.join', (['models_dir', 'file'], {}), '(mode... |
# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"absl.flags.mark_flags_as_required",
"utils.convert_to_tfe",
"random.shuffle",
"absl.flags.DEFINE_string",
"absl.app.run",
"absl.flags.DEFINE_integer",
"tensorflow.io.TFRecordWriter",
"os.path.join"
] | [((987, 1046), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""gt_file"""', 'None', '"""Path to the GT file"""'], {}), "('gt_file', None, 'Path to the GT file')\n", (1006, 1046), False, 'from absl import flags\n'), ((1058, 1123), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""img_dir"""', 'None', '""... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-28 18:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0017_auto_20161123_2339'),
]
operations = [
migrations.CreateModel(... | [
"django.db.models.CharField",
"django.db.models.IntegerField",
"django.db.models.AutoField"
] | [((404, 497), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (420, 497), False, 'from django.db import migrations, models\... |
import matplotlib.pyplot as plot
import numpy as np
#Function to get x and y coordinates from the first 10 clicks, then close the image.
def onclick(event):
x.append(event.xdata)
y.append(event.ydata)
print(len(x))
xval = int(event.xdata)
yval = int(event.ydata)
print(str([xval,yval]))
if ... | [
"matplotlib.pyplot.show",
"numpy.linalg.lstsq",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.close",
"numpy.shape",
"numpy.array",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.gcf"
] | [((723, 739), 'matplotlib.pyplot.imshow', 'plot.imshow', (['dem'], {}), '(dem)\n', (734, 739), True, 'import matplotlib.pyplot as plot\n'), ((749, 759), 'matplotlib.pyplot.gca', 'plot.gca', ([], {}), '()\n', (757, 759), True, 'import matplotlib.pyplot as plot\n'), ((770, 780), 'matplotlib.pyplot.gcf', 'plot.gcf', ([], ... |
import logging
import coloredlogs
FORMAT = '[%(name)s] %(levelname)s:%(message)s'
FORMATTER = logging.Formatter(fmt=FORMAT)
def get_logger(name='default', level=logging.DEBUG, colored=False):
logger = logging.getLogger(name)
logger.propagate = False
logger.setLevel(level)
if not logger.handlers:
... | [
"logging.Formatter",
"logging.StreamHandler",
"coloredlogs.install",
"logging.getLogger"
] | [((96, 125), 'logging.Formatter', 'logging.Formatter', ([], {'fmt': 'FORMAT'}), '(fmt=FORMAT)\n', (113, 125), False, 'import logging\n'), ((209, 232), 'logging.getLogger', 'logging.getLogger', (['name'], {}), '(name)\n', (226, 232), False, 'import logging\n'), ((336, 359), 'logging.StreamHandler', 'logging.StreamHandle... |
## https://notes.desy.de/s/ljPrespZd#Infrastructure--Cluster-login
import torch
## for the code to work, install torchvision
## $ python -m pip install --user -I --no-deps torchvision
import torchvision
from torchvision import datasets, transforms
## NB: in case torchvision cannot be found inside a jupyter notebook, f... | [
"torch.nn.Dropout",
"torch.flatten",
"tensorboardX.SummaryWriter",
"torch.utils.data.DataLoader",
"torch.allclose",
"torch.nn.Conv2d",
"torch.cuda.device_count",
"torch.nn.Linear",
"pathlib.Path",
"torch.cuda.is_available",
"torch.nn.functional.max_pool2d",
"torch.nn.functional.log_softmax",
... | [((1023, 1096), 'torchvision.datasets.MNIST', 'datasets.MNIST', (['somepath'], {'download': '(True)', 'transform': 'transform_', 'train': '(True)'}), '(somepath, download=True, transform=transform_, train=True)\n', (1037, 1096), False, 'from torchvision import datasets, transforms\n'), ((1130, 1204), 'torchvision.datas... |
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource, Range1d, FuncTickFormatter, FixedTicker
from math import pi, floor
#ColourOptions = ["red","blue","green","black","yellow","purple"]
class Collision_BarChart(object):
def __init__(self, xVals, yVals, colours = None, width=None):
... | [
"bokeh.models.ColumnDataSource",
"bokeh.plotting.figure",
"math.floor",
"bokeh.models.Range1d",
"bokeh.models.FixedTicker"
] | [((1208, 1224), 'bokeh.plotting.figure', 'figure', ([], {'tools': '""""""'}), "(tools='')\n", (1214, 1224), False, 'from bokeh.plotting import figure\n'), ((2807, 2821), 'bokeh.models.Range1d', 'Range1d', (['(-1)', 'x'], {}), '(-1, x)\n', (2814, 2821), False, 'from bokeh.models import ColumnDataSource, Range1d, FuncTic... |
import sqlite3
MASTER_PASSWORD = "<PASSWORD>"
senha = input("Insira sua senha master: ")
if senha != MASTER_PASSWORD:
print("Senha inválida! Encerrando ...")
exit()
conn = sqlite3.connect('password.db')
cursor = conn.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS users(
service T... | [
"sqlite3.connect"
] | [((192, 222), 'sqlite3.connect', 'sqlite3.connect', (['"""password.db"""'], {}), "('password.db')\n", (207, 222), False, 'import sqlite3\n')] |
"""
Created on Nov 21, 2013
@author: <NAME>
In this module you can find the :class:`MyPlotGrid` which is just
a :class:`PyQt5.QtGui.QScrollArea` with some additions.
More important is the :class:`MyPlotContent`.
It shows an overview of many :class:`src.myplotwidget.MyPlotWidget`
and manages them.
"""
from pyqtgraph.... | [
"pyqtgraph.Qt.QtWidgets.QWidget.__init__",
"pyqtgraph.Qt.QtCore.pyqtSignal",
"pyqtgraph.Qt.QtWidgets.QGridLayout",
"pyqtgraph.Qt.QtCore.QSize",
"pyqtgraph.Qt.QtGui.QColor",
"swan.widgets.plot_widget.MyPlotWidget",
"swan.widgets.indicator_cell.IndicatorWidget",
"pyqtgraph.Qt.QtWidgets.QScrollArea",
"... | [((1593, 1624), 'pyqtgraph.Qt.QtCore.pyqtSignal', 'QtCore.pyqtSignal', (['object', 'bool'], {}), '(object, bool)\n', (1610, 1624), False, 'from pyqtgraph.Qt import QtCore, QtGui, QtWidgets\n'), ((1648, 1667), 'pyqtgraph.Qt.QtCore.pyqtSignal', 'QtCore.pyqtSignal', ([], {}), '()\n', (1665, 1667), False, 'from pyqtgraph.Q... |
# coding: utf-8
"""
Criteo API Transition Swagger
This is used to help Criteo clients transition from MAPI to Criteo API # noqa: E501
The version of the OpenAPI document: 1.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class PatchAdSet(objec... | [
"six.iteritems"
] | [((4475, 4508), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (4488, 4508), False, 'import six\n')] |
import pika
import config
class RabbitMq:
def __init__(self):
self.conn = None
self.channel = None
self.__config = config.RABBITMQ
self.__connect()
def __connect(self):
self.conn = pika.BlockingConnection(
pika.ConnectionParameters(
host=sel... | [
"pika.BasicProperties",
"pika.ConnectionParameters"
] | [((269, 322), 'pika.ConnectionParameters', 'pika.ConnectionParameters', ([], {'host': "self.__config['HOST']"}), "(host=self.__config['HOST'])\n", (294, 322), False, 'import pika\n'), ((672, 709), 'pika.BasicProperties', 'pika.BasicProperties', ([], {'delivery_mode': '(2)'}), '(delivery_mode=2)\n', (692, 709), False, '... |
from django import forms
from django_grapesjs.settings import BASE, GRAPESJS_DEFAULT_HTML, REDACTOR_CONFIG
from django_grapesjs.utils import apply_string_handling
from .widgets import GrapesJsWidget
__all__ = (
'GrapesJsField',
)
class GrapesJsField(forms.CharField):
'''
Form field with support grapesjs... | [
"django_grapesjs.utils.apply_string_handling"
] | [((1047, 1093), 'django_grapesjs.utils.apply_string_handling', 'apply_string_handling', (['value', '"""apply_tag_save"""'], {}), "(value, 'apply_tag_save')\n", (1068, 1093), False, 'from django_grapesjs.utils import apply_string_handling\n')] |
import base64
def base64_string(val):
if val is None or val == b'':
return None
return base64.b64encode(val).decode('utf-8')
def to_int(val):
if val is None:
return val
if val == b'':
return 0
if isinstance(val, bytes):
return int.from_bytes(val, 'big')
if isi... | [
"base64.b64encode"
] | [((105, 126), 'base64.b64encode', 'base64.b64encode', (['val'], {}), '(val)\n', (121, 126), False, 'import base64\n')] |
#!/usr/bin/env python3
"""
Script that logs into `google.com`
"""
from logging import debug
from typing import Generator
from selenium.common.exceptions import NoSuchElementException, TimeoutException
from selenium.webdriver.common.keys import Keys
from ..script import Script as BaseClass
URL = 'https://www.google.co... | [
"logging.debug"
] | [((739, 767), 'logging.debug', 'debug', (['"""going to login page"""'], {}), "('going to login page')\n", (744, 767), False, 'from logging import debug\n'), ((673, 704), 'logging.debug', 'debug', (['"""User already logged in"""'], {}), "('User already logged in')\n", (678, 704), False, 'from logging import debug\n'), (... |
from dataclasses import dataclass
from typing import cast
from fastapi import Request
__all__ = ['RequestAnalyzer']
@dataclass
class RequestAnalyzer:
request: Request
@property
def client_ip_address(self) -> str:
return cast(str, self.request.client.host)
@property
def client_user_age... | [
"typing.cast"
] | [((246, 281), 'typing.cast', 'cast', (['str', 'self.request.client.host'], {}), '(str, self.request.client.host)\n', (250, 281), False, 'from typing import cast\n')] |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Zyxel.MSAN.get_version
# ---------------------------------------------------------------------
# Copyright (C) 2007-2018 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------... | [
"re.compile"
] | [((605, 868), 're.compile', 're.compile', (['"""^\\\\s*product model\\\\s*:\\\\s+(?P<platform>\\\\S+)\\\\s*\\\\n^\\\\s*system up time\\\\s*:\\\\s+(?P<uptime>\\\\S+)\\\\s*\\\\n^\\\\s*f/w version\\\\s*:\\\\s+(?P<version>\\\\S+) \\\\| \\\\S+\\\\s*\\\\n^\\\\s*bootbase version\\\\s*:\\\\s+(?P<bootprom>\\\\S+) \\\\| \\\\S+\\... |
import open3d as o3d
import copy
import numpy as np
# Helper visualization function
def draw_registration_result(source, target, transformation):
source_temp = copy.deepcopy(source)
target_temp = copy.deepcopy(target)
source_temp.paint_uniform_color([1, 0.706, 0])
target_temp.paint_uniform_color([0, 0.... | [
"copy.deepcopy",
"numpy.asarray",
"open3d.io.read_point_cloud",
"open3d.visualization.draw_geometries",
"open3d.pipelines.registration.evaluate_registration",
"open3d.pipelines.registration.ICPConvergenceCriteria",
"open3d.pipelines.registration.TransformationEstimationPointToPoint",
"open3d.pipelines... | [((459, 518), 'open3d.io.read_point_cloud', 'o3d.io.read_point_cloud', (['"""../test_data/icp/cloud_bin_0.pcd"""'], {}), "('../test_data/icp/cloud_bin_0.pcd')\n", (482, 518), True, 'import open3d as o3d\n'), ((528, 587), 'open3d.io.read_point_cloud', 'o3d.io.read_point_cloud', (['"""../test_data/icp/cloud_bin_1.pcd"""'... |
"""
Developer : <NAME>
VER : 1.0
Data Source : https://api.covid19india.org/v4/data.json
"""
import urllib.request
import urllib.error
import json
import matplotlib.pyplot as plt
import numpy as np
import time
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
#Graph Plotting Function
def plo... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"json.loads",
"matplotlib.pyplot.yticks",
"time.strftime",
"PIL.Image.open",
"PIL.ImageFont.truetype",
"matplotlib.pyplot.barh",
"PIL.ImageDraw.Draw",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots",
"mat... | [((1789, 1814), 'time.strftime', 'time.strftime', (['"""%d-%m-%Y"""'], {}), "('%d-%m-%Y')\n", (1802, 1814), False, 'import time\n'), ((1916, 1934), 'json.loads', 'json.loads', (['output'], {}), '(output)\n', (1926, 1934), False, 'import json\n'), ((3404, 3430), 'PIL.Image.open', 'Image.open', (['"""template.png"""'], {... |
#!/usr/bin/env python3
"""
Author: <NAME>.
Included in TOGA by <NAME>.
"""
import argparse
import sys
from datetime import datetime as dt
from collections import defaultdict
try:
from modules.common import make_cds_track
from modules.common import flatten
except ImportError:
from common import make_cds_tra... | [
"argparse.ArgumentParser",
"collections.defaultdict",
"common.make_cds_track",
"datetime.datetime.now",
"sys.exit"
] | [((2706, 2731), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2729, 2731), False, 'import argparse\n'), ((3446, 3463), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (3457, 3463), False, 'from collections import defaultdict\n'), ((13333, 13341), 'datetime.datetime.now',... |
"""
pyjs9.py: connects Python and JS9 via the JS9 (back-end) helper
"""
from __future__ import print_function
import time
import json
import base64
import logging
from traceback import format_exc
from threading import Condition
from io import BytesIO
import requests
__all__ = ['JS9', 'js9Globals']
"""
pyjs9.py conn... | [
"pyfits.HDUList",
"io.BytesIO",
"logging.error",
"logging.debug",
"json.loads",
"socketio.Client",
"logging.warning",
"numpy.frombuffer",
"threading.Condition",
"time.sleep",
"logging.info",
"pyfits.PrimaryHDU",
"numpy.array",
"requests.post",
"numpy.ascontiguousarray",
"numpy.issubdty... | [((1775, 1813), 'logging.info', 'logging.info', (['"""set socketio transport"""'], {}), "('set socketio transport')\n", (1787, 1813), False, 'import logging\n'), ((1907, 1961), 'logging.info', 'logging.info', (['"""no python-socketio, use html transport"""'], {}), "('no python-socketio, use html transport')\n", (1919, ... |
#!/usr/bin/env python
from collections import defaultdict
from math import ceil
def solve(input):
def element(s):
n, el = s.split()
return (el, int(n))
def nxt(needs):
for el, n in needs.items():
if el != 'ORE' and n > 0:
return (el, n)
def ore_needed... | [
"collections.defaultdict",
"math.ceil"
] | [((341, 357), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (352, 357), False, 'from collections import defaultdict\n'), ((516, 537), 'math.ceil', 'ceil', (['(need / produces)'], {}), '(need / produces)\n', (520, 537), False, 'from math import ceil\n')] |
# -*- coding: utf-8 -*-
#
# Copyright (c) the purl authors
# SPDX-License-Identifier: MIT
#
# 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 t... | [
"packageurl.contrib.route.Router",
"packageurl.PackageURL.from_string"
] | [((1512, 1520), 'packageurl.contrib.route.Router', 'Router', ([], {}), '()\n', (1518, 1520), False, 'from packageurl.contrib.route import Router\n'), ((1910, 1938), 'packageurl.PackageURL.from_string', 'PackageURL.from_string', (['purl'], {}), '(purl)\n', (1932, 1938), False, 'from packageurl import PackageURL\n'), ((2... |
import json
from influxdb import InfluxDBClient
import logging
import platform
from typing import Dict, List
logging.basicConfig(
level=logging.ERROR,
format='%(asctime)s.%(msecs)03d %(levelname)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
)
logger = logging.getLogger(__name__)
class InfluxDBConnector... | [
"platform.node",
"logging.basicConfig",
"influxdb.InfluxDBClient",
"json.dumps",
"logging.getLogger"
] | [((111, 251), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.ERROR', 'format': '"""%(asctime)s.%(msecs)03d %(levelname)s: %(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""'}), "(level=logging.ERROR, format=\n '%(asctime)s.%(msecs)03d %(levelname)s: %(message)s', datefmt=\n '%Y-%m-%d %H:%... |
import json
import sys
import os
import jsonlines
import traceback
import logging
from tqdm import tqdm
import pickle
import itertools
import linecache
import html
import re
ALL_TITLES = {}
class WikiElement(object):
def get_ids(self) -> list:
"""Returns list of all ids in that element"""
pass
... | [
"json.load",
"os.path.join"
] | [((848, 872), 'os.path.join', 'os.path.join', (['input_path'], {}), '(input_path)\n', (860, 872), False, 'import os\n'), ((1500, 1513), 'json.load', 'json.load', (['fp'], {}), '(fp)\n', (1509, 1513), False, 'import json\n')] |
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
import time,random,names,os,requests,sys
from seleniumwire import webdriver
from random_username.generate import generate_username
from selenium.webdriver.firefox.options import Options
from selenium.webdriver import Act... | [
"random.randint",
"os.getcwd",
"random.choice",
"time.sleep",
"pyvirtualdisplay.Display",
"pathlib.Path",
"selenium.webdriver.ChromeOptions",
"selenium.webdriver.Chrome",
"requests.get",
"selenium.webdriver.ActionChains"
] | [((879, 914), 'pyvirtualdisplay.Display', 'Display', ([], {'visible': '(0)', 'size': '(800, 600)'}), '(visible=0, size=(800, 600))\n', (886, 914), False, 'from pyvirtualdisplay import Display\n'), ((2390, 2406), 'random.choice', 'random.choice', (['a'], {}), '(a)\n', (2403, 2406), False, 'import time, random, names, os... |
"""Dock of card GUI."""
import random
from tkinter import Button # Import tkinter
from tkinter import Frame # Import tkinter
from tkinter import Label # Import tkinter
from tkinter import LEFT # Import tkinter
from tkinter import PhotoImage
from tkinter import Tk # Import tkinter
class DeckOfCardsGUI(object):
... | [
"tkinter.Button",
"random.shuffle",
"tkinter.Frame",
"tkinter.Label",
"tkinter.Tk"
] | [((441, 445), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (443, 445), False, 'from tkinter import Tk\n'), ((733, 746), 'tkinter.Frame', 'Frame', (['window'], {}), '(window)\n', (738, 746), False, 'from tkinter import Frame\n'), ((1194, 1225), 'random.shuffle', 'random.shuffle', (['self.image_list'], {}), '(self.image_list)\n... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# __author__: Yxn
# date: 2016/10/14
from flask_assets import Bundle
bundles = {
'common_css': Bundle(
'css/body.css',
'css/lib/adminlte/adminlte.min.css',
'css/lib/bootstrap/bootstrap.min.css',
'css/lib/skins/skin-blue.min.css',
... | [
"flask_assets.Bundle"
] | [((147, 383), 'flask_assets.Bundle', 'Bundle', (['"""css/body.css"""', '"""css/lib/adminlte/adminlte.min.css"""', '"""css/lib/bootstrap/bootstrap.min.css"""', '"""css/lib/skins/skin-blue.min.css"""', '"""css/lib/fontawesome/font-awesome.min.css"""'], {'output': '"""css/common.css"""', 'filters': '"""cssmin"""'}), "('cs... |
import govt
import service
from cryptography.hazmat.primitives.asymmetric import dh
import tools
def print_as_hex(data: bytes):
print(data.hex())
def main():
NAME = "Alice"
# TODO: This is just to get a large prime number
params = dh.generate_parameters(generator=2, key_size=512)
p = params.pa... | [
"govt.Govt",
"cryptography.hazmat.primitives.asymmetric.dh.generate_parameters",
"service.Service",
"tools.get_random_int"
] | [((253, 302), 'cryptography.hazmat.primitives.asymmetric.dh.generate_parameters', 'dh.generate_parameters', ([], {'generator': '(2)', 'key_size': '(512)'}), '(generator=2, key_size=512)\n', (275, 302), False, 'from cryptography.hazmat.primitives.asymmetric import dh\n'), ((519, 530), 'govt.Govt', 'govt.Govt', ([], {}),... |
import os
import h5py
import pandas as pd
import logging
import numpy as np
from progress.bar import Bar
from multiprocessing import Pool, cpu_count
from omegaconf import OmegaConf
from tools.utils import io
# from ANCSH_lib.utils import NetworkType
# from tools.visualization import Viewer, ANCSHVisualizer
import uti... | [
"numpy.isin",
"pandas.read_csv",
"numpy.empty",
"numpy.ones",
"tools.utils.io.write_json",
"numpy.linalg.norm",
"numpy.arange",
"os.path.join",
"multiprocessing.cpu_count",
"tools.utils.io.file_exist",
"numpy.empty_like",
"numpy.reshape",
"pandas.concat",
"numpy.stack",
"h5py.File",
"n... | [((358, 390), 'logging.getLogger', 'logging.getLogger', (['"""proc_stage2"""'], {}), "('proc_stage2')\n", (375, 390), False, 'import logging\n'), ((1020, 1052), 'numpy.zeros', 'np.zeros', (['(vertices.shape[0], 3)'], {}), '((vertices.shape[0], 3))\n', (1028, 1052), True, 'import numpy as np\n'), ((2148, 2187), 'numpy.w... |
# flowbysector.py (flowsa)
# !/usr/bin/env python3
# coding=utf-8
"""
Produces a FlowBySector data frame based on a method file for the given class
To run code, specify the "Run/Debug Configurations" Parameters to the
"flowsa/data/flowbysectormethods" yaml file name
you want to use.
Example: "Parameters: --m Water_na... | [
"flowsa.fbs_allocation.direct_allocation_method",
"flowsa.metadata.write_metadata",
"argparse.ArgumentParser",
"flowsa.sectormapping.map_fbs_flows",
"pandas.read_csv",
"flowsa.fbs_allocation.dataset_allocation_method",
"flowsa.common.load_source_catalog",
"flowsa.flowbyfunctions.aggregator",
"yaml.s... | [((2108, 2133), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2131, 2133), False, 'import argparse\n'), ((4566, 4631), 'flowsa.common.vLog.info', 'vLog.info', (['"""Initiating flowbysector creation for %s"""', 'method_name'], {}), "('Initiating flowbysector creation for %s', method_name)\n", ... |
#----------------------------------------------------------------------------#
# Imports
#----------------------------------------------------------------------------#
import json
import dateutil.parser
import babel
from flask import Flask, render_template, request, Response, flash, redirect, url_for
from flask_moment... | [
"logging.FileHandler",
"flask.Flask",
"logging.Formatter",
"flask_moment.Moment",
"flask_sqlalchemy.SQLAlchemy",
"flask_migrate.Migrate",
"flask.render_template",
"babel.dates.format_datetime"
] | [((721, 733), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (731, 733), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((932, 943), 'flask_moment.Moment', 'Moment', (['app'], {}), '(app)\n', (938, 943), False, 'from flask_moment import Moment\n'), ((954, 970), 'flask_migrate.Migrate', 'Migrate', ... |
"""
Created on 13 Dec 2016
@author: <NAME> (<EMAIL>)
the I2C addresses of the internal (in A4 pot) and external (exposed to air) SHTs
example JSON:
{"int": "0x44", "ext": "0x45"}
"""
from collections import OrderedDict
from scs_core.data.json import PersistentJSONable
from scs_dfe.climate.sht31 import SHT31
# -... | [
"collections.OrderedDict",
"scs_dfe.climate.sht31.SHT31"
] | [((2002, 2024), 'scs_dfe.climate.sht31.SHT31', 'SHT31', (['self.__int_addr'], {}), '(self.__int_addr)\n', (2007, 2024), False, 'from scs_dfe.climate.sht31 import SHT31\n'), ((2126, 2148), 'scs_dfe.climate.sht31.SHT31', 'SHT31', (['self.__ext_addr'], {}), '(self.__ext_addr)\n', (2131, 2148), False, 'from scs_dfe.climate... |
import scxx.preprocessing as pp
import scxx.plotting as pl
import scanorama
import os
import numpy as np
import scanpy as sc
from anndata import AnnData
np.random.seed(0)
NAMESPACE = 'mouse_brain'
BATCH_SIZE = 1000
result_dir="./results/1M_mouse_brain/scanorama/"
data_names = [
'data/mouse_brain/nuclei',
'da... | [
"scanorama.correct_scanpy",
"numpy.random.seed",
"pandas.read_csv",
"numpy.concatenate"
] | [((154, 171), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (168, 171), True, 'import numpy as np\n'), ((1165, 1230), 'scanorama.correct_scanpy', 'scanorama.correct_scanpy', (['datasets'], {'return_dimred': '(True)', 'dimred': '(16)'}), '(datasets, return_dimred=True, dimred=16)\n', (1189, 1230), False... |
#-*- coding:utf-8 -*-
from generate_face import *
from gan_model import ganModel
import tensorflow as tf
if __name__ == '__main__':
hparams = tf.contrib.training.HParams(
data_root = './../../datas/gan_face/img_align_celeba',
crop_h = 108, #对原始图片裁剪后高
crop_w = 108, #对原始图片裁剪后宽
r... | [
"tensorflow.contrib.training.HParams",
"tensorflow.global_variables_initializer",
"tensorflow.Session",
"gan_model.ganModel",
"tensorflow.placeholder",
"tensorflow.global_variables",
"tensorflow.summary.FileWriter",
"tensorflow.train.checkpoint_exists",
"tensorflow.train.get_checkpoint_state"
] | [((147, 394), 'tensorflow.contrib.training.HParams', 'tf.contrib.training.HParams', ([], {'data_root': '"""./../../datas/gan_face/img_align_celeba"""', 'crop_h': '(108)', 'crop_w': '(108)', 'resize_h': '(64)', 'resize_w': '(64)', 'is_crop': '(True)', 'z_dim': '(100)', 'batch_size': '(64)', 'sample_size': '(64)', 'outpu... |
# -*- coding: utf-8 -*-
"""
"""
import copy
import time
import itertools
class CalcRecord():
"""
逆ポーランド用の要素格納クラス
"""
def __init__(self, a,b,c,d,op1,op2,op3):
self.a = a
self.b = b
self.c = c
self.d = d
self.op1 = op1
self.op2 = op2
self.op3 = op3
... | [
"itertools.product",
"itertools.permutations",
"time.time"
] | [((628, 639), 'time.time', 'time.time', ([], {}), '()\n', (637, 639), False, 'import time\n'), ((1359, 1370), 'time.time', 'time.time', ([], {}), '()\n', (1368, 1370), False, 'import time\n'), ((1617, 1649), 'itertools.permutations', 'itertools.permutations', (['src_nums'], {}), '(src_nums)\n', (1639, 1649), False, 'im... |
#!/usr/bin/env python3
"""
Polyglot v2 node server for WeatherFlow Weather Station data.
Copyright (c) 2018,2019 <NAME>
"""
import polyinterface
import sys
import time
import datetime
import urllib3
import json
import socket
import math
import threading
LOGGER = polyinterface.LOGGER
class PrecipitationNode(polyinterf... | [
"datetime.datetime.now"
] | [((1574, 1597), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1595, 1597), False, 'import datetime\n'), ((3830, 3853), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (3851, 3853), False, 'import datetime\n'), ((4102, 4125), 'datetime.datetime.now', 'datetime.datetime.now', ([... |
import numpy as np
from aura import aura_loader
import os
import time
import random
def break_aura(path, pieces):
"""
Breaks an aura file into smaller chunks. Saves chunks to local folders.
:param path: A string type of the path to the aura file that is being chunked.
:param pieces: An integer type ... | [
"os.mkdir",
"random.shuffle",
"numpy.zeros",
"time.time",
"aura.aura_loader.read_file"
] | [((373, 400), 'aura.aura_loader.read_file', 'aura_loader.read_file', (['path'], {}), '(path)\n', (394, 400), False, 'from aura import aura_loader\n'), ((497, 515), 'os.mkdir', 'os.mkdir', (['filepath'], {}), '(filepath)\n', (505, 515), False, 'import os\n'), ((673, 718), 'numpy.zeros', 'np.zeros', (['(l, w, chunkSize)'... |