code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
# xbutil GUI Device Manager Module
# Developers: <NAME>, <NAME>
# MIT License
# Copyright (c) 2020-2021 xbutil GUI Developers
import tkinter as tk
from tkinter import ttk, Toplevel, scrolledtext, messagebox
from tksheet import Sheet
import subprocess
import os
import datetime
import... | [
"tkinter.ttk.Label",
"subprocess.Popen",
"tkinter.Toplevel.winfo_exists",
"tkinter.messagebox.showinfo",
"tkinter.scrolledtext.ScrolledText",
"tkinter.Toplevel",
"tkinter.ttk.Button",
"tksheet.Sheet",
"re.compile"
] | [((2078, 2133), 're.compile', 're.compile', (['"""\\\\x1B(?:[@-Z\\\\\\\\-_]|\\\\[[0-?]*[ -/]*[@-~])"""'], {}), "('\\\\x1B(?:[@-Z\\\\\\\\-_]|\\\\[[0-?]*[ -/]*[@-~])')\n", (2088, 2133), False, 'import re\n'), ((2155, 2202), 're.compile', 're.compile', (['"""FPGA write bandwidth =\\\\s+(.*) MB"""'], {}), "('FPGA write ban... |
from weakref import ref
class SchemaWrapper:
def __init__(self, parent, wrapped, path):
self._wrapped = wrapped
assert path in ("SCHEMA", "RESULTSCHEMA")
self._path = path
self._parent = ref(parent)
def mount(self, *args, **kwargs):
raise Exception("Schema cells cannot ... | [
"weakref.ref"
] | [((224, 235), 'weakref.ref', 'ref', (['parent'], {}), '(parent)\n', (227, 235), False, 'from weakref import ref\n')] |
from pyfirmata import Arduino
from l289n import L298N
def main():
board = Arduino('/dev/ttyACM0')
# Initial pin
ena = 11
enb = 10
in1 = 7
in2 = 6
in3 = 5
in4 = 4
motor = L298N(board, ena, in1, in2, in3, in4, enb)
# Forward with speed 70%
motor.forward(0.7)
if __name__ == ... | [
"l289n.L298N",
"pyfirmata.Arduino"
] | [((80, 103), 'pyfirmata.Arduino', 'Arduino', (['"""/dev/ttyACM0"""'], {}), "('/dev/ttyACM0')\n", (87, 103), False, 'from pyfirmata import Arduino\n'), ((208, 250), 'l289n.L298N', 'L298N', (['board', 'ena', 'in1', 'in2', 'in3', 'in4', 'enb'], {}), '(board, ena, in1, in2, in3, in4, enb)\n', (213, 250), False, 'from l289n... |
import numpy as np
'''
Includes blood glucose level proxy for diabetes: 0-3
(lo2 - counts as abnormal, lo1, normal, hi1, hi2 - counts as abnormal)
Initial distribution:
[.05, .15, .6, .15, .05] for non-diabetics and [.01, .05, .15, .6, .19] for diabetics
'''
class State(object):
NUM_OBS_STATES = 720
N... | [
"numpy.random.rand",
"numpy.floor",
"numpy.array",
"numpy.concatenate"
] | [((8262, 8278), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (8276, 8278), True, 'import numpy as np\n'), ((8293, 8327), 'numpy.concatenate', 'np.concatenate', (['[obs, [noise_obs]]'], {}), '([obs, [noise_obs]])\n', (8307, 8327), True, 'import numpy as np\n'), ((10379, 10423), 'numpy.concatenate', 'np.conca... |
''' demo of reading a button, interrupt-based!
Two modes:
1. callback including updates on LED and OLED - not good practices
2. callback, properly defined. Requires program checks status (while True).
2017-0917 PePo DOES NOT WORK properly
Pin method off/on replaced (MP 1.9.2), tested on WeMOS-OLED ESP32
2017-... | [
"ssd1306.SSD1306_I2C",
"machine.Pin"
] | [((521, 560), 'machine.Pin', 'machine.Pin', (['__LED_PIN', 'machine.Pin.OUT'], {}), '(__LED_PIN, machine.Pin.OUT)\n', (532, 560), False, 'import machine, time\n'), ((666, 728), 'machine.Pin', 'machine.Pin', (['__BUTTON_PIN', 'machine.Pin.IN', 'machine.Pin.PULL_UP'], {}), '(__BUTTON_PIN, machine.Pin.IN, machine.Pin.PULL... |
'''
Assorted functions used in the machine learning codes during the Blue Stars project
Created by: <NAME> (<EMAIL>)
'''
#External packages and functions used
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Activation
from tensorflow.keras.optimizers import Adam
from sklearn.... | [
"seaborn.heatmap",
"sklearn.preprocessing.StandardScaler",
"tensorflow.keras.layers.Dense",
"sklearn.metrics.r2_score",
"sklearn.metrics.mean_absolute_error",
"tensorflow.keras.layers.LeakyReLU",
"matplotlib.pyplot.figure",
"sklearn.metrics.max_error",
"tensorflow.keras.models.Sequential",
"sklear... | [((7666, 7678), 'tensorflow.keras.models.Sequential', 'Sequential', ([], {}), '()\n', (7676, 7678), False, 'from tensorflow.keras.models import Sequential\n'), ((8303, 8406), 'tensorflow.keras.optimizers.Adam', 'tf.keras.optimizers.Adam', ([], {'learning_rate': 'learning_rate', 'beta_1': 'beta1', 'beta_2': 'beta2', 'ep... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
###
# Copyright (2016-2021) Hewlett Packard Enterprise Development LP
#
# 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/licen... | [
"ansible_collections.hpe.oneview.plugins.module_utils.oneview.compare",
"ansible_collections.hpe.oneview.plugins.module_utils.oneview.OneViewModuleValueError",
"ansible_collections.hpe.oneview.plugins.module_utils.oneview.OneViewModuleResourceNotFound"
] | [((6792, 6848), 'ansible_collections.hpe.oneview.plugins.module_utils.oneview.OneViewModuleValueError', 'OneViewModuleValueError', (['self.MSG_CANT_CREATE_AND_UPLOAD'], {}), '(self.MSG_CANT_CREATE_AND_UPLOAD)\n', (6815, 6848), False, 'from ansible_collections.hpe.oneview.plugins.module_utils.oneview import OneViewModul... |
import urllib.request
import sys
import pafy
import vlc
from pyyoutube import Api
import threading
api = Api(api_key="<KEY>")
output_devices = []
def search_video(keyword):
response = api.search_by_keywords(q=keyword, search_type=["video"], count=1, limit=1)
video_id = response.items[0].id.videoId
retu... | [
"threading.Thread",
"pyyoutube.Api",
"pafy.new",
"vlc.Instance"
] | [((107, 127), 'pyyoutube.Api', 'Api', ([], {'api_key': '"""<KEY>"""'}), "(api_key='<KEY>')\n", (110, 127), False, 'from pyyoutube import Api\n'), ((974, 987), 'pafy.new', 'pafy.new', (['url'], {}), '(url)\n', (982, 987), False, 'import pafy\n'), ((1048, 1096), 'vlc.Instance', 'vlc.Instance', (["('' if show_video else '... |
from docutils import nodes
def disguise_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
"""
Role to obfuscate e-mail addresses using DISGUISE comments.
"""
obfuscated = '<!-- DISGUISE -->'.join(list(text))
obfuscated = '<b>' + obfuscated
obfuscated = obfuscated + '</b>'
... | [
"docutils.nodes.raw"
] | [((329, 369), 'docutils.nodes.raw', 'nodes.raw', (['""""""', 'obfuscated'], {'format': '"""html"""'}), "('', obfuscated, format='html')\n", (338, 369), False, 'from docutils import nodes\n')] |
import os
import pandas as pd
import numpy as np
def to_df(indexes, sync, peak_value, d, metadata, save=False, path='',filename_roi=''):
Time = metadata['TimePoint']
df = pd.DataFrame(index=range(1, len(d)+1),
columns=['Nbr of Peaks', 'Nbr of Sync Cells',
... | [
"os.path.isfile",
"pandas.ExcelWriter"
] | [((1451, 1488), 'os.path.isfile', 'os.path.isfile', (["(path + '/' + filename)"], {}), "(path + '/' + filename)\n", (1465, 1488), False, 'import os\n'), ((1840, 1877), 'pandas.ExcelWriter', 'pd.ExcelWriter', (["(path + '/' + filename)"], {}), "(path + '/' + filename)\n", (1854, 1877), True, 'import pandas as pd\n'), ((... |
#============================================================
#
#
# Copyright (c) 2017 NetApp, Inc. All rights reserved.
# Specifications subject to change without notice.
#
# This sample code is provided AS IS, with no support or
# warranties of any kind, including but not limited to
# warranties of merchantability or... | [
"json.dumps",
"warnings.filterwarnings"
] | [((596, 629), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (619, 629), False, 'import warnings\n'), ((18316, 18335), 'json.dumps', 'json.dumps', (['payload'], {}), '(payload)\n', (18326, 18335), False, 'import json\n'), ((18573, 18592), 'json.dumps', 'json.dumps', (['pay... |
from distutils.core import setup
setup(name='pyipmitest',
version='1.0',
scripts=['ipmi_debug.py'],
)
| [
"distutils.core.setup"
] | [((34, 100), 'distutils.core.setup', 'setup', ([], {'name': '"""pyipmitest"""', 'version': '"""1.0"""', 'scripts': "['ipmi_debug.py']"}), "(name='pyipmitest', version='1.0', scripts=['ipmi_debug.py'])\n", (39, 100), False, 'from distutils.core import setup\n')] |
import argparse
import cv2
import numpy as np
from typing import Tuple
def str2bool(v):
if isinstance(v, bool):
return v
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
return False
else:
raise argparse.Argum... | [
"numpy.log",
"cv2.waitKey",
"numpy.fliplr",
"pathlib.Path",
"numpy.min",
"numpy.max",
"cv2.applyColorMap",
"numpy.random.rand",
"cv2.flip",
"cv2.imshow",
"argparse.ArgumentTypeError"
] | [((651, 693), 'cv2.applyColorMap', 'cv2.applyColorMap', (['depth', 'cv2.COLORMAP_JET'], {}), '(depth, cv2.COLORMAP_JET)\n', (668, 693), False, 'import cv2\n'), ((1276, 1295), 'numpy.log', 'np.log', (['depth_image'], {}), '(depth_image)\n', (1282, 1295), True, 'import numpy as np\n'), ((1458, 1497), 'pathlib.Path', 'Pat... |
import codecs
import os
import sys
try:
from setuptools import setup, find_packages
except:
from distutils.core import setup, find_packages
with open("README.md", "r") as fh:
LONG_DESCRIPTION = fh.read()
NAME = "pyshopee"
PACKAGES = ['hmac', 'hashlib', 'requests', 'urllib']
DESCRIPTION = "python imple... | [
"distutils.core.find_packages"
] | [((995, 1010), 'distutils.core.find_packages', 'find_packages', ([], {}), '()\n', (1008, 1010), False, 'from distutils.core import setup, find_packages\n')] |
from ckeditor.widgets import CKEditorWidget
from django import forms
from django.contrib import admin
from django.contrib.flatpages.admin import FlatPageAdmin, FlatpageForm
from django.contrib.flatpages.models import FlatPage
from flatblocks.admin import FlatBlockAdmin
from flatblocks.models import FlatBlock
class Cu... | [
"ckeditor.widgets.CKEditorWidget",
"django.contrib.admin.site.register",
"django.contrib.admin.site.unregister"
] | [((568, 599), 'django.contrib.admin.site.unregister', 'admin.site.unregister', (['FlatPage'], {}), '(FlatPage)\n', (589, 599), False, 'from django.contrib import admin\n'), ((600, 650), 'django.contrib.admin.site.register', 'admin.site.register', (['FlatPage', 'CustomFlatPageAdmin'], {}), '(FlatPage, CustomFlatPageAdmi... |
# -*- coding: utf-8 -*-
"""Holds views related to login and authenticating"""
from flask import render_template, redirect, url_for, request, session
from flask_login import current_user, logout_user, login_required,\
login_user
from app import wjl_app
from app.authentication import is_facebook_supported, is_github_... | [
"app.model.LeagueRequest.query.filter",
"flask.request.form.get",
"app.views.helper.get_base_data",
"flask.url_for",
"app.authentication.is_github_supported",
"app.logging.LOGGER.info",
"app.model.Player.query.filter",
"app.model.DB.session.delete",
"app.wjl_app.route",
"app.model.OAuth.query.filt... | [((583, 615), 'app.wjl_app.route', 'wjl_app.route', (['"""/delete-account"""'], {}), "('/delete-account')\n", (596, 615), False, 'from app import wjl_app\n'), ((874, 921), 'app.wjl_app.route', 'wjl_app.route', (['"""/delete-user"""'], {'methods': "['POST']"}), "('/delete-user', methods=['POST'])\n", (887, 921), False, ... |
#coding:utf-8
import urllib.request
import urllib.parse
import http.cookiejar
from bs4 import BeautifulSoup
import os
import re
from config import *
import socket
#socket.setdefaulttimeout(10.0)
class spider:
def __init__(self,url):
pass
def makeOpener(self):
#proxy_support = urllib.request.Pro... | [
"bs4.BeautifulSoup",
"os.path.exists",
"os.makedirs",
"re.compile"
] | [((1480, 1507), 'bs4.BeautifulSoup', 'BeautifulSoup', (['data', '"""lxml"""'], {}), "(data, 'lxml')\n", (1493, 1507), False, 'from bs4 import BeautifulSoup\n'), ((6703, 6723), 'os.path.exists', 'os.path.exists', (['name'], {}), '(name)\n', (6717, 6723), False, 'import os\n'), ((6925, 6945), 'os.path.exists', 'os.path.e... |
import astroid
from shopify_python import ast
def test_count_tree_size():
root = astroid.builder.parse("""
def test(x, y):
return x * y if x > 5 else 0
""")
assert ast.count_tree_size(root) == 14
| [
"shopify_python.ast.count_tree_size",
"astroid.builder.parse"
] | [((88, 184), 'astroid.builder.parse', 'astroid.builder.parse', (['"""\n def test(x, y):\n return x * y if x > 5 else 0\n """'], {}), '(\n """\n def test(x, y):\n return x * y if x > 5 else 0\n """)\n', (109, 184), False, 'import astroid\n'), ((191, 216), 'shopify_python.ast.count_tree_size'... |
import os
import re
from datetime import datetime as dt
import pandas as pd
from praw import Reddit as _reddit_
from twitter import Api as _twitter_
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
class Analyse:
def __init__(self):
self.sia = SentimentIntensityAnalyzer()
self.... | [
"os.path.abspath",
"pandas.read_csv",
"datetime.datetime.utcfromtimestamp",
"vaderSentiment.vaderSentiment.SentimentIntensityAnalyzer",
"twitter.Api",
"praw.Reddit",
"re.sub",
"re.compile"
] | [((278, 306), 'vaderSentiment.vaderSentiment.SentimentIntensityAnalyzer', 'SentimentIntensityAnalyzer', ([], {}), '()\n', (304, 306), False, 'from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer\n'), ((418, 480), 'pandas.read_csv', 'pd.read_csv', (["(self.dir_name + '\\\\dependencies\\\\ticker_list.csv'... |
import shutil
import sqlite3
from unittest import TestCase
import table
class TestTable(TestCase):
def setUp(self):
"""
Sets up two tables using well-known queries from a test database
"""
con = sqlite3.connect('test.db')
con.row_factory = sqlite3.Row
self.dims = ... | [
"shutil.get_terminal_size",
"sqlite3.connect",
"table.printable"
] | [((235, 261), 'sqlite3.connect', 'sqlite3.connect', (['"""test.db"""'], {}), "('test.db')\n", (250, 261), False, 'import sqlite3\n'), ((320, 346), 'shutil.get_terminal_size', 'shutil.get_terminal_size', ([], {}), '()\n', (344, 346), False, 'import shutil\n'), ((1357, 1374), 'table.printable', 'table.printable', ([], {}... |
"""Tests for the delete CLI function"""
import logging
from alchy import Manager
from click.testing import CliRunner
from genotype.cli.match_cmd import check_cmd
from genotype.store.models import Analysis, Sample
def test_match_no_args(cli_runner: CliRunner, sequence_ctx: dict):
# GIVEN a database with a sampl... | [
"genotype.store.models.Sample.query.count",
"genotype.store.models.Analysis.query.count",
"genotype.store.models.Sample.query.first"
] | [((711, 733), 'genotype.store.models.Analysis.query.count', 'Analysis.query.count', ([], {}), '()\n', (731, 733), False, 'from genotype.store.models import Analysis, Sample\n'), ((750, 770), 'genotype.store.models.Sample.query.count', 'Sample.query.count', ([], {}), '()\n', (768, 770), False, 'from genotype.store.model... |
import copy
import itertools
import pickle
import os
from collections import defaultdict
from Model.ReprLookupTable import REPRLOOKUPTABLE
from Model.ValidatorLookupTable import VALIDATORLOOKUPTABLE
from Model.CompositionLookupTable import COMPOSITIONLOOKUPTABLE
import sys
# Relation's constants
BT = {"bt"}
RS = {"rs"... | [
"os.path.dirname",
"collections.defaultdict",
"itertools.combinations",
"pickle.load",
"sys.exc_info"
] | [((18091, 18108), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (18102, 18108), False, 'from collections import defaultdict\n'), ((18435, 18452), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (18446, 18452), False, 'from collections import defaultdict\n'), ((19372, 19411)... |
import pyodbc
try:
con_string = r'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\Users\artush\Documents\Code\pydb.accdb;'
conn = pyodbc.connect(con_string)
cur = conn.cursor()
lst = cur.execute("SELECT IMDB FROM Таблица1")
a = []
for row in cur.fetchall():
a.append(float(row.IMDB))
... | [
"pyodbc.connect"
] | [((146, 172), 'pyodbc.connect', 'pyodbc.connect', (['con_string'], {}), '(con_string)\n', (160, 172), False, 'import pyodbc\n')] |
from dataclasses import dataclass
from logging import getLogger
from typing import List, Optional
from injector import inject
from core_get.cli.parse.composite_parser import CompositeParser
from core_get.cli.parse.options_parsers.common_options_parser import CommonOptionsParser
from core_get.cli.parse.parser import P... | [
"logging.getLogger"
] | [((464, 483), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (473, 483), False, 'from logging import getLogger\n')] |
import socket
import sys
from .node_server import NodeServer
class NodeClient(NodeServer):
"""!
A subclass of node server, Client will have 2 sockets
'c_sock' is the clients socket
'sock' is the server socket
This will be the recipient of the blockchain
"""
c_sock = socket.socket(socket.A... | [
"socket.gethostname",
"socket.socket",
"sys.exit"
] | [((298, 347), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (311, 347), False, 'import socket\n'), ((424, 444), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (442, 444), False, 'import socket\n'), ((1408, 1418), 'sys.exit', 's... |
import pandas as pd
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder,OneHotEncoder
data = pd.read_csv('Prepared data v1.csv')
data =data.drop('Unnamed: 0',axis=1)
le1 = LabelEncoder()
le2 ... | [
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.OneHotEncoder",
"sklearn.preprocessing.LabelEncoder",
"sklearn.linear_model.LinearRegression"
] | [((219, 254), 'pandas.read_csv', 'pd.read_csv', (['"""Prepared data v1.csv"""'], {}), "('Prepared data v1.csv')\n", (230, 254), True, 'import pandas as pd\n'), ((300, 314), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (312, 314), False, 'from sklearn.preprocessing import LabelEncoder, OneHotE... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
from calendar import month
from erpnext.hr.doctype.employee.employee import deactivate_sales_person
import frappe
from frappe.utils import getdate, nowd... | [
"frappe.utils.get_datetime",
"frappe.utils.formatdate",
"frappe.sendmail",
"frappe.bold",
"frappe.utils.nowdate",
"frappe.db.exists",
"frappe.utils.now.weekday",
"json.loads",
"frappe.db.sql",
"frappe.utils.getdate",
"frappe.new_doc",
"frappe.utils.get_fullname",
"datetime.timedelta",
"fra... | [((13034, 13052), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (13050, 13052), False, 'import frappe\n'), ((14602, 14620), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (14618, 14620), False, 'import frappe\n'), ((14972, 14990), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (14988, ... |
#!/usr/bin/python3
import random
import math
import numpy as np
def softmax(z):
return np.exp(z) / np.sum(np.exp(z))
########################################################################################################################
# Input & Data Normalization
class Input(object):
def __init__(self... | [
"math.exp",
"random.randint",
"math.sqrt",
"math.tanh",
"random.uniform",
"random.random",
"numpy.exp"
] | [((13660, 13680), 'random.randint', 'random.randint', (['(0)', 'm'], {}), '(0, m)\n', (13674, 13680), False, 'import random\n'), ((13690, 13710), 'random.randint', 'random.randint', (['(0)', 'm'], {}), '(0, m)\n', (13704, 13710), False, 'import random\n'), ((13854, 13874), 'random.randint', 'random.randint', (['(0)', '... |
from flask import Flask, request
from flask_restful import Api, Resource, reqparse
import requests
import pdb
from heart_rate_inference import HeartRateInference
app = Flask(__name__)
api = Api(app)
class HeartRateInferenceHub(object):
def __init__(self):
self.hub = {}
def filter(self, id, inte... | [
"flask_restful.Api",
"flask.Flask",
"heart_rate_inference.HeartRateInference",
"argparse.ArgumentParser"
] | [((173, 188), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (178, 188), False, 'from flask import Flask, request\n'), ((195, 203), 'flask_restful.Api', 'Api', (['app'], {}), '(app)\n', (198, 203), False, 'from flask_restful import Api, Resource, reqparse\n'), ((1052, 1119), 'argparse.ArgumentParser', 'arg... |
from haul.policy import ImportPolicy, RelinkAction
from io import BytesIO
from test_app.app import reset
from test_app.models import Book, Author, Tag
from test_app.export import BookExporter, AuthorExporter, TagExporter
from haul import ImportContainer, ExportContainer
EXPORTERS = [BookExporter, AuthorExporter, Tag... | [
"test_app.models.Author.objects.all",
"test_app.models.Book.objects.all",
"io.BytesIO",
"haul.policy.RelinkAction.Create",
"test_app.models.Book.objects.create",
"test_app.app.reset",
"test_app.models.Author.objects.get",
"test_app.models.Author.objects.create",
"haul.policy.RelinkAction.Discard",
... | [((363, 370), 'test_app.app.reset', 'reset', ([], {}), '()\n', (368, 370), False, 'from test_app.app import reset\n'), ((380, 411), 'test_app.models.Author.objects.create', 'Author.objects.create', ([], {'name': '"""1"""'}), "(name='1')\n", (401, 411), False, 'from test_app.models import Book, Author, Tag\n'), ((416, 4... |
# -*- coding: utf-8 -*-
# @Time : 2019/7/13
# @Author : Godder
# @Github : https://github.com/WangGodder
from torchcmh.run import run
import torch
torch.backends.cudnn.benchmark = True
if __name__ == '__main__':
run()
| [
"torchcmh.run.run"
] | [((224, 229), 'torchcmh.run.run', 'run', ([], {}), '()\n', (227, 229), False, 'from torchcmh.run import run\n')] |
# Generated by Django 3.2 on 2021-07-16 17:45
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
opera... | [
"django.db.models.OneToOneField",
"django.db.migrations.swappable_dependency",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.EmailField",
"django.db.models.ImageField",
"django.db.models.AutoField"
] | [((245, 302), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (276, 302), False, 'from django.db import migrations, models\n'), ((434, 527), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
from datawinners.location.LocationTree import get_location_tree, get_location_hierarchy
class LocationBridge(object):
def __init__(self,location_tree=None,get_loc_hierarchy=None):
self.location_tree = location_tree or get_location_tree()
self.get_location_hierarchy = get_loc_hierarchy or get_locati... | [
"datawinners.location.LocationTree.get_location_tree"
] | [((231, 250), 'datawinners.location.LocationTree.get_location_tree', 'get_location_tree', ([], {}), '()\n', (248, 250), False, 'from datawinners.location.LocationTree import get_location_tree, get_location_hierarchy\n')] |
from functools import wraps
class Monitor:
def __init__(self):
""" Store parameter values of a function when function is used in program.
Example:
m = Monitor()
print = m.function_parameter(print, (None, "end"))
print("Hi, Bob", end="\n\n")
print("H... | [
"functools.wraps"
] | [((1489, 1500), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (1494, 1500), False, 'from functools import wraps\n'), ((2344, 2355), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (2349, 2355), False, 'from functools import wraps\n'), ((2991, 3002), 'functools.wraps', 'wraps', (['func'], {}), '(func)\... |
import os
import numpy as np
import h5py
import tensorflow as tf
import keras
import keras.backend as K
############################################
### Function to load data in h5py format ###
############################################
def load_data(path_to_data):
data = h5py.File(path_to_data,'r')
X_test... | [
"h5py.File",
"rpy2.robjects.packages.importr",
"random.randint",
"keras.backend.epsilon",
"numpy.zeros",
"numpy.transpose",
"numpy.array",
"numpy.reshape",
"numpy.tile",
"keras.backend.clip"
] | [((282, 310), 'h5py.File', 'h5py.File', (['path_to_data', '"""r"""'], {}), "(path_to_data, 'r')\n", (291, 310), False, 'import h5py\n'), ((483, 509), 'numpy.array', 'np.array', (["data['test_out']"], {}), "(data['test_out'])\n", (491, 509), True, 'import numpy as np\n'), ((527, 554), 'numpy.array', 'np.array', (["data[... |
import numpy as np
from vocab import male_names, female_names, cities_and_states, countries
from vocab_pt import male_names_pt, female_names_pt, cities_pt, countries_pt
from util import get_new_item, get_n_different_items
from util import vi, not_vi, vi_pt, not_vi_pt, create_csv
def contradiction_instance_1(person_l... | [
"util.get_n_different_items",
"util.create_csv",
"util.get_new_item"
] | [((597, 634), 'util.get_n_different_items', 'get_n_different_items', (['person_list', 'n'], {}), '(person_list, n)\n', (618, 634), False, 'from util import get_new_item, get_n_different_items\n'), ((648, 684), 'util.get_n_different_items', 'get_n_different_items', (['place_list', 'n'], {}), '(place_list, n)\n', (669, 6... |
# import the psycopg2 database adapter for PostgreSQL
from psycopg2 import extensions, connect, InterfaceError
# import the psycopg2 errors library
import psycopg2.errors
def db_connect(db, user, host, password):
conn = connect(
dbname = db,
user = user,
host = host,
password = pa... | [
"psycopg2.connect"
] | [((227, 286), 'psycopg2.connect', 'connect', ([], {'dbname': 'db', 'user': 'user', 'host': 'host', 'password': 'password'}), '(dbname=db, user=user, host=host, password=password)\n', (234, 286), False, 'from psycopg2 import extensions, connect, InterfaceError\n')] |
#!/usr/bin/env python3
import os
from .build_directory import BuildDirectory
from .debug_writer import debug_print
from .template_library import create_template_from_file
class UnitTestBuilder(object):
default_relative_template_directory = os.path.join('templates', 'test_templates')
template_directory = templ... | [
"os.path.dirname",
"os.path.join"
] | [((246, 289), 'os.path.join', 'os.path.join', (['"""templates"""', '"""test_templates"""'], {}), "('templates', 'test_templates')\n", (258, 289), False, 'import os\n'), ((432, 489), 'os.path.join', 'os.path.join', (['template_directory', '"""unittest_template.tpl"""'], {}), "(template_directory, 'unittest_template.tpl'... |
"""Form for the elternbrief application"""
from django import forms
class UserImportForm(forms.Form):
"""Simple form for uploading csv files for importing users."""
parents_file = forms.FileField(required=True, widget=forms.FileInput(attrs={'class': 'custom-file-input'}))
students_file = forms.FileField(... | [
"django.forms.FileInput"
] | [((229, 282), 'django.forms.FileInput', 'forms.FileInput', ([], {'attrs': "{'class': 'custom-file-input'}"}), "(attrs={'class': 'custom-file-input'})\n", (244, 282), False, 'from django import forms\n'), ((342, 395), 'django.forms.FileInput', 'forms.FileInput', ([], {'attrs': "{'class': 'custom-file-input'}"}), "(attrs... |
#!/usr/bin/env python
"""
main.py
"""
import sys
import json
import argparse
import numpy as np
from helpers import compute_scores
P_AT_01_THRESHOLD = 0.475
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--cache-path', type=str, default='data/cache')
return parser.parse_ar... | [
"numpy.load",
"argparse.ArgumentParser",
"helpers.compute_scores",
"json.dumps",
"numpy.loadtxt"
] | [((196, 221), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (219, 221), False, 'import argparse\n'), ((434, 494), 'numpy.load', 'np.load', (["('%s_valid.npy' % args.cache_path)"], {'allow_pickle': '(True)'}), "('%s_valid.npy' % args.cache_path, allow_pickle=True)\n", (441, 494), True, 'import ... |
from __future__ import absolute_import
import argparse
def arg_parse():
parser = argparse.ArgumentParser(description='Short Project Grasping arm with Reinforcement Learning')
# Datasets parameters
parser.add_argument('--model_dir', type=str, default='./roboticgrasper/log',help="place where it saves model... | [
"argparse.ArgumentParser"
] | [((87, 185), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Short Project Grasping arm with Reinforcement Learning"""'}), "(description=\n 'Short Project Grasping arm with Reinforcement Learning')\n", (110, 185), False, 'import argparse\n')] |
import re
from unittest import TestCase
from expects import expect, equal, raise_error, be_true, be_false
from slender import List
class TestOne(TestCase):
def test_one_if_all_of_them_are_truthy(self):
e = List([5, 3, 5, 2, 4])
expect(e.one()).to(be_false)
def test_one_if_more_than_one_is... | [
"slender.List",
"expects.raise_error"
] | [((224, 245), 'slender.List', 'List', (['[5, 3, 5, 2, 4]'], {}), '([5, 3, 5, 2, 4])\n', (228, 245), False, 'from slender import List\n'), ((347, 381), 'slender.List', 'List', (["[False, None, 'dog', 'plum']"], {}), "([False, None, 'dog', 'plum'])\n", (351, 381), False, 'from slender import List\n'), ((478, 527), 'slend... |
from pystac.utils import make_absolute_href
from pystac.stac_io import STAC_IO
def merge_common_properties(item_dict, collection_cache=None, json_href=None):
"""Merges Collection properties into an Item.
Args:
item_dict: JSON dict of the Item which properties should be merged
into.
... | [
"pystac.stac_io.STAC_IO.read_json",
"pystac.utils.make_absolute_href"
] | [((1364, 1410), 'pystac.utils.make_absolute_href', 'make_absolute_href', (['collection_href', 'json_href'], {}), '(collection_href, json_href)\n', (1382, 1410), False, 'from pystac.utils import make_absolute_href\n'), ((1641, 1675), 'pystac.stac_io.STAC_IO.read_json', 'STAC_IO.read_json', (['collection_href'], {}), '(c... |
""" parse logs to get elapsed time of client sessions """
import datetime
import os
import re
import sys
def usage(msg='', error_code=1):
""" Output the usage + any other message provided and then exit """
if msg != '':
print(msg)
print("Usage: {} <logfile>".format(__file__))
exit(error_code)... | [
"os.path.abspath",
"os.path.realpath",
"datetime.datetime.strptime",
"os.path.isfile",
"re.compile"
] | [((576, 600), 'os.path.isfile', 'os.path.isfile', (['filename'], {}), '(filename)\n', (590, 600), False, 'import os\n'), ((751, 790), 'os.path.abspath', 'os.path.abspath', (["(scriptdir + '/../logs')"], {}), "(scriptdir + '/../logs')\n", (766, 790), False, 'import os\n'), ((814, 862), 'os.path.abspath', 'os.path.abspat... |
import torch
import numpy as np
from smplx import SMPL as _SMPL
from smplx.body_models import ModelOutput
from smplx.lbs import vertices2joints
import config
class SMPL(_SMPL):
"""
Extension of the official SMPL (from the smplx python package) implementation to
support more joints.
"""
def __init... | [
"numpy.load",
"smplx.body_models.ModelOutput",
"torch.cat",
"smplx.lbs.vertices2joints",
"torch.tensor"
] | [((427, 465), 'numpy.load', 'np.load', (['config.J_REGRESSOR_EXTRA_PATH'], {}), '(config.J_REGRESSOR_EXTRA_PATH)\n', (434, 465), True, 'import numpy as np\n'), ((497, 536), 'numpy.load', 'np.load', (['config.COCOPLUS_REGRESSOR_PATH'], {}), '(config.COCOPLUS_REGRESSOR_PATH)\n', (504, 536), True, 'import numpy as np\n'),... |
# coding: utf-8
from datetime import date, datetime
from typing import List, Dict, Type
from openapi_server.models.base_model_ import Model
from openapi_server import util
class DataQueryCoords(Model):
"""NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Do not edit... | [
"openapi_server.util.deserialize_model"
] | [((1289, 1322), 'openapi_server.util.deserialize_model', 'util.deserialize_model', (['dikt', 'cls'], {}), '(dikt, cls)\n', (1311, 1322), False, 'from openapi_server import util\n')] |
# coding: utf-8
"""
Copyright 2016 SmartBear Software
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... | [
"six.iteritems"
] | [((5128, 5157), 'six.iteritems', 'iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (5137, 5157), False, 'from six import iteritems\n')] |
from __future__ import print_function
import argparse
import json
import logging
import os
import pandas as pd
import numpy as np
import pickle as pkl
from sagemaker_containers import entry_point
from sagemaker_xgboost_container.data_utils import get_dmatrix
import xgboost as xgb
from xgboost.sklearn import XGBClas... | [
"os.listdir",
"argparse.ArgumentParser",
"pandas.read_csv",
"os.environ.get",
"numpy.array",
"xgboost.XGBClassifier",
"numpy.bincount",
"os.path.join",
"pandas.concat"
] | [((568, 588), 'numpy.bincount', 'np.bincount', (['y_train'], {}), '(y_train)\n', (579, 588), True, 'import numpy as np\n'), ((1479, 1504), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1502, 1504), False, 'import argparse\n'), ((3426, 3446), 'pandas.concat', 'pd.concat', (['raw_data1'], {}), ... |
import os
from subprocess import PIPE, Popen
import numpy as np
import pytest
import vtk
import vtki
from vtki import examples
from vtki.plotting import running_xserver
TEST_DOWNLOADS = False
try:
if os.environ['TEST_DOWNLOADS'] == 'True':
TEST_DOWNLOADS = True
except KeyError:
pass
@pytest.mark.sk... | [
"vtki.examples.load_sphere",
"numpy.empty",
"vtki.examples.download_faults",
"vtki.examples.download_bolt_nut",
"numpy.sin",
"numpy.arange",
"vtki.examples.plot_wave",
"vtki.StructuredGrid",
"vtki.Plotter",
"numpy.meshgrid",
"vtki.examples.download_masonry_texture",
"numpy.linspace",
"vtki.e... | [((641, 662), 'numpy.empty', 'np.empty', (['(x.size, 3)'], {}), '((x.size, 3))\n', (649, 662), True, 'import numpy as np\n'), ((892, 921), 'vtki.Plotter', 'vtki.Plotter', ([], {'off_screen': '(True)'}), '(off_screen=True)\n', (904, 921), False, 'import vtki\n'), ((1368, 1392), 'numpy.arange', 'np.arange', (['(-10)', '(... |
"""
Passport uses the Tornado template engine to render files, injecting values
from Consul services and kv pairs.
"""
import argparse
from os import path
import sys
from consulate import api
from tornado import template
__version__ = '0.1.1'
class ConsulLoader(template.Loader):
def __init__(self, root_direct... | [
"sys.stdout.write",
"tornado.template.Template",
"argparse.ArgumentParser",
"os.path.realpath",
"consulate.api.Consulate",
"tornado.template.Loader",
"sys.stderr.write",
"os.path.join",
"sys.exit"
] | [((1957, 2024), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Render templates from Consul"""'}), "(description='Render templates from Consul')\n", (1980, 2024), False, 'import argparse\n'), ((969, 998), 'consulate.api.Consulate', 'api.Consulate', (['host', 'port', 'dc'], {}), '(host, p... |
from fuzzconfig import FuzzConfig
import nonrouting
import pytrellis
import fuzzloops
import interconnect
cfg = FuzzConfig(job="DTR", family="ECP5", device="LFE5U-45F", ncl="empty.ncl",
tiles=["CIB_R71C22:DTR"])
def get_substs(mode="DTR"):
if mode == "NONE":
comm... | [
"pytrellis.load_database",
"fuzzconfig.FuzzConfig"
] | [((113, 216), 'fuzzconfig.FuzzConfig', 'FuzzConfig', ([], {'job': '"""DTR"""', 'family': '"""ECP5"""', 'device': '"""LFE5U-45F"""', 'ncl': '"""empty.ncl"""', 'tiles': "['CIB_R71C22:DTR']"}), "(job='DTR', family='ECP5', device='LFE5U-45F', ncl='empty.ncl',\n tiles=['CIB_R71C22:DTR'])\n", (123, 216), False, 'from fuzz... |
# Generated by Django 2.2.6 on 2019-12-05 15:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('foundation', '0006_llistudentdata_was_immigration_status_valid_date_dealt'),
]
operations = [
migrations.AddField(
model_name='l... | [
"django.db.models.BooleanField"
] | [((405, 451), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'blank': '(True)', 'default': '(False)'}), '(blank=True, default=False)\n', (424, 451), False, 'from django.db import migrations, models\n'), ((601, 647), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'blank': '(True)', 'default... |
#!/usr/bin/python3
import re
resp_dict = {}
def dec_to_bin(x):
return int(bin(x)[2:])
index_for_mem_cache = 0
with open('./input.txt', 'r') as input:
list_lines = input.read().split("mask = ")
list_lines = "++".join(list_lines)
list_lines = list_lines.split("++")
list_lines = list(filter(None, ... | [
"re.finditer",
"re.search"
] | [((1600, 1646), 're.finditer', 're.finditer', (['"""X"""', "resp_dict[element]['result']"], {}), "('X', resp_dict[element]['result'])\n", (1611, 1646), False, 'import re\n'), ((459, 488), 're.search', 're.search', (['"""\\\\[(.*)\\\\]"""', 'info'], {}), "('\\\\[(.*)\\\\]', info)\n", (468, 488), False, 'import re\n')] |
"""
Copyright (c) 2020, 2021 Red Hat, IBM Corporation and others.
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 o... | [
"os.getenv",
"json.loads"
] | [((635, 661), 'os.getenv', 'os.getenv', (['"""slo_direction"""'], {}), "('slo_direction')\n", (644, 661), False, 'import os\n'), ((5846, 5875), 'json.loads', 'json.loads', (['search_space_json'], {}), '(search_space_json)\n', (5856, 5875), False, 'import json\n')] |
import copy
try:
from collections.abc import MutableSequence
except ImportError:
from collections import MutableSequence
class CommonList(MutableSequence):
def __init__(self, *args, **kwargs):
self.__data = []
self.extend(list(*args, **kwargs))
def __getitem__(self, index):
... | [
"copy.deepcopy"
] | [((778, 804), 'copy.deepcopy', 'copy.deepcopy', (['self.__data'], {}), '(self.__data)\n', (791, 804), False, 'import copy\n')] |
from collections import defaultdict
from math import prod
from typing import Dict, List
from aocpuzzle import AoCPuzzle
class Puzzle16(AoCPuzzle):
def common(self, input_data: List[str]) -> None:
self.notes: Dict[str, List[int]] = defaultdict(list)
self.your_ticket: List[int] = []
self.ne... | [
"collections.defaultdict"
] | [((246, 263), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (257, 263), False, 'from collections import defaultdict\n'), ((2095, 2112), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (2106, 2112), False, 'from collections import defaultdict\n'), ((2718, 2734), 'collections... |
from grafana import views
from django.urls import path
app_name = "grafana"
urlpatterns = [
path("", views.OrganizationListView.as_view(), name="org-list"),
path("org/<int:pk>", views.OrganizationDetailView.as_view(), name="org-detail"),
path("org/<int:pk>/annotations", views.AnnotationList.as_view(), nam... | [
"grafana.views.OrganizationListView.as_view",
"grafana.views.DashboardMutate.as_view",
"grafana.views.UserList.as_view",
"grafana.views.OrganizationDetailView.as_view",
"grafana.views.AnnotationList.as_view",
"grafana.views.DashboardDetailView.as_view",
"grafana.views.RevisionVersion.as_view",
"grafan... | [((107, 143), 'grafana.views.OrganizationListView.as_view', 'views.OrganizationListView.as_view', ([], {}), '()\n', (141, 143), False, 'from grafana import views\n'), ((188, 226), 'grafana.views.OrganizationDetailView.as_view', 'views.OrganizationDetailView.as_view', ([], {}), '()\n', (224, 226), False, 'from grafana i... |
# These are the libraries will be useing for this lab.
import torch
import matplotlib.pylab as plt
# Create a tensor x
x = torch.tensor(2.0, requires_grad = True)
print("The tensor x: ", x)
# Create a tensor y according to y = x^2
y = x ** 2
print("The result of y = x^2: ", y)
# Take the derivative. Try to print... | [
"torch.relu",
"matplotlib.pylab.legend",
"torch.linspace",
"matplotlib.pylab.xlabel",
"torch.sum",
"torch.tensor",
"matplotlib.pylab.show"
] | [((127, 164), 'torch.tensor', 'torch.tensor', (['(2.0)'], {'requires_grad': '(True)'}), '(2.0, requires_grad=True)\n', (139, 164), False, 'import torch\n'), ((762, 799), 'torch.tensor', 'torch.tensor', (['(2.0)'], {'requires_grad': '(True)'}), '(2.0, requires_grad=True)\n', (774, 799), False, 'import torch\n'), ((1799,... |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# <NAME>
# California Institute of Technology
# (C) 1998-2003 All Rights Reserved
#
# <LicenseText>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | [
"pyre.debug.Firewall.hit",
"Token.Token.__init__"
] | [((798, 833), 'Token.Token.__init__', 'Token.__init__', (['self', 'match', 'groups'], {}), '(self, match, groups)\n', (812, 833), False, 'from Token import Token\n'), ((1153, 1181), 'pyre.debug.Firewall.hit', 'pyre.debug.Firewall.hit', (['msg'], {}), '(msg)\n', (1176, 1181), False, 'import pyre\n')] |
import chess
import chess.svg
from helpers.io_helpers import ensure_dir_exists
from helpers.pgn_helpers import pgn_iterate
def main():
# Input
input_path = "generated.pgn"
# Output
output_directory = input_path.replace(".pgn", "") + "/"
ensure_dir_exists(output_directory)
with open(input_path... | [
"chess.Board",
"chess.svg.board",
"helpers.io_helpers.ensure_dir_exists",
"helpers.pgn_helpers.pgn_iterate"
] | [((259, 294), 'helpers.io_helpers.ensure_dir_exists', 'ensure_dir_exists', (['output_directory'], {}), '(output_directory)\n', (276, 294), False, 'from helpers.io_helpers import ensure_dir_exists\n'), ((387, 410), 'helpers.pgn_helpers.pgn_iterate', 'pgn_iterate', (['games_file'], {}), '(games_file)\n', (398, 410), Fals... |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 The Bitcoin Unlimited developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import test_framework.loginit
import os
import os.path
import time
import sys
if sys.version_info[0] ... | [
"os.remove",
"test_framework.bunode.VersionlessProtoHandler",
"test_framework.mininode.NetworkThread",
"test_framework.test_framework.BitcoinTestFramework.__init__",
"logging.info",
"test_framework.bunode.BasicBUCashNode"
] | [((801, 836), 'test_framework.test_framework.BitcoinTestFramework.__init__', 'BitcoinTestFramework.__init__', (['self'], {}), '(self)\n', (830, 836), False, 'from test_framework.test_framework import BitcoinTestFramework\n'), ((1606, 1623), 'test_framework.bunode.BasicBUCashNode', 'BasicBUCashNode', ([], {}), '()\n', (... |
import numpy as np
import matplotlib.pyplot as plt
from convolution_matrices.convmat2D import *
#generate a picture array with a circle
Nx = 2*256
Ny = 2*256;
A = 9*np.ones((Nx,Ny));
ci = Nx/2-1; cj= Ny/2-1;
cr = np.round(0.35*Nx);
I,J=np.meshgrid(np.arange(A.shape[0]),np.arange(A.shape[1]));
dist = np.sqrt((I-ci)**2... | [
"numpy.set_printoptions",
"matplotlib.pyplot.show",
"numpy.abs",
"matplotlib.pyplot.imshow",
"numpy.ones",
"numpy.where",
"numpy.arange",
"numpy.linalg.norm",
"numpy.round",
"numpy.sqrt"
] | [((214, 233), 'numpy.round', 'np.round', (['(0.35 * Nx)'], {}), '(0.35 * Nx)\n', (222, 233), True, 'import numpy as np\n'), ((303, 341), 'numpy.sqrt', 'np.sqrt', (['((I - ci) ** 2 + (J - cj) ** 2)'], {}), '((I - ci) ** 2 + (J - cj) ** 2)\n', (310, 341), True, 'import numpy as np\n'), ((362, 375), 'matplotlib.pyplot.ims... |
from urllib import request
from django.urls import path
from django.contrib.auth import views as view
from . import views
from .views import User_registration, Comment_creation, RegisterUserView
urlpatterns = [
path('', views.index, name='index'),
path('hw_list', views.hw_view, name='hwlist'),
path('profi... | [
"django.contrib.auth.views.LogoutView.as_view",
"django.contrib.auth.views.LoginView.as_view",
"django.urls.path"
] | [((217, 252), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (221, 252), False, 'from django.urls import path\n'), ((258, 303), 'django.urls.path', 'path', (['"""hw_list"""', 'views.hw_view'], {'name': '"""hwlist"""'}), "('hw_list', views.hw_view, ... |
# -*- coding: utf-8 -*-
"""
Provides common functionality for classes in this module which
wrap a connection to koji, manage the session, and provide
convenience methods for interacting with the koji api.
"""
import koji
class KojiWrapperBase(object):
"""
Base Koji Wrapper object
This class provides th... | [
"koji.ClientSession"
] | [((1947, 1975), 'koji.ClientSession', 'koji.ClientSession', (['self.url'], {}), '(self.url)\n', (1965, 1975), False, 'import koji\n')] |
#
# Font editor
#
import PySimpleGUI as sg
import os
import json
def showEditor(font):
sg.theme('DarkAmber') # Keep things interesting for your users
buttons = []
button_row = []
row_count = 0
row_max = 10
for c in range(65, 91):
row_count += 1
button_row.append(sg.Button(... | [
"PySimpleGUI.Button",
"json.dump",
"os.makedirs",
"PySimpleGUI.Exit",
"PySimpleGUI.theme",
"os.path.isdir",
"PySimpleGUI.InputText",
"PySimpleGUI.Frame",
"PySimpleGUI.Multiline",
"PySimpleGUI.Text",
"PySimpleGUI.Window"
] | [((93, 114), 'PySimpleGUI.theme', 'sg.theme', (['"""DarkAmber"""'], {}), "('DarkAmber')\n", (101, 114), True, 'import PySimpleGUI as sg\n'), ((1022, 1075), 'PySimpleGUI.Window', 'sg.Window', (['"""Ascii Font Editor"""', 'layout'], {'finalize': '(True)'}), "('Ascii Font Editor', layout, finalize=True)\n", (1031, 1075), ... |
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic.base import TemplateView
admin.autodiscover()
urlpatterns = [
url(r'', include('accounts.urls')),
url(r'^$', TemplateView.as_view(te... | [
"django.conf.urls.static.static",
"django.contrib.admin.autodiscover",
"django.conf.urls.include",
"django.conf.urls.url",
"django.views.generic.base.TemplateView.as_view"
] | [((204, 224), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (222, 224), False, 'from django.contrib import admin\n'), ((417, 478), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_root=settings.M... |
"""Binary analysis logic"""
from elftools.elf.elffile import ELFFile
from itanium_demangler import parse as demangle
DATA_SECTIONS = [".rodata", ".data.rel.ro", ".data.rel.ro.local", ".rdata"]
class CppClass:
"""Class to represent a class in a C++ binary"""
def __init__(self, name):
self.name = nam... | [
"elftools.elf.elffile.ELFFile",
"itanium_demangler.parse"
] | [((969, 986), 'elftools.elf.elffile.ELFFile', 'ELFFile', (['elf_file'], {}), '(elf_file)\n', (976, 986), False, 'from elftools.elf.elffile import ELFFile\n'), ((2756, 2770), 'itanium_demangler.parse', 'demangle', (['name'], {}), '(name)\n', (2764, 2770), True, 'from itanium_demangler import parse as demangle\n'), ((279... |
"""Dashboard service, it present stock quotes and recommendations."""
import asyncio
import logging
import typing
import uvicorn
from aiokafka import AIOKafkaConsumer
from fastapi import FastAPI, WebSocket
from starlette.endpoints import WebSocketEndpoint
import settings
logging.basicConfig(level=logging.INFO)
logg... | [
"asyncio.get_event_loop",
"logging.basicConfig",
"uvicorn.run",
"aiokafka.AIOKafkaConsumer",
"logging.getLogger",
"fastapi.FastAPI"
] | [((276, 315), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (295, 315), False, 'import logging\n'), ((325, 352), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (342, 352), False, 'import logging\n'), ((360, 369), 'fastapi.FastAPI'... |
# coding: utf-8
# In[1]:
import torch
import torch.nn as nn
import torchvision
import torch.nn.functional as F
from torchvision import datasets, transforms, models
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
import sys, os
from glob import glob
import imageio
import argparse
im... | [
"torch.distributed.is_initialized",
"os.mkdir",
"torch.nn.Dropout",
"argparse.ArgumentParser",
"torch.nn.AdaptiveMaxPool2d",
"torch.cat",
"torch.cuda.device_count",
"numpy.mean",
"torch.distributed.get_world_size",
"os.path.join",
"torch.utils.data.DataLoader",
"torch.distributed.get_rank",
... | [((670, 702), 'os.path.exists', 'os.path.exists', (['weight_save_root'], {}), '(weight_save_root)\n', (684, 702), False, 'import sys, os\n'), ((708, 734), 'os.mkdir', 'os.mkdir', (['weight_save_root'], {}), '(weight_save_root)\n', (716, 734), False, 'import sys, os\n'), ((1076, 1101), 'torch.cuda.device_count', 'torch.... |
import numpy as np
from termcolor import colored
from pyfiglet import *
print(colored("Advent of Code - Day 25", "yellow").center(80, "-"))
print(colored(figlet_format("Sea Cucumber",font="small",justify="center"), 'green'))
print(colored("Output","yellow").center(80, "-"))
g = np.array([[{".": 0, ">": 2, "v": 1}[a] f... | [
"termcolor.colored",
"numpy.roll"
] | [((78, 122), 'termcolor.colored', 'colored', (['"""Advent of Code - Day 25"""', '"""yellow"""'], {}), "('Advent of Code - Day 25', 'yellow')\n", (85, 122), False, 'from termcolor import colored\n'), ((231, 258), 'termcolor.colored', 'colored', (['"""Output"""', '"""yellow"""'], {}), "('Output', 'yellow')\n", (238, 258)... |
"""
This function will scrape the links for all U.S. state and top city locations on RateBeer.
Once the links are scraped, then we will iterate through each link and download the brewery
reviews
Inputs: 1. URL to page containing links (Can be any string)
Outputs: 1. Desired links to sub-pages
"""
def GetLinks(state):... | [
"bs4.BeautifulSoup",
"requests.get",
"re.compile"
] | [((618, 649), 'requests.get', 'requests.get', (['url'], {'verify': '(False)'}), '(url, verify=False)\n', (630, 649), False, 'import requests\n'), ((663, 695), 'bs4.BeautifulSoup', 'BeautifulSoup', (['page.text', '"""lxml"""'], {}), "(page.text, 'lxml')\n", (676, 695), False, 'from bs4 import BeautifulSoup\n'), ((771, 8... |
from django.shortcuts import render
from django.views.generic import CreateView, UpdateView, TemplateView
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse_lazy
from django.contrib.messages.views import SuccessMessageMixin
from django.contrib import messages as msg
from conf_ord... | [
"conf_order.models.Order.objects.create",
"django.urls.reverse_lazy",
"books.models.BookAvailability.objects.all",
"user_profile.models.UserProfile.objects.get",
"books.models.Book.objects.filter",
"orders.models.Cart.objects.get",
"orders.models.ProductInCart.objects.all"
] | [((697, 718), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""login"""'], {}), "('login')\n", (709, 718), False, 'from django.urls import reverse_lazy\n'), ((819, 853), 'user_profile.models.UserProfile.objects.get', 'UserProfile.objects.get', ([], {'user': 'user'}), '(user=user)\n', (842, 853), False, 'from user_prof... |
import os
import time
import unittest
from dns import resolver
from dns.resolver import Resolver
from certbot_dns_duckdns.cert.client import DEFAULT_PROPAGATION_SECONDS
from certbot_dns_duckdns.duckdns.client import DuckDNSClient, TXTUpdateError
TEST_DOMAIN = os.environ.get("TEST_DOMAIN")
TEST_DUCKDNS_TOKEN = os.env... | [
"unittest.main",
"dns.resolver.Resolver",
"certbot_dns_duckdns.duckdns.client.DuckDNSClient",
"time.sleep",
"os.environ.get",
"certbot_dns_duckdns.duckdns.client.DuckDNSClient.__get_validated_root_domain__"
] | [((263, 292), 'os.environ.get', 'os.environ.get', (['"""TEST_DOMAIN"""'], {}), "('TEST_DOMAIN')\n", (277, 292), False, 'import os\n'), ((314, 350), 'os.environ.get', 'os.environ.get', (['"""TEST_DUCKDNS_TOKEN"""'], {}), "('TEST_DUCKDNS_TOKEN')\n", (328, 350), False, 'import os\n'), ((7804, 7819), 'unittest.main', 'unit... |
"""
Construct Grid Graph
"""
def sample(H, W, AS):
# PAST1J
from collections import defaultdict
edges = defaultdict(dict)
for x in range(W):
for y in range(H):
pos = y * W + x
if x < W - 1:
edges[pos + 1][pos] = AS[y][x]
if x > 0:
... | [
"collections.defaultdict"
] | [((118, 135), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (129, 135), False, 'from collections import defaultdict\n'), ((590, 607), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (601, 607), False, 'from collections import defaultdict\n')] |
# This file is part of Hypothesis, which may be found at
# https://github.com/HypothesisWorks/hypothesis/
#
# Most of this work is copyright (C) 2013-2020 <NAME>
# (<EMAIL>), but it contains contributions by others. See
# CONTRIBUTING.rst for a full list of people who may hold copyright, and
# consult the git log if yo... | [
"sys.path.append",
"click.version_option",
"click.argument",
"importlib.import_module",
"difflib.get_close_matches",
"click.option",
"click.UsageError",
"click.Choice",
"click.group",
"sys.exit"
] | [((2160, 2180), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (2175, 2180), False, 'import sys\n'), ((2187, 2256), 'click.group', 'click.group', ([], {'context_settings': "{'help_option_names': ('-h', '--help')}"}), "(context_settings={'help_option_names': ('-h', '--help')})\n", (2198, 2256), Fals... |
import psycopg2
from datetime import datetime, timedelta
connection_args = {
"user": "postgres",
"password": "<PASSWORD>",
"host": "database",
"port": 5432,
"database": "asrdb"
}
def get_current_time() -> datetime:
dt = datetime.now()
timezone = timedelta(hours=3) # Russian костыли
... | [
"datetime.datetime.now",
"datetime.timedelta",
"psycopg2.connect"
] | [((248, 262), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (260, 262), False, 'from datetime import datetime, timedelta\n'), ((278, 296), 'datetime.timedelta', 'timedelta', ([], {'hours': '(3)'}), '(hours=3)\n', (287, 296), False, 'from datetime import datetime, timedelta\n'), ((535, 570), 'psycopg2.conne... |
import numpy as np
import os
import json
import quantities as pq
from mpi4py import MPI
import elephant.spade as spade
import argparse
import yaml
from utils import mkdirp, split_path
with open("configfile.yaml", 'r') as stream:
config = yaml.load(stream)
# max. time window width in number of bins
winlen = config... | [
"utils.mkdirp",
"yaml.load",
"numpy.load",
"argparse.ArgumentParser",
"os.path.exists",
"elephant.spade.spade",
"utils.split_path"
] | [((926, 1052), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Compute spade on artificial data for the given winlen and spectrum parameters"""'}), "(description=\n 'Compute spade on artificial data for the given winlen and spectrum parameters'\n )\n", (949, 1052), False, 'import ar... |
from typing import Union
from math import floor, ceil
import torch
from torch import Tensor
from torch.nn import Module
from torch.nn import functional as F
def _box_kernel_1d(n: int) -> Tensor:
assert n > 0
x = [1.0 for k in range(n)]
x = torch.tensor(x)
x = x / x.sum()
return x
def _binomial_... | [
"math.floor",
"torch.nn.functional.pad",
"torch.tensor",
"math.ceil"
] | [((255, 270), 'torch.tensor', 'torch.tensor', (['x'], {}), '(x)\n', (267, 270), False, 'import torch\n'), ((476, 491), 'torch.tensor', 'torch.tensor', (['x'], {}), '(x)\n', (488, 491), False, 'import torch\n'), ((1601, 1615), 'math.floor', 'floor', (['padding'], {}), '(padding)\n', (1606, 1615), False, 'from math impor... |
import sys
import json
import matplotlib.pyplot as plt
def label(bar):
for b in bar:
height = b.get_height()
plt.text(b.get_x() + b.get_width() / 2, height,
height, ha='center', va='bottom')
json_input = sys.argv[1]
stdnt_cp_total = []
title = {'prog-four-grades.json': ['Program... | [
"matplotlib.pyplot.title",
"json.load",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xlabel"
] | [((748, 774), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(6, 6)'}), '(figsize=(6, 6))\n', (758, 774), True, 'import matplotlib.pyplot as plt\n'), ((775, 835), 'matplotlib.pyplot.title', 'plt.title', (['f"""{title[json_input][0]} - Completed Checkpoints"""'], {}), "(f'{title[json_input][0]} - Completed ... |
"""
Must define three methods:
* answer_pattern(pattern, args)
* render_answer_html(answer_data)
* render_answer_json(answer_data)
"""
from .patterns import PATTERNS
import json
import requests
from django.template import loader, Context
from random import Random
#####
#API key
def get_api_key():
key = "38ea9c3c... | [
"django.template.Context",
"django.template.loader.get_template",
"requests.get",
"json.dumps"
] | [((504, 521), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (516, 521), False, 'import requests\n'), ((1729, 1752), 'json.dumps', 'json.dumps', (['answer_data'], {}), '(answer_data)\n', (1739, 1752), False, 'import json\n'), ((1476, 1524), 'django.template.loader.get_template', 'loader.get_template', (['"""... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.OperateContext import OperateContext
class KoubeiRetailWmsPartnerQueryModel(object):
def __init__(self):
self._operate_context = None
self._part... | [
"alipay.aop.api.domain.OperateContext.OperateContext.from_alipay_dict"
] | [((623, 661), 'alipay.aop.api.domain.OperateContext.OperateContext.from_alipay_dict', 'OperateContext.from_alipay_dict', (['value'], {}), '(value)\n', (654, 661), False, 'from alipay.aop.api.domain.OperateContext import OperateContext\n')] |
# **************************************************************************** #
# #
# ::: :::::::: #
# config.py :+: :+: :+: ... | [
"numpy.load",
"os.makedirs",
"os.path.exists",
"os.system",
"torch.cuda.is_available",
"torch.device",
"os.path.join"
] | [((11130, 11201), 'os.path.join', 'os.path.join', (['self.DataSet_Root', "self.DataSetConfig['train_index_file']"], {}), "(self.DataSet_Root, self.DataSetConfig['train_index_file'])\n", (11142, 11201), False, 'import os\n'), ((11231, 11300), 'os.path.join', 'os.path.join', (['self.DataSet_Root', "self.DataSetConfig['va... |
"""The tests for the Demo roller shutter platform."""
import unittest
import homeassistant.util.dt as dt_util
from homeassistant.components.rollershutter import demo
from tests.common import fire_time_changed, get_test_home_assistant
class TestRollershutterDemo(unittest.TestCase):
"""Test the Demo roller shutter... | [
"homeassistant.components.rollershutter.demo.DemoRollershutter",
"tests.common.get_test_home_assistant",
"homeassistant.util.dt.utcnow"
] | [((460, 485), 'tests.common.get_test_home_assistant', 'get_test_home_assistant', ([], {}), '()\n', (483, 485), False, 'from tests.common import fire_time_changed, get_test_home_assistant\n'), ((715, 761), 'homeassistant.components.rollershutter.demo.DemoRollershutter', 'demo.DemoRollershutter', (['self.hass', '"""test"... |
from distutils.core import setup
from image_similarity import VERSION, LICENSE
setup(
name='image-similarity-sql-python',
version=VERSION,
packages=['image_similarity'],
url='https://github.com/Azure/Azure-MachineLearning-DataScience-Private/tree/master/Misc/SQL_RRE_Templates/ImageSimilarity_SQL',
... | [
"distutils.core.setup"
] | [((80, 330), 'distutils.core.setup', 'setup', ([], {'name': '"""image-similarity-sql-python"""', 'version': 'VERSION', 'packages': "['image_similarity']", 'url': '"""https://github.com/Azure/Azure-MachineLearning-DataScience-Private/tree/master/Misc/SQL_RRE_Templates/ImageSimilarity_SQL"""', 'license': 'LICENSE'}), "(n... |
# pylint: disable=W,C,R
from __future__ import print_function
from collections import OrderedDict
from errno import EEXIST
from unittest import TestCase
from mock import call, MagicMock, patch
from py_rofi_bus.dbus import Daemon
class DaemonTestCase(TestCase):
def setUp(self):
self.construct_daemon()... | [
"mock.patch.object",
"py_rofi_bus.dbus.Daemon",
"py_rofi_bus.dbus.Daemon.bootstrap",
"mock.patch",
"mock.MagicMock"
] | [((472, 483), 'mock.MagicMock', 'MagicMock', ([], {}), '()\n', (481, 483), False, 'from mock import call, MagicMock, patch\n'), ((509, 520), 'mock.MagicMock', 'MagicMock', ([], {}), '()\n', (518, 520), False, 'from mock import call, MagicMock, patch\n'), ((713, 770), 'mock.patch', 'patch', (['"""py_rofi_bus.dbus.daemon... |
from pytest import fixture
from modron import create_app
@fixture()
def app():
return create_app()
| [
"pytest.fixture",
"modron.create_app"
] | [((61, 70), 'pytest.fixture', 'fixture', ([], {}), '()\n', (68, 70), False, 'from pytest import fixture\n'), ((93, 105), 'modron.create_app', 'create_app', ([], {}), '()\n', (103, 105), False, 'from modron import create_app\n')] |
from fastapi import FastAPI
from fastapi.exceptions import RequestValidationError
from fastapi.staticfiles import StaticFiles
from starlette.exceptions import HTTPException
from starlette.middleware.cors import CORSMiddleware
from starlette.requests import Request
from starlette.templating import Jinja2Templates
from ... | [
"fastapi.staticfiles.StaticFiles",
"app.core.events.create_start_app_handler",
"app.core.events.create_stop_app_handler",
"fastapi.FastAPI"
] | [((775, 832), 'fastapi.FastAPI', 'FastAPI', ([], {'title': 'PROJECT_NAME', 'debug': 'DEBUG', 'version': 'VERSION'}), '(title=PROJECT_NAME, debug=DEBUG, version=VERSION)\n', (782, 832), False, 'from fastapi import FastAPI\n'), ((1065, 1100), 'fastapi.staticfiles.StaticFiles', 'StaticFiles', ([], {'directory': '"""app/st... |
# coding:utf8
"""
Description:matplotlib绘制复杂图
Author:伏草惟存
Prompt: code in Python3 env
"""
import matplotlib
import matplotlib.pyplot as plt
import csv
from datetime import datetime
#加入中文显示
import matplotlib.font_manager as fm
# 解决中文乱码,本案例使用宋体字
myfont=fm.FontProperties(fname=r"C:\\Windows\\Fonts\\simsun.ttc")
def ... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"csv.reader",
"matplotlib.pyplot.plot",
"matplotlib.font_manager.FontProperties",
"matplotlib.pyplot.figure",
"datetime.datetime.strptime",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.fill_between",
"matplot... | [((254, 317), 'matplotlib.font_manager.FontProperties', 'fm.FontProperties', ([], {'fname': '"""C:\\\\\\\\Windows\\\\\\\\Fonts\\\\\\\\simsun.ttc"""'}), "(fname='C:\\\\\\\\Windows\\\\\\\\Fonts\\\\\\\\simsun.ttc')\n", (271, 317), True, 'import matplotlib.font_manager as fm\n'), ((345, 357), 'matplotlib.pyplot.figure', 'p... |
# Copyright 2020 Google 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 to in writing, ... | [
"json.dump",
"traceback.print_exc",
"csv.reader",
"csv.writer",
"shutil.copyfile",
"warnings.warn"
] | [((1337, 1351), 'csv.reader', 'csv.reader', (['fd'], {}), '(fd)\n', (1347, 1351), False, 'import csv\n'), ((3251, 3265), 'csv.reader', 'csv.reader', (['fd'], {}), '(fd)\n', (3261, 3265), False, 'import csv\n'), ((3894, 3912), 'csv.writer', 'csv.writer', (['fd_out'], {}), '(fd_out)\n', (3904, 3912), False, 'import csv\n... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
import blog.fields
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='... | [
"django.db.models.DateTimeField",
"django.db.migrations.AlterModelOptions"
] | [((272, 362), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""entry"""', 'options': "{'verbose_name_plural': 'entries'}"}), "(name='entry', options={'verbose_name_plural':\n 'entries'})\n", (300, 362), False, 'from django.db import models, migrations\n'), ((502, 553), 'dja... |
from pdiffutils import DiffractionDataPoint, DiffractionDataPointMean
import math
import pytest
# remember, I've overridden ==
def is_all_equal(p1, p2):
return bool(
math.isclose(p1.x, p2.x)
and math.isclose(p1.y, p2.y)
and math.isclose(p1.e, p2.e)
)
def test_construction():
ddpm... | [
"math.isnan",
"pdiffutils.DiffractionDataPoint",
"math.sqrt",
"pdiffutils.DiffractionDataPointMean",
"pytest.raises",
"math.isclose"
] | [((326, 352), 'pdiffutils.DiffractionDataPointMean', 'DiffractionDataPointMean', ([], {}), '()\n', (350, 352), False, 'from pdiffutils import DiffractionDataPoint, DiffractionDataPointMean\n'), ((390, 411), 'math.isnan', 'math.isnan', (['ddpmean.x'], {}), '(ddpmean.x)\n', (400, 411), False, 'import math\n'), ((423, 447... |
import os
import csv
import requests
import json
from datetime import datetime
"""
Sample script to create ARKs from the output of the larkm_integration
Drupal module (https://github.com/mjordan/larkm_integration). See that
module's README for more information.
By default, this output is a JSON list containing object... | [
"os.remove",
"json.load",
"requests.get",
"requests.post",
"datetime.datetime.now"
] | [((740, 754), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (752, 754), False, 'from datetime import datetime\n'), ((936, 965), 'requests.get', 'requests.get', (['drupal_endpoint'], {}), '(drupal_endpoint)\n', (948, 965), False, 'import requests\n'), ((1114, 1135), 'json.load', 'json.load', (['input_file']... |
"""
measurement.py
MeasurementModel wraps up a halo.HaloDensityProfile instance with both a set of
observables (e.g., {r, DeltaSigma, DeltaSigma_err}) and a prior on the model
parameters of interest.
"""
from collections import OrderedDict
import numpy as np
from scipy import optimize
from colossus.halo.profile_ba... | [
"numpy.log",
"numpy.interp",
"numpy.isfinite",
"numpy.ones",
"numpy.any",
"scipy.optimize.fminbound",
"collections.OrderedDict"
] | [((3773, 3819), 'collections.OrderedDict', 'OrderedDict', (['[(p.name, p) for p in parameters]'], {}), '([(p.name, p) for p in parameters])\n', (3784, 3819), False, 'from collections import OrderedDict\n'), ((8424, 8486), 'numpy.any', 'np.any', (['[return_lnlike, return_profile, return_vir, return_sp]'], {}), '([return... |
import requests
from bs4 import BeautifulSoup
import sqlite3 as sql
import json
import os.path
indexprocessurl = "http://192.168.127.12/bbvrs/index_process.php"
databaseName = "Voterlist.db"
progressFilename = "Progress.json"
masterDict={}
def createTableIfNotExists(dbName):
conn=sql.connect(dbName)
CREATETAB... | [
"requests.session",
"json.dump",
"json.load",
"sqlite3.connect",
"requests.get",
"bs4.BeautifulSoup",
"requests.post"
] | [((287, 306), 'sqlite3.connect', 'sql.connect', (['dbName'], {}), '(dbName)\n', (298, 306), True, 'import sqlite3 as sql\n'), ((9881, 9908), 'bs4.BeautifulSoup', 'BeautifulSoup', (['responsetext'], {}), '(responsetext)\n', (9894, 9908), False, 'from bs4 import BeautifulSoup\n'), ((1037, 1066), 'json.dump', 'json.dump',... |
import re
import logging
from frontend.antlr.tinycParser import tinycParser
from frontend.antlr.tinycVisitor import tinycVisitor
logger = logging.getLogger(__name__)
TABLE = {}
class CustomTinycVisitor(tinycVisitor):
# Visit a parse tree produced by tinycParser#program.
def visitProgram(self, ctx:tinycPa... | [
"logging.debug",
"re.search",
"logging.getLogger"
] | [((141, 168), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (158, 168), False, 'import logging\n'), ((514, 545), 'logging.debug', 'logging.debug', (['"""visitStatement"""'], {}), "('visitStatement')\n", (527, 545), False, 'import logging\n'), ((1634, 1666), 'logging.debug', 'logging.debu... |
import os
from . import wsgi
class Recipe(wsgi.ScriptRecipe):
def __init__(self, buildout, name, options):
options.setdefault('application', '')
super(Recipe, self).__init__(buildout, name, options)
self.wsgi = None
if self.options['application'] == 'auto':
... | [
"os.path.dirname",
"os.path.join",
"os.path.relpath",
"os.path.basename"
] | [((1115, 1182), 'os.path.join', 'os.path.join', (["self.options['bin_dir']", "('%s:application' % wsgi_name)"], {}), "(self.options['bin_dir'], '%s:application' % wsgi_name)\n", (1127, 1182), False, 'import os\n'), ((1714, 1758), 'os.path.dirname', 'os.path.dirname', (["self.options['application']"], {}), "(self.option... |
"""
Solver D1Q2Q2 for the shallow water system on [0, 1]
d_t(h) + d_x(q) = 0, t > 0, 0 < x < 1,
d_t(q) + d_x(q^2/h+gh^2/2) = 0, t > 0, 0 < x < 1,
h(t=0,x) = h0(x), q(t=0,x) = q0(x),
d_t(h)(t,x=0) = d_t(h)(t,x=1) = 0
d_t(q)(t,x=0) = d_t(q)(t,x=1) = 0
the initial condition is a picewise constant function
in ... | [
"sympy.symbols",
"pylbm.Simulation",
"numpy.empty"
] | [((460, 488), 'sympy.symbols', 'sp.symbols', (['"""h, q, X, LA, g"""'], {}), "('h, q, X, LA, g')\n", (470, 488), True, 'import sympy as sp\n'), ((562, 579), 'numpy.empty', 'np.empty', (['x.shape'], {}), '(x.shape)\n', (570, 579), True, 'import numpy as np\n'), ((2339, 2376), 'pylbm.Simulation', 'pylbm.Simulation', (['d... |
import warnings
warnings.filterwarnings("ignore")
import nltk
from nltk.tokenize import word_tokenize,sent_tokenize
from nltk.translate.bleu_score import corpus_bleu,sentence_bleu
from tqdm import tqdm
from collections import defaultdict
import collections
import math
from statistics import mean, median,variance,stdev
... | [
"argparse.ArgumentParser",
"warnings.filterwarnings",
"collections.defaultdict",
"random.seed",
"nltk.translate.bleu_score.corpus_bleu"
] | [((16, 49), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (39, 49), False, 'import warnings\n'), ((375, 400), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (398, 400), False, 'import argparse\n'), ((1215, 1229), 'random.seed', 'random.seed', (['(... |
import os
import csv
import json
import pickle
import random
import argparse
import numpy as np
import tensorflow as tf
import _pickle as cPickle
from copy import deepcopy
import collections
from collections import OrderedDict
__author__ = '<NAME>'
flags = tf.flags
FLAGS = flags.FLAGS
flags.DEFINE_float("masked_lm_p... | [
"csv.reader",
"argparse.ArgumentParser",
"tensorflow.logging.info",
"tensorflow.python_io.TFRecordWriter",
"random.Random",
"tensorflow.train.Features",
"tensorflow.gfile.GFile",
"collections.namedtuple",
"collections.OrderedDict"
] | [((3778, 3836), 'tensorflow.logging.info', 'tf.logging.info', (['"""Wrote %d total instances"""', 'total_written'], {}), "('Wrote %d total instances', total_written)\n", (3793, 3836), True, 'import tensorflow as tf\n'), ((4188, 4250), 'collections.namedtuple', 'collections.namedtuple', (['"""MaskedLmInstance"""', "['in... |
import os
# Local
import majik.obfuscate
ALGORITHMS = [
majik.obfuscate.Algorithm.AES128,
majik.obfuscate.Algorithm.AES192,
majik.obfuscate.Algorithm.AES256,
]
TESTSIZES = [0, 1, 15, 16, 17, 16384, 1048575, 1048576, 1048577]
def random_text(size):
output = []
while True:
block = os.uran... | [
"os.urandom"
] | [((313, 333), 'os.urandom', 'os.urandom', (['(size * 4)'], {}), '(size * 4)\n', (323, 333), False, 'import os\n')] |