code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Copyright (c) 2018 <NAME>.
# Uranium is released under the terms of the LGPLv3 or higher.
import os
import time # For timing lock file
from typing import Any, Optional
from UM.Logger import Logger
from UM.Platform import Platform
## Manage a lock file for reading / writing in a directory.
# \param filename th... | [
"os.remove",
"os.open",
"os.stat",
"UM.Logger.Logger.log",
"ctypes.windll.kernel32.CloseHandle",
"ctypes.windll.kernel32.CreateFileW",
"time.sleep",
"time.time",
"UM.Platform.Platform.isWindows",
"os.close",
"UM.Logger.Logger.logException"
] | [((1672, 1683), 'time.time', 'time.time', ([], {}), '()\n', (1681, 1683), False, 'import time\n'), ((2981, 2992), 'time.time', 'time.time', ([], {}), '()\n', (2990, 2992), False, 'import time\n'), ((5337, 5357), 'UM.Platform.Platform.isWindows', 'Platform.isWindows', ([], {}), '()\n', (5355, 5357), False, 'from UM.Plat... |
#! /usr/bin/env python
from __future__ import absolute_import
import datetime
import os
import re
import sys
import time
import json
import unittest
import irods.test.helpers as helpers
# Regular expression to match common synonyms for localhost.
#
LOCALHOST_REGEX = re.compile(r"""^(127(\.\d+){1,3}|[0:]+1|(.*-)?loca... | [
"unittest.main",
"json.dump",
"os.path.abspath",
"json.load",
"os.path.join",
"os.path.dirname",
"time.sleep",
"irods.test.helpers.make_session",
"datetime.datetime.now",
"os.listdir",
"re.compile"
] | [((270, 358), 're.compile', 're.compile', (['"""^(127(\\\\.\\\\d+){1,3}|[0:]+1|(.*-)?localhost(\\\\.\\\\w+)?)$"""', 're.IGNORECASE'], {}), "('^(127(\\\\.\\\\d+){1,3}|[0:]+1|(.*-)?localhost(\\\\.\\\\w+)?)$', re.\n IGNORECASE)\n", (280, 358), False, 'import re\n'), ((11712, 11737), 'os.path.dirname', 'os.path.dirname'... |
# Generated by Django 2.0.2 on 2018-04-12 19:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('article', '0005_auto_20180412_1836'),
]
operations = [
migrations.DeleteModel(
na... | [
"django.db.models.ForeignKey",
"django.db.migrations.DeleteModel"
] | [((281, 320), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""Comments"""'}), "(name='Comments')\n", (303, 320), False, 'from django.db import migrations, models\n'), ((462, 583), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'db_column': '"""slug"""', 'default': 'None', 'on_... |
import tensorflow as tf
import tensorflow_probability as tfp
import numpy as np
import src.utils as utils
def gaussian_d(x, y):
"""
A conceptual lack of understanding here.
Do I need a dx to calculate this over?
Doesnt make sense for a single point!?
"""
d = tf.norm(x - y, axis=1)
return tf... | [
"numpy.pad",
"tensorflow.nn.relu",
"tensorflow.keras.layers.Conv2D",
"tensorflow.abs",
"tensorflow.losses.mean_squared_error",
"tensorflow.enable_eager_execution",
"tensorflow.zeros_like",
"tensorflow.constant",
"tensorflow.keras.layers.Activation",
"tensorflow.exp",
"tensorflow.random_normal",
... | [((284, 306), 'tensorflow.norm', 'tf.norm', (['(x - y)'], {'axis': '(1)'}), '(x - y, axis=1)\n', (291, 306), True, 'import tensorflow as tf\n'), ((4033, 4060), 'tensorflow.enable_eager_execution', 'tf.enable_eager_execution', ([], {}), '()\n', (4058, 4060), True, 'import tensorflow as tf\n'), ((4069, 4103), 'tensorflow... |
import asyncio
import logging
import importlib
import signal
from contextlib import contextmanager
def get_module(module_path):
module_path, _, child_name = module_path.rpartition('.')
module = importlib.import_module(module_path)
child = getattr(module, child_name)
return module, child
class Inte... | [
"importlib.import_module",
"logging.warn",
"asyncio.set_event_loop",
"signal.signal",
"asyncio.new_event_loop"
] | [((205, 241), 'importlib.import_module', 'importlib.import_module', (['module_path'], {}), '(module_path)\n', (228, 241), False, 'import importlib\n'), ((1097, 1121), 'asyncio.new_event_loop', 'asyncio.new_event_loop', ([], {}), '()\n', (1119, 1121), False, 'import asyncio\n'), ((1126, 1154), 'asyncio.set_event_loop', ... |
import copy
import threading
from threading import Thread
import time
import paho.mqtt.client as mqtt
from modules.data import variables
from modules.data.constants import Constants
class MQTTClient(Thread):
def __init__(self):
Thread.__init__(self)
self._stopEvent = threading.Ev... | [
"threading.Thread.__init__",
"time.sleep",
"time.time",
"threading.Event",
"paho.mqtt.client.Client"
] | [((259, 280), 'threading.Thread.__init__', 'Thread.__init__', (['self'], {}), '(self)\n', (274, 280), False, 'from threading import Thread\n'), ((308, 325), 'threading.Event', 'threading.Event', ([], {}), '()\n', (323, 325), False, 'import threading\n'), ((372, 383), 'time.time', 'time.time', ([], {}), '()\n', (381, 38... |
# encoding: utf-8
# Project: Ecosytem-based Automated Range Mapping (EBAR)
# Credits: <NAME>, <NAME>
# © NatureServe Canada 2020 under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
# Program: PublishRangeMapTool.py
# ArcGIS Python tool for creating JPG, PDF and Spatial Data (Zip) for a Range Map
# Notes:
... | [
"EBARUtils.updateArcGISProTemplate",
"arcpy.MakeTableView_management",
"EBARUtils.createReplaceFolder",
"arcpy.Delete_management",
"arcpy.mp.ArcGISProject",
"arcpy.da.SearchCursor",
"EBARUtils.updateCursor",
"urllib.request.urlopen",
"EBARUtils.displayMessage",
"shutil.copyfile",
"EBARUtils.crea... | [((809, 832), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (830, 832), False, 'import datetime\n'), ((1429, 1488), 'EBARUtils.displayMessage', 'EBARUtils.displayMessage', (['messages', '"""Processing parameters"""'], {}), "(messages, 'Processing parameters')\n", (1453, 1488), False, 'import EBARU... |
## THIS IS ANONYMOUS HANDLER
import json
import telegram
import os
import logging
from dynamo_call import *
# Logging is cool!
logger = logging.getLogger()
if logger.handlers:
for handler in logger.handlers:
logger.removeHandler(handler)
logging.basicConfig(level=logging.INFO)
OK_RESPONSE = {
'stat... | [
"logging.basicConfig",
"json.dumps",
"os.environ.get",
"telegram.Bot",
"logging.getLogger"
] | [((140, 159), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (157, 159), False, 'import logging\n'), ((254, 293), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (273, 293), False, 'import logging\n'), ((399, 415), 'json.dumps', 'json.dumps', (['"""o... |
"""
File: T_reflection_examples.py
Purpose: examples of t_flip applied to a melody.
"""
from fractions import Fraction
from tonalmodel.diatonic_pitch import DiatonicPitch
from transformation.functions.pitchfunctions.diatonic_pitch_reflection_function import FlipType
from transformation.reflection.t_chromatic_reflectio... | [
"tonalmodel.interval.Interval.parse",
"fractions.Fraction",
"tonalmodel.diatonic_pitch.DiatonicPitch.parse"
] | [((594, 609), 'fractions.Fraction', 'Fraction', (['(1)', '(16)'], {}), '(1, 16)\n', (602, 609), False, 'from fractions import Fraction\n'), ((2303, 2329), 'tonalmodel.diatonic_pitch.DiatonicPitch.parse', 'DiatonicPitch.parse', (['"""F:4"""'], {}), "('F:4')\n", (2322, 2329), False, 'from tonalmodel.diatonic_pitch import... |
# Copyright 2017 IBM Corp.
#
# 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, sof... | [
"tessia.baselib.common.utils.timer",
"tessia.baselib.common.logger.get_logger"
] | [((1299, 1319), 'tessia.baselib.common.logger.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (1309, 1319), False, 'from tessia.baselib.common.logger import get_logger\n'), ((2416, 2477), 'tessia.baselib.common.utils.timer', 'timer', (['self._cmd_channel', 'check_cmd', '[0, 1, 5, 15]', 'error_msg'], {}),... |
import prefect
from prefect import task, Flow
@task
def say_hello():
logger = prefect.context.get("logger")
logger.info("Hello, Cloud!")
with Flow("hello-flow") as flow:
say_hello()
# Register the flow under the "tutorial" project
flow.register(project_name="test-project")
| [
"prefect.Flow",
"prefect.context.get"
] | [((83, 112), 'prefect.context.get', 'prefect.context.get', (['"""logger"""'], {}), "('logger')\n", (102, 112), False, 'import prefect\n'), ((152, 170), 'prefect.Flow', 'Flow', (['"""hello-flow"""'], {}), "('hello-flow')\n", (156, 170), False, 'from prefect import task, Flow\n')] |
import uuid
import time
from fastapi.testclient import TestClient
from main import app, DEVICEID
DEFAULT_DEVICEID = "795F83C8-C2C5-4AE4-8FC9-1770E1ABE23B".lower()
TEST_PAYLOAD = {
"motionGravityX": 0,
DEVICEID: DEFAULT_DEVICEID
}
def test_main_route():
with TestClient(app) as client:
response = ... | [
"fastapi.testclient.TestClient"
] | [((274, 289), 'fastapi.testclient.TestClient', 'TestClient', (['app'], {}), '(app)\n', (284, 289), False, 'from fastapi.testclient import TestClient\n'), ((490, 505), 'fastapi.testclient.TestClient', 'TestClient', (['app'], {}), '(app)\n', (500, 505), False, 'from fastapi.testclient import TestClient\n'), ((814, 829), ... |
"""CAS authentication backend"""
from urllib import urlencode, urlopen
from urlparse import urljoin
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.models import AnonymousUser
__all__ = ['CASBackend']
def _verify_cas1(ticket, service):
"""Verifies CAS 1.0 a... | [
"django.contrib.auth.models.AnonymousUser",
"elementtree.ElementTree.fromstring",
"django.contrib.auth.models.User.objects.get",
"urllib.urlopen",
"django.contrib.auth.models.User.objects.create_user",
"urlparse.urljoin",
"urllib.urlencode"
] | [((562, 574), 'urllib.urlopen', 'urlopen', (['url'], {}), '(url)\n', (569, 574), False, 'from urllib import urlencode, urlopen\n'), ((1212, 1224), 'urllib.urlopen', 'urlopen', (['url'], {}), '(url)\n', (1219, 1224), False, 'from urllib import urlencode, urlopen\n'), ((532, 549), 'urllib.urlencode', 'urlencode', (['para... |
__package__ = 'archivebox.core'
from django.utils import timezone
from ..config import PUBLIC_SNAPSHOTS
def detect_timezone(request, activate: bool=True):
gmt_offset = (request.COOKIES.get('GMT_OFFSET') or '').strip()
tz = None
if gmt_offset.replace('-', '').isdigit():
tz = timezone.get_fixed_ti... | [
"django.utils.timezone.activate"
] | [((377, 398), 'django.utils.timezone.activate', 'timezone.activate', (['tz'], {}), '(tz)\n', (394, 398), False, 'from django.utils import timezone\n')] |
import requests
import os
import sys
__dirname = os.path.abspath(os.path.dirname(__file__))
if not os.path.isdir(__dirname+'/lists'):
os.mkdir(__dirname+'/lists')
try:
i = 0
while True:
if i <= 5000:
try:
s = requests.get("https://public.freeproxyapi.com/api/Proxy/Mini... | [
"os.mkdir",
"os.path.isdir",
"os.path.dirname",
"requests.get",
"sys.exit"
] | [((66, 91), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (81, 91), False, 'import os\n'), ((101, 136), 'os.path.isdir', 'os.path.isdir', (["(__dirname + '/lists')"], {}), "(__dirname + '/lists')\n", (114, 136), False, 'import os\n'), ((140, 170), 'os.mkdir', 'os.mkdir', (["(__dirname + '/li... |
import async_timeout
from aiohttp import ClientConnectionError
from custom_components.wienerlinien.const import BASE_URL
import logging
_LOGGER = logging.getLogger(__name__)
class WienerlinienAPI:
"""Call API."""
def __init__(self, session, loop, stopid):
"""Initialize."""
self.session = se... | [
"custom_components.wienerlinien.const.BASE_URL.format",
"async_timeout.timeout",
"logging.getLogger"
] | [((148, 175), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (165, 175), False, 'import logging\n'), ((488, 516), 'custom_components.wienerlinien.const.BASE_URL.format', 'BASE_URL.format', (['self.stopid'], {}), '(self.stopid)\n', (503, 516), False, 'from custom_components.wienerlinien.co... |
from pathlib import Path
DIR_DATA = Path(__file__).absolute().parent.parent / 'data'
DIR_DATA_LOGS = DIR_DATA / 'logs'
DIR_DATA_LOGS.mkdir(parents=True, exist_ok=True)
DIR_DATA_RAW = DIR_DATA / 'raw'
DIR_DATA_RAW.mkdir(parents=True, exist_ok=True)
DIR_DATA_INTERHIM = DIR_DATA / 'interim'
DIR_DATA_INTERHIM.mkdir(pare... | [
"pathlib.Path"
] | [((37, 51), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (41, 51), False, 'from pathlib import Path\n')] |
#!/usr/bin/env python3
"""
Author : vpaz
Date : 2019-04-04
Purpose: Rock the Casbah
"""
import os
import sys
import re
# --------------------------------------------------
def main():
args = sys.argv[1:]
if len(args) != 2:
print('Usage: {} PASSWORD ALT'.format(os.path.basename(sys.argv[0])))
... | [
"re.match",
"sys.exit",
"os.path.basename"
] | [((322, 333), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (330, 333), False, 'import sys\n'), ((282, 311), 'os.path.basename', 'os.path.basename', (['sys.argv[0]'], {}), '(sys.argv[0])\n', (298, 311), False, 'import os\n'), ((646, 691), 're.match', 're.match', (["('.?' + password + '.?')", 'alt_version'], {}), "('.... |
"""
filename: _exploit_generation.py
author: ww9210
This plugin is used to reproduce the gadget chain and generate concrete payload discovered in previous phase.
We do not generate concrete payload during exploration because such constraint solving will eat a lot of memeoy space
This file does not handle the detail of ... | [
"multiprocessing.Process",
"os.path.join",
"os.listdir"
] | [((6671, 6686), 'os.path.join', 'join', (['mypath', 'f'], {}), '(mypath, f)\n', (6675, 6686), False, 'from os.path import isfile, join\n'), ((4973, 4988), 'os.listdir', 'listdir', (['mypath'], {}), '(mypath)\n', (4980, 4988), False, 'from os import listdir\n'), ((6595, 6610), 'os.listdir', 'listdir', (['mypath'], {}), ... |
from typing import List
import math
class Solution:
def maxOperations(self, nums: List[int], k: int) -> int:
max_ops = 0
counts = {}
for n in nums:
if n in counts:
counts[n] = counts[n] + 1
else:
counts[n] = 1
for n in counts... | [
"math.floor"
] | [((481, 507), 'math.floor', 'math.floor', (['(counts[n] // 2)'], {}), '(counts[n] // 2)\n', (491, 507), False, 'import math\n')] |
# ===============================================================================
# Copyright 2014 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | [
"pychron.graph.time_series_graph.TimeSeriesStackedGraph",
"traits.api.Instance",
"numpy.array",
"os.path.join",
"pychron.core.helpers.filetools.fileiter"
] | [((1282, 1297), 'traits.api.Instance', 'Instance', (['Graph'], {}), '(Graph)\n', (1290, 1297), False, 'from traits.api import HasTraits, Instance\n'), ((1336, 1394), 'os.path.join', 'os.path.join', (['paths.spectrometer_scans_dir', '"""scan-005.txt"""'], {}), "(paths.spectrometer_scans_dir, 'scan-005.txt')\n", (1348, 1... |
'''
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
For example:
Given binary tree [3,9,20,null,null,15,7],
3
/ \
9 20
/ \
15 7
return its level order traversal as:
[
[3],
[9,20],
[15,7]
]
'''
# Definition for a binary tr... | [
"collections.deque"
] | [((545, 552), 'collections.deque', 'deque', ([], {}), '()\n', (550, 552), False, 'from collections import deque\n')] |
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.utils.translation import ugettext_lazy as _
from .managers import UserManager
class User(AbstractUser):
email = models.EmailField(_('Email address'), unique=True)
regno = models.CharField(_('Registration number'), ma... | [
"django.utils.translation.ugettext_lazy"
] | [((230, 248), 'django.utils.translation.ugettext_lazy', '_', (['"""Email address"""'], {}), "('Email address')\n", (231, 248), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((292, 316), 'django.utils.translation.ugettext_lazy', '_', (['"""Registration number"""'], {}), "('Registration number')\n",... |
import os
import torch
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from torch.utils.tensorboard import SummaryWriter
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import seaborn as sns
import sklearn
from sklearn.model_selection import train_test_split
fro... | [
"os.path.abspath",
"torch.nn.MSELoss",
"torch.utils.data.DataLoader",
"torch.nn.ModuleList",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.MinMaxScaler",
"torch.clamp",
"torch.cuda.is_available",
"numpy.array",
"torch.utils.tensorboard.SummaryWriter",
"t... | [((497, 540), 'os.path.abspath', 'os.path.abspath', (["(__file__ + '/../vis_data/')"], {}), "(__file__ + '/../vis_data/')\n", (512, 540), False, 'import os\n'), ((1918, 1953), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {'feature_range': '(-1, 1)'}), '(feature_range=(-1, 1))\n', (1930, 1953), False, 'fro... |
from django.utils.functional import wraps
def frame_deny_exempt(view):
@wraps(view)
def inner(*args, **kwargs):
response = view(*args, **kwargs)
response._frame_deny_exempt = True
return response
return inner
| [
"django.utils.functional.wraps"
] | [((78, 89), 'django.utils.functional.wraps', 'wraps', (['view'], {}), '(view)\n', (83, 89), False, 'from django.utils.functional import wraps\n')] |
'''
This is from where we run the program. Yay!
'''
from controllers.competition import Competition
from boundaries.text_ui import TextUI
competition = Competition(TextUI())
competition.run_game() | [
"boundaries.text_ui.TextUI"
] | [((165, 173), 'boundaries.text_ui.TextUI', 'TextUI', ([], {}), '()\n', (171, 173), False, 'from boundaries.text_ui import TextUI\n')] |
import logging
import fileinput
import os
import random
from zipfile import ZipFile
import gensim
from gensim.models.keyedvectors import KeyedVectors
from basic_srl.conversions import concatenate_corpora
from basic_srl.dataset import Dataset, DatasetMM
from basic_srl.framenet import generate_framenet_lexicon
from bas... | [
"basic_srl.salsa.generate_salsa_corpora",
"basic_srl.dataset.Dataset",
"logging.basicConfig",
"basic_srl.conversions.concatenate_corpora",
"basic_srl.resources.ResourceManager",
"logging.info",
"os.path.isfile",
"random.seed",
"gensim.scripts.glove2word2vec.glove2word2vec",
"basic_srl.dataset.Data... | [((509, 534), 'os.path.isfile', 'os.path.isfile', (['file_name'], {}), '(file_name)\n', (523, 534), False, 'import os\n'), ((680, 704), 'os.path.isfile', 'os.path.isfile', (['path_out'], {}), '(path_out)\n', (694, 704), False, 'import os\n'), ((808, 899), 'logging.info', 'logging.info', (['"""Converting [%s] to [%s] in... |
from pathlib import Path
from SHIMON.api.error import error_202, error_400
from SHIMON.api.api_base import ApiBase
from typing import TYPE_CHECKING
from SHIMON import HttpResponse
if TYPE_CHECKING:
from SHIMON.shimon import Shimon
class ApiTheme(ApiBase):
callname = "theme"
def __init__(self) -> None:... | [
"SHIMON.api.error.error_400",
"pathlib.Path",
"pathlib.Path.cwd",
"SHIMON.api.error.error_202"
] | [((580, 612), 'pathlib.Path', 'Path', (['"""SHIMON/templates/themes/"""'], {}), "('SHIMON/templates/themes/')\n", (584, 612), False, 'from pathlib import Path\n'), ((892, 903), 'SHIMON.api.error.error_400', 'error_400', ([], {}), '()\n', (901, 903), False, 'from SHIMON.api.error import error_202, error_400\n'), ((868, ... |
from sklearn.ensemble import RandomForestClassifier
rf = RandomForestClassifier(n_jobs=4, criterion='entropy')
rf.fit(X_train, y_train)
y_train_pred = rf.predict(X_train)
from sklearn.metrics import precision_score
precision_score(y_train, y_train_pred)
| [
"sklearn.ensemble.RandomForestClassifier",
"sklearn.metrics.precision_score"
] | [((58, 111), 'sklearn.ensemble.RandomForestClassifier', 'RandomForestClassifier', ([], {'n_jobs': '(4)', 'criterion': '"""entropy"""'}), "(n_jobs=4, criterion='entropy')\n", (80, 111), False, 'from sklearn.ensemble import RandomForestClassifier\n'), ((219, 257), 'sklearn.metrics.precision_score', 'precision_score', (['... |
import argparse
import gzip
import os
import shutil
import sys
from abacat.abacat_helper import timer_wrapper
"""
A script to rename files in assembly directory structure.
Input:
One or more assembly directories.
Output:
One or more assembly directories with the directory and all files renamed.
"""
def ls_and_decom... | [
"os.path.abspath",
"os.remove",
"gzip.open",
"argparse.ArgumentParser",
"os.path.basename",
"os.path.isdir",
"os.path.dirname",
"shutil.copyfileobj",
"os.path.join",
"os.listdir",
"sys.exit"
] | [((721, 750), 'os.path.abspath', 'os.path.abspath', (['assembly_dir'], {}), '(assembly_dir)\n', (736, 750), False, 'import os\n'), ((3255, 3284), 'os.path.abspath', 'os.path.abspath', (['assembly_dir'], {}), '(assembly_dir)\n', (3270, 3284), False, 'import os\n'), ((4718, 4786), 'argparse.ArgumentParser', 'argparse.Arg... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import psutil
import math
import cpuinfo
def get_grains_info():
grains = {}
disk_data = psutil.disk_partitions()
disks = []
for disk in disk_data:
diskname = disk.mountpoint
disktotal = convert_bytes(psutil.disk_usage(disk.mountpoint).tota... | [
"psutil.disk_partitions",
"psutil.virtual_memory",
"cpuinfo.get_cpu_info",
"math.pow",
"psutil.disk_usage",
"math.log"
] | [((145, 169), 'psutil.disk_partitions', 'psutil.disk_partitions', ([], {}), '()\n', (167, 169), False, 'import psutil\n'), ((429, 451), 'cpuinfo.get_cpu_info', 'cpuinfo.get_cpu_info', ([], {}), '()\n', (449, 451), False, 'import cpuinfo\n'), ((544, 567), 'psutil.virtual_memory', 'psutil.virtual_memory', ([], {}), '()\n... |
"""
Main flask application
# Reference for start/stop trick:
https://stackoverflow.com/questions/49821707/starting-and-stopping-a-method-using-flask-routes-python
# TODO: Load ML model with redis and keep it for sometime.
1- detector/yolov3/detector.py |=> yolov3 weightfile -> redis cache
2- deepsort/deep... | [
"redis.Redis",
"threading.Thread",
"utils.parser.get_config",
"argparse.ArgumentParser",
"flask.Flask",
"dotenv.load_dotenv",
"flask.jsonify",
"os.environ.keys",
"rtsp_threaded_tracker.RealTimeTracking",
"os.getenv"
] | [((1032, 1056), 'redis.Redis', 'Redis', (['"""111.222.333.444"""'], {}), "('111.222.333.444')\n", (1037, 1056), False, 'from redis import Redis\n'), ((1063, 1078), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (1068, 1078), False, 'from flask import Response, Flask, jsonify\n'), ((1271, 1293), 'os.getenv'... |
import sys
import random
import numpy as np
from numpy.random import randn
sys.path.append('../DescriptiveStatisticsFunction')
sys.path.append('../HelperFunctions')
from HelperFunctions.HelperFunctions import lib_mean
from HelperFunctions.HelperFunctions import lib_median
from HelperFunctions.HelperFunctions import lib... | [
"DescriptiveStatisticsFunction.DescriptiveStatisticsFunction.created_median",
"DescriptiveStatisticsFunction.DescriptiveStatisticsFunction.created_quartile",
"DescriptiveStatisticsFunction.DescriptiveStatisticsFunction.created_skewness",
"HelperFunctions.HelperFunctions.lib_zscore",
"DescriptiveStatisticsFu... | [((75, 126), 'sys.path.append', 'sys.path.append', (['"""../DescriptiveStatisticsFunction"""'], {}), "('../DescriptiveStatisticsFunction')\n", (90, 126), False, 'import sys\n'), ((127, 164), 'sys.path.append', 'sys.path.append', (['"""../HelperFunctions"""'], {}), "('../HelperFunctions')\n", (142, 164), False, 'import ... |
from secml.testing import CUnitTest
from secml.figure import CFigure
from secml.optim.constraints import CConstraint
class TestCPlotConstraint(CUnitTest):
"""Unit test for TestCPlot."""
def setUp(self):
self.constraints = [
CConstraint.create("box", lb=0, ub=1),
CConstraint.c... | [
"secml.testing.CUnitTest.main",
"secml.optim.constraints.CConstraint.create",
"secml.figure.CFigure"
] | [((681, 697), 'secml.testing.CUnitTest.main', 'CUnitTest.main', ([], {}), '()\n', (695, 697), False, 'from secml.testing import CUnitTest\n'), ((528, 537), 'secml.figure.CFigure', 'CFigure', ([], {}), '()\n', (535, 537), False, 'from secml.figure import CFigure\n'), ((256, 293), 'secml.optim.constraints.CConstraint.cre... |
from abc import abstractmethod, ABCMeta
from keras import activations, initializers, regularizers, constraints, backend as K
from keras.engine import Layer
from keras.utils import conv_utils
import tensorflow as tf
from keras.layers import Conv2D
class Conv2DCustom(Layer, metaclass=ABCMeta):
"""
Custom convo... | [
"keras.backend.stack",
"keras.utils.conv_utils.normalize_padding",
"keras.constraints.serialize",
"keras.backend.dot",
"keras.activations.serialize",
"keras.utils.conv_utils.normalize_tuple",
"keras.activations.get",
"keras.regularizers.get",
"keras.backend.spatial_2d_padding",
"keras.backend.resh... | [((1480, 1537), 'keras.utils.conv_utils.normalize_tuple', 'conv_utils.normalize_tuple', (['kernel_size', '(2)', '"""kernel_size"""'], {}), "(kernel_size, 2, 'kernel_size')\n", (1506, 1537), False, 'from keras.utils import conv_utils\n'), ((1561, 1610), 'keras.utils.conv_utils.normalize_tuple', 'conv_utils.normalize_tup... |
from abc import ABC, abstractmethod
from multiprocessing import Pool
from shutil import rmtree
from time import time
import numpy as np
import os
import progressbar
import pysam
import pysamstats
class PileupGenerator(ABC):
"""
Base class for generating pileups from read alignments.
Usage:
X, y ... | [
"numpy.save",
"os.makedirs",
"numpy.argmax",
"pysam.AlignmentFile",
"os.path.exists",
"time.time",
"numpy.max",
"multiprocessing.Pool",
"shutil.rmtree",
"pysamstats.stat_variation",
"progressbar.ProgressBar",
"numpy.concatenate"
] | [((6509, 6548), 'pysam.AlignmentFile', 'pysam.AlignmentFile', (['self.bam_file_path'], {}), '(self.bam_file_path)\n', (6528, 6548), False, 'import pysam\n'), ((9409, 9448), 'pysam.AlignmentFile', 'pysam.AlignmentFile', (['self.bam_file_path'], {}), '(self.bam_file_path)\n', (9428, 9448), False, 'import pysam\n'), ((153... |
"""
Creates new Selenium-controlled browser session.
Usage:
-l <path> - session file location (set to default if omitted)
-a - run in visible mode (non-headless)
-v - verbose
-h - help (print this )
Note: if session file path is omitted, session file is created under package's root (see P... | [
"viperdriver.loggers_set",
"getopt.getopt",
"viperdriver.logger.critical",
"viperdriver.SessionDriver",
"viperdriver.logger.info",
"viperdriver.logger.error",
"sys.exit",
"logging.getLogger"
] | [((497, 524), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (514, 524), False, 'import logging\n'), ((599, 614), 'viperdriver.SessionDriver', 'SessionDriver', ([], {}), '()\n', (612, 614), False, 'from viperdriver import SessionDriver, dir_session_default, logger, loggers_set\n'), ((810,... |
# -*- coding: utf-8 -*-
'''
模块名:zwTools.py
默认缩写:zwt,示例:zwTools.py as zwt
【简介】
zwQT量化软件,常用工具(非量化)函数模块
zw量化,py量化第一品牌
网站:http://www.ziwang.com zw网站
py量化QQ总群 124134140 千人大群 zwPython量化&大数据
开发:zw量化开源团队 2016.04.01 首发
'''
#
# zwTools.py as zwt.
import sys,os
import time
impo... | [
"pickle.dump",
"os.walk",
"numexpr.evaluate",
"time.sleep",
"datetime.datetime",
"pickle.load"
] | [((750, 780), 'numexpr.evaluate', 'ne.evaluate', (['"""(d>=k0)&(d<=k9)"""'], {}), "('(d>=k0)&(d<=k9)')\n", (761, 780), True, 'import numexpr as ne\n'), ((929, 965), 'numexpr.evaluate', 'ne.evaluate', (['"""(xk>k0sgn)&(xk<k9sgn)"""'], {}), "('(xk>k0sgn)&(xk<k9sgn)')\n", (940, 965), True, 'import numexpr as ne\n'), ((146... |
#!/usr/bin/env python
import os
import glob
import logging
from pkg_resources import resource_filename
import jinja2
log = logging.getLogger(__name__)
class Data(dict):
""" Holder for the templates. """
def __init__(self):
self.env = jinja2.Environment(
keep_trailing_newline=True,
... | [
"os.path.basename",
"pkg_resources.resource_filename",
"jinja2.Environment",
"glob.glob",
"logging.getLogger"
] | [((126, 153), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (143, 153), False, 'import logging\n'), ((256, 302), 'jinja2.Environment', 'jinja2.Environment', ([], {'keep_trailing_newline': '(True)'}), '(keep_trailing_newline=True)\n', (274, 302), False, 'import jinja2\n'), ((454, 474), 'g... |
from explodingquantumbomb import succes_probability
import matplotlib.pyplot as plt
if __name__ == '__main__':
x_axis = []
y_axis = []
for n in range(1,50,1):
y_axis.append(succes_probability(100,n))
x_axis.append(n)
plt.plot(x_axis, y_axis)
plt.ylabel('probability of detecting ... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylabel",
"explodingquantumbomb.succes_probability",
"matplotlib.pyplot.xlabel"
] | [((388, 398), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (396, 398), True, 'import matplotlib.pyplot as plt\n'), ((250, 274), 'matplotlib.pyplot.plot', 'plt.plot', (['x_axis', 'y_axis'], {}), '(x_axis, y_axis)\n', (258, 274), True, 'import matplotlib.pyplot as plt\n'), ((283, 344), 'matplotlib.pyplot.ylabe... |
# -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
from .driver import sto_driver
from scrapy.http import HtmlResponse, Response
from CrawlerUtils.Utils import Utils
from lxml... | [
"CrawlerUtils.Utils.Utils.GetPageContent",
"CrawlerUtils.Utils.Utils.GetResponseForJson",
"CrawlerUtils.Utils.Utils.GetSelectorForText",
"scrapy.http.HtmlResponse"
] | [((2721, 2807), 'scrapy.http.HtmlResponse', 'HtmlResponse', ([], {'url': 'url', 'body': 'driver.page_source', 'encoding': '"""utf-8"""', 'request': 'request'}), "(url=url, body=driver.page_source, encoding='utf-8', request=\n request)\n", (2733, 2807), False, 'from scrapy.http import HtmlResponse, Response\n'), ((28... |
import logging
import sys
import unittest
import os
from morghulis.os_utils import ensure_dir
from morghulis.pascal_faces import PascalFaces
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
log = logging.getLogger(__name__)
DS_DIR = os.path.dirname(__file__) + '/PASCAL_sample/'
TMP_DIR = '/opt/project/.tm... | [
"logging.basicConfig",
"os.path.dirname",
"morghulis.os_utils.ensure_dir",
"morghulis.pascal_faces.PascalFaces",
"logging.getLogger"
] | [((144, 202), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.INFO'}), '(stream=sys.stdout, level=logging.INFO)\n', (163, 202), False, 'import logging\n'), ((209, 236), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (226, 236), False, 'import ... |
import numpy as np
class Method:
def __call__(self, x):
raise NotImplementedError()
def disable(self, index, x):
raise NotImplementedError
def __repr__(self):
raise NotImplementedError
class Max(Method):
def __call__(self, x):
return x.argmax()
def disable(self... | [
"numpy.argpartition",
"numpy.arange",
"numpy.sum",
"numpy.ravel"
] | [((848, 859), 'numpy.ravel', 'np.ravel', (['x'], {}), '(x)\n', (856, 859), True, 'import numpy as np\n'), ((905, 922), 'numpy.arange', 'np.arange', (['x.size'], {}), '(x.size)\n', (914, 922), True, 'import numpy as np\n'), ((1174, 1191), 'numpy.arange', 'np.arange', (['x.size'], {}), '(x.size)\n', (1183, 1191), True, '... |
import numpy as np
from scipy import interpolate
from scipy.ndimage import gaussian_filter
import functools
from . import mdfmodels, fast_mdfmodels
import dynesty as dy
from dynesty import plotting as dyplot
"""
TODO: figure out how to deal with error bars.
Do I just have to hierarchical inference it?
"""
def ptfor... | [
"functools.partial",
"dynesty.DynamicNestedSampler",
"numpy.sum"
] | [((513, 524), 'numpy.sum', 'np.sum', (['lnp'], {}), '(lnp)\n', (519, 524), True, 'import numpy as np\n'), ((653, 705), 'functools.partial', 'functools.partial', (['lnlkhd_leaky_box'], {'fehdata': 'fehdata'}), '(lnlkhd_leaky_box, fehdata=fehdata)\n', (670, 705), False, 'import functools\n'), ((831, 889), 'dynesty.Dynami... |
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket 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 applicab... | [
"twisted.internet.defer.returnValue",
"frozendict.frozendict"
] | [((5755, 5823), 'frozendict.frozendict', 'frozendict', (['{(etype, state_key): v for etype, state_key, v in input}'], {}), '({(etype, state_key): v for etype, state_key, v in input})\n', (5765, 5823), False, 'from frozendict import frozendict\n'), ((5232, 5258), 'twisted.internet.defer.returnValue', 'defer.returnValue'... |
from datetime import datetime, timedelta
from functools import partial, reduce
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional
import click
from contxt.utils.serializer import Serializer
NOW = datetime.now().replace(microsecond=0)
LAST_WEEK = NOW - timedelta(days=7)
# FIXME
OPTIONAL_... | [
"functools.partial",
"click.option",
"datetime.timedelta",
"contxt.utils.serializer.Serializer.to_table",
"click.secho",
"datetime.datetime.now"
] | [((284, 301), 'datetime.timedelta', 'timedelta', ([], {'days': '(7)'}), '(days=7)\n', (293, 301), False, 'from datetime import datetime, timedelta\n'), ((491, 527), 'click.secho', 'click.secho', (['msg'], {'fg': '"""red"""', 'err': '(True)'}), "(msg, fg='red', err=True)\n", (502, 527), False, 'import click\n'), ((228, ... |
import numpy as np
import os
import numpy as np
import math
import matplotlib as mpl
mpl.rcParams.update({
"axes.titlesize" : "medium"
})
import matplotlib.pyplot as plt
plt.rcParams.update({
"pgf.texsystem": "pdflatex",
"pgf.preamble": [
r"\usepackage[utf8x]{inputenc}",
r"\usepackage[... | [
"numpy.load",
"matplotlib.pyplot.show",
"matplotlib.rcParams.update",
"numpy.square",
"numpy.min",
"matplotlib.pyplot.rcParams.update",
"numpy.mean",
"numpy.max",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig"
] | [((88, 137), 'matplotlib.rcParams.update', 'mpl.rcParams.update', (["{'axes.titlesize': 'medium'}"], {}), "({'axes.titlesize': 'medium'})\n", (107, 137), True, 'import matplotlib as mpl\n'), ((178, 313), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'pgf.texsystem': 'pdflatex', 'pgf.preamble': [\n ... |
"""Utility classes and methods for use with json and appengine, and some filters for string input.
Provides both a specialized json encoder, GqlEncoder, designed to simplify
encoding directly from GQL results to JSON. A helper function, encode, is also
provided to further simplify usage.
GqlEncoder: Adds support fo... | [
"json.JSONEncoder.default"
] | [((1833, 1868), 'json.JSONEncoder.default', 'json.JSONEncoder.default', (['self', 'obj'], {}), '(self, obj)\n', (1857, 1868), False, 'import json\n')] |
import zlib
import binascii
def zlib压缩(data):
return zlib.compress(data)
def zlib解压(data):
return zlib.decompress(data)
| [
"zlib.compress",
"zlib.decompress"
] | [((59, 78), 'zlib.compress', 'zlib.compress', (['data'], {}), '(data)\n', (72, 78), False, 'import zlib\n'), ((109, 130), 'zlib.decompress', 'zlib.decompress', (['data'], {}), '(data)\n', (124, 130), False, 'import zlib\n')] |
# -*- coding: utf-8 -*-
"""Top-level package for stacklog."""
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__version__ = '1.1.0'
import time
from collections import defaultdict
from functools import wraps
from ._time_formatters import format_time
from .compat import clearlist, getnargs
__all__ = (
'stacklog',
... | [
"collections.defaultdict",
"functools.wraps",
"time.time"
] | [((1752, 1769), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1763, 1769), False, 'from collections import defaultdict\n'), ((5335, 5346), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (5340, 5346), False, 'from functools import wraps\n'), ((7569, 7580), 'time.time', 'time.time', ([],... |
import numpy as np
import matplotlib.pyplot as plt
import random
def mutation(pop, number_of_individuals, F):
index1 = np.random.randint(number_of_individuals)
index2 = np.random.randint(number_of_individuals)
index3 = np.random.randint(number_of_individuals)
# print("1: ", index1)
# print("2: ", ... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"numpy.square",
"matplotlib.pyplot.draw",
"numpy.random.randint",
"numpy.array",
"numpy.mean",
"numpy.random.rand",
"matplotlib.pyplot.pause"
] | [((125, 165), 'numpy.random.randint', 'np.random.randint', (['number_of_individuals'], {}), '(number_of_individuals)\n', (142, 165), True, 'import numpy as np\n'), ((179, 219), 'numpy.random.randint', 'np.random.randint', (['number_of_individuals'], {}), '(number_of_individuals)\n', (196, 219), True, 'import numpy as n... |
from django.conf.urls import url
from .views import registration, home, log_in, log_out, verify, like, dislike, about, create_post, post_detail
urlpatterns = [
url(r'^registration/$', registration, name='registration'),
url(r'^login/$', log_in, name='login'),
url(r'^logout/$', log_out, name='logout'),
... | [
"django.conf.urls.url"
] | [((165, 222), 'django.conf.urls.url', 'url', (['"""^registration/$"""', 'registration'], {'name': '"""registration"""'}), "('^registration/$', registration, name='registration')\n", (168, 222), False, 'from django.conf.urls import url\n'), ((229, 266), 'django.conf.urls.url', 'url', (['"""^login/$"""', 'log_in'], {'nam... |
# --------------------------------------------------------
# OpenVQA
# Written by <NAME> https://github.com/ParadoxZW
# based on the implementation in https://github.com/hengyuan-hu/bottom-up-attention-vqa
# ELU is chosen as the activation function in non-linear layers due to
# the experiment results that indicate ELU ... | [
"torch.nn.Dropout",
"torch.nn.Sequential",
"torch.cat",
"torch.nn.functional.softmax",
"torch.nn.Linear"
] | [((1203, 1225), 'torch.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (1216, 1225), True, 'import torch.nn as nn\n'), ((2102, 2134), 'torch.nn.functional.softmax', 'nn.functional.softmax', (['logits', '(1)'], {}), '(logits, 1)\n', (2123, 2134), True, 'import torch.nn as nn\n'), ((2273, 2293), 'torch... |
import pytest
from hypothesis import given
from hypothesis._strategies import (
one_of,
text,
integers,
none,
floats,
booleans,
tuples,
lists,
dictionaries,
times,
uuids,
composite,
)
from meiga import Result
@composite
def all_types(draw):
return draw(
one... | [
"hypothesis._strategies.times",
"hypothesis._strategies.floats",
"hypothesis._strategies.integers",
"hypothesis._strategies.text",
"hypothesis._strategies.none",
"meiga.Result",
"hypothesis._strategies.tuples",
"hypothesis._strategies.uuids",
"hypothesis._strategies.booleans"
] | [((728, 755), 'meiga.Result', 'Result', ([], {'success': 'given_value'}), '(success=given_value)\n', (734, 755), False, 'from meiga import Result\n'), ((926, 953), 'meiga.Result', 'Result', ([], {'failure': 'given_value'}), '(failure=given_value)\n', (932, 953), False, 'from meiga import Result\n'), ((337, 343), 'hypot... |
# -*- coding: utf-8 -*-
"""
--------------------------------------
@File : admin.py
@Author : maixiaochai
@Email : <EMAIL>
@Created on : 2020/5/9 13:29
--------------------------------------
"""
from flask_restful import Api
from App.api.admin.api_admin_user import AdminUserResource
api_admin = Api(pr... | [
"flask_restful.Api"
] | [((314, 334), 'flask_restful.Api', 'Api', ([], {'prefix': '"""/admin"""'}), "(prefix='/admin')\n", (317, 334), False, 'from flask_restful import Api\n')] |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# <NAME> <<EMAIL>>
# Thu Feb 7 09:58:22 2013
#
# Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland
"""Re-usable decorators and utilities for bob test code
"""
import os
import functools
import nose.plugins.skip
def datafile(f, module=None, ... | [
"os.unlink",
"tempfile.mkstemp",
"pkg_resources.resource_filename",
"os.close",
"functools.wraps",
"os.path.join"
] | [((1326, 1379), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['resource', 'final_path'], {}), '(resource, final_path)\n', (1357, 1379), False, 'import pkg_resources\n'), ((2394, 2426), 'tempfile.mkstemp', 'tempfile.mkstemp', (['suffix', 'prefix'], {}), '(suffix, prefix)\n', (2410, 2426), False... |
from sys import stdout
from osaterminology.dom import aeteparser
class _Out:
def write(self, s):
stdout.write(s.encode("utf8", "replace"))
class TextRenderer:
def __init__(self, out=_Out()):
self.output = out
self.indent = ""
self._pad = False
def add(self, name, type, ismany, islast, tbc=False):
if self._... | [
"osaterminology.dom.aeteparser.parseapp"
] | [((2380, 2423), 'osaterminology.dom.aeteparser.parseapp', 'aeteparser.parseapp', (['p'], {'style': '"""applescript"""'}), "(p, style='applescript')\n", (2399, 2423), False, 'from osaterminology.dom import aeteparser\n')] |
import unittest
from clip.Clip import *
class TestClipOrigenPrediction(unittest.TestCase):
#since results are floats, test that we are very close to the expected value
def test_Clip_ORIGEN_binned(self):
predictor = Clip("Data")
predictor.set_prediction_param... | [
"unittest.main"
] | [((2966, 2981), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2979, 2981), False, 'import unittest\n')] |
# Copyright 2017. <NAME>. All rights reserved
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
# dis... | [
"pandas.read_csv",
"h5py.File",
"numpy.uint32"
] | [((2252, 2275), 'h5py.File', 'h5py.File', (['h5file', 'mode'], {}), '(h5file, mode)\n', (2261, 2275), False, 'import h5py\n'), ((2491, 2538), 'pandas.read_csv', 'pd.read_csv', (['csvfile'], {'sep': '""" """', 'na_values': '"""NONE"""'}), "(csvfile, sep=' ', na_values='NONE')\n", (2502, 2538), True, 'import pandas as pd... |
from nltk.corpus import stopwords
from nltk.stem.lancaster import LancasterStemmer
from nltk.stem import SnowballStemmer, PorterStemmer
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from . import __path__ as ROOT_PATH
from nltk.tokenize import word_tokenize, sent_tokenize
from copy import... | [
"sklearn.feature_extraction.text.CountVectorizer",
"nltk.stem.PorterStemmer",
"sklearn.feature_extraction.text.TfidfVectorizer",
"nltk.stem.SnowballStemmer",
"copy.copy",
"nltk.stem.lancaster.LancasterStemmer",
"nltk.tokenize.sent_tokenize",
"numpy.random.randint",
"nltk.corpus.stopwords.words",
"... | [((2495, 2505), 'copy.copy', 'copy', (['text'], {}), '(text)\n', (2499, 2505), False, 'from copy import copy\n'), ((2523, 2553), 're.sub', 're.sub', (['urlpat', '""""""', 'clean_text'], {}), "(urlpat, '', clean_text)\n", (2529, 2553), False, 'import re\n'), ((2915, 2940), 'nltk.tokenize.word_tokenize', 'word_tokenize',... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 6 23:55:00 2018
@author: shifu
"""
import city_map as cm
class Regionsupervisor():
def __init__(self, dao, region_name):
self.dao = dao
self.region_name = region_name
def get_blocks(self):
region_n... | [
"city_map.get_adjacency_list"
] | [((560, 599), 'city_map.get_adjacency_list', 'cm.get_adjacency_list', (['self.region_name'], {}), '(self.region_name)\n', (581, 599), True, 'import city_map as cm\n')] |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from phonebook.models import Contact
admin.site.register(Contact) | [
"django.contrib.admin.site.register"
] | [((163, 191), 'django.contrib.admin.site.register', 'admin.site.register', (['Contact'], {}), '(Contact)\n', (182, 191), False, 'from django.contrib import admin\n')] |
# Generated by Django 3.2.4 on 2021-06-15 22:49
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("rules", "0001_initial")]
operations = [
migrations.CreateModel(
name="Ordinance",
fields=[
... | [
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.SlugField",
"django.db.models.AutoField",
"django.db.models.DateTimeField"
] | [((871, 986), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""ordinance"""', 'to': '"""rules.rulegroup"""'}), "(on_delete=django.db.models.deletion.CASCADE, related_name\n ='ordinance', to='rules.rulegroup')\n", (888, 986), False, 'from ... |
import math
import wall_e
name = 'double_link_planar_robot'
type_ = 'rr' # 2 rotary joints
dh_params = [
[math.pi/2, 0, 0, 20], # theta, d, alpha, a
[math.pi, 0, 0, 10],
]
masses = [5, 7]
lengths = [20, 10]
dimensions = [[10], [10]] # [[r1], [r2]]
end_pos = [20, 20, 0] # qx, qy, qz
vels = [10, 5]
accs = ... | [
"wall_e.pprint",
"wall_e.Robot"
] | [((355, 420), 'wall_e.Robot', 'wall_e.Robot', (['name', 'type_', 'dh_params', 'masses', 'lengths', 'dimensions'], {}), '(name, type_, dh_params, masses, lengths, dimensions)\n', (367, 420), False, 'import wall_e\n'), ((487, 513), 'wall_e.pprint', 'wall_e.pprint', (['fk_mat_expr'], {}), '(fk_mat_expr)\n', (500, 513), Fa... |
# script for generating user-user projection.
# copied from anthony's notebook mostly, with modifications to split users by timestamp
from snap_import_user_projection import UnimodalUserProjection
from pyspark.sql import SparkSession, functions as F
spark = SparkSession.builder.getOrCreate()
input_path = "src/data/pr... | [
"numpy.ceil",
"pyspark.sql.functions.expr",
"pyspark.sql.SparkSession.builder.getOrCreate",
"scipy.optimize.fsolve",
"pyspark.sql.types.LongType",
"random.random",
"numpy.array",
"snap_import_user_projection.UnimodalUserProjection",
"pyspark.sql.functions.col",
"numpy.random.choice"
] | [((259, 293), 'pyspark.sql.SparkSession.builder.getOrCreate', 'SparkSession.builder.getOrCreate', ([], {}), '()\n', (291, 293), False, 'from pyspark.sql import SparkSession, functions as F\n'), ((2391, 2410), 'numpy.array', 'np.array', (['edge_list'], {}), '(edge_list)\n', (2399, 2410), True, 'import numpy as np\n'), (... |
'''
Created on Feb 2, 2013
@author: Brad
'''
from solver import Solver, SolvedSet, share_unit, visible_intersection
from sudoku_board import AlternatingChain
class XCycleSolver(Solver):
NAME = "XCycle"
def find(self, board, do_all = False):
solved_sets = []
for cell in board.as_list():
... | [
"solver.visible_intersection",
"sudoku_board.AlternatingChain",
"solver.share_unit"
] | [((341, 377), 'sudoku_board.AlternatingChain', 'AlternatingChain', (['board', 'cell', '(1)', '(10)'], {}), '(board, cell, 1, 10)\n', (357, 377), False, 'from sudoku_board import AlternatingChain\n'), ((590, 626), 'sudoku_board.AlternatingChain', 'AlternatingChain', (['board', 'cell', '(0)', '(10)'], {}), '(board, cell,... |
import os, json
import pandas as pd
import geopandas as gp
# tolerance to use for geometry compression
# see https://shapely.readthedocs.io/en/latest/manual.html#object.simplify
simplify_tolerance = 0.1
acs_dir = 'docs/_data/acs/regions'
conversion_dir = 'docs/_data/epa_to_acs_cbsa'
tmp_dir = 'docs/_data/tmp'
for ye... | [
"pandas.DataFrame",
"os.path.basename",
"geopandas.GeoDataFrame",
"os.path.join",
"os.listdir",
"geopandas.read_file"
] | [((331, 355), 'os.path.join', 'os.path.join', (['tmp_dir', 'o'], {}), '(tmp_dir, o)\n', (343, 355), False, 'import os, json\n'), ((444, 482), 'os.path.join', 'os.path.join', (['year_dir', '"""geojson.json"""'], {}), "(year_dir, 'geojson.json')\n", (456, 482), False, 'import os, json\n'), ((365, 384), 'os.listdir', 'os.... |
#
# Import the libraries you need ... you may need to install them
# into your Python environment as they don't come with Python.
#
import requests # For fetching webpages
from bs4 import BeautifulSoup # For drilling down into the webpage
#
# Store the basic URL we need
#
url = "https://beta.charitycommission.gov.uk... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((612, 657), 'requests.get', 'requests.get', (['url'], {'params': "{'regId': '213890'}"}), "(url, params={'regId': '213890'})\n", (624, 657), False, 'import requests\n'), ((763, 802), 'bs4.BeautifulSoup', 'BeautifulSoup', (['response.content', '"""lxml"""'], {}), "(response.content, 'lxml')\n", (776, 802), False, 'fro... |
from __future__ import print_function
from __future__ import unicode_literals
import time
import sys
import os
import shutil
import csv
import collections
import subprocess
import sys
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'pip', '--upgrade'])
subprocess.check_call([sys.executable, '-m', 'pip',... | [
"pyspark.sql.SparkSession.builder.appName",
"pyspark.sql.functions.col",
"transformers.DistilBertTokenizer.from_pretrained",
"subprocess.check_call"
] | [((185, 272), 'subprocess.check_call', 'subprocess.check_call', (["[sys.executable, '-m', 'pip', 'install', 'pip', '--upgrade']"], {}), "([sys.executable, '-m', 'pip', 'install', 'pip',\n '--upgrade'])\n", (206, 272), False, 'import subprocess\n'), ((269, 380), 'subprocess.check_call', 'subprocess.check_call', (["[s... |
"""Unittest for papi.ssh.Ssh class"""
import unittest
class TestSsh(unittest.TestCase):
def test_noop(self):
self.assertEqual(True, True)
if __name__ == '__main__':
unittest.main() | [
"unittest.main"
] | [((185, 200), 'unittest.main', 'unittest.main', ([], {}), '()\n', (198, 200), False, 'import unittest\n')] |
# -*- coding: utf-8 -*-
import unittest
import webracer
class UrlencodeUtf8Test(unittest.TestCase):
def test_urlencode_simple(self):
input = dict(a='a', b='b')
output = webracer.urlencode_utf8(input)
# dictionary keys are not ordered
self.assertTrue(output == 'a=a&b=b' or output ==... | [
"unittest.main",
"webracer.urlencode_utf8"
] | [((2492, 2507), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2505, 2507), False, 'import unittest\n'), ((191, 221), 'webracer.urlencode_utf8', 'webracer.urlencode_utf8', (['input'], {}), '(input)\n', (214, 221), False, 'import webracer\n'), ((417, 447), 'webracer.urlencode_utf8', 'webracer.urlencode_utf8', (['i... |
import os
import lightbulb
from dotenv import load_dotenv
from . import mine_plugin
load_dotenv()
@mine_plugin.command
@lightbulb.add_checks(lightbulb.guild_only)
@lightbulb.command(
'mcip', 'Shows minecraft server IP'
)
@lightbulb.implements(lightbulb.PrefixCommand, lightbulb.SlashCommand)
async def mcip(ctx: ... | [
"lightbulb.add_checks",
"dotenv.load_dotenv",
"lightbulb.command",
"os.getenv",
"lightbulb.implements"
] | [((86, 99), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (97, 99), False, 'from dotenv import load_dotenv\n'), ((124, 166), 'lightbulb.add_checks', 'lightbulb.add_checks', (['lightbulb.guild_only'], {}), '(lightbulb.guild_only)\n', (144, 166), False, 'import lightbulb\n'), ((168, 222), 'lightbulb.command', 'l... |
from pathlib import Path
import re
import typing as T
from . import logging
from .toolz import *
log = logging.new_log(__name__)
# ----------------------------------------------------------------------
#
# NTLM/SAM database functions
#
# ----------------------------------------------------------------------
ntlm_re... | [
"re.compile"
] | [((323, 362), 're.compile', 're.compile', (['"""(?P<ntlm>\\\\w{32}:\\\\w{32})"""'], {}), "('(?P<ntlm>\\\\w{32}:\\\\w{32})')\n", (333, 362), False, 'import re\n'), ((1391, 1507), 're.compile', 're.compile', (['"""^\\\\s*(?:(?P<domain>.*?)\\\\\\\\)?(?P<user>.*?):(?P<sid>\\\\d+):(?P<hashes>\\\\w{32}:\\\\w{32}):::\\\\s*$""... |
from django import forms
from django.utils.translation import npgettext, pgettext_lazy
from django_filters import CharFilter, ChoiceFilter, OrderingFilter
from ....core.filters import SortedFilterSet
from ....widget import SliderType
from ....widget.models import Slider
SORT_BY_FIELDS = {
'name': pgettext_lazy('... | [
"django.utils.translation.pgettext_lazy",
"django.utils.translation.npgettext"
] | [((305, 355), 'django.utils.translation.pgettext_lazy', 'pgettext_lazy', (['"""Brand list sorting option"""', '"""name"""'], {}), "('Brand list sorting option', 'name')\n", (318, 355), False, 'from django.utils.translation import npgettext, pgettext_lazy\n'), ((388, 435), 'django.utils.translation.pgettext_lazy', 'pget... |
"""
Class for walker with approximate average-patterns, in particular the
approximate MFPT from root to target.
"""
import pattern_walker as rw
import numpy as np
import networkx as nx
__all__ = [
'MF_patternWalker', 'overlap_MF_patternWalker'
]
class MF_patternWalker(rw.fullProbPatternWalker):
"""
... | [
"numpy.sum",
"numpy.float",
"networkx.shortest_path",
"numpy.array",
"networkx.to_numpy_array",
"networkx.DiGraph",
"numpy.prod"
] | [((10013, 10023), 'numpy.float', 'np.float', ([], {}), '()\n', (10021, 10023), True, 'import numpy as np\n'), ((10809, 10821), 'networkx.DiGraph', 'nx.DiGraph', ([], {}), '()\n', (10819, 10821), True, 'import networkx as nx\n'), ((18976, 18999), 'numpy.prod', 'np.prod', (['branch_weights'], {}), '(branch_weights)\n', (... |
import numpy as np
import matplotlib.pyplot as plt
X = np.linspace(-np.pi, np.pi, 256)
C = np.cos(X)
S = np.sin(X)
plt.plot(X, C)
plt.plot(X, S)
plt.show() | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.sin",
"numpy.cos",
"numpy.linspace"
] | [((59, 90), 'numpy.linspace', 'np.linspace', (['(-np.pi)', 'np.pi', '(256)'], {}), '(-np.pi, np.pi, 256)\n', (70, 90), True, 'import numpy as np\n'), ((96, 105), 'numpy.cos', 'np.cos', (['X'], {}), '(X)\n', (102, 105), True, 'import numpy as np\n'), ((111, 120), 'numpy.sin', 'np.sin', (['X'], {}), '(X)\n', (117, 120), ... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 21 16:09:07 2020
@author: <NAME>
"""
import cv2
image = cv2.imread("E:\Workfolder\LearningOpenCVPython\image.jpg")
#insert white dots on the image
for i in range (0, image.shape[0], 15):
for j in range (0, image.shape[1], 15):
image[i:i+3, j:j+3] = (255,255,... | [
"cv2.waitKey",
"cv2.imread",
"cv2.imshow",
"cv2.medianBlur"
] | [((105, 166), 'cv2.imread', 'cv2.imread', (['"""E:\\\\Workfolder\\\\LearningOpenCVPython\\\\image.jpg"""'], {}), "('E:\\\\Workfolder\\\\LearningOpenCVPython\\\\image.jpg')\n", (115, 166), False, 'import cv2\n'), ((548, 573), 'cv2.medianBlur', 'cv2.medianBlur', (['image', '(11)'], {}), '(image, 11)\n', (562, 573), False... |
from WGALP.workflow import Workflow
from WGALP.blocks.FastQC import FastQC
from WGALP.blocks.TrimmomaticPE import TrimmomaticPE
# prepare the step necessary to trim fastq files and to asses their quality
class TrimFastq(Workflow):
def task(self, args_dict):
fastq_fwd = args_dict["fastq_fwd"]... | [
"WGALP.blocks.FastQC.FastQC",
"WGALP.blocks.TrimmomaticPE.TrimmomaticPE"
] | [((456, 502), 'WGALP.blocks.FastQC.FastQC', 'FastQC', (['"""fastqc_raw_fwd"""', 'self.root', 'fastq_fwd'], {}), "('fastqc_raw_fwd', self.root, fastq_fwd)\n", (462, 502), False, 'from WGALP.blocks.FastQC import FastQC\n'), ((511, 557), 'WGALP.blocks.FastQC.FastQC', 'FastQC', (['"""fastqc_raw_rev"""', 'self.root', 'fastq... |
import os
import tqdm
import nltk
import pandas as pd
import torch
import pickle
from PIL import Image
from torchvision import transforms
from miprometheus.utils.problems_utils.language import Language
from miprometheus.utils.param_interface import ParamInterface
from miprometheus.problems.image_text_to_class.image_te... | [
"pickle.dump",
"miprometheus.utils.problems_utils.language.Language",
"os.path.join",
"torch.stack",
"torch.LongTensor",
"pandas.read_csv",
"torch.nn.Embedding",
"PIL.Image.open",
"torchvision.transforms.ToTensor",
"miprometheus.utils.param_interface.ParamInterface",
"os.path.isfile",
"pickle.... | [((11146, 11162), 'miprometheus.utils.param_interface.ParamInterface', 'ParamInterface', ([], {}), '()\n', (11160, 11162), False, 'from miprometheus.utils.param_interface import ParamInterface\n'), ((4527, 4580), 'os.path.expanduser', 'os.path.expanduser', (["params['settings']['data_folder']"], {}), "(params['settings... |
import unittest
from iris.mlmodel import ml
import os
test_model = ml()
MODELS_OBJECTS = ['accuracy.txt', 'dtc.sav', 'gnb.sav', 'knc.sav',
'lr.sav', 'mnb.sav', 'rfc.sav', 'svm.sav', 'meta.yaml']
# TODO
# [X]Attributes
# [X]Runtime
# Saved stuffs
class MyTestCase(unittest.TestCase):
def test_a... | [
"unittest.main",
"iris.mlmodel.ml",
"os.listdir"
] | [((68, 72), 'iris.mlmodel.ml', 'ml', ([], {}), '()\n', (70, 72), False, 'from iris.mlmodel import ml\n'), ((1374, 1389), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1387, 1389), False, 'import unittest\n'), ((1005, 1035), 'os.listdir', 'os.listdir', (['"""./iris/ML_models"""'], {}), "('./iris/ML_models')\n", (... |
from flask import redirect, render_template, request, session
from functools import wraps
def login_required(f):
"""
Decorate routes to require login.
http://flask.pocoo.org/docs/1.0/patterns/viewdecorators/
"""
@wraps(f)
def decorated_function(*args, **kwargs):
if session.get("user_id"... | [
"flask.redirect",
"flask.session.get",
"functools.wraps"
] | [((234, 242), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (239, 242), False, 'from functools import wraps\n'), ((299, 321), 'flask.session.get', 'session.get', (['"""user_id"""'], {}), "('user_id')\n", (310, 321), False, 'from flask import redirect, render_template, request, session\n'), ((350, 368), 'flask.redir... |
import pygame
from pygame.sprite import Sprite
import sys
import os
class Explosion(Sprite):
def __init__(self, bosss):
super(Explosion, self).__init__()
self.images = []
self.bosss = bosss
for num in range(10):
img = pygame.image.load(resource_path(f"animations/ani{nu... | [
"pygame.transform.scale",
"os.path.abspath",
"os.path.join"
] | [((1382, 1423), 'os.path.join', 'os.path.join', (['sys._MEIPASS', 'relative_path'], {}), '(sys._MEIPASS, relative_path)\n', (1394, 1423), False, 'import os\n'), ((1448, 1468), 'os.path.abspath', 'os.path.abspath', (['"""."""'], {}), "('.')\n", (1463, 1468), False, 'import os\n'), ((364, 403), 'pygame.transform.scale', ... |
from contextvars import ContextVar
from typing import Dict, Any, Optional
session_state: ContextVar[Optional[Dict[str, Any]]] = ContextVar('session', default=None)
def get_session_state() -> Dict:
"""Get current session from context or empty dict
"""
session = session_state.get()
return session.copy(... | [
"contextvars.ContextVar"
] | [((129, 164), 'contextvars.ContextVar', 'ContextVar', (['"""session"""'], {'default': 'None'}), "('session', default=None)\n", (139, 164), False, 'from contextvars import ContextVar\n')] |
# sys.path.append("..src")
import src.agents as agents
import src.agents.util.agent_credentials as creds
from src.agents.util.supplier_info import *
pra = agents.PRAgent(*creds.pra, [7], 2, [0.0, 1.0, 0.01]) # The tuple at the end defines the arguments for np.arange
ca = agents.CAgent(*creds.ca)
ssa = agents.SSAgen... | [
"src.agents.OAAgent",
"src.agents.PRAgent",
"src.agents.KMAgent",
"src.agents.OAgent",
"src.agents.CAgent",
"src.agents.SSAgent",
"src.agents.SAgent"
] | [((158, 210), 'src.agents.PRAgent', 'agents.PRAgent', (['*creds.pra', '[7]', '(2)', '[0.0, 1.0, 0.01]'], {}), '(*creds.pra, [7], 2, [0.0, 1.0, 0.01])\n', (172, 210), True, 'import src.agents as agents\n'), ((276, 300), 'src.agents.CAgent', 'agents.CAgent', (['*creds.ca'], {}), '(*creds.ca)\n', (289, 300), True, 'import... |
"""Module for base of [conditional | latent] neural processes"""
import abc
from functools import partial
import torch
import torch.nn as nn
import torch.nn.functional as F
from npf.architectures import MLP, merge_flat_input
from npf.utils.helpers import (
MultivariateNormalDiag,
isin_range,
)
from npf.utils.i... | [
"torch.mean",
"functools.partial",
"npf.utils.initialization.weights_init",
"torch.cat",
"npf.utils.helpers.isin_range",
"npf.architectures.merge_flat_input",
"torch.nn.functional.softplus",
"torch.sigmoid",
"torch.nn.Linear",
"torch.nn.Identity"
] | [((4624, 4637), 'torch.nn.Identity', 'nn.Identity', ([], {}), '()\n', (4635, 4637), True, 'import torch.nn as nn\n'), ((6138, 6156), 'npf.utils.initialization.weights_init', 'weights_init', (['self'], {}), '(self)\n', (6150, 6156), False, 'from npf.utils.initialization import weights_init\n'), ((6266, 6321), 'functools... |
#
# Copyright 2016 University of Southern California
#
# 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... | [
"bdbag.get_typed_exception",
"bdbag.urlretrieve",
"os.path.getsize",
"bdbag.fetch.get_transfer_summary",
"logging.getLogger",
"bdbag.fetch.ensure_valid_output_path",
"bdbag.urlcleanup",
"bdbag.urlsplit",
"bdbag.fetch.auth.keychain.get_auth_entries",
"datetime.datetime.now",
"bdbag.fetch.auth.key... | [((852, 879), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (869, 879), False, 'import logging\n'), ((1241, 1284), 'bdbag.fetch.auth.keychain.get_auth_entries', 'keychain.get_auth_entries', (['url', 'auth_config'], {}), '(url, auth_config)\n', (1266, 1284), True, 'import bdbag.fetch.auth... |
from __future__ import print_function
import boto3
from botocore.vendored import requests
import json
import logging
import os
import base64
logger = logging.getLogger()
logger.setLevel(logging.INFO)
topic_arn = os.environ['topic_arn']
approval_url= os.environ['approval_url']+'?waitUrl='
sns = boto3.resource('sns')
... | [
"boto3.resource",
"base64.b64encode",
"logging.getLogger",
"json.dumps"
] | [((151, 170), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (168, 170), False, 'import logging\n'), ((298, 319), 'boto3.resource', 'boto3.resource', (['"""sns"""'], {}), "('sns')\n", (312, 319), False, 'import boto3\n'), ((686, 712), 'base64.b64encode', 'base64.b64encode', (['wait_url'], {}), '(wait_url)\... |
'''
Author: jianzhnie
Date: 2022-01-19 17:15:05
LastEditTime: 2022-03-04 18:30:51
LastEditors: jianzhnie
Description:
'''
import json
import os
import sys
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from tqdm.auto import tqdm
from nlptoolkit.data.utils.utils import PAD_TOKEN, g... | [
"sys.path.append",
"nlptoolkit.models.elmo.elmo_model.BiLM",
"nlptoolkit.data.utils.utils.get_loader",
"torch.nn.CrossEntropyLoss",
"tqdm.auto.tqdm",
"torch.cuda.is_available",
"nlptoolkit.datasets.elmodataset.BiLMDataset",
"numpy.exp",
"nlptoolkit.datasets.elmodataset.load_corpus",
"os.path.join"... | [((496, 521), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (511, 521), False, 'import sys\n'), ((1250, 1284), 'nlptoolkit.datasets.elmodataset.load_corpus', 'load_corpus', (["configs['train_file']"], {}), "(configs['train_file'])\n", (1261, 1284), False, 'from nlptoolkit.datasets.elmoda... |
# -*- coding: UTF-8 -*-
import pyaudio
import wave
import io
import time
import collections
from datetime import datetime
import threading
import sys
import traceback
from google.cloud import speech
from google.cloud.speech import enums
from google.cloud.speech import types
import grpc
from enum import Enum, unique
imp... | [
"wave.open",
"threading.Thread.__init__",
"logging.basicConfig",
"logging.getLogger",
"wave.Wave_write",
"time.sleep",
"pyaudio.PyAudio",
"sys.exc_info",
"google.cloud.speech.SpeechClient",
"datetime.datetime.now",
"collections.deque"
] | [((333, 419), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s [%(threadName)s %(module)s] %(message)s"""'}), "(format=\n '%(asctime)s [%(threadName)s %(module)s] %(message)s')\n", (352, 419), False, 'import logging\n'), ((424, 451), 'logging.getLogger', 'logging.getLogger', (['__name__'... |
from json import load
from os import getenv, getcwd
from random import choice
from nextcord import Colour, Embed
from nextcord.ext import commands
# Methods
def get_operator(group: str) -> list:
with open(getcwd()+"/neverglowbot/resources/r6_operators.json", "r") as read_file:
operator_data = load(read_... | [
"nextcord.ext.commands.Cog.listener",
"json.load",
"os.getcwd",
"random.choice",
"nextcord.Colour.from_rgb",
"nextcord.ext.commands.command",
"os.getenv"
] | [((742, 765), 'nextcord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (763, 765), False, 'from nextcord.ext import commands\n'), ((863, 973), 'nextcord.ext.commands.command', 'commands.command', ([], {'name': '"""r6-def"""', 'brief': '"""Let the bot choose a defender and an armament suggestion ... |
import os
import re
import pandas as pd
#%matplotlib inline
from datetime import datetime
from PIL import Image
import numpy as np
import sys
import shutil
from distutils import dir_util
import re
import glob
import chainer
import chainer.links as L
import chainer.functions as F
import chainer.cuda as cuda
from chaine... | [
"argparse.ArgumentParser",
"cupy.empty",
"pandas.read_csv",
"cupy.hstack",
"chainer.no_backprop_mode",
"chainer.iterators.MultithreadIterator",
"chainer.serializers.load_npz",
"os.path.exists",
"cupy_augmentation.cupy_augmentation",
"util.make_accuracy_image",
"datetime.datetime.now",
"chainer... | [((12467, 12520), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Chainer v4.0.0"""'}), "(description='Chainer v4.0.0')\n", (12490, 12520), False, 'import argparse\n'), ((15758, 15820), 'pandas.read_csv', 'pd.read_csv', (['"""./dataset/weight_of_remark_new.csv"""'], {'index_col': '(0)'}),... |
import encoding_fix
import requests
"""
In this script, we are requesting the same data as in wikipedia1-1.py, but doing two new things:
1. We are 'parameterizing' our query (specifying each of the query components separately, and then concatenating them into the API endpoint right before we send our request.
2. We a... | [
"requests.get"
] | [((926, 995), 'requests.get', 'requests.get', (['"""https://en.wikipedia.org/w/api.php"""'], {'params': 'parameters'}), "('https://en.wikipedia.org/w/api.php', params=parameters)\n", (938, 995), False, 'import requests\n')] |
import dramatiq
import os
import transaction
from dramatiq.rate_limits import ConcurrentRateLimiter
from dramatiq.rate_limits.backends import RedisBackend
from elasticsearch_dsl import connections
from pyramid.paster import get_appsettings, setup_logging
from threading import local
from toja.models import get_engine,... | [
"toja.models.get_tm_session",
"transaction.manager.begin",
"transaction.manager.commit",
"threading.local",
"pyramid.paster.setup_logging",
"transaction.manager.abort",
"pyramid.paster.get_appsettings"
] | [((761, 768), 'threading.local', 'local', ([], {}), '()\n', (766, 768), False, 'from threading import local\n'), ((3739, 3746), 'threading.local', 'local', ([], {}), '()\n', (3744, 3746), False, 'from threading import local\n'), ((5541, 5548), 'threading.local', 'local', ([], {}), '()\n', (5546, 5548), False, 'from thr... |
import functools
import time
@functools.lru_cache(2)
def cached_function(value):
for i in range(value):
i ** value
def timed():
start = time.time()
cached_function(4647)
print(time.time() - start)
timed()
timed()
| [
"functools.lru_cache",
"time.time"
] | [((32, 54), 'functools.lru_cache', 'functools.lru_cache', (['(2)'], {}), '(2)\n', (51, 54), False, 'import functools\n'), ((156, 167), 'time.time', 'time.time', ([], {}), '()\n', (165, 167), False, 'import time\n'), ((204, 215), 'time.time', 'time.time', ([], {}), '()\n', (213, 215), False, 'import time\n')] |
import os
import csv
# WorkDir
Path = 'Src/7-MostMentioned'
# SrcDir
SrcPath = 'Data/6-Quotes'
print('Analyzing everything...')
# create MostMentioned csv
# os.system('python ' + Path + "/" 'mostMentioned.py')
with open(SrcPath + '/' + "ListNames.csv") as csv_file:
# read current CSV file
csv_reader = csv.... | [
"csv.reader",
"os.system"
] | [((316, 351), 'csv.reader', 'csv.reader', (['csv_file'], {'delimiter': '""","""'}), "(csv_file, delimiter=',')\n", (326, 351), False, 'import csv\n'), ((750, 814), 'os.system', 'os.system', (["('python ' + Path + '/mostMentioned.py' + ' ' + row[0])"], {}), "('python ' + Path + '/mostMentioned.py' + ' ' + row[0])\n", (7... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 24 06:45:50 2021
@author: ubuntu
"""
import cv2
#mjpg-streamerを動作させているPC・ポートを入力
URL = "http://192.168.100.111:8080/?action=stream"
s_video = cv2.VideoCapture(URL)
while True:
ret, img = s_video.read()
cv2.imshow("WebCamera form Raspberry... | [
"cv2.VideoCapture",
"cv2.imshow",
"cv2.waitKey"
] | [((215, 236), 'cv2.VideoCapture', 'cv2.VideoCapture', (['URL'], {}), '(URL)\n', (231, 236), False, 'import cv2\n'), ((284, 330), 'cv2.imshow', 'cv2.imshow', (['"""WebCamera form Raspberry pi"""', 'img'], {}), "('WebCamera form Raspberry pi', img)\n", (294, 330), False, 'import cv2\n'), ((338, 352), 'cv2.waitKey', 'cv2.... |
"""
stanCode Breakout Project
Adapted from <NAME>'s Breakout by
<NAME>, <NAME>, <NAME>,
and <NAME>
YOUR DESCRIPTION HERE
"""
from simpleimage import SimpleImage
from campy.graphics.gwindow import GWindow
from campy.graphics.gobjects import GOval, GRect, GLabel
from campy.gui.events.mouse import onmouseclicked, onmous... | [
"campy.graphics.gobjects.GRect",
"campy.gui.events.mouse.onmouseclicked",
"random.randint",
"campy.gui.events.mouse.onmousemoved",
"campy.graphics.gobjects.GLabel",
"campy.graphics.gwindow.GWindow",
"random.random",
"campy.graphics.gobjects.GOval"
] | [((1891, 1953), 'campy.graphics.gwindow.GWindow', 'GWindow', ([], {'width': 'window_width', 'height': 'window_height', 'title': 'title'}), '(width=window_width, height=window_height, title=title)\n', (1898, 1953), False, 'from campy.graphics.gwindow import GWindow\n'), ((2003, 2037), 'campy.graphics.gobjects.GRect', 'G... |
import os
import numpy as np
from Simulation import Simulation
from utils import is_empty, erase_files
if __name__ == "__main__":
# step to begin and step to end for all the simulations
step_to_begin = 0
step_to_end = 5000
# list of number of boids, must be same size than list_directories var
l... | [
"os.mkdir",
"utils.is_empty",
"Simulation.Simulation",
"os.path.exists",
"numpy.arange",
"utils.erase_files"
] | [((768, 846), 'Simulation.Simulation', 'Simulation', ([], {'list_num_boids': 'num_boids', 'repository': 'directory', 'step': 'step_to_begin'}), '(list_num_boids=num_boids, repository=directory, step=step_to_begin)\n', (778, 846), False, 'from Simulation import Simulation\n'), ((921, 956), 'os.path.exists', 'os.path.exi... |
import mastermind.uri as uri
def test_is_template():
assert uri.is_template("http://localhost:8000") is False
assert uri.is_template("http://localhost:8000/{a}/") is True
def test_eq():
assert uri.eq("http://localhost:8000", "http://localhost:8000")
assert uri.eq("https://localhost", "https://localh... | [
"mastermind.uri.query_pairs",
"mastermind.uri.is_template",
"mastermind.uri.expand_template",
"mastermind.uri.eq",
"mastermind.uri.path_segments"
] | [((209, 265), 'mastermind.uri.eq', 'uri.eq', (['"""http://localhost:8000"""', '"""http://localhost:8000"""'], {}), "('http://localhost:8000', 'http://localhost:8000')\n", (215, 265), True, 'import mastermind.uri as uri\n'), ((277, 325), 'mastermind.uri.eq', 'uri.eq', (['"""https://localhost"""', '"""https://localhost""... |
from flask import request, redirect
import urllib.parse
from fHDHR_web.tools import api_sub_handler, tabbed_json_response
class Origins():
endpoints = ["/api/origins"]
endpoint_name = "api_origins"
endpoint_methods = ["GET", "POST"]
endpoint_parameters = {
"method": {
... | [
"fHDHR_web.tools.api_sub_handler",
"flask.request.args.get",
"fHDHR_web.tools.tabbed_json_response"
] | [((825, 853), 'fHDHR_web.tools.api_sub_handler', 'api_sub_handler', (['self', '*args'], {}), '(self, *args)\n', (840, 853), False, 'from fHDHR_web.tools import api_sub_handler, tabbed_json_response\n'), ((921, 973), 'flask.request.args.get', 'request.args.get', (['"""redirect"""'], {'default': 'None', 'type': 'str'}), ... |