code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import random
import time
import json
import hashlib
import requests
def generateNonceStr():
return "".join(random.sample('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 16))
# def change_type(byte):
# if isinstance(byte, bytes):
# return str(byte, encoding="utf-8")
# return js... | [
"random.sample",
"json.loads",
"requests.post",
"json.dumps",
"time.time"
] | [((773, 797), 'json.loads', 'json.loads', (['resp.content'], {}), '(resp.content)\n', (783, 797), False, 'import json\n'), ((114, 201), 'random.sample', 'random.sample', (['"""0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"""', '(16)'], {}), "('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW... |
'''
@version: Python 3.7.3
@Author: Louis
@Date: 2020-06-15 13:27:40
LastEditors: Louis
LastEditTime: 2020-08-19 15:06:25
'''
import os
import sys
from enum import Enum
from datetime import datetime
TODAY = datetime.now().strftime("%Y%m%d")
TODAY_ = datetime.now().strftime("%Y-%m-%d")
TIME = datetime.now().strftime("... | [
"datetime.datetime.now"
] | [((460, 474), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (472, 474), False, 'from datetime import datetime\n'), ((209, 223), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (221, 223), False, 'from datetime import datetime\n'), ((252, 266), 'datetime.datetime.now', 'datetime.now', ([], {}), '... |
import datetime
import json
import os
import pathlib
import uuid
from django.conf import settings
from django.db import models
from django_celery_results.models import TaskResult
class Country(models.Model):
class Meta:
db_table = "country"
ordering = ("country",)
country = models.CharField(... | [
"django.db.models.Index",
"json.loads",
"django.db.models.FloatField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"pathlib.Path",
"django.db.models.FileField",
"django.db.models.DateTimeField",
"django.db.models.BooleanField",
"uuid.uuid4",
"d... | [((303, 375), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'unique': '(True)', 'help_text': '"""Country name."""'}), "(max_length=100, unique=True, help_text='Country name.')\n", (319, 375), False, 'from django.db import models\n'), ((389, 474), 'django.db.models.CharField', 'models.Ch... |
from repeated_word import find_first_repeat
import pytest
def test_regular_str():
text = "Once upon a time, there was a brave princess who..."
assert find_first_repeat(text) == "a"
def test_bigger_different_case():
text = "It was the best of times, it was the worst of times, it was the age of wisdom, it w... | [
"repeated_word.find_first_repeat",
"pytest.raises"
] | [((159, 182), 'repeated_word.find_first_repeat', 'find_first_repeat', (['text'], {}), '(text)\n', (176, 182), False, 'from repeated_word import find_first_repeat\n'), ((865, 888), 'repeated_word.find_first_repeat', 'find_first_repeat', (['text'], {}), '(text)\n', (882, 888), False, 'from repeated_word import find_first... |
# coding=utf-8
import urllib2
import random
url = "http://www.baidu.com/"
# 可以是User-Agent列表,也可以是代理列表
ua_list = [
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv2.0.1) Gecko/20100101 Firefox/4.0.1",
"Mozilla/5.0 (Windows NT 6.1; rv2.0.1) Gecko/20100101 Firefox/4.0.1",
"Opera/9.80 (Macintosh; Int... | [
"urllib2.Request",
"urllib2.urlopen",
"random.choice"
] | [((629, 651), 'random.choice', 'random.choice', (['ua_list'], {}), '(ua_list)\n', (642, 651), False, 'import random\n'), ((675, 695), 'urllib2.Request', 'urllib2.Request', (['url'], {}), '(url)\n', (690, 695), False, 'import urllib2\n'), ((938, 962), 'urllib2.urlopen', 'urllib2.urlopen', (['request'], {}), '(request)\n... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 29 15:44:44 2019
@author: liuhongbing
"""
# coding=utf-8
import tensorflow as tf
import time
import os
from charCNN_model import CharCNN
import datetime
from read_data import Config,Dataset
# Load data
print("正在载入数据...")
# 函数dataset_read:输入文件名,返回... | [
"tensorflow.Graph",
"os.path.exists",
"os.makedirs",
"tensorflow.Variable",
"tensorflow.Session",
"tensorflow.summary.merge",
"os.path.join",
"tensorflow.nn.zero_fraction",
"tensorflow.global_variables",
"charCNN_model.CharCNN",
"tensorflow.summary.scalar",
"tensorflow.global_variables_initial... | [((524, 593), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {'allow_soft_placement': '(True)', 'log_device_placement': '(False)'}), '(allow_soft_placement=True, log_device_placement=False)\n', (538, 593), True, 'import tensorflow as tf\n'), ((618, 649), 'tensorflow.Session', 'tf.Session', ([], {'config': 'session_co... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 27 11:26:25 2019
@author: engelen
"""
import xarray as xr
import pandas as pd
from glob import glob
import os
import numpy as np
from collections import defaultdict
def get_first_true(df, condition):
time = df[condition].iloc[0:1].index.values
if time.size == 0:... | [
"numpy.abs",
"pandas.read_csv",
"os.path.join",
"xarray.Dataset",
"collections.defaultdict",
"os.path.basename",
"pandas.DataFrame",
"xarray.open_dataset",
"pandas.concat",
"glob.glob"
] | [((454, 467), 'glob.glob', 'glob', (['fw_path'], {}), '(fw_path)\n', (458, 467), False, 'from glob import glob\n'), ((528, 541), 'glob.glob', 'glob', (['or_path'], {}), '(or_path)\n', (532, 541), False, 'from glob import glob\n'), ((1383, 1396), 'collections.defaultdict', 'defaultdict', ([], {}), '()\n', (1394, 1396), ... |
from src.features.preprocessing.huawei_traces import HuaweiTracePreprocessor
import dataclass_cli
import dataclasses
import logging
import pandas as pd
from pathlib import Path
from tqdm import tqdm
from typing import List, Dict, Set
import http
import re
from .base import Preprocessor
from collections import Counter
f... | [
"pandas.read_pickle",
"pandas.DataFrame.from_records",
"re.split",
"logging.debug",
"pandas.read_csv",
"pathlib.Path",
"pandas.Grouper",
"pandas.merge",
"tqdm.tqdm",
"collections.Counter",
"pandas.concat",
"src.features.preprocessing.huawei_traces.HuaweiTracePreprocessor",
"logging.error",
... | [((488, 531), 'pathlib.Path', 'Path', (['"""data/logs_aggregated_concurrent.csv"""'], {}), "('data/logs_aggregated_concurrent.csv')\n", (492, 531), False, 'from pathlib import Path\n'), ((566, 602), 'pathlib.Path', 'Path', (['"""data/concurrent_data/traces/"""'], {}), "('data/concurrent_data/traces/')\n", (570, 602), F... |
#!/usr/bin/env python
#
# This script is meant to be run when new security hub events are added or we need
# to regenerate sample securityhub event files
#
import json
import os
import boto3
# To get all supported TTPs, it's easiest to fetch it from the AWS console:
# https://eu-west-1.console.aws.amazon.com/securit... | [
"os.path.exists",
"boto3.client",
"json.dumps",
"os.path.dirname",
"os.remove"
] | [((8706, 8758), 'boto3.client', 'boto3.client', (['"""securityhub"""'], {'region_name': '"""eu-west-1"""'}), "('securityhub', region_name='eu-west-1')\n", (8718, 8758), False, 'import boto3\n'), ((9789, 9809), 'os.path.exists', 'os.path.exists', (['file'], {}), '(file)\n', (9803, 9809), False, 'import os\n'), ((9612, 9... |
# -*- coding: utf-8 -*-
import datetime
import time
import math
ABA = ["HERTZ", "HERO"]
SECONDS_PER_DAY = 60 * 60 * 24
def _get_hertz_feed(reference_timestamp, current_timestamp, period_days, phase_days, reference_asset_value, amplitude):
"""
Given the reference timestamp, the current timestamp, the period (... | [
"datetime.datetime.strptime",
"datetime.datetime.now",
"datetime.date",
"datetime.date.today",
"math.sin"
] | [((965, 1092), 'math.sin', 'math.sin', (['((current_timestamp - (hz_reference_timestamp + hz_phase)) / hz_period % 1 *\n hz_period * (2 * math.pi / hz_period))'], {}), '((current_timestamp - (hz_reference_timestamp + hz_phase)) /\n hz_period % 1 * hz_period * (2 * math.pi / hz_period))\n', (973, 1092), False, 'im... |
# -*- coding: UTF-8 -*-
import json
import logging
import os
import re
import requests
import schedule
import sys
import threading
import time
import yaml
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('VegaOps2N9e')
reload(sys)
sys.setdefaultencoding('utf8')
def _push_metrics(cfg, metrics):
... | [
"logging.basicConfig",
"logging.getLogger",
"os.path.exists",
"sys.setdefaultencoding",
"yaml.dump",
"schedule.run_pending",
"json.dumps",
"time.sleep",
"os.exit",
"os.path.isfile",
"threading.Thread",
"os.system"
] | [((157, 196), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (176, 196), False, 'import logging\n'), ((206, 238), 'logging.getLogger', 'logging.getLogger', (['"""VegaOps2N9e"""'], {}), "('VegaOps2N9e')\n", (223, 238), False, 'import logging\n'), ((252, 282), 'sy... |
import numpy
from AnyQt.QtGui import QColor, QRadialGradient, QPainterPathStroker
def saturated(color, factor=150):
"""Return a saturated color.
"""
h = color.hsvHueF()
s = color.hsvSaturationF()
v = color.valueF()
a = color.alphaF()
s = factor * s / 100.0
s = max(min(1.0, s), 0.0)
... | [
"AnyQt.QtGui.QPainterPathStroker",
"AnyQt.QtGui.QColor.fromHsvF",
"numpy.argsort",
"numpy.linspace",
"AnyQt.QtGui.QRadialGradient"
] | [((507, 551), 'numpy.linspace', 'numpy.linspace', (['(0.0)', '(1.0)', 'num'], {'endpoint': '(True)'}), '(0.0, 1.0, num, endpoint=True)\n', (521, 551), False, 'import numpy\n'), ((1030, 1060), 'AnyQt.QtGui.QRadialGradient', 'QRadialGradient', (['(0.5)', '(0.5)', '(0.5)'], {}), '(0.5, 0.5, 0.5)\n', (1045, 1060), False, '... |
#!/usr/bin/env python3
# coding: utf8
__author__ = "<NAME>"
# Librería bot telegram
# doc: https://github.com/python-telegram-bot/python-telegram-bot
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import Updater, CommandHandler, MessageHandler, CallbackQueryHandler, Filters
import s... | [
"telegram.ext.MessageHandler",
"telegram.ext.CallbackQueryHandler",
"sys.path.append",
"telegram.ext.Updater",
"telegram.ext.CommandHandler"
] | [((323, 345), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (338, 345), False, 'import sys\n'), ((564, 583), 'telegram.ext.Updater', 'Updater', (['self.token'], {}), '(self.token)\n', (571, 583), False, 'from telegram.ext import Updater, CommandHandler, MessageHandler, CallbackQueryHandler, Fi... |
# [START maps_http_places_textsearch_incomplete_address]
import requests
url = "https://maps.googleapis.com/maps/api/place/textsearch/json?query=123%20main%20street&key=YOUR_API_KEY"
payload={}
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
# [END maps_http... | [
"requests.request"
] | [((221, 280), 'requests.request', 'requests.request', (['"""GET"""', 'url'], {'headers': 'headers', 'data': 'payload'}), "('GET', url, headers=headers, data=payload)\n", (237, 280), False, 'import requests\n')] |
import six
import unittest2
from gcloud.datastore import helpers, key, set_default_dataset_id
from gcloudorm import model, properties
class TestProperties(unittest2.TestCase):
_DATASET_ID = 'DATASET'
def setUp(self):
set_default_dataset_id(self._DATASET_ID)
def testBooleanProperty(self):
... | [
"gcloudorm.properties.JsonProperty",
"datetime.time",
"gcloudorm.properties.FloatProperty",
"datetime.datetime.utcnow",
"gcloudorm.properties.PickleProperty",
"gcloudorm.properties.DateProperty",
"gcloudorm.properties.TimeProperty",
"gcloudorm.properties.IntegerProperty",
"gcloudorm.properties.IdPro... | [((238, 278), 'gcloud.datastore.set_default_dataset_id', 'set_default_dataset_id', (['self._DATASET_ID'], {}), '(self._DATASET_ID)\n', (260, 278), False, 'from gcloud.datastore import helpers, key, set_default_dataset_id\n'), ((3831, 3857), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (3855... |
# TODO: figure out how to put this in the app/ folder and still use serverless
# This line: `handler: main.handler`
# How do we specify a path here, as per uvicorn?
import os
from enum import Enum
from typing import Optional
from pydantic import BaseModel
from fastapi import FastAPI, Query
# for lambda; see https://... | [
"ontology_term_usage.term_usage.OntologyClient",
"mangum.Mangum",
"fastapi.FastAPI",
"os.environ.get"
] | [((556, 585), 'os.environ.get', 'os.environ.get', (['"""STAGE"""', 'None'], {}), "('STAGE', None)\n", (570, 585), False, 'import os\n'), ((643, 659), 'ontology_term_usage.term_usage.OntologyClient', 'OntologyClient', ([], {}), '()\n', (657, 659), False, 'from ontology_term_usage.term_usage import OntologyClient, Result... |
from typing import Dict, List
import bcrypt
from app.session import SessionManager
from app.models.user import User
from app.models.validator import Validator
class UserService:
def __init__(self) -> None:
pass
def create(self, payload: Dict[str, str]) -> User:
hashed_pw = bcrypt.hashpw(payl... | [
"bcrypt.gensalt",
"app.session.SessionManager.session"
] | [((346, 362), 'bcrypt.gensalt', 'bcrypt.gensalt', ([], {}), '()\n', (360, 362), False, 'import bcrypt\n'), ((457, 481), 'app.session.SessionManager.session', 'SessionManager.session', ([], {}), '()\n', (479, 481), False, 'from app.session import SessionManager\n'), ((626, 650), 'app.session.SessionManager.session', 'Se... |
# -*- encoding: utf-8 -*-
import glob
import io
import re
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import splitext
from setuptools import find_packages
from setuptools import setup
def read(*names, **kwargs):
return io.open(
join(dirname(__file__), *n... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.basename",
"glob.glob"
] | [((761, 781), 'setuptools.find_packages', 'find_packages', (['"""src"""'], {}), "('src')\n", (774, 781), False, 'from setuptools import find_packages\n'), ((862, 883), 'glob.glob', 'glob.glob', (['"""src/*.py"""'], {}), "('src/*.py')\n", (871, 883), False, 'import glob\n'), ((299, 316), 'os.path.dirname', 'dirname', ([... |
"""
pyexcel_io.writers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
file writers
:copyright: (c) 2014-2020 by Onni Software Ltd.
:license: New BSD License, see LICENSE for more details
"""
from pyexcel_io.plugins import IOPluginInfoChainV2
IOPluginInfoChainV2(__name__).add_a_writer(
relative_plugin_cla... | [
"pyexcel_io.plugins.IOPluginInfoChainV2"
] | [((253, 282), 'pyexcel_io.plugins.IOPluginInfoChainV2', 'IOPluginInfoChainV2', (['__name__'], {}), '(__name__)\n', (272, 282), False, 'from pyexcel_io.plugins import IOPluginInfoChainV2\n')] |
from collections import Counter
import typing
from pathlib import Path
import subprocess
import os
def run_muscle(guide_alignment, in_file, out_file):
command = ['muscle', '-quiet', '-profile', '-in1', guide_alignment, '-in2', in_file, '-out', out_file]
subprocess.check_call(command)
def add_sequences_to_... | [
"collections.Counter",
"subprocess.check_call"
] | [((267, 297), 'subprocess.check_call', 'subprocess.check_call', (['command'], {}), '(command)\n', (288, 297), False, 'import subprocess\n'), ((3704, 3789), 'collections.Counter', 'Counter', (["[alignment[key][pos] for key in alignment if alignment[key][pos] != '-']"], {}), "([alignment[key][pos] for key in alignment if... |
from perfrunner.helpers.cbmonitor import timeit, with_stats
from perfrunner.tests import PerfTest
from perfrunner.workloads.kvgen import kvgen
class IndexTest(PerfTest):
COLLECTORS = {
'secondary_stats': True,
'secondary_debugstats': True,
'secondary_debugstats_bucket': True,
'sec... | [
"perfrunner.workloads.kvgen.kvgen"
] | [((1122, 1194), 'perfrunner.workloads.kvgen.kvgen', 'kvgen', (['self.master_node', 'self.test_config.load_settings.items'], {'wait': '(True)'}), '(self.master_node, self.test_config.load_settings.items, wait=True)\n', (1127, 1194), False, 'from perfrunner.workloads.kvgen import kvgen\n'), ((1233, 1306), 'perfrunner.wor... |
import os
import logging
import conjugatedescent
import coordinatedescent
import gradientdescent
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)
def _choose_operation(requested_operation: str):
if requested_operation == 'CONJUGATE_GRADIENT':
optimizer = conjugatedescent.Conjug... | [
"logging.basicConfig",
"logging.getLogger",
"os.getenv",
"conjugatedescent.ConjugateGradientDescent",
"gradientdescent.GradientDescent",
"coordinatedescent.CoordinateDescent"
] | [((99, 139), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (118, 139), False, 'import logging\n'), ((146, 173), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (163, 173), False, 'import logging\n'), ((297, 340), 'conjugatedescen... |
import unittest
from dll import Node, DoubleLinkedList
class TestIt(unittest.TestCase):
def test_1(self):
"""make a node"""
n1 = Node('A')
self.assertEqual(n1._value, 'A')
def test_2(self):
"""make a test head is set when add first node"""
n1 = Node('A')
dl = DoubleLinkedList()
dl.append(n1)
self... | [
"dll.Node",
"dll.DoubleLinkedList"
] | [((137, 146), 'dll.Node', 'Node', (['"""A"""'], {}), "('A')\n", (141, 146), False, 'from dll import Node, DoubleLinkedList\n'), ((262, 271), 'dll.Node', 'Node', (['"""A"""'], {}), "('A')\n", (266, 271), False, 'from dll import Node, DoubleLinkedList\n'), ((279, 297), 'dll.DoubleLinkedList', 'DoubleLinkedList', ([], {})... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Spectrassembler main program
@author: <NAME>
"""
from __future__ import print_function
from time import time
import sys
import argparse
from functools import partial
from multiprocessing import Pool
import numpy as np
from Bio import SeqIO
from scipy.sparse import coo... | [
"spectral.remove_bridge_reads",
"argparse.ArgumentParser",
"scipy.sparse.coo_matrix",
"ioandplots.make_dir",
"spectral.sym_max",
"overlaps.compute_positions",
"consensus.run_spoa_in_cc",
"ioandplots.oprint",
"spectral.reorder_mat",
"time.time",
"spectral.reorder_mat_par",
"ioandplots.fill_args... | [((715, 721), 'time.time', 'time', ([], {}), '()\n', (719, 721), False, 'from time import time\n'), ((732, 861), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""De novo experimental assemblerbased on a spectral algorithm to reorder the reads"""'}), "(description=\n 'De novo experimenta... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 18 16:59:08 2021
@author: Hatlab_3
"""
from data_processing.ddh5_Plotting.utility_modules.FS_utility_functions import fit_fluxsweep
from data_processing.Helper_Functions import find_all_ddh5
from plottr.apps.autoplot import autoplotDDH5, script, main
import numpy as np
im... | [
"numpy.abs",
"data_processing.ddh5_Plotting.utility_modules.FS_utility_functions.fit_fluxsweep",
"matplotlib.pyplot.plot",
"numpy.size",
"scipy.signal.savgol_filter",
"scipy.interpolate.interp1d",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.legend"
] | [((1611, 1654), 'data_processing.ddh5_Plotting.utility_modules.FS_utility_functions.fit_fluxsweep', 'fit_fluxsweep', (['datadir', 'savedir', '"""SA_2X_B1"""'], {}), "(datadir, savedir, 'SA_2X_B1')\n", (1624, 1654), False, 'from data_processing.ddh5_Plotting.utility_modules.FS_utility_functions import fit_fluxsweep\n'),... |
"""app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based vie... | [
"django.urls.path"
] | [((697, 736), 'django.urls.path', 'path', (['""""""', 'views.manager'], {'name': '"""manager"""'}), "('', views.manager, name='manager')\n", (701, 736), False, 'from django.urls import path\n'), ((742, 792), 'django.urls.path', 'path', (['"""<int:id>/"""', 'views.manager1'], {'name': '"""manager1"""'}), "('<int:id>/', ... |
# Copyright 2019 Huawei Technologies Co., Ltd
#
# 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... | [
"os.path.exists",
"os.path.join",
"tempfile.NamedTemporaryFile",
"tempfile.mkdtemp",
"os.mkdir",
"pytest.raises",
"shutil.rmtree",
"mindinsight.datavisual.data_transform.data_loader.DataLoader"
] | [((1273, 1291), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (1289, 1291), False, 'import tempfile\n'), ((1303, 1336), 'os.path.exists', 'os.path.exists', (['self._summary_dir'], {}), '(self._summary_dir)\n', (1317, 1336), False, 'import os\n'), ((1391, 1418), 'os.mkdir', 'os.mkdir', (['self._summary_dir']... |
from linked_list import LinkedList
from node import Node
from mergeList import ll_merge
# import pytest
def test_linked_list_creation():
"""Validating if Linked List was Created."""
ll = LinkedList([2, 3, 4, 5])
assert Node(2).val is ll.head.val
assert isinstance(ll.head.val, int)
def test_insert_i... | [
"linked_list.LinkedList",
"node.Node",
"mergeList.ll_merge"
] | [((198, 222), 'linked_list.LinkedList', 'LinkedList', (['[2, 3, 4, 5]'], {}), '([2, 3, 4, 5])\n', (208, 222), False, 'from linked_list import LinkedList\n'), ((460, 472), 'linked_list.LinkedList', 'LinkedList', ([], {}), '()\n', (470, 472), False, 'from linked_list import LinkedList\n'), ((662, 765), 'linked_list.Linke... |
# -*- coding: utf-8 -*-
import scrapy
from bs4 import BeautifulSoup
from cultureBigdata.items import CultureNewsItem, CultureBasicItem, CultureEventItem
from selenium import webdriver
import re
import time
class ChengdulibSpider(scrapy.Spider):
name = 'chengdulib'
# 爬去机构动态所需的参数
news_u... | [
"cultureBigdata.items.CultureBasicItem",
"bs4.BeautifulSoup",
"scrapy.Request",
"cultureBigdata.items.CultureEventItem",
"re.findall"
] | [((2515, 2549), 'bs4.BeautifulSoup', 'BeautifulSoup', (['data', '"""html.parser"""'], {}), "(data, 'html.parser')\n", (2528, 2549), False, 'from bs4 import BeautifulSoup\n'), ((3890, 3924), 'bs4.BeautifulSoup', 'BeautifulSoup', (['data', '"""html.parser"""'], {}), "(data, 'html.parser')\n", (3903, 3924), False, 'from b... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" calibration_rig.py: trilateration microphone calibration
Since trilateration doesn't account for the acoustic properties of the sound
source, the results will be skewed. To account for this, it's possible
to use machine learning to build a lookup table-like... | [
"serial.Serial",
"acoustic_fixture.AcousticFixture",
"time.time",
"time.sleep"
] | [((1010, 1021), 'time.time', 'time.time', ([], {}), '()\n', (1019, 1021), False, 'import time\n'), ((1082, 1099), 'acoustic_fixture.AcousticFixture', 'AF', ([], {'cal_mode': '(True)'}), '(cal_mode=True)\n', (1084, 1099), True, 'from acoustic_fixture import AcousticFixture as AF, BUFFER, AMPLITUDE_SIZE\n'), ((2033, 2062... |
import unittest
from programy.clients.events.console.config import ConsoleConfiguration
from programy.config.brain.dynamic import BrainDynamicsConfiguration
from programy.config.file.yaml_file import YamlConfigurationFile
class BrainDynamicsConfigurationTests(unittest.TestCase):
def test_with_data(self):
... | [
"programy.config.file.yaml_file.YamlConfigurationFile",
"programy.config.brain.dynamic.BrainDynamicsConfiguration",
"programy.clients.events.console.config.ConsoleConfiguration"
] | [((329, 352), 'programy.config.file.yaml_file.YamlConfigurationFile', 'YamlConfigurationFile', ([], {}), '()\n', (350, 352), False, 'from programy.config.file.yaml_file import YamlConfigurationFile\n'), ((1014, 1042), 'programy.config.brain.dynamic.BrainDynamicsConfiguration', 'BrainDynamicsConfiguration', ([], {}), '(... |
from setuptools import setup, find_packages
import codecs
import os
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as fh:
long_description = "\n" + fh.read()
VERSION = '0.0.3'
DESCRIPTION = 'Communicate with other machines via the local netwo... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((92, 117), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (107, 117), False, 'import os\n'), ((137, 168), 'os.path.join', 'os.path.join', (['here', '"""README.md"""'], {}), "(here, 'README.md')\n", (149, 168), False, 'import os\n'), ((576, 591), 'setuptools.find_packages', 'find_packages', ... |
#! python
#
#
from renderer.shape import Shape
from renderer.bolts import Vector, EPSILON
class Plane(Shape):
def LocalNormal( self, localPoint ):
return Vector( 0, 1, 0 )
def LocalIntersect(self, localRay):
if abs(localRay.Direction()[1]) < EPSILON:
return []
timeToInters... | [
"renderer.bolts.Vector"
] | [((168, 183), 'renderer.bolts.Vector', 'Vector', (['(0)', '(1)', '(0)'], {}), '(0, 1, 0)\n', (174, 183), False, 'from renderer.bolts import Vector, EPSILON\n')] |
#!/usr/bin/env python3
# coding=utf-8
#
# Copyright (c) 2020 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... | [
"os.path.exists",
"rsa.decrypt",
"hashlib.new",
"os.path.join",
"rsa.encrypt",
"os.path.dirname",
"_core.logger.platform_logger"
] | [((865, 891), '_core.logger.platform_logger', 'platform_logger', (['"""Encrypt"""'], {}), "('Encrypt')\n", (880, 891), False, 'from _core.logger import platform_logger\n'), ((1274, 1323), 'os.path.join', 'os.path.join', (['Variables.exec_dir', 'PUBLIC_KEY_FILE'], {}), '(Variables.exec_dir, PUBLIC_KEY_FILE)\n', (1286, 1... |
from base64 import b64encode
from hashlib import sha1
from Crypto.Hash import SHA
from Crypto.Signature import PKCS1_v1_5
from Crypto.PublicKey import RSA
class Rsa:
@classmethod
def sign(cls, text, privateKeyContent):
digest = SHA.new(text)
rsaKey = RSA.importKey(privateKeyContent)
s... | [
"base64.b64encode",
"Crypto.Signature.PKCS1_v1_5.new",
"Crypto.Hash.SHA.new",
"hashlib.sha1",
"Crypto.PublicKey.RSA.importKey"
] | [((247, 260), 'Crypto.Hash.SHA.new', 'SHA.new', (['text'], {}), '(text)\n', (254, 260), False, 'from Crypto.Hash import SHA\n'), ((278, 310), 'Crypto.PublicKey.RSA.importKey', 'RSA.importKey', (['privateKeyContent'], {}), '(privateKeyContent)\n', (291, 310), False, 'from Crypto.PublicKey import RSA\n'), ((328, 350), 'C... |
from tornado import gen, httpclient
from tornado.escape import json_decode
import logging
@gen.coroutine
def receiver(args):
logging.info("Enter simple_plugin")
logging.debug("args: %s", str(args))
http_client = httpclient.AsyncHTTPClient()
response = yield http_client.fetch("http://localhost:5984/_ses... | [
"tornado.escape.json_decode",
"logging.info",
"tornado.httpclient.AsyncHTTPClient"
] | [((130, 165), 'logging.info', 'logging.info', (['"""Enter simple_plugin"""'], {}), "('Enter simple_plugin')\n", (142, 165), False, 'import logging\n'), ((225, 253), 'tornado.httpclient.AsyncHTTPClient', 'httpclient.AsyncHTTPClient', ([], {}), '()\n', (251, 253), False, 'from tornado import gen, httpclient\n'), ((396, 4... |
from setuptools import find_packages, setup
with open("requirements.txt") as f:
requirements = f.read().splitlines()
with open("README.md") as f:
readme = f.read()
setup(
name="kubespec",
version="0.1.dev20200203",
url="https://github.com/machinezone/kubespec",
author="<NAME>",
author_em... | [
"setuptools.find_packages"
] | [((635, 650), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (648, 650), False, 'from setuptools import find_packages, setup\n')] |
import logging
from django import forms
from tantalus.services import get_tantalus_client, TantalusException
class TantalusProductAdminForm(forms.ModelForm):
"""Tantalus Product Admin Form."""
tantalus_id = forms.ChoiceField(required=True)
def __init__(self, *args, **kwargs):
"""Initialize Tan... | [
"django.forms.ChoiceField",
"django.forms.IntegerField",
"tantalus.services.get_tantalus_client"
] | [((220, 252), 'django.forms.ChoiceField', 'forms.ChoiceField', ([], {'required': '(True)'}), '(required=True)\n', (237, 252), False, 'from django import forms\n'), ((1292, 1324), 'django.forms.ChoiceField', 'forms.ChoiceField', ([], {'required': '(True)'}), '(required=True)\n', (1309, 1324), False, 'from django import ... |
import matplotlib.pyplot as plt
#---------------------------------------------------------------
# Function plot:
# Plot cost x generation graphic
# Parameters:
# itens - cost of each generation
# itens2 - number of feasible solutions at each generation
#-------------------------------------------------------... | [
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.show"
] | [((672, 682), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (680, 682), True, 'import matplotlib.pyplot as plt\n'), ((405, 425), 'matplotlib.pyplot.plot', 'plt.plot', (['itens', '"""b"""'], {}), "(itens, 'b')\n", (413, 425), True, 'import matplotlib.pyplot as plt\n'), ((433, 451), 'matplotlib.pyplot.ylabel', ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Python example script showing SecureX Cloud Analytics Alerts.
Copyright (c) 2020 Cisco and/or its affiliates.
This software is licensed to you under the terms of the Cisco Sample
Code License, Version 1.1 (the "License"). You may obtain a copy of the
License at
... | [
"requests.post",
"environment.SWC.get",
"requests.packages.urllib3.disable_warnings",
"environment.WXT.get",
"datetime.datetime.utcnow",
"json.dumps",
"requests.get",
"datetime.timedelta"
] | [((966, 1032), 'requests.packages.urllib3.disable_warnings', 'requests.packages.urllib3.disable_warnings', (['InsecureRequestWarning'], {}), '(InsecureRequestWarning)\n', (1008, 1032), False, 'import requests\n'), ((1168, 1187), 'environment.SWC.get', 'env.SWC.get', (['"""host"""'], {}), "('host')\n", (1179, 1187), Tru... |
from __future__ import print_function
import argparse
import os
import re
import nltk.data
parser = argparse.ArgumentParser()
parser.add_argument('--source-dir', help="Source data directory", default="./dataset/original_data")
parser.add_argument('--target-dir', help="Traget data directory", default="./dataset/pre_p... | [
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"os.path.join",
"os.fsencode",
"os.mkdir",
"os.fsdecode",
"re.sub"
] | [((103, 128), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (126, 128), False, 'import argparse\n'), ((484, 501), 'os.fsencode', 'os.fsencode', (['path'], {}), '(path)\n', (495, 501), False, 'import os\n'), ((545, 566), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (555, 56... |
from logging import StreamHandler
from ipware import get_client_ip
class EnhancedStreamHandler(StreamHandler, object):
def emit(self, record):
record.ip = ''
record.email = ''
try:
request = record.args[0]
record.ip, _ = get_client_ip(request)
record.a... | [
"ipware.get_client_ip"
] | [((277, 299), 'ipware.get_client_ip', 'get_client_ip', (['request'], {}), '(request)\n', (290, 299), False, 'from ipware import get_client_ip\n')] |
from genetic_algo import Genetic_algorithm, Network_info
import train_cfar10 as cfar10
import tensorflow as tf
print("GPU Available: ", tf.test.is_gpu_available())
nb_classes, batch_size, input_shape, x_train, x_test, y_train, y_test = cfar10.get_cifar10()
dataset = {
# 'name': 'cifar10',
'num_classes... | [
"genetic_algo.Network_info",
"train_cfar10.get_cifar10",
"tensorflow.test.is_gpu_available",
"genetic_algo.Genetic_algorithm"
] | [((238, 258), 'train_cfar10.get_cifar10', 'cfar10.get_cifar10', ([], {}), '()\n', (256, 258), True, 'import train_cfar10 as cfar10\n'), ((569, 709), 'genetic_algo.Genetic_algorithm', 'Genetic_algorithm', ([], {'starting_population': 'starting_population', 'num_generations': '(2)', 'train_epochs': '(1)', 'max_poulation'... |
"""Half-Cheetah Environment with full observation."""
import gym.error
from .locomotion import LocomotionEnv
try:
from gym.envs.mujoco.half_cheetah_v3 import HalfCheetahEnv
except (ModuleNotFoundError, gym.error.DependencyNotInstalled):
HalfCheetahEnv = object
class MBHalfCheetahEnv(LocomotionEnv, HalfCheet... | [
"gym.envs.mujoco.half_cheetah_v3.HalfCheetahEnv.__init__"
] | [((698, 793), 'gym.envs.mujoco.half_cheetah_v3.HalfCheetahEnv.__init__', 'HalfCheetahEnv.__init__', (['self'], {'ctrl_cost_weight': 'ctrl_cost_weight', 'forward_reward_weight': '(1.0)'}), '(self, ctrl_cost_weight=ctrl_cost_weight,\n forward_reward_weight=1.0)\n', (721, 793), False, 'from gym.envs.mujoco.half_cheetah... |
"""
m3u.py --- Jen Plugin for accessing m3u data
Copyright (C) 2018
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 version 3 of the License, or
(at your option) any la... | [
"urllib2.urlopen",
"resources.lib.util.context.get_context_items",
"re.compile",
"resources.lib.util.xml.JenList",
"koding.route",
"urllib2.Request",
"xbmcaddon.Addon",
"resources.lib.util.xml.JenItem"
] | [((2310, 2341), 'koding.route', 'route', ([], {'mode': '"""m3u"""', 'args': "['url']"}), "(mode='m3u', args=['url'])\n", (2315, 2341), False, 'from koding import route\n'), ((2923, 2935), 'resources.lib.util.xml.JenList', 'JenList', (['xml'], {}), '(xml)\n', (2930, 2935), False, 'from resources.lib.util.xml import JenI... |
from safenotes.helpers import display_colored_text
from safenotes.colors import red, blue
from typing import Callable, Dict
from os import system
from sys import exit
import safenotes.files_accessor as files_accessor
import questionary
class Displayer:
"""
Class for displaying all notes, handling user action... | [
"safenotes.files_accessor.edit_file_and_encrypt",
"safenotes.files_accessor.get_saved_notes_filenames",
"safenotes.files_accessor.decrypt_file",
"safenotes.files_accessor.delete_file",
"safenotes.files_accessor.note_full_path",
"safenotes.files_accessor.encrypt_file",
"safenotes.files_accessor.is_file_e... | [((568, 583), 'os.system', 'system', (['"""clear"""'], {}), "('clear')\n", (574, 583), False, 'from os import system\n'), ((1066, 1081), 'os.system', 'system', (['"""clear"""'], {}), "('clear')\n", (1072, 1081), False, 'from os import system\n'), ((1091, 1141), 'safenotes.helpers.display_colored_text', 'display_colored... |
from collections import defaultdict
from dataclasses import dataclass
from typing import Dict, List, Optional
import numpy as np
import numpy.typing as npt
from nuplan.common.actor_state.agent import Agent
from nuplan.common.actor_state.ego_state import EgoState
from nuplan.common.actor_state.vehicle_parameters impor... | [
"numpy.abs",
"numpy.isclose",
"numpy.amin",
"nuplan.common.geometry.compute.signed_longitudinal_distance",
"numpy.sum",
"collections.defaultdict",
"nuplan.common.actor_state.vehicle_parameters.get_pacifica_parameters",
"nuplan.common.geometry.compute.signed_lateral_distance",
"numpy.amax"
] | [((9182, 9199), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (9193, 9199), False, 'from collections import defaultdict\n'), ((9608, 9625), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (9619, 9625), False, 'from collections import defaultdict\n'), ((2093, 2118), 'nuplan.... |
import logging
from six.moves.urllib.parse import urlsplit
from django.conf import settings
from django.conf.urls import url, re_path
from django.core.exceptions import PermissionDenied
from django.urls import reverse
from django.utils.html import escape, format_html_join
from wagtail.admin.menu import MenuItem
from ... | [
"logging.getLogger",
"django.core.exceptions.PermissionDenied",
"django.utils.html.format_html_join",
"six.moves.urllib.parse.urlsplit",
"cosme.v1.util.util.get_streamfields",
"wagtail.core.models.Page.objects.get",
"django.utils.html.escape",
"django.urls.reverse",
"wagtail.core.hooks.register"
] | [((484, 511), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (501, 511), False, 'import logging\n'), ((515, 551), 'wagtail.core.hooks.register', 'hooks.register', (['"""before_delete_page"""'], {}), "('before_delete_page')\n", (529, 551), False, 'from wagtail.core import hooks\n'), ((654,... |
from flask import render_template, flash, redirect
from flask import session, url_for, request, g
from flask.ext.login import login_user, logout_user
from flask.ext.login import current_user, login_required
from filebarn import app, db, lm
from .forms import LoginForm
from .models import User
@app.route('/secret/<use... | [
"flask.render_template",
"flask.request.args.get",
"filebarn.app.route",
"flask.flash",
"flask.url_for",
"flask.ext.login.login_user"
] | [((297, 328), 'filebarn.app.route', 'app.route', (['"""/secret/<username>"""'], {}), "('/secret/<username>')\n", (306, 328), False, 'from filebarn import app, db, lm\n'), ((430, 469), 'filebarn.app.route', 'app.route', (['"""/"""'], {'methods': "['GET', 'POST']"}), "('/', methods=['GET', 'POST'])\n", (439, 469), False,... |
# -*- coding: utf-8 -*-
from django.db import models
from datetime import date
from django.utils import timezone
from user.models import Person,Customer
from .price_category import PriceCategory
from core.models import Address
from core.mixins import TimeStampedMixin,PartComposMixin,ThumbnailMixin
from core.utils impor... | [
"django.db.models.FloatField",
"django.db.models.ForeignKey",
"core.utils.combine_datetime_pk",
"django.db.models.ManyToManyField",
"django.db.models.DecimalField",
"django.db.models.CharField"
] | [((438, 475), 'django.db.models.CharField', 'models.CharField', (['"""款号"""'], {'max_length': '(20)'}), "('款号', max_length=20)\n", (454, 475), False, 'from django.db import models\n'), ((492, 541), 'django.db.models.CharField', 'models.CharField', (['"""描述"""'], {'max_length': '(50)', 'blank': '(True)'}), "('描述', max_l... |
import unittest
import tempfile
import numpy as np
import coremltools
import os
import shutil
import tensorflow as tf
from tensorflow.keras import backend as _keras
from tensorflow.keras import layers
from coremltools._deps import HAS_TF_2
from test_utils import generate_data, tf_transpose
class TensorFlowKerasTests... | [
"numpy.random.rand",
"tensorflow.keras.layers.BatchNormalization",
"numpy.array",
"tensorflow.keras.layers.Dense",
"tensorflow.train.write_graph",
"tensorflow.keras.layers.GlobalMaxPooling2D",
"unittest.main",
"tensorflow.keras.layers.MaxPooling1D",
"tensorflow.gfile.GFile",
"tensorflow.keras.laye... | [((10165, 10224), 'unittest.skip', 'unittest.skip', (['"""non-equal block shape is not yet supported"""'], {}), "('non-equal block shape is not yet supported')\n", (10178, 10224), False, 'import unittest\n'), ((11845, 11885), 'unittest.skip', 'unittest.skip', (['"""list index out of range"""'], {}), "('list index out o... |
# Third party imports
from django.conf.urls import url, include
from rest_framework import routers
from django.contrib import admin
# Pepper imports
from pepper.facebook.api import UserViewSet, GroupViewSet
# Relative imports
from . import api_urls
# Default user and group routers
router = routers.DefaultRouter()
ro... | [
"django.conf.urls.include",
"django.conf.urls.url",
"rest_framework.routers.DefaultRouter"
] | [((294, 317), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {}), '()\n', (315, 317), False, 'from rest_framework import routers\n'), ((644, 674), 'django.conf.urls.url', 'url', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (647, 674), False, 'from django.conf.urls i... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import markovify
import glob
# use 3 or even 2 to add more nonsense. using 5 will eliminate cross-corpora sentences. so 4 is optimal
STATE_SIZE = 4
SENTENCES = 1000
models = []
for filename in glob.glob("corpus-programming/*.txt"):
print('Loading file:', filename)
... | [
"markovify.combine",
"glob.glob"
] | [((243, 280), 'glob.glob', 'glob.glob', (['"""corpus-programming/*.txt"""'], {}), "('corpus-programming/*.txt')\n", (252, 280), False, 'import glob\n'), ((437, 467), 'glob.glob', 'glob.glob', (['"""corpus-veda/*.txt"""'], {}), "('corpus-veda/*.txt')\n", (446, 467), False, 'import glob\n'), ((616, 641), 'markovify.combi... |
"""
Graph exploration module.
"""
import itertools
import time
from qas.wikidata import Wikidata, NoSPARQLResponse
MAX_PATH_LENGTH = 5
DISABLE_PARALLEL = True
RETRY_PARALLEL_SPARQL = False
class Path(object):
def __init__(self, path, config, item_from, item_to):
self.length = len(path) // 2 + 1
... | [
"qas.wikidata.Wikidata.sparql",
"itertools.product",
"itertools.combinations",
"qas.wikidata.Wikidata.sparql_parallel",
"time.time"
] | [((4410, 4432), 'qas.wikidata.Wikidata.sparql', 'Wikidata.sparql', (['query'], {}), '(query)\n', (4425, 4432), False, 'from qas.wikidata import Wikidata, NoSPARQLResponse\n'), ((5383, 5405), 'qas.wikidata.Wikidata.sparql', 'Wikidata.sparql', (['query'], {}), '(query)\n', (5398, 5405), False, 'from qas.wikidata import W... |
from copy import deepcopy
import os
import uuid
import pyparsing
from lxml import etree
from resources.sbtabpy import modelSystem
OUTPUT_NAME = "test_model.xml"
######################
######################
##
## Utility Functions
##
######################
######################
def genID():
... | [
"lxml.etree.SubElement",
"pyparsing.Word",
"uuid.uuid4",
"resources.sbtabpy.modelSystem",
"copy.deepcopy",
"lxml.etree.tostring"
] | [((488, 501), 'resources.sbtabpy.modelSystem', 'modelSystem', ([], {}), '()\n', (499, 501), False, 'from resources.sbtabpy import modelSystem\n'), ((2172, 2204), 'lxml.etree.SubElement', 'etree.SubElement', (['model', '"""notes"""'], {}), "(model, 'notes')\n", (2188, 2204), False, 'from lxml import etree\n'), ((2224, 2... |
import asyncio
import logging
import sys
import discord
import yaml
from discord.ext import commands
from twilio.rest import Client
config = yaml.safe_load(open("config.yml"))
bot = commands.Bot(command_prefix=config["prefix"], intents=discord.Intents.default())
logging.basicConfig(
format="%(levelname)s | %(asct... | [
"logging.basicConfig",
"twilio.rest.Client",
"logging.info",
"discord.Intents.default"
] | [((265, 396), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)s | %(asctime)s | %(name)s | %(message)s"""', 'stream': 'sys.stdout', 'level': 'logging.INFO'}), "(format=\n '%(levelname)s | %(asctime)s | %(name)s | %(message)s', stream=sys.\n stdout, level=logging.INFO)\n", (284, 396),... |
from django.dispatch import receiver
from django.utils.text import slugify
from django.db.models.signals import post_delete, pre_save
from blog.models import *
def category_create(sender, instance, **kwargs):
instance.name = instance.name.lower()
pre_save.connect(category_create, sender=Category)
# Create Sl... | [
"django.dispatch.receiver",
"django.utils.text.slugify",
"django.db.models.signals.pre_save.connect"
] | [((256, 306), 'django.db.models.signals.pre_save.connect', 'pre_save.connect', (['category_create'], {'sender': 'Category'}), '(category_create, sender=Category)\n', (272, 306), False, 'from django.db.models.signals import post_delete, pre_save\n'), ((560, 602), 'django.db.models.signals.pre_save.connect', 'pre_save.co... |
#!/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:
# pylint: disable=no-member
#
# @Author: oesteban
# @Date: 2016-01-05 11:33:39
# @Email: <EMAIL>
# @Last modified by: oesteban
""" Encapsulates report gene... | [
"mriqc.data.IndividualTemplate",
"mriqc.reports.utils.anat_flags",
"mriqc.reports.utils.iqms2html",
"io.open",
"json.load",
"datetime.datetime.now",
"mriqc.reports.utils.read_report_snippet",
"os.path.basename",
"mriqc.logging.getLogger",
"os.path.abspath",
"mriqc.utils.misc.BIDS_COMP.keys"
] | [((903, 936), 'mriqc.logging.getLogger', 'logging.getLogger', (['"""mriqc.report"""'], {}), "('mriqc.report')\n", (920, 936), False, 'from mriqc import logging\n'), ((1166, 1193), 'os.path.abspath', 'op.abspath', (["(fname + '.html')"], {}), "(fname + '.html')\n", (1176, 1193), True, 'import os.path as op\n'), ((2565, ... |
import restic
import unittest
import shutil
class TestBackup(unittest.TestCase):
def test_backup_file(self):
repo = restic.Repo.init('repos_test/test_repo', '12345678')
try:
repo.backup('setup.py')
snapshots = repo.snapshots()
self.assertEqual(len(snapshots), 1)... | [
"unittest.main",
"shutil.rmtree",
"restic.Repo.init"
] | [((578, 593), 'unittest.main', 'unittest.main', ([], {}), '()\n', (591, 593), False, 'import unittest\n'), ((130, 182), 'restic.Repo.init', 'restic.Repo.init', (['"""repos_test/test_repo"""', '"""12345678"""'], {}), "('repos_test/test_repo', '12345678')\n", (146, 182), False, 'import restic\n'), ((508, 545), 'shutil.rm... |
# Copyright (c) 2019 <NAME> <<EMAIL>>
# ISC License <https://opensource.org/licenses/isc>
import typing
from textwrap import dedent
import pytest
import file_config
from hypothesis import given
from hypothesis.strategies import from_regex
@file_config.config
class A:
@file_config.config
class B:
bar... | [
"hypothesis.strategies.from_regex",
"pytest.warns",
"pytest.raises",
"file_config.var"
] | [((355, 375), 'file_config.var', 'file_config.var', (['str'], {}), '(str)\n', (370, 375), False, 'import file_config\n'), ((386, 404), 'file_config.var', 'file_config.var', (['B'], {}), '(B)\n', (401, 404), False, 'import file_config\n'), ((414, 458), 'hypothesis.strategies.from_regex', 'from_regex', (['"""\\\\A[a-zA-Z... |
#!/usr/bin/env ipython
import unittest
from clisn import loads
from match import LISNPattern
from pprint import pprint
class PatternTest(unittest.TestCase):
def test_very_basic_pattern(self):
@LISNPattern
def pat_vb(case, default):
@case
def A(res):
'''
... | [
"unittest.main",
"clisn.loads"
] | [((4727, 4742), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4740, 4742), False, 'import unittest\n'), ((897, 912), 'clisn.loads', 'loads', (['"""FooBar"""'], {}), "('FooBar')\n", (902, 912), False, 'from clisn import loads\n'), ((951, 961), 'clisn.loads', 'loads', (['"""b"""'], {}), "('b')\n", (956, 961), Fals... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
大智慧数据的处理
"""
import urllib
import urllib.request
import numpy as np
from struct import *
from ..xio.h5 import write_dataframe_set_struct_keep_head
dzh_h5_type = np.dtype([
('time', np.uint64),
('pre_day', np.float64),
('pre_close', np.float64),
('split... | [
"numpy.fromiter",
"urllib.request.install_opener",
"urllib.request.ProxyHandler",
"urllib.request.build_opener",
"numpy.dtype",
"urllib.request.urlopen"
] | [((213, 545), 'numpy.dtype', 'np.dtype', (["[('time', np.uint64), ('pre_day', np.float64), ('pre_close', np.float64), (\n 'split', np.float64), ('purchase', np.float64), ('purchase_price', np.\n float64), ('dividend', np.float64), ('dr_pre_close', np.float64), (\n 'dr_factor', np.float64), ('backward_factor', ... |
from collections import namedtuple
from itertools import chain
from os import makedirs, rename, scandir, listdir
from os.path import (join as p, exists, relpath, isdir, isfile,
expanduser, expandvars, realpath)
from struct import pack
import errno
import hashlib
import json
import logging
import re
import shuti... | [
"logging.getLogger",
"itertools.chain",
"rdflib.parser.create_input_source",
"re.compile",
"os.path.exists",
"textwrap.dedent",
"os.listdir",
"os.path.isdir",
"os.path.expanduser",
"os.path.relpath",
"urllib.parse.unquote",
"collections.namedtuple",
"rdflib.term.URIRef",
"yaml.dump",
"os... | [((1648, 1675), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1665, 1675), False, 'import logging\n'), ((1705, 1737), 'os.path.join', 'p', (['OWMETA_PROFILE_DIR', '"""bundles"""'], {}), "(OWMETA_PROFILE_DIR, 'bundles')\n", (1706, 1737), True, 'from os.path import join as p, exists, relp... |
"""
Simple class based thing to make loading the datasets nice and easy.
Author: <NAME>
Created: 13/12/2020
"""
import pandas as pd
from sqlalchemy import MetaData, create_engine
from src.config import RAW_DATA
class Data:
def __init__(self, dataset: str) -> None:
"""
Simple class to act as an ... | [
"pandas.read_sql_table",
"sqlalchemy.MetaData",
"src.config.RAW_DATA.joinpath",
"pandas.Categorical"
] | [((1383, 1410), 'sqlalchemy.MetaData', 'MetaData', ([], {'bind': 'self._engine'}), '(bind=self._engine)\n', (1391, 1410), False, 'from sqlalchemy import MetaData, create_engine\n'), ((2188, 2251), 'pandas.read_sql_table', 'pd.read_sql_table', ([], {'table_name': 'self._tablename', 'con': 'self._engine'}), '(table_name=... |
import torch
from torch_geometric.data import InMemoryDataset,Data
from os.path import join, isfile
from os import listdir
import numpy as np
import os.path as osp
from utils.construct_graph import read_data
class AbideDataset(InMemoryDataset):
def __init__(self, root, name, transform=None, pre_transform=None):
... | [
"os.listdir",
"torch.load",
"os.path.join",
"torch.save",
"utils.construct_graph.read_data"
] | [((476, 511), 'torch.load', 'torch.load', (['self.processed_paths[0]'], {}), '(self.processed_paths[0])\n', (486, 511), False, 'import torch\n'), ((576, 602), 'os.path.join', 'osp.join', (['self.root', '"""raw"""'], {}), "(self.root, 'raw')\n", (584, 602), True, 'import os.path as osp\n'), ((994, 1026), 'utils.construc... |
"""
Author: <NAME> (Vincent)
Description: Connect/create an SQLite3 database and check/create the necessary tables.
"""
import sqlite3
from sqlite3 import Error
import os
def make_dir(filename):
current_dir = os.path.dirname(os.path.abspath(__file__))
dest_dir = os.path.join(current_dir, "db")
try:
... | [
"os.path.abspath",
"os.path.join",
"os.makedirs"
] | [((273, 304), 'os.path.join', 'os.path.join', (['current_dir', '"""db"""'], {}), "(current_dir, 'db')\n", (285, 304), False, 'import os\n'), ((388, 420), 'os.path.join', 'os.path.join', (['dest_dir', 'filename'], {}), '(dest_dir, filename)\n', (400, 420), False, 'import os\n'), ((231, 256), 'os.path.abspath', 'os.path.... |
# -*- coding: utf-8 -*-
# !/usr/bin/env python
__author__ = 'maxwu'
from random import randint
from django.views.generic import TemplateView
from chartjs.views.lines import BaseLineChartView
class LineChartJSONView(BaseLineChartView):
def get_labels(self):
"""Return 7 labels."""
#return ["Januar... | [
"django.views.generic.TemplateView.as_view"
] | [((927, 980), 'django.views.generic.TemplateView.as_view', 'TemplateView.as_view', ([], {'template_name': '"""line_chart.html"""'}), "(template_name='line_chart.html')\n", (947, 980), False, 'from django.views.generic import TemplateView\n')] |
from src.commands.help import HelpCommand
from src.commands.version import VersionCommand
class CommandManager(object):
"""docstring for CommandManager."""
def __init__(self):
super(CommandManager, self).__init__()
self.command_list = self._build_command_list()
def _build_command_list(sel... | [
"src.commands.version.VersionCommand",
"src.commands.help.HelpCommand"
] | [((554, 571), 'src.commands.help.HelpCommand', 'HelpCommand', (['self'], {}), '(self)\n', (565, 571), False, 'from src.commands.help import HelpCommand\n'), ((596, 612), 'src.commands.version.VersionCommand', 'VersionCommand', ([], {}), '()\n', (610, 612), False, 'from src.commands.version import VersionCommand\n')] |
import torch
import torch.nn as nn
from asteroid.engine.optimizers import make_optimizer
from torch.nn.modules.loss import _Loss
from asteroid.filterbanks import make_enc_dec
from asteroid.filterbanks.transforms import take_mag
from pystoi import stoi
from pb_bss_eval.evaluation.module_pesq import pesq
class Discrimi... | [
"torch.nn.BatchNorm2d",
"torch.ones_like",
"torch.nn.LeakyReLU",
"asteroid.filterbanks.transforms.take_mag",
"torch.nn.Conv2d",
"asteroid.filterbanks.make_enc_dec",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.Linear",
"torch.cat"
] | [((3727, 3761), 'asteroid.filterbanks.make_enc_dec', 'make_enc_dec', ([], {}), "(**conf['filterbank'])\n", (3739, 3761), False, 'from asteroid.filterbanks import make_enc_dec\n'), ((1034, 1057), 'torch.nn.AdaptiveAvgPool2d', 'nn.AdaptiveAvgPool2d', (['(1)'], {}), '(1)\n', (1054, 1057), True, 'import torch.nn as nn\n'),... |
from collections import Counter
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.shortcuts import render, HttpResponseRedirect, redirect
from django.views.generic import ListView
from apps.corecode.models import AcademicSession, AcademicTerm,StudentClass
from a... | [
"django.shortcuts.render",
"apps.students.models.Student.objects.get",
"apps.students.models.Student.objects.all",
"django.contrib.messages.warning",
"apps.corecode.models.StudentClass.objects.all",
"django.shortcuts.redirect",
"django.contrib.messages.success"
] | [((535, 556), 'apps.students.models.Student.objects.all', 'Student.objects.all', ([], {}), '()\n', (554, 556), False, 'from apps.students.models import Student\n'), ((2096, 2164), 'django.shortcuts.render', 'render', (['request', '"""result/create_result.html"""', "{'students': students}"], {}), "(request, 'result/crea... |
# coding: utf-8
"""
NamSor API v2
NamSor API v2 : enpoints to process personal names (gender, cultural origin or ethnicity) in all alphabets or languages. Use GET methods for small tests, but prefer POST methods for higher throughput (batch processing of up to 100 names at a time). Need something you can't fi... | [
"six.iteritems"
] | [((10186, 10219), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (10199, 10219), False, 'import six\n')] |
"""
Res2Net for ImageNet-1K, implemented in Gluon.
Original paper: 'Res2Net: A New Multi-scale Backbone Architecture,' https://arxiv.org/abs/1904.01169.
"""
__all__ = ['Res2Net', 'res2net50_w14_s8', 'res2net50_w26_s8']
import os
from mxnet import cpu
from mxnet.gluon import nn, HybridBlock
from mxnet.gluon.co... | [
"numpy.prod",
"mxnet.nd.zeros",
"mxnet.gluon.nn.Dense",
"mxnet.cpu",
"mxnet.gluon.contrib.nn.Identity",
"os.path.join",
"mxnet.gluon.nn.Flatten",
"mxnet.gluon.nn.AvgPool2D",
"mxnet.gluon.nn.HybridSequential",
"mxnet.gluon.nn.Activation"
] | [((7313, 7318), 'mxnet.cpu', 'cpu', ([], {}), '()\n', (7316, 7318), False, 'from mxnet import cpu\n'), ((7341, 7378), 'os.path.join', 'os.path.join', (['"""~"""', '""".mxnet"""', '"""models"""'], {}), "('~', '.mxnet', 'models')\n", (7353, 7378), False, 'import os\n'), ((10602, 10610), 'mxnet.cpu', 'mx.cpu', ([], {}), '... |
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.4
# kernelspec:
# display_name: Python 3
# name: python3
# ---
# +
from pathlib import Path
import geopandas as gpd
import pandas as pd
fro... | [
"geopandas.sjoin",
"geopandas.read_file",
"pathlib.Path",
"shapely.geometry.box",
"geopandas.overlay",
"pandas.read_excel"
] | [((366, 378), 'pathlib.Path', 'Path', (['"""data"""'], {}), "('data')\n", (370, 378), False, 'from pathlib import Path\n'), ((1416, 1458), 'pandas.read_excel', 'pd.read_excel', (["FILEPATHS['rail_schedules']"], {}), "(FILEPATHS['rail_schedules'])\n", (1429, 1458), True, 'import pandas as pd\n'), ((2145, 2204), 'geopand... |
from unittest import TestCase, skipUnless, mock
from pya import *
import numpy as np
import time
class TestAserver(TestCase):
def setUp(self) -> None:
self.backend = DummyBackend()
self.sig = np.sin(2 * np.pi * 440 * np.linspace(0, 1, 44100))
self.asine = Asig(self.sig, sr=44100, label="t... | [
"numpy.linspace",
"numpy.iinfo",
"time.sleep",
"numpy.max"
] | [((555, 570), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (565, 570), False, 'import time\n'), ((1049, 1064), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (1059, 1064), False, 'import time\n'), ((809, 823), 'numpy.max', 'np.max', (['sample'], {}), '(sample)\n', (815, 823), True, 'import numpy as ... |
import sys
from zeep import Client
from PythonUtils.text_input import TextInput
from PythonUtils.live_info.display_item import DisplayItem
from PythonUtils.user_input import UserInput
import json
from pathlib import Path
# WSDL location of the LDBWS rail information. The most up to date version is
# detailed here: htt... | [
"zeep.Client",
"PythonUtils.text_input.TextInput",
"PythonUtils.live_info.display_item.DisplayItem.__init__",
"pathlib.Path"
] | [((2552, 2672), 'PythonUtils.text_input.TextInput', 'TextInput', (['"""Which station would you like to see the departures of? Please enter the 3 character station code."""'], {}), "(\n 'Which station would you like to see the departures of? Please enter the 3 character station code.'\n )\n", (2561, 2672), False, ... |
# Importing modules
import pygame
import numpy as np
import random
# Initializing the Pygame module
pygame.init()
def console_screen():
"""This function is meant for the user to enter specifications for the game as the player plays. """
print('Note: Enter nicknames to name the players in the game'... | [
"pygame.mouse.get_pressed",
"pygame.init",
"pygame.quit",
"pygame.mixer.music.set_volume",
"pygame.mixer_music.load",
"pygame.font.Font",
"numpy.flip",
"pygame.display.set_mode",
"pygame.mixer_music.play",
"pygame.mouse.get_pos",
"pygame.draw.rect",
"pygame.image.load",
"pygame.display.updat... | [((107, 120), 'pygame.init', 'pygame.init', ([], {}), '()\n', (118, 120), False, 'import pygame\n'), ((2801, 2857), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(display_width, display_height)'], {}), '((display_width, display_height))\n', (2824, 2857), False, 'import pygame\n'), ((2859, 2901), 'pygame.disp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from IPython.core.magic import (
register_line_magic,
register_cell_magic,
register_line_cell_magic,
)
from IPython.display import HTML, Image
from pygments import highlight
from pygments.lexers import PythonLexer, get_lexer_by_name
from pygments.formatte... | [
"pygments.formatters.ImageFormatter",
"pygments.formatters.HtmlFormatter",
"pygments.lexers.PythonLexer",
"pygments.lexers.get_lexer_by_name"
] | [((1019, 1032), 'pygments.lexers.PythonLexer', 'PythonLexer', ([], {}), '()\n', (1030, 1032), False, 'from pygments.lexers import PythonLexer, get_lexer_by_name\n'), ((680, 693), 'pygments.lexers.PythonLexer', 'PythonLexer', ([], {}), '()\n', (691, 693), False, 'from pygments.lexers import PythonLexer, get_lexer_by_nam... |
# -*- coding: utf-8 -*-
from flask import render_template, session, request
from app import app
from app.log import get_logger
from app.models.Login import login_required
from app.models.SQL_DB import User
logger = get_logger(__name__)
@app.route("/settings/profile", methods=["GET", "POST"])
@login_required
def set... | [
"flask.render_template",
"app.models.Mailgun_Internal.mailgun_get_campaigns",
"app.models.SQL_DB.User.query.filter_by",
"flask_bcrypt.generate_password_hash",
"app.models.Settings.edit_password",
"app.models.Settings.edit_profile",
"app.app.route",
"app.models.Mailgun_Internal.mailgun_delete_campaigns... | [((217, 237), 'app.log.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (227, 237), False, 'from app.log import get_logger\n'), ((241, 296), 'app.app.route', 'app.route', (['"""/settings/profile"""'], {'methods': "['GET', 'POST']"}), "('/settings/profile', methods=['GET', 'POST'])\n", (250, 296), False, '... |
from django.conf.urls import include, url
from django.views.generic.base import RedirectView
urlpatterns = [
url(r'^event/', include('sedastrela_is.event.urls', namespace='event')),
url(r'^$', RedirectView.as_view(url='/admin/')),
]
| [
"django.conf.urls.include",
"django.views.generic.base.RedirectView.as_view"
] | [((131, 185), 'django.conf.urls.include', 'include', (['"""sedastrela_is.event.urls"""'], {'namespace': '"""event"""'}), "('sedastrela_is.event.urls', namespace='event')\n", (138, 185), False, 'from django.conf.urls import include, url\n'), ((203, 238), 'django.views.generic.base.RedirectView.as_view', 'RedirectView.as... |
# test synthetic particles with x-displacement
from os.path import join
import matplotlib.pyplot as plt
# imports
import numpy as np
import pandas as pd
import filter
import analyze
from correction import correct
from utils import io, plotting, modify, details
# setup file paths
base_dir = '/Users/mackenzie/Desktop... | [
"utils.plotting.plot_dfbicts_local",
"os.path.join",
"matplotlib.pyplot.close",
"filter.dficts_filter",
"matplotlib.pyplot.tight_layout",
"utils.io.read_dataframes",
"analyze.calculate_bin_local_rmse_z",
"matplotlib.pyplot.show"
] | [((411, 436), 'os.path.join', 'join', (['base_dir', '"""results"""'], {}), "(base_dir, 'results')\n", (415, 436), False, 'from os.path import join\n'), ((449, 471), 'os.path.join', 'join', (['base_dir', '"""figs"""'], {}), "(base_dir, 'figs')\n", (453, 471), False, 'from os.path import join\n'), ((508, 560), 'os.path.j... |
#!flask/bin/python
# Copyright 2015 vblazhnov
#
# 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... | [
"db.DataBase.add_user",
"flask.Flask",
"db.DataBase.get_user_info",
"db.DataBase.add_event",
"db.DataBase.get_users_event",
"functools.wraps",
"db.DataBase.get_users_events",
"flask.abort",
"db.DataBase.is_valid_pass",
"flask.jsonify"
] | [((739, 754), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (744, 754), False, 'from flask import Flask, jsonify, abort, make_response, request\n'), ((1234, 1242), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (1239, 1242), False, 'from functools import wraps\n'), ((1566, 1605), 'db.DataBase.is_valid_... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from ast import literal_eval
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
class Project(models.Model):
_inherit = 'project.project'
sale_line_id = fields.Many2one(
... | [
"odoo._",
"odoo.api.constrains",
"odoo.fields.Many2one",
"odoo.fields.Integer",
"odoo.api.depends",
"odoo.fields.Boolean"
] | [((298, 856), 'odoo.fields.Many2one', 'fields.Many2one', (['"""sale.order.line"""', '"""Sales Order Item"""'], {'copy': '(False)', 'domain': '"""[(\'is_service\', \'=\', True), (\'is_expense\', \'=\', False), (\'order_id\', \'=\', sale_order_id), (\'state\', \'in\', [\'sale\', \'done\']), \'|\', (\'company_id\', \'=\',... |
from .AAA3A_utils.cogsutils import CogsUtils # isort:skip
from redbot.core import commands # isort:skip
from redbot.core.i18n import Translator, cog_i18n # isort:skip
from redbot.core.bot import Red # isort:skip
import discord # isort:skip
import typing # isort:skip
from typing import List, Optional, Tuple,... | [
"redbot.core.Config.get_conf",
"redbot.core.commands.Cog.listener",
"redbot.core.i18n.Translator",
"redbot.core.i18n.cog_i18n",
"redbot.core.commands.guild_only",
"discord.Colour.dark_teal",
"redbot.core.commands.group",
"discord.Embed",
"redbot.core.commands.guildowner"
] | [((1035, 1067), 'redbot.core.i18n.Translator', 'Translator', (['"""AntiNuke"""', '__file__'], {}), "('AntiNuke', __file__)\n", (1045, 1067), False, 'from redbot.core.i18n import Translator, cog_i18n\n'), ((1072, 1083), 'redbot.core.i18n.cog_i18n', 'cog_i18n', (['_'], {}), '(_)\n', (1080, 1083), False, 'from redbot.core... |
import webbrowser
from subprocess import Popen
from typing import List
from gochan.config import BROWSER_PATH
def open_link(url: str):
if BROWSER_PATH is None:
webbrowser.open(url)
else:
Popen([BROWSER_PATH, url])
def open_links(urls: List[str]):
if BROWSER_PATH is None:
for url... | [
"subprocess.Popen",
"webbrowser.open"
] | [((175, 195), 'webbrowser.open', 'webbrowser.open', (['url'], {}), '(url)\n', (190, 195), False, 'import webbrowser\n'), ((214, 240), 'subprocess.Popen', 'Popen', (['[BROWSER_PATH, url]'], {}), '([BROWSER_PATH, url])\n', (219, 240), False, 'from subprocess import Popen\n'), ((381, 409), 'subprocess.Popen', 'Popen', (['... |
"""Add domain's ip
Revision ID: 2710366d3d68
Revises: 43b883c483b4
Create Date: 2021-12-22 03:19:46.487228
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '2<PASSWORD>'
down_revision = '43b883c483b4'
branch_labels = None
depends_on = None
def upgrade():
... | [
"sqlalchemy.String",
"alembic.op.drop_column"
] | [((583, 616), 'alembic.op.drop_column', 'op.drop_column', (['"""domains"""', '"""ipv4"""'], {}), "('domains', 'ipv4')\n", (597, 616), False, 'from alembic import op\n'), ((429, 440), 'sqlalchemy.String', 'sa.String', ([], {}), '()\n', (438, 440), True, 'import sqlalchemy as sa\n')] |
# Copyright (c) <NAME>, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
# added -fpermissive to CMAKE_CXX_FLAGS to workaround g++ 4.3 compile
# problem on the included CPT code. We were getting "changes meaning
# of" errors as documented in
# http://stupefydeveloper.blogspot.com/2008/11/c-name-lookup-c... | [
"os.path.exists",
"utils.output",
"utils.error",
"utils.cmake_command",
"os.path.join",
"utils.file_exists",
"os.chdir",
"os.mkdir",
"shutil.rmtree",
"os.system",
"utils.make_command"
] | [((642, 684), 'os.path.join', 'os.path.join', (['config.archive_dir', 'BASENAME'], {}), '(config.archive_dir, BASENAME)\n', (654, 684), False, 'import os\n'), ((710, 766), 'os.path.join', 'os.path.join', (['config.build_dir', "('%s-build' % (BASENAME,))"], {}), "(config.build_dir, '%s-build' % (BASENAME,))\n", (722, 76... |
import gym
from gym import wrappers
from gym.envs.registration import register
from config import Params
# register ExpansionAi gym env
register(
id='ExpansionAi-v0',
entry_point='expansionai_env:ExpansionAiEnv',
)
def create_expansionai_env(env_id, video=False, params=Params()):
gym.spec(env_id)._kwarg... | [
"config.Params",
"gym.spec",
"gym.wrappers.Monitor",
"gym.envs.registration.register",
"gym.make"
] | [((138, 213), 'gym.envs.registration.register', 'register', ([], {'id': '"""ExpansionAi-v0"""', 'entry_point': '"""expansionai_env:ExpansionAiEnv"""'}), "(id='ExpansionAi-v0', entry_point='expansionai_env:ExpansionAiEnv')\n", (146, 213), False, 'from gym.envs.registration import register\n'), ((282, 290), 'config.Param... |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\apartments\situations\neighbor_group_hangout.py
# Compiled at: 2018-11-17 02:17:10
# Size of source ... | [
"random.sample",
"sims4.tuning.instances.lock_instance_tunables",
"situations.situation_complex.TunableSituationJobAndRoleState",
"situations.situation_guest_list.SituationGuestList",
"ui.ui_dialog_notification.TunableUiDialogNotificationSnippet",
"services.active_household",
"services.get_event_manager... | [((7150, 7320), 'sims4.tuning.instances.lock_instance_tunables', 'lock_instance_tunables', (['NeighborGroupHangoutSituation'], {'exclusivity': 'BouncerExclusivityCategory.NORMAL', 'creation_ui_option': 'SituationCreationUIOption.NOT_AVAILABLE'}), '(NeighborGroupHangoutSituation, exclusivity=\n BouncerExclusivityCate... |
import inspect
import os
import sys
import unittest
from unittest.mock import call, patch
from Whittler import File, Process, WhittlerProgram
from WhittlerTests import Random, UnitTester
testNames = [
'test_get_module_ReturnsWhittlerProgramModule',
'test_make_whittler_filepath_for_command_ReturnsHomeSlashDot... | [
"Whittler.WhittlerProgram.open_whittler_file_with_editor_environment_variable.assert_called_once_with",
"os.path.expanduser.assert_called_once_with",
"Whittler.WhittlerProgram.try_open_whittler_file.assert_called_once_with",
"Whittler.WhittlerProgram.write_program_output_to_whittler_file.assert_called_once_wi... | [((2732, 2770), 'unittest.mock.patch', 'patch', (['"""os.environ.get"""'], {'spec_set': '(True)'}), "('os.environ.get', spec_set=True)\n", (2737, 2770), False, 'from unittest.mock import call, patch\n'), ((2776, 2830), 'unittest.mock.patch', 'patch', (['"""Whittler.Process.fail_fast_run"""'], {'spec_set': '(True)'}), "... |
from django.db import models
from django.utils.translation import ugettext as _
from ckeditor_uploader.fields import RichTextUploadingField
class RangAward(models.Model):
title = models.CharField(verbose_name=_('Заголовок'), max_length=60)
volume = models.DecimalField(verbose_name=_('Объём'), max_digits=10, d... | [
"django.utils.translation.ugettext",
"ckeditor_uploader.fields.RichTextUploadingField",
"django.db.models.BooleanField"
] | [((877, 911), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (896, 911), False, 'from django.db import models\n'), ((927, 961), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (946, 961), False, 'from ... |
# --------------------------------
# Name: CEBatchFBXExport.py
# Purpose: Batch export of CE layers to game engine importable FBXs.
# Current Owner: <NAME>
# Last Modified: 7/12/2017
# Copyright: (c) Co-Adaptive
# CityEngine Vs: 2017
# Python Version: 2.7
# License
# Copyright 2015 <NAME>
#
# Licensed under the Apa... | [
"os.path.exists",
"os.path.join",
"os.makedirs"
] | [((1509, 1538), 'os.path.exists', 'os.path.exists', (['Base_Dir_Path'], {}), '(Base_Dir_Path)\n', (1523, 1538), False, 'import os\n'), ((1860, 1886), 'os.makedirs', 'os.makedirs', (['Base_Dir_Path'], {}), '(Base_Dir_Path)\n', (1871, 1886), False, 'import os\n'), ((1587, 1625), 'os.path.join', 'os.path.join', (['Base_Di... |
import tkinter as tk
import random
class Controller(object):
"""
A class to control the movement of the snake in the game
"""
def __init__(self, screen):
"""
Binds the arrow keys to the game canvas.
Parameters:
screen (Canvas): The canvas for the Snake game.
... | [
"tkinter.Tk",
"random.randint",
"tkinter.Label"
] | [((9641, 9648), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (9646, 9648), True, 'import tkinter as tk\n'), ((5884, 5918), 'random.randint', 'random.randint', (['(0)', '(self._width - 5)'], {}), '(0, self._width - 5)\n', (5898, 5918), False, 'import random\n'), ((5936, 5971), 'random.randint', 'random.randint', (['(0)', '(... |
# coding: utf-8
from __future__ import with_statement, print_function, absolute_import
import torch
from torch import nn
import torch.nn.functional as F
import numpy as np
def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_pl... | [
"torch.nn.ReLU",
"torch.nn.init.constant_",
"torch.nn.Sequential",
"numpy.random.random_integers",
"torch.nn.init.kaiming_normal_",
"torch.nn.Conv2d",
"torch.nn.functional.normalize",
"torch.nn.MaxPool2d",
"torch.nn.Linear",
"torch.nn.functional.softmax",
"torch.rand"
] | [((293, 424), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'out_planes'], {'kernel_size': '(3)', 'stride': 'stride', 'padding': 'dilation', 'groups': 'groups', 'bias': '(False)', 'dilation': 'dilation'}), '(in_planes, out_planes, kernel_size=3, stride=stride, padding=\n dilation, groups=groups, bias=False, dilatio... |
# https://discordapp.com/developers/docs/resources/channel#embed-limits
import discord
from ..lists import (
weapons_english_internal,
abilities_short_to_emoji,
top_500_emoji,
weapons_to_emoji,
)
# Cheers to Lean
class LohiEmbed:
def __init__(
self,
title="\uFEFF",
descrip... | [
"discord.Embed"
] | [((1739, 1815), 'discord.Embed', 'discord.Embed', ([], {'title': 'title', 'description': 'desc', 'color': 'self.color', 'url': 'self.url'}), '(title=title, description=desc, color=self.color, url=self.url)\n', (1752, 1815), False, 'import discord\n'), ((2291, 2367), 'discord.Embed', 'discord.Embed', ([], {'title': 'tit... |
import argparse
import asyncio
import json
import sys
import time
from google.protobuf import json_format
from google.protobuf.message import DecodeError
from highlevel.adapter.socket.isotp import ISOTPSocketAdapter, ISOTPAddress
from proto.gen.python.outech_pb2 import BusMessage
t_last = time.time()
async def mai... | [
"sys.stdout.flush",
"proto.gen.python.outech_pb2.BusMessage",
"argparse.ArgumentParser",
"json.dumps",
"google.protobuf.json_format.MessageToDict",
"highlevel.adapter.socket.isotp.ISOTPAddress",
"time.time",
"sys.stdout.write"
] | [((293, 304), 'time.time', 'time.time', ([], {}), '()\n', (302, 304), False, 'import time\n'), ((356, 423), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Read packets on the CAN bus."""'}), "(description='Read packets on the CAN bus.')\n", (379, 423), False, 'import argparse\n'), ((908,... |
import torch
from torch import nn
from torch.nn import functional as F
from lib.utils import bounding_box_batch, get_member
from models.pose_discriminator import MIDisc, MIDiscConv1
from lib.utils import toggle_grad
from torch.optim import Adam
from collections import namedtuple
VGGOutput = namedtuple(
"VGGOutput... | [
"torch.nn.ReLU",
"torch.optim.lr_scheduler.MultiStepLR",
"torch.nn.Sequential",
"lib.utils.bounding_box_batch",
"torch.exp",
"torch.pow",
"models.pose_discriminator.MIDiscConv1",
"torch.nn.MSELoss",
"torch.sum",
"torch.nn.Sigmoid",
"torch.mean",
"lib.utils.get_member",
"torch.zeros_like",
... | [((294, 387), 'collections.namedtuple', 'namedtuple', (['"""VGGOutput"""', "['input', 'relu1_2', 'relu2_2', 'relu3_2', 'relu4_2', 'relu5_2']"], {}), "('VGGOutput', ['input', 'relu1_2', 'relu2_2', 'relu3_2',\n 'relu4_2', 'relu5_2'])\n", (304, 387), False, 'from collections import namedtuple\n'), ((609, 635), 'torch.s... |
"""Implementation of circuit for ML
"""
from numpy import pi, random, zeros_like, zeros, log2
class circuitML():
"""Abstract Quantum ML circuit interface.
Provides a unified interface to run multiple parametric circuits with
different input and model parameters, agnostic of the backend, implemented
in... | [
"numpy.zeros_like",
"numpy.zeros",
"numpy.random.seed",
"numpy.log2",
"numpy.random.randn"
] | [((2458, 2485), 'numpy.random.randn', 'random.randn', (['self.nbparams'], {}), '(self.nbparams)\n', (2470, 2485), False, 'from numpy import pi, random, zeros_like, zeros, log2\n'), ((4925, 4956), 'numpy.zeros', 'zeros', (['(self.nbparams, dim_out)'], {}), '((self.nbparams, dim_out))\n', (4930, 4956), False, 'from numpy... |
'''
mb_24x256_512.py
Very Simple MicroPython module/driver for Microchip 24x256 and 24x512 I2C EEPROM
Author: <EMAIL>
Version: 0.1, 2021-06-04
**NOTE(1): There is no guarantee that this software will work in the way you expect (or at all).
**Use at your own risk.
**NOTE(2): This driver is intended to b... | [
"utime.sleep_ms"
] | [((2949, 2967), 'utime.sleep_ms', 'utime.sleep_ms', (['(10)'], {}), '(10)\n', (2963, 2967), False, 'import utime\n')] |
import os
from permedcoe.core.constants import SEPARATOR
DO_NOT_PARSE = (".pyc", ".def", ".sif")
PARSING_KEY = "NEW_NAME"
PARSING_PATH = "/PATH/TO/"
def adapt_name(name, path):
""" Replace recursively into the given path they keyword with name.
Like a set recursively.
Args:
name (str): Name to p... | [
"os.rename",
"os.path.join",
"os.path.basename",
"os.walk"
] | [((464, 477), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (471, 477), False, 'import os\n'), ((1107, 1138), 'os.path.join', 'os.path.join', (['path', '"""src"""', '"""bb"""'], {}), "(path, 'src', 'bb')\n", (1119, 1138), False, 'import os\n'), ((1157, 1188), 'os.path.join', 'os.path.join', (['path', '"""src"""', '... |
import collections
import datetime
import json
import logging
import time
# Python 2 compatibility
try:
from logging.handlers import QueueHandler
except ImportError:
from logutils.queue import QueueHandler
# Python 2/3 hack for stringify, below
try:
unicode
except NameError:
unicode = str
nocolor =... | [
"datetime.datetime.utcfromtimestamp",
"datetime.datetime.fromtimestamp",
"logging.Formatter",
"json.dumps",
"time.localtime",
"time.time"
] | [((387, 398), 'time.time', 'time.time', ([], {}), '()\n', (396, 398), False, 'import time\n'), ((953, 964), 'time.time', 'time.time', ([], {}), '()\n', (962, 964), False, 'import time\n'), ((7285, 7304), 'logging.Formatter', 'logging.Formatter', ([], {}), '()\n', (7302, 7304), False, 'import logging\n'), ((1016, 1041),... |