code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
ROOT_DIR = '/home/oschung_skcc/git'
import os
import os.path as osp
#import modelindex
WORK_DIR = os.path.dirname( os.path.dirname(os.path.realpath(__file__)) ) #'/home/oschung_skcc/git/mymm/oxford'
DATA_DIR= osp.join(WORK_DIR, 'data')
IMG_PREFIX = 'images'
ANN_PREFIX = 'annotations/xmls'
metaTrain0 = osp.join(DAT... | [
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"IPython.display.Image",
"os.path.join",
"os.path.realpath",
"re.sub"
] | [((211, 237), 'os.path.join', 'osp.join', (['WORK_DIR', '"""data"""'], {}), "(WORK_DIR, 'data')\n", (219, 237), True, 'import os.path as osp\n'), ((308, 354), 'os.path.join', 'osp.join', (['DATA_DIR', 'ANN_PREFIX', '"""trainval.txt"""'], {}), "(DATA_DIR, ANN_PREFIX, 'trainval.txt')\n", (316, 354), True, 'import os.path... |
# -*- coding: utf-8 -*-
#
# Creating Sequence to Sequence Models
#-------------------------------------
# Here we show how to implement sequence to sequence models.
# Specifically, we will build an English to German translation model.
#
import os
import re
import string
import requests
import io
import numpy as np
i... | [
"os.path.exists",
"tensorflow.python.framework.ops.reset_default_graph",
"os.makedirs",
"matplotlib.pyplot.ylabel",
"tensorflow.variable_scope",
"tensorflow.Session",
"matplotlib.pyplot.plot",
"os.path.join",
"matplotlib.pyplot.xlabel",
"requests.get",
"io.BytesIO",
"collections.Counter",
"t... | [((653, 678), 'tensorflow.python.framework.ops.reset_default_graph', 'ops.reset_default_graph', ([], {}), '()\n', (676, 678), False, 'from tensorflow.python.framework import ops\n'), ((705, 717), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (715, 717), True, 'import tensorflow as tf\n'), ((1110, 1144), 'os.pat... |
import streamlit as st
def main():
st.markdown("""
All solutions to Latex [LaTeX 工作室](https://www.latexstudio.net/)
Online Latex: [Your Projects - Overleaf, Online LaTeX Editor](https://www.overleaf.com/project)
R Bookdown and Markd... | [
"streamlit.markdown"
] | [((41, 354), 'streamlit.markdown', 'st.markdown', (['"""\n All solutions to Latex [LaTeX 工作室](https://www.latexstudio.net/)\n \n Online Latex: [Your Projects - Overleaf, Online LaTeX Editor](https://www.overleaf.com/project)\n \n R Bookdown and ... |
import requests
import json
from .logger import *
import inspect
class DataServiceAPI():
def __init__(self, base_url, user_name, password, logger=None):
self.base_url = base_url
self.auth = (user_name, password)
self.logger = logger
def get_request(self, url):
result = []... | [
"inspect.stack",
"json.dumps",
"requests.get"
] | [((357, 411), 'requests.get', 'requests.get', (['f"""{self.base_url}/{url}"""'], {'auth': 'self.auth'}), "(f'{self.base_url}/{url}', auth=self.auth)\n", (369, 411), False, 'import requests\n'), ((951, 967), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (961, 967), False, 'import json\n'), ((642, 657), 'inspec... |
import time
import random
import audioio
from digitalio import DigitalInOut, Pull, Direction
from adafruit_seesaw.seesaw import Seesaw
from adafruit_seesaw.pwmout import PWMOut
from adafruit_motor import servo
from busio import I2C
import board
wavefiles = ["01.wav", "02.wav", "03.wav", "04.wav", "05.wav", "06.wav",
... | [
"random.choice",
"adafruit_motor.servo.Servo",
"busio.I2C",
"time.sleep",
"adafruit_seesaw.pwmout.PWMOut",
"adafruit_seesaw.seesaw.Seesaw",
"audioio.AudioOut",
"digitalio.DigitalInOut",
"audioio.WaveFile"
] | [((455, 480), 'busio.I2C', 'I2C', (['board.SCL', 'board.SDA'], {}), '(board.SCL, board.SDA)\n', (458, 480), False, 'from busio import I2C\n'), ((490, 501), 'adafruit_seesaw.seesaw.Seesaw', 'Seesaw', (['i2c'], {}), '(i2c)\n', (496, 501), False, 'from adafruit_seesaw.seesaw import Seesaw\n'), ((509, 532), 'digitalio.Digi... |
"""
Given a string, sort it based on the decreasing frequency of its characters.
Example 1:
Input: "Programming"
Output: "rrggmmPiano"
Explanation: 'r', 'g', and 'm' appeared twice, so they need to appear before any other character.
Example 2:
Input: "abcbab"
Output: "bbbaac"
Explanation: 'b' appeared three times, 'a... | [
"heapq.heappush",
"heapq.heappop"
] | [((601, 628), 'heapq.heappush', 'heappush', (['maxHeap', '(-f, ch)'], {}), '(maxHeap, (-f, ch))\n', (609, 628), False, 'from heapq import heapify, heappush, heappop\n'), ((683, 699), 'heapq.heappop', 'heappop', (['maxHeap'], {}), '(maxHeap)\n', (690, 699), False, 'from heapq import heapify, heappush, heappop\n')] |
import socket
def send_light_command(command):
clientsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clientsocket.connect(('localhost', 7777))
clientsocket.send(command.encode())
| [
"socket.socket"
] | [((68, 117), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (81, 117), False, 'import socket\n')] |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swig_im... | [
"_board.IntVector_back",
"_board.IntVector___getslice__",
"_board.IntVector_assign",
"_board.SwigPyIterator_equal",
"_board.Board_Vct",
"_board.IntVector_begin",
"_board.IntVector_push_back",
"_board.IntVector___delslice__",
"_board.IntVector_empty",
"_board.SwigPyIterator_copy",
"_board.SwigPyI... | [((3385, 3418), '_board.SwigPyIterator_value', '_board.SwigPyIterator_value', (['self'], {}), '(self)\n', (3412, 3418), False, 'import _board\n'), ((3460, 3495), '_board.SwigPyIterator_incr', '_board.SwigPyIterator_incr', (['self', 'n'], {}), '(self, n)\n', (3486, 3495), False, 'import _board\n'), ((3537, 3572), '_boar... |
from unittest import TestCase
from sphinx_json_schema_formatter.mergers import merge
class AllOfTestCase(TestCase):
def test_merge_properties(self):
base = {
"required": ["A"],
"properties": {
"A": {"type": "string", "enum": ["x", "y"]},
"B": {"type... | [
"sphinx_json_schema_formatter.mergers.merge"
] | [((571, 601), 'sphinx_json_schema_formatter.mergers.merge', 'merge', (['base', 'to_merge', '"""allOf"""'], {}), "(base, to_merge, 'allOf')\n", (576, 601), False, 'from sphinx_json_schema_formatter.mergers import merge\n')] |
# -*- coding: utf-8 -*-
import asyncio
import re
from PIL import Image
import os
import json
import subprocess
import time
import overwrite
from datetime import datetime
import hashlib
import threading
from PIL import ImageFile
#To ensure that *.png file are read
ImageFile.LOAD_TRUNCATED_IMAGES = True
#how to use ima... | [
"overwrite.overwrite",
"os.path.exists",
"os.listdir",
"PIL.Image.open",
"os.makedirs",
"overwrite.bar",
"subprocess.Popen",
"asyncio.wait",
"hashlib.sha224",
"subprocess.call",
"re.sub",
"re.findall",
"asyncio.get_event_loop",
"threading.Thread"
] | [((4814, 4838), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (4836, 4838), False, 'import asyncio\n'), ((759, 791), 'subprocess.call', 'subprocess.call', (['cmd'], {'shell': '(True)'}), '(cmd, shell=True)\n', (774, 791), False, 'import subprocess\n'), ((1053, 1085), 'subprocess.call', 'subproce... |
import numpy as np
def softmax(x):
"""Stable softmax"""
x -= np.max(x, axis=0)
e_x = np.exp(x)
return e_x / np.sum(e_x, axis=0)
def get_idx_aug_baseline(LOO_influences):
"""Returns points randomly"""
idxs = np.random.choice(
len(LOO_influences),
len(LOO_influences),
... | [
"numpy.abs",
"numpy.max",
"numpy.exp",
"sample_dpp.oct_sample_k_dpp",
"numpy.sum",
"numpy.min"
] | [((71, 88), 'numpy.max', 'np.max', (['x'], {'axis': '(0)'}), '(x, axis=0)\n', (77, 88), True, 'import numpy as np\n'), ((99, 108), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (105, 108), True, 'import numpy as np\n'), ((541, 576), 'numpy.abs', 'np.abs', (['LOO_influences'], {'dtype': 'float'}), '(LOO_influences, dtype... |
# Copyright 2016, 2018 IBM Corp.
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | [
"nova.network.model.Model",
"pypowervm.wrappers.network.CNA.bld",
"nova_powervm.virt.powervm.vif.plug",
"mock.patch",
"nova_powervm.virt.powervm.vif.unplug",
"nova.network.model.VIF",
"mock.Mock",
"nova_powervm.virt.powervm.vif._get_trunk_dev_name",
"nova_powervm.virt.powervm.vif.get_secure_rmc_vswi... | [((1214, 1230), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (1228, 1230), False, 'import mock\n'), ((1812, 1875), 'mock.patch', 'mock.patch', (['"""oslo_serialization.jsonutils.dumps"""'], {'autospec': '(True)'}), "('oslo_serialization.jsonutils.dumps', autospec=True)\n", (1822, 1875), False, 'import mock\n')... |
# importing packages
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import math
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import mean_squared_error
from keras.models import Sequential
from keras.layers import LSTM, Dense
# convert an array of values int... | [
"numpy.reshape",
"pandas.read_csv",
"matplotlib.pyplot.plot",
"keras.models.Sequential",
"sklearn.metrics.mean_squared_error",
"keras.layers.LSTM",
"numpy.array",
"numpy.empty_like",
"numpy.random.seed",
"keras.layers.Dense",
"sklearn.preprocessing.MinMaxScaler",
"matplotlib.pyplot.show"
] | [((670, 688), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (684, 688), True, 'import numpy as np\n'), ((719, 758), 'pandas.read_csv', 'pd.read_csv', (['"""./airline-passengers.csv"""'], {}), "('./airline-passengers.csv')\n", (730, 758), True, 'import pandas as pd\n'), ((843, 877), 'sklearn.preproces... |
import abc
import atexit
import time
import logging
from spyke import events, utils, resources
from spyke.resources import loading_queue
from spyke.audio import AudioDevice
from spyke.ecs import scene
from spyke.windowing.window_specs import WindowSpecs
from spyke.windowing.window import Window
from spyke.graphics.ren... | [
"logging.getLogger",
"spyke.windowing.window.Window",
"atexit.unregister",
"spyke.resources.unload_all",
"spyke.resources.loading_queue.process",
"time.perf_counter",
"spyke.ecs.scene.get_current",
"spyke.audio.AudioDevice",
"spyke.events._process_events",
"spyke.utils.garbage_collect",
"spyke.e... | [((388, 415), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (405, 415), False, 'import logging\n'), ((541, 560), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (558, 560), False, 'import time\n'), ((593, 621), 'spyke.windowing.window.Window', 'Window', (['window_specificatio... |
import errno
import os
import logging
import urllib2
import httplib
import urlparse
import m3u8
import shutil
import crypto
from futures import ThreadPoolExecutor, TimeoutError
import helpers
import atomic
from transcode import transcode_playlist
config = helpers.load_config()
NUM_THREAD_WORKERS = config.getint('hls... | [
"futures.ThreadPoolExecutor",
"transcode.transcode_playlist",
"logging.debug",
"atomic.AtomicWriteFileObj",
"atomic.AtomicWriteFile",
"logging.info",
"helpers.load_config",
"urlparse.urlparse",
"crypto.get_key",
"os.path.exists",
"urllib2.urlopen",
"m3u8.load",
"shutil.copyfileobj",
"crypt... | [((259, 280), 'helpers.load_config', 'helpers.load_config', ([], {}), '()\n', (278, 280), False, 'import helpers\n'), ((2254, 2294), 'logging.debug', 'logging.debug', (["('Consuming %s' % m3u8_uri)"], {}), "('Consuming %s' % m3u8_uri)\n", (2267, 2294), False, 'import logging\n'), ((2310, 2329), 'm3u8.load', 'm3u8.load'... |
# Copyright 2017 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | [
"core.domain.classifier_services.save_classifier",
"core.tests.test_utils.CallCounter",
"core.domain.classifier_services.delete_classifier",
"core.domain.exp_services.get_exploration_by_id",
"os.path.join",
"core.domain.classifier_services.classify",
"core.domain.classifier_services.get_classifier_by_id... | [((938, 994), 'core.platform.models.Registry.import_models', 'models.Registry.import_models', (['[models.NAMES.classifier]'], {}), '([models.NAMES.classifier])\n', (967, 994), False, 'from core.platform import models\n'), ((1504, 1570), 'os.path.join', 'os.path.join', (['feconf.TESTS_DATA_DIR', '"""string_classifier_te... |
import sys
import numpy as np
INF = 10 ** 18
def main():
x, y, z, K = map(int, sys.stdin.readline().split())
abc = np.array(sys.stdin.read().split(), dtype=np.int64)
a = np.append(abc[:x], INF)
b = np.append(abc[x:x + y], INF)
c = np.append(abc[x + y:x + y+ z], INF)
a = np.sort(a)... | [
"numpy.append",
"numpy.sort",
"sys.stdin.readline",
"sys.stdin.read"
] | [((194, 217), 'numpy.append', 'np.append', (['abc[:x]', 'INF'], {}), '(abc[:x], INF)\n', (203, 217), True, 'import numpy as np\n'), ((227, 255), 'numpy.append', 'np.append', (['abc[x:x + y]', 'INF'], {}), '(abc[x:x + y], INF)\n', (236, 255), True, 'import numpy as np\n'), ((265, 301), 'numpy.append', 'np.append', (['ab... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [
"openstack.utils.enable_logging"
] | [((678, 729), 'openstack.utils.enable_logging', 'utils.enable_logging', ([], {'debug': '(True)', 'stream': 'sys.stdout'}), '(debug=True, stream=sys.stdout)\n', (698, 729), False, 'from openstack import utils\n')] |
"""
Robot Debugger
"""
from cumulusci.tasks.robotframework.debugger import (
Breakpoint,
DebuggerCli,
Keyword,
Suite,
Testcase,
)
class DebugListener(object):
"""A robot framework listener for debugging test cases
This acts as the controller for the debugger. It is responsible
for m... | [
"cumulusci.tasks.robotframework.debugger.Suite",
"cumulusci.tasks.robotframework.debugger.Testcase",
"cumulusci.tasks.robotframework.debugger.Keyword",
"cumulusci.tasks.robotframework.debugger.Breakpoint",
"cumulusci.tasks.robotframework.debugger.DebuggerCli"
] | [((698, 724), 'cumulusci.tasks.robotframework.debugger.DebuggerCli', 'DebuggerCli', ([], {'listener': 'self'}), '(listener=self)\n', (709, 724), False, 'from cumulusci.tasks.robotframework.debugger import Breakpoint, DebuggerCli, Keyword, Suite, Testcase\n'), ((1185, 1205), 'cumulusci.tasks.robotframework.debugger.Keyw... |
# Copyright The OpenTelemetry Authors
#
# 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 ... | [
"opentelemetry.exporter.zipkin.proto.http.v2.ProtobufEncoder._encode_span_id",
"opentelemetry.exporter.zipkin.proto.http.v2.ProtobufEncoder",
"opentelemetry.exporter.zipkin.proto.http.v2.gen.zipkin_pb2.Endpoint",
"opentelemetry.exporter.zipkin.node_endpoint.NodeEndpoint",
"json.dumps",
"opentelemetry.expo... | [((1361, 1393), 'opentelemetry.exporter.zipkin.proto.http.v2.ProtobufEncoder', 'ProtobufEncoder', (['*args'], {}), '(*args, **kwargs)\n', (1376, 1393), False, 'from opentelemetry.exporter.zipkin.proto.http.v2 import ProtobufEncoder\n'), ((2763, 2814), 'opentelemetry.exporter.zipkin.proto.http.v2.gen.zipkin_pb2.Endpoint... |
from bpy_speckle.convert.to_native import convert_to_native
def get_speckle_subobjects(attr, scale, name):
subobjects = []
for key in attr.keys():
if isinstance(attr[key], dict):
subtype = attr[key].get("type", None)
if subtype:
name = f"{name}.{key}"
... | [
"bpy_speckle.convert.to_native.convert_to_native"
] | [((338, 372), 'bpy_speckle.convert.to_native.convert_to_native', 'convert_to_native', (['attr[key]', 'name'], {}), '(attr[key], name)\n', (355, 372), False, 'from bpy_speckle.convert.to_native import convert_to_native\n'), ((764, 798), 'bpy_speckle.convert.to_native.convert_to_native', 'convert_to_native', (['attr[key]... |
#https://www.hackerrank.com/challenges/counting-valleys/problem?isFullScreen=true
import sys
import collections
steps = int(sys.stdin.readline())
path = sys.stdin.readline().rstrip()
a=list(path)
level=1
answer=0
for i in a:
if i == 'U':
level+=1
if level == 1:
answer +=1
else:
... | [
"sys.stdin.readline"
] | [((126, 146), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (144, 146), False, 'import sys\n'), ((155, 175), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (173, 175), False, 'import sys\n')] |
from collections import namedtuple
from .util import memoize
@memoize
def scale_steps(scale):
steps = {
'major' : [ 2, 2, 1, 2, 2, 2, 1 ],
'minor_natural' : [ 2, 1, 2, 2, 1, 2, 2 ],
'minor_harmonic' : [ 2, 1, 2, 2, 1, 3, 1 ],
'minor_melodic' : [ 2, 1, 2, 2, 2, 2, 1 ],
... | [
"math.pow",
"collections.namedtuple",
"re.compile"
] | [((3676, 3722), 'collections.namedtuple', 'namedtuple', (['"""Pitch"""', '"""name octave accidentals"""'], {}), "('Pitch', 'name octave accidentals')\n", (3686, 3722), False, 'from collections import namedtuple\n'), ((3734, 3782), 'collections.namedtuple', 'namedtuple', (['"""Duration"""', '"""length length_modifier"""... |
import os
from os import path
from tile_fetch import get_tile
from tile_fetch import get_tiles_by_extent
from tile_fetch import save_tile
TEMPLATE = ('http://services.arcgisonline.com'
'/ArcGIS/rest/services/'
'World_Topo_Map/MapServer/tile'
'/{{z}}/{{y}}/{{x}}.png')
here = path.a... | [
"tile_fetch.save_tile",
"os.path.exists",
"os.path.join",
"tile_fetch.get_tiles_by_extent",
"os.path.dirname",
"tile_fetch.get_tile",
"os.remove"
] | [((451, 495), 'tile_fetch.get_tile', 'get_tile', (['lng', 'lat', 'level'], {'template': 'TEMPLATE'}), '(lng, lat, level, template=TEMPLATE)\n', (459, 495), False, 'from tile_fetch import get_tile\n'), ((587, 624), 'os.path.join', 'path.join', (['here', '"""test_save_tile.png"""'], {}), "(here, 'test_save_tile.png')\n",... |
import komand
from .schema import SampleSamplesInput, SampleSamplesOutput
# Custom imports below
from komand.exceptions import PluginException
class SampleSamples(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name='sample_samples',
description='R... | [
"komand.exceptions.PluginException"
] | [((1020, 1152), 'komand.exceptions.PluginException', 'PluginException', ([], {'cause': '"""Unable to return artifact data."""', 'assistance': '"""Only Threat Grid customers have access to artifact data."""'}), "(cause='Unable to return artifact data.', assistance=\n 'Only Threat Grid customers have access to artifac... |
from setuptools import setup, find_packages
test_deps = [
"pytest",
"pytest-pylint",
"pytest-cov"
]
extras = {
'test': test_deps,
}
classifiers = [
'Development Status :: 3 - Alpha',
'Intended Audience :: Education',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python ::... | [
"setuptools.find_packages"
] | [((745, 760), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (758, 760), False, 'from setuptools import setup, find_packages\n')] |
# Generated by Django 2.0 on 2017-12-10 17:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('website', '0006_auto_20171210_0506'),
]
operations = [
migrations.AddField(
model_name='event',
name='description',
... | [
"django.db.models.TextField"
] | [((336, 368), 'django.db.models.TextField', 'models.TextField', ([], {'default': '"""test"""'}), "(default='test')\n", (352, 368), False, 'from django.db import migrations, models\n')] |
import collections
import typing
def cumprod(mod: int, a: typing.List[int]) -> typing.List[int]:
"""Compute cummulative product over Modular."""
a = a.copy()
for i in range(len(a) - 1):
a[i + 1] = a[i + 1] * a[i] % mod
return a
def factorial(mod: int, n: int) -> typing.List[int]:... | [
"collections.Counter"
] | [((1288, 1310), 'collections.Counter', 'collections.Counter', (['s'], {}), '(s)\n', (1307, 1310), False, 'import collections\n')] |
import xml.etree.ElementTree as ET, csv, urllib.request
def query_ldap(id):
tree = ET.parse(urllib.request.urlopen('[your_ldap_server]/Query?serverID=[server_id]&searchBase=o=[the_org]&Prebuilt=true&scope=2&filter=id=' + id ))
ns = {'dsml': 'http://www.dsml.org/DSML','env':'http://schemas.xmlsoap.org/soap/envelope/'... | [
"csv.writer"
] | [((1172, 1202), 'csv.writer', 'csv.writer', (['f'], {'dialect': '"""excel"""'}), "(f, dialect='excel')\n", (1182, 1202), False, 'import xml.etree.ElementTree as ET, csv, urllib.request\n')] |
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
import random
import vk_api
import json
from pprint import pprint
from vk_api.bot_longpoll import VkBotLongPoll
from vk_api import VkUpload
from typing import List
'''
class MyLongPoll(VkBotLongPoll):
import vk_api
api = None
def set_api(self, new_api: vk_api.VkApi)... | [
"vk_api.VkUpload",
"random.randrange",
"vk_api.bot_longpoll.VkBotLongPoll",
"json.dumps",
"vk_api.VkApi"
] | [((820, 845), 'vk_api.VkApi', 'vk_api.VkApi', ([], {'token': 'token'}), '(token=token)\n', (832, 845), False, 'import vk_api\n'), ((891, 923), 'vk_api.bot_longpoll.VkBotLongPoll', 'VkBotLongPoll', (['self.vk', 'group_id'], {}), '(self.vk, group_id)\n', (904, 923), False, 'from vk_api.bot_longpoll import VkBotLongPoll\n... |
from recon.core.module import BaseModule
from recon.utils.crypto import aes_decrypt
class Module(BaseModule):
meta = {
'name': 'PwnedList - Pwned Domain Credentials Fetcher',
'author': '<NAME> (@LaNMaSteR53)',
'description': 'Queries the PwnedList API to fetch all credentials for a domain.... | [
"recon.utils.crypto.aes_decrypt"
] | [((1917, 1963), 'recon.utils.crypto.aes_decrypt', 'aes_decrypt', (["cred['password']", 'decrypt_key', 'iv'], {}), "(cred['password'], decrypt_key, iv)\n", (1928, 1963), False, 'from recon.utils.crypto import aes_decrypt\n')] |
#
# Author: <NAME>
# Copyright 2016
#
import logging
import isceobj
import mroipac
import os
import numpy as np
from isceobj.Util.decorators import use_api
logger = logging.getLogger('isce.insar.VerifyDEM')
def runVerifyDEM(self):
'''
Make sure that a DEM is available for processing the given data.
'''
... | [
"logging.getLogger",
"os.path.exists",
"numpy.ceil",
"numpy.floor",
"isceobj.createDemImage"
] | [((167, 208), 'logging.getLogger', 'logging.getLogger', (['"""isce.insar.VerifyDEM"""'], {}), "('isce.insar.VerifyDEM')\n", (184, 208), False, 'import logging\n'), ((464, 488), 'isceobj.createDemImage', 'isceobj.createDemImage', ([], {}), '()\n', (486, 488), False, 'import isceobj\n'), ((551, 592), 'os.path.exists', 'o... |
# Copyright 2016 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
"requests.auth.HTTPBasicAuth",
"json.dumps",
"dashboard.models.CacheAPI.objects.update_or_create",
"requests.get",
"django.utils.timezone.now",
"datetime.timedelta",
"dashboard.models.CacheAPI.objects.only"
] | [((8754, 8783), 'json.dumps', 'json.dumps', (['resp_content_json'], {}), '(resp_content_json)\n', (8764, 8783), False, 'import json\n'), ((5111, 5138), 'requests.get', 'requests.get', (['uri'], {}), '(uri, **kwargs)\n', (5123, 5138), False, 'import requests\n'), ((8817, 8831), 'django.utils.timezone.now', 'timezone.now... |
from dataclasses import InitVar, dataclass, asdict, field
from typing import Dict, Any, List, Set
from enum import Enum
class HighValuesAre(str, Enum):
bad = "bad"
good = "good"
neutral = "neutral"
class SignalFormat(str, Enum):
per100k = "per100k"
percent = "percent"
fraction = "fraction"
... | [
"dataclasses.field",
"dataclasses.asdict"
] | [((8654, 8671), 'dataclasses.field', 'field', ([], {'init': '(False)'}), '(init=False)\n', (8659, 8671), False, 'from dataclasses import InitVar, dataclass, asdict, field\n'), ((8709, 8726), 'dataclasses.field', 'field', ([], {'init': '(False)'}), '(init=False)\n', (8714, 8726), False, 'from dataclasses import InitVar,... |
import os
import sys
import logging
from . import base, test
RTS_ENV = str.lower(os.getenv('RTS_ENV') or 'test')
RTS_DEBUG = str.lower(os.getenv('RTS_DEBUG') or '') == 'true'
__config = {
'base': base.Config,
'test': test.Config
}
CONFIG = __config[RTS_ENV]
logger = logging.getLogger('rts')
logger.setLevel(... | [
"logging.getLogger",
"logging.Formatter",
"logging.StreamHandler",
"os.getenv"
] | [((279, 303), 'logging.getLogger', 'logging.getLogger', (['"""rts"""'], {}), "('rts')\n", (296, 303), False, 'import logging\n'), ((379, 452), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""'], {}), "('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n", (39... |
#!/usr/bin/env python
# encoding: utf-8
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import os, sys, re
import logging
import argparse
import collections
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
logger = logging.getLogger(__file__)
de... | [
"logging.basicConfig",
"logging.getLogger",
"argparse.ArgumentParser",
"collections.defaultdict",
"sys.exit"
] | [((220, 278), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stderr', 'level': 'logging.INFO'}), '(stream=sys.stderr, level=logging.INFO)\n', (239, 278), False, 'import logging\n'), ((288, 315), 'logging.getLogger', 'logging.getLogger', (['__file__'], {}), '(__file__)\n', (305, 315), False, 'import ... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 6 08:59:23 2022
@author: <NAME>
"""
import operator
import itertools
ewns = [[0] * 360] * 360
def theta_python(theta1, theta2):
ew = theta1 + 180
# ns = 180 - theta2 if theta2 > 179 else 179 - theta2
ns = -1 * (theta2 - 179)
return ew, ns
def python_... | [
"itertools.product"
] | [((1007, 1038), 'itertools.product', 'itertools.product', (['poss1', 'poss2'], {}), '(poss1, poss2)\n', (1024, 1038), False, 'import itertools\n')] |
import os
import cv2
import numpy as np
from torch.utils.data import DataLoader, Dataset, sampler
from kaggle_runner.datasets.coders import run_length_decode
from kaggle_runner.datasets.transfomers import get_transforms
class SIIMDataset(Dataset):
def __init__(self, df, fnames, data_folder, size, mean, std, pha... | [
"kaggle_runner.datasets.coders.run_length_decode",
"os.path.join",
"numpy.zeros",
"kaggle_runner.datasets.transfomers.get_transforms",
"cv2.imread"
] | [((504, 542), 'kaggle_runner.datasets.transfomers.get_transforms', 'get_transforms', (['phase', 'size', 'mean', 'std'], {}), '(phase, size, mean, std)\n', (518, 542), False, 'from kaggle_runner.datasets.transfomers import get_transforms\n'), ((800, 842), 'os.path.join', 'os.path.join', (['self.root', "(image_id + '.png... |
import functools
from flask import (
Blueprint, flash, g, redirect, render_template, request, session, url_for
)
from zxcvbn import zxcvbn
import nacl.pwhash
from nut_cloud.db import get_db
bp = Blueprint('auth', __name__, url_prefix='/auth')
@bp.route('/register', methods=['GET', 'POST'])
def register():
i... | [
"flask.render_template",
"flask.session.get",
"flask.flash",
"functools.wraps",
"nut_cloud.db.get_db",
"flask.url_for",
"flask.session.clear",
"flask.Blueprint"
] | [((202, 249), 'flask.Blueprint', 'Blueprint', (['"""auth"""', '__name__'], {'url_prefix': '"""/auth"""'}), "('auth', __name__, url_prefix='/auth')\n", (211, 249), False, 'from flask import Blueprint, flash, g, redirect, render_template, request, session, url_for\n'), ((1694, 1731), 'flask.render_template', 'render_temp... |
from styx_msgs.msg import TrafficLight
import tensorflow as tf
import numpy as np
import cv2
import rospy
import math
class TLClassifier(object):
def __init__(self):
#TODO load classifier
self.MODEL_NAME = 'ssd_mobilenet_v1_coco_2017_11_17'
model_file = self.MODEL_NAME + '/frozen_inference_... | [
"cv2.rectangle",
"tensorflow.Graph",
"numpy.average",
"tensorflow.Session",
"numpy.asarray",
"tensorflow.GraphDef",
"numpy.squeeze",
"numpy.array",
"numpy.expand_dims",
"cv2.cvtColor",
"tensorflow.gfile.GFile",
"tensorflow.import_graph_def"
] | [((362, 372), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (370, 372), True, 'import tensorflow as tf\n'), ((2831, 2869), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2RGB'], {}), '(image, cv2.COLOR_BGR2RGB)\n', (2843, 2869), False, 'import cv2\n'), ((2889, 2921), 'numpy.asarray', 'np.asarray', (['imag... |
import sys
import pandas as pd
import numpy as np
import pandas as pd
from sqlalchemy import create_engine
def load_data(messages_filepath, categories_filepath):
messages = pd.read_csv(messages_filepath)
categories = pd.read_csv(categories_filepath)
df = messages.merge(categories,on = 'id')
return df
... | [
"sqlalchemy.create_engine",
"pandas.concat",
"pandas.read_csv"
] | [((179, 209), 'pandas.read_csv', 'pd.read_csv', (['messages_filepath'], {}), '(messages_filepath)\n', (190, 209), True, 'import pandas as pd\n'), ((227, 259), 'pandas.read_csv', 'pd.read_csv', (['categories_filepath'], {}), '(categories_filepath)\n', (238, 259), True, 'import pandas as pd\n'), ((878, 913), 'pandas.conc... |
import random
from psycopg2 import sql
from src.modules.catfact_helper import get_catfact
from src.modules.db_helper import member_exists, insert_member, get_table, connection_error, dbfunc_run
from src.modules.discord_helper import change_nickname, kick_member, try_send
from src.tools.botfunction import BotFunction
fr... | [
"src.modules.db_helper.get_table",
"src.tools.message_return.message_data",
"src.modules.db_helper.member_exists",
"src.modules.db_helper.insert_member",
"src.modules.db_helper.dbfunc_run",
"src.modules.discord_helper.change_nickname",
"src.modules.catfact_helper.get_catfact",
"src.modules.discord_hel... | [((2814, 2862), 'src.tools.message_return.message_data', 'message_data', (['message.channel', '"""User registered"""'], {}), "(message.channel, 'User registered')\n", (2826, 2862), False, 'from src.tools.message_return import message_data\n'), ((3245, 3293), 'src.tools.message_return.message_data', 'message_data', (['m... |
from django import forms
from django.core.exceptions import ValidationError
from htmx_tutorial.clients.models import Client
from htmx_tutorial.clients.utils import get_max_order
class SimpleClientForm(forms.Form):
input_text = forms.CharField()
first_name = forms.CharField(required=False)
last_name = for... | [
"htmx_tutorial.clients.models.Client.objects.filter",
"htmx_tutorial.clients.utils.get_max_order",
"django.forms.CharField",
"django.core.exceptions.ValidationError",
"htmx_tutorial.clients.models.Client.objects.get"
] | [((234, 251), 'django.forms.CharField', 'forms.CharField', ([], {}), '()\n', (249, 251), False, 'from django import forms\n'), ((269, 300), 'django.forms.CharField', 'forms.CharField', ([], {'required': '(False)'}), '(required=False)\n', (284, 300), False, 'from django import forms\n'), ((317, 348), 'django.forms.CharF... |
import json
import logging
from cryptojwt.exception import BadSignature
from cryptojwt.jws.exception import JWSException
from cryptojwt.key_jar import KeyJar
from fedoidcmsg import ClientMetadataStatement
from fedoidcmsg import DoNotCompare
from fedoidcmsg import IgnoreKeys
from fedoidcmsg import MetadataStatementErr... | [
"logging.getLogger",
"fedoidcmsg.is_lesser",
"json.loads",
"oidcmsg.oauth2.Message",
"cryptojwt.key_jar.KeyJar",
"oidcmsg.time_util.utc_time_sans_frac",
"fedoidcmsg.MetadataStatementError",
"fedoidcmsg.unfurl"
] | [((552, 579), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (569, 579), False, 'import logging\n'), ((3630, 3650), 'oidcmsg.time_util.utc_time_sans_frac', 'utc_time_sans_frac', ([], {}), '()\n', (3648, 3650), False, 'from oidcmsg.time_util import utc_time_sans_frac\n'), ((6355, 6363), 'c... |
from methods import load_json, save_json, chunks
from collections import Counter
from math import ceil
# External libs:
from tabulate import tabulate
from matplotlib import pyplot as plt
from matplotlib.lines import Line2D
import seaborn as sns
sns.set_style("white")
sns.set_context('paper', font_scale=7)
my_palette ... | [
"matplotlib.pyplot.text",
"methods.save_json",
"seaborn.set_palette",
"matplotlib.pyplot.savefig",
"seaborn.color_palette",
"seaborn.despine",
"methods.load_json",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"seaborn.set_context",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot... | [((247, 269), 'seaborn.set_style', 'sns.set_style', (['"""white"""'], {}), "('white')\n", (260, 269), True, 'import seaborn as sns\n'), ((270, 308), 'seaborn.set_context', 'sns.set_context', (['"""paper"""'], {'font_scale': '(7)'}), "('paper', font_scale=7)\n", (285, 308), True, 'import seaborn as sns\n'), ((322, 356),... |
# -*- coding: utf-8 -*-
# Imports
#==================================================
import json, keras, gensim, codecs
import tensorflow as tf
import numpy as np
import keras.preprocessing.text as kpt
from keras.callbacks import Callback
from keras.layers import Dropout, Input, Dense, Embedding, LSTM, Bidirectional
... | [
"keras.initializers.RandomUniform",
"keras.preprocessing.text.Tokenizer",
"keras.models.load_model",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.classification_report",
"keras.layers.add",
"sklearn.metrics.precision_recall_fscore_support",
"keras_contrib.layers.CRF",
"numpy.array",
... | [((5429, 5455), 'keras.preprocessing.text.Tokenizer', 'kpt.Tokenizer', ([], {'lower': '(False)'}), '(lower=False)\n', (5442, 5455), True, 'import keras.preprocessing.text as kpt\n'), ((5925, 5951), 'keras.preprocessing.text.Tokenizer', 'kpt.Tokenizer', ([], {'lower': '(False)'}), '(lower=False)\n', (5938, 5951), True, ... |
import unittest
import congressperson
from datasources import propublica
class TestCongress(unittest.TestCase):
def setUp(self):
self.cp = congressperson.Congressperson("H001075")
def test_get_name(self):
self.assertEqual(self.cp.get_name(), "<NAME>")
def test_get_recent_votes(self):
... | [
"unittest.main",
"congressperson.Congressperson",
"datasources.propublica.ProPublica.load_api_key"
] | [((472, 508), 'datasources.propublica.ProPublica.load_api_key', 'propublica.ProPublica.load_api_key', ([], {}), '()\n', (506, 508), False, 'from datasources import propublica\n'), ((513, 528), 'unittest.main', 'unittest.main', ([], {}), '()\n', (526, 528), False, 'import unittest\n'), ((153, 193), 'congressperson.Congr... |
"""A simple web application using epubmangler"""
import os
import re
import shutil
import time
import uuid
import uvicorn
from multiprocessing import Process
from pathlib import Path
from xml.etree.ElementTree import Element
from fastapi import FastAPI, File, UploadFile, Request
from fastapi.responses import FileRe... | [
"fastapi.FastAPI",
"os.listdir",
"uvicorn.run",
"pathlib.Path",
"fastapi.responses.FileResponse",
"epubmangler.EPub",
"multiprocessing.Process",
"epubmangler.json_to_dict",
"epubmangler.strip_namespace",
"time.sleep",
"re.match",
"uuid.uuid4",
"xml.etree.ElementTree.Element",
"shutil.copy"... | [((498, 512), 'pathlib.Path', 'Path', (['"""upload"""'], {}), "('upload')\n", (502, 512), False, 'from pathlib import Path\n'), ((522, 536), 'pathlib.Path', 'Path', (['"""static"""'], {}), "('static')\n", (526, 536), False, 'from pathlib import Path\n'), ((545, 570), 'pathlib.Path', 'Path', (['STATIC', '"""main.html"""... |
from setuptools import setup
setup(
name="memrepl",
version="1.0",
url="https://github.com/agustingianni/memrepl",
author="<NAME>",
author_email="<EMAIL>",
description=("Memory inspection REPL interface"),
license="MIT",
keywords="memory debugger repl reverse engineering",
py_module... | [
"setuptools.setup"
] | [((30, 456), 'setuptools.setup', 'setup', ([], {'name': '"""memrepl"""', 'version': '"""1.0"""', 'url': '"""https://github.com/agustingianni/memrepl"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""Memory inspection REPL interface"""', 'license': '"""MIT"""', 'keywords': '"""memory deb... |
#!/usr/bin/env python
import sys
import pandas as pd
import plotly.express as px
from sklearn.decomposition import PCA
usage = """beta_diversity_plot.py <raw_data.tsv> <output_file_name>"""
#--- Check and read arguments ---#
if len(sys.argv) != 3:
exit("Usage: " + usage )
OUTFILE_NAME=sys.argv[2]
df = pd.read_... | [
"sklearn.decomposition.PCA",
"plotly.express.scatter_3d",
"pandas.read_csv",
"pandas.Categorical"
] | [((312, 371), 'pandas.read_csv', 'pd.read_csv', (['sys.argv[1]'], {'sep': '"""\t"""', 'skiprows': '(0)', 'index_col': '(0)'}), "(sys.argv[1], sep='\\t', skiprows=0, index_col=0)\n", (323, 371), True, 'import pandas as pd\n'), ((991, 996), 'sklearn.decomposition.PCA', 'PCA', ([], {}), '()\n', (994, 996), False, 'from sk... |
import numpy as np
def list_to_mat(data, dims):
m, n = dims
n_obs = len(data[:, 0])
out1 = np.zeros((m, n))
out2 = np.zeros((m, n))
for ind in range(n_obs):
i, j = data[ind, :2]
i = int(i)
j = int(j)
out1[i, j] = data[ind, -1]
out2[i, j] = 1
return out1... | [
"numpy.abs",
"numpy.log",
"numpy.sum",
"numpy.zeros",
"numpy.shape"
] | [((104, 120), 'numpy.zeros', 'np.zeros', (['(m, n)'], {}), '((m, n))\n', (112, 120), True, 'import numpy as np\n'), ((132, 148), 'numpy.zeros', 'np.zeros', (['(m, n)'], {}), '((m, n))\n', (140, 148), True, 'import numpy as np\n'), ((485, 528), 'numpy.sum', 'np.sum', (['(U[i_obs, :] * V[:, j_obs].T)'], {'axis': '(1)'}),... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... | [
"openstackclient.volume.v3.volume_group_snapshot.CreateVolumeGroupSnapshot",
"openstackclient.tests.unit.volume.v3.fakes.FakeVolumeGroupSnapshot.create_volume_group_snapshots",
"openstackclient.volume.v3.volume_group_snapshot.ListVolumeGroupSnapshot",
"openstackclient.tests.unit.volume.v3.fakes.FakeVolumeGrou... | [((1216, 1270), 'openstackclient.tests.unit.volume.v3.fakes.FakeVolumeGroup.create_one_volume_group', 'volume_fakes.FakeVolumeGroup.create_one_volume_group', ([], {}), '()\n', (1268, 1270), True, 'from openstackclient.tests.unit.volume.v3 import fakes as volume_fakes\n'), ((1314, 1385), 'openstackclient.tests.unit.volu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""":Mod: env
:Synopsis:
:Author:
servilla
:Created:
1/13/19
"""
import json
import pathlib
from bs4 import BeautifulSoup
import click
import daiquiri
from lxml import etree
import yaml
import requests
logger = daiquiri.getLogger('env: ' + __name__)
def build... | [
"json.loads",
"yaml.dump",
"click.option",
"yaml.load",
"requests.get",
"click.echo",
"daiquiri.getLogger",
"click.command"
] | [((270, 308), 'daiquiri.getLogger', 'daiquiri.getLogger', (["('env: ' + __name__)"], {}), "('env: ' + __name__)\n", (288, 308), False, 'import daiquiri\n'), ((2101, 2116), 'click.command', 'click.command', ([], {}), '()\n', (2114, 2116), False, 'import click\n'), ((2118, 2197), 'click.option', 'click.option', (['"""-c"... |
"""
This is used for dynamic object completion.
Jedi tries to guess the types with a backtracking approach.
"""
def func(a):
#? int() str()
return a
#? int()
func(1)
func
int(1) + (int(2))+ func('')
# Again the same function, but with another call.
def func(a):
#? float()
return a
func(1.0)
# Agai... | [
"sys"
] | [((167, 174), 'sys', 'func', (['(1)'], {}), '(1)\n', (171, 174), True, 'import sys as func\n'), ((303, 312), 'sys', 'func', (['(1.0)'], {}), '(1.0)\n', (307, 312), True, 'import sys as func\n'), ((800, 811), 'sys', 'func', (['"""str"""'], {}), "('str')\n", (804, 811), True, 'import sys as func\n'), ((873, 882), 'sys', ... |
import random
from django.contrib.auth.models import User
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import status, mixins
from rest_framework.authentication import TokenAuthentication
from rest_framework.decorators import action
from django.db.models import Max
from rest_framewo... | [
"rest_framework.decorators.action",
"rest_framework.generics.get_object_or_404",
"rest_framework.response.Response",
"django.contrib.auth.models.User.objects.all",
"django.db.models.Max",
"random.randint"
] | [((941, 959), 'django.contrib.auth.models.User.objects.all', 'User.objects.all', ([], {}), '()\n', (957, 959), False, 'from django.contrib.auth.models import User\n'), ((1442, 1479), 'rest_framework.decorators.action', 'action', ([], {'detail': '(True)', 'methods': "['post']"}), "(detail=True, methods=['post'])\n", (14... |
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | [
"collections.namedtuple",
"glyphsLib.to_glyphs",
"glyphsLib.to_ufos",
"glyphsLib.classes.GSFont",
"pytest.param",
"pytest.mark.parametrize"
] | [((1184, 1222), 'collections.namedtuple', 'namedtuple', (['"""Field"""', '"""name test_value"""'], {}), "('Field', 'name test_value')\n", (1194, 1222), False, 'from collections import namedtuple\n'), ((23319, 23367), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""fields"""', 'ufo_info_spec'], {}), "('field... |
# coding: utf-8
"""
Location API
Geolocation, Geocoding and Maps # noqa: E501
OpenAPI spec version: 2.0.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class GeolocationResponseSchema(object):
"""NOTE: This class is auto generated by OpenA... | [
"six.iteritems"
] | [((10767, 10800), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (10780, 10800), False, 'import six\n')] |
#!/usr/bin/env python
import argparse
import configparser
import json
import csv
import os.path
from asnake.aspace import ASpace
class LabelPrinter:
def __init__(self, resource):
config = configparser.ConfigParser()
config.read("local_settings.cfg")
self.aspace = ASpace(
base... | [
"csv.writer",
"configparser.ConfigParser",
"argparse.ArgumentParser"
] | [((2523, 2634), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Creates a csv with container labels based on a a given resource ID."""'}), "(description=\n 'Creates a csv with container labels based on a a given resource ID.')\n", (2546, 2634), False, 'import argparse\n'), ((204, 231),... |
import pickle
import os
from pathlib import Path
import pdb
class QtableSave:
def saveQtable(self, qtable):
path = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(path, "qtable.pickle"), 'wb') as file:
pickle.dump(qtable, file, protocol=pickle.HIGHEST_PROTOCOL)
d... | [
"os.path.abspath",
"pickle.dump",
"pickle.load",
"os.path.join"
] | [((415, 450), 'os.path.join', 'os.path.join', (['path', '"""qtable.pickle"""'], {}), "(path, 'qtable.pickle')\n", (427, 450), False, 'import os\n'), ((145, 170), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (160, 170), False, 'import os\n'), ((254, 313), 'pickle.dump', 'pickle.dump', (['qta... |
import pandas as pd
import numpy as np
from rdkit.Chem import PandasTools, AllChem
from rdkit import Chem
from rdkit.Chem.rdMolDescriptors import GetMorganFingerprint, GetMorganFingerprintAsBitVect
from rdkit import DataStructs
import os
from scipy.stats import lognorm
import time
#%%% Read in the InStock i chunks
db ... | [
"numpy.zeros",
"pandas.concat",
"pandas.read_csv",
"rdkit.Chem.MolFromSmiles"
] | [((1196, 1298), 'pandas.read_csv', 'pd.read_csv', (['"""../data/original/COCONUT_DB_NPL.smi"""'], {'sep': '"""\t"""', 'header': 'None', 'names': "['smiles', 'npl']"}), "('../data/original/COCONUT_DB_NPL.smi', sep='\\t', header=None,\n names=['smiles', 'npl'])\n", (1207, 1298), True, 'import pandas as pd\n'), ((335, ... |
from crawler import extract_base, process_website, scrape_url_for_links, stream_seeds_into_queue
import unittest
from unittest.mock import patch
from bs4 import BeautifulSoup
from collections import deque
class DotDict(dict):
def __getattr__(self, item):
if item in self:
return self[item]
... | [
"crawler.stream_seeds_into_queue",
"crawler.extract_base",
"crawler.process_website",
"bs4.BeautifulSoup",
"crawler.scrape_url_for_links",
"unittest.mock.patch"
] | [((1779, 1811), 'unittest.mock.patch', 'patch', (['"""crawler.process_website"""'], {}), "('crawler.process_website')\n", (1784, 1811), False, 'from unittest.mock import patch\n'), ((2217, 2242), 'unittest.mock.patch', 'patch', (['"""crawler.requests"""'], {}), "('crawler.requests')\n", (2222, 2242), False, 'from unitt... |
import pickle
from datetime import datetime
from arq.utils import to_unix_ms
from .fixtures import CronWorker
datetimes = [
datetime(2032, 1, 1), # init one cron func
datetime(2032, 1, 1), # init the other cron func
datetime(2032, 1, 1), # init the third cron func
datetime(2032, 1, 1, 3, 0, 1),
... | [
"datetime.datetime",
"pickle.dump"
] | [((131, 151), 'datetime.datetime', 'datetime', (['(2032)', '(1)', '(1)'], {}), '(2032, 1, 1)\n', (139, 151), False, 'from datetime import datetime\n'), ((179, 199), 'datetime.datetime', 'datetime', (['(2032)', '(1)', '(1)'], {}), '(2032, 1, 1)\n', (187, 199), False, 'from datetime import datetime\n'), ((233, 253), 'dat... |
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.contrib.messages.views import SuccessMessageMixin
from django.views.generic import CreateView, DetailView, ListView, UpdateView
from guardian.mixins import LoginRequiredMixin
from guardian.mixins import (
PermissionRequiredMixin as Obje... | [
"grandchallenge.subdomains.utils.reverse"
] | [((1076, 1109), 'grandchallenge.subdomains.utils.reverse', 'reverse', (['"""hanging-protocols:list"""'], {}), "('hanging-protocols:list')\n", (1083, 1109), False, 'from grandchallenge.subdomains.utils import reverse\n'), ((1734, 1767), 'grandchallenge.subdomains.utils.reverse', 'reverse', (['"""hanging-protocols:list""... |
from django.db.models import QuerySet
from django.utils import timezone
class SoftDeleteQuerySet(QuerySet):
def delete(self):
return super(SoftDeleteQuerySet, self).update(deleted_at=timezone.now(), is_deleted=True)
def hard_delete(self):
return super(SoftDeleteQuerySet, self).delete()
d... | [
"django.utils.timezone.now"
] | [((197, 211), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (209, 211), False, 'from django.utils import timezone\n')] |
import datetime
import pandas as pd
from local_group_support.utils.google import export_messages_stats, pull_from_dashboard, export_member_stats
SCOPES = ['https://www.googleapis.com/auth/spreadsheets']
SPREADSHEET_ID = '1LrSjkBQqZsIzGKs25O7FC9pHFoOEeRuAAs3IL1NEE8g'
UPDATE_DATE_RANGE_NAME = 'Local group dashboard!K2... | [
"local_group_support.utils.google.export_messages_stats",
"local_group_support.utils.google.export_member_stats",
"local_group_support.utils.google.pull_from_dashboard",
"datetime.date",
"pandas.to_datetime"
] | [((433, 487), 'local_group_support.utils.google.pull_from_dashboard', 'pull_from_dashboard', ([], {'range_name': 'UPDATE_DATE_RANGE_NAME'}), '(range_name=UPDATE_DATE_RANGE_NAME)\n', (452, 487), False, 'from local_group_support.utils.google import export_messages_stats, pull_from_dashboard, export_member_stats\n'), ((55... |
from rpython.rlib import jit
from rpython.rlib.cache import Cache
from rpython.rlib.objectmodel import specialize, import_from_mixin
from rsqueakvm.util.version import Version
class QuasiConstantCache(Cache):
def _build(self, obj):
class NewQuasiConst(object):
import_from_mixin(QuasiConstantM... | [
"rpython.rlib.objectmodel.specialize.arg",
"rpython.rlib.objectmodel.specialize.memo",
"rpython.rlib.objectmodel.specialize.argtype",
"rpython.rlib.jit.promote_string",
"rpython.rlib.jit.promote",
"rpython.rlib.objectmodel.import_from_mixin",
"rsqueakvm.util.version.Version"
] | [((1106, 1123), 'rpython.rlib.objectmodel.specialize.memo', 'specialize.memo', ([], {}), '()\n', (1121, 1123), False, 'from rpython.rlib.objectmodel import specialize, import_from_mixin\n'), ((1311, 1328), 'rpython.rlib.objectmodel.specialize.arg', 'specialize.arg', (['(1)'], {}), '(1)\n', (1325, 1328), False, 'from rp... |
from multivariate_t_mixture import *
import matplotlib.pyplot as plt
def multivariate_t_rvs(m, S, df=np.inf, n=1):
m = np.asarray(m)
d = len(m)
if df == np.inf:
x = 1.
else:
x = np.random.chisquare(df, n)/df
z = np.random.multivariate_normal(np.zeros(d),S,(n,))
return m + z/np.s... | [
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.show"
] | [((615, 645), 'matplotlib.pyplot.scatter', 'plt.scatter', (['arr', 't.likelihood'], {}), '(arr, t.likelihood)\n', (626, 645), True, 'import matplotlib.pyplot as plt\n'), ((646, 656), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (654, 656), True, 'import matplotlib.pyplot as plt\n')] |
#######
#
# cct_json_utils.py
#
# Utilities for working with COCO Camera Traps .json databases
#
# Format spec:
#
# https://github.com/Microsoft/CameraTraps/blob/master/data_management/README.md#coco-cameratraps-format
#
#######
#%% Constants and imports
import os
import json
from collections import defaultdict, Ord... | [
"os.path.normpath",
"collections.OrderedDict",
"collections.defaultdict"
] | [((1903, 2039), 'collections.OrderedDict', 'OrderedDict', (["[('info', db['info']), ('categories', db['categories']), ('annotations', db\n ['annotations']), ('images', db['images'])]"], {}), "([('info', db['info']), ('categories', db['categories']), (\n 'annotations', db['annotations']), ('images', db['images'])]... |
from typing import Type
import unittest, os
from ocr_azure import OCR
class TestOCR(unittest.TestCase):
def setUp(self):
self.ocr = OCR('../examples/images', 'output.txt', '3592a71759b9440c8824481a381347b9')
self.res = self.ocr.get_text(f'{self.ocr.img_directory}/azurebeg.png')
def test_init_(... | [
"unittest.main",
"ocr_azure.OCR",
"os.remove"
] | [((1276, 1291), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1289, 1291), False, 'import unittest, os\n'), ((145, 220), 'ocr_azure.OCR', 'OCR', (['"""../examples/images"""', '"""output.txt"""', '"""3592a71759b9440c8824481a381347b9"""'], {}), "('../examples/images', 'output.txt', '3592a71759b9440c8824481a381347b... |
from requests_counter.reqcounter import ReqCounter
import pytest
origin_allowed = ["origin_1", "origin_2"]
@pytest.mark.asyncio
async def test_check_origin_in():
cl = ReqCounter('redis://localhost')
await cl.setup_source(origin_allowed)
res = await cl.check_source("origin_1")
await cl.destroy_all()
... | [
"requests_counter.reqcounter.ReqCounter"
] | [((174, 205), 'requests_counter.reqcounter.ReqCounter', 'ReqCounter', (['"""redis://localhost"""'], {}), "('redis://localhost')\n", (184, 205), False, 'from requests_counter.reqcounter import ReqCounter\n'), ((433, 464), 'requests_counter.reqcounter.ReqCounter', 'ReqCounter', (['"""redis://localhost"""'], {}), "('redis... |
"""
Copyright 2021 Novartis Institutes for BioMedical Research Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law... | [
"streamlit.write"
] | [((895, 933), 'streamlit.write', 'st.write', (['html'], {'unsafe_allow_html': '(True)'}), '(html, unsafe_allow_html=True)\n', (903, 933), True, 'import streamlit as st\n')] |
#! /usr/bin/env python
# per rosengren 2011
from waflib.TaskGen import feature, after_method
from waflib.Task import Task, always_run
from os.path import basename, isabs
from os import tmpfile, linesep
def options(opt):
grp = opt.add_option_group('Softlink Libraries Options')
grp.add_option('--exclude', default='/u... | [
"os.linesep.join",
"os.tmpfile",
"os.path.isabs",
"waflib.TaskGen.feature",
"waflib.Task.always_run",
"waflib.TaskGen.after_method",
"os.path.basename"
] | [((541, 565), 'waflib.TaskGen.feature', 'feature', (['"""softlink_libs"""'], {}), "('softlink_libs')\n", (548, 565), False, 'from waflib.TaskGen import feature, after_method\n'), ((567, 595), 'waflib.TaskGen.after_method', 'after_method', (['"""process_rule"""'], {}), "('process_rule')\n", (579, 595), False, 'from wafl... |
import time
import unittest
from nose.tools import eq_, ok_
from tornado import version_info
from .utils import TornadoTestCase
class TestTornadoExecutor(TornadoTestCase):
"""
Ensure that Tornado web handlers are properly traced even if
``@run_on_executor`` decorator is used.
"""
def test_on_ex... | [
"nose.tools.ok_",
"unittest.skipIf",
"nose.tools.eq_",
"time.sleep"
] | [((4544, 4679), 'unittest.skipIf', 'unittest.skipIf', (['((version_info[0], version_info[1]) in [(4, 0), (4, 1)])'], {'reason': '"""Custom kwargs are available only for Tornado 4.2+"""'}), "((version_info[0], version_info[1]) in [(4, 0), (4, 1)],\n reason='Custom kwargs are available only for Tornado 4.2+')\n", (455... |
"""
\author <NAME> s181753, <NAME> s181755, <NAME> s182312
\date nov 2018
\version 1.0
\brief Demo to test out the final solution
\details This demo test our algorithm by recommending categories for XX random pages. In order to evaluate the precision of our
out solution, it computes the number of correct suggest... | [
"ParseDumpWiki.ParseDumpWiki",
"Categorization.Categorization",
"DatabaseWiki.databaseWiki"
] | [((473, 488), 'ParseDumpWiki.ParseDumpWiki', 'ParseDumpWiki', ([], {}), '()\n', (486, 488), False, 'from ParseDumpWiki import ParseDumpWiki\n'), ((503, 517), 'DatabaseWiki.databaseWiki', 'databaseWiki', ([], {}), '()\n', (515, 517), False, 'from DatabaseWiki import databaseWiki\n'), ((546, 562), 'Categorization.Categor... |
"""Base class for Cameras."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import os
import numpy as np
from robovat.math import get_transform
from robovat.math import Pose
from robovat.math import Orientation
class Camera(object):
"""... | [
"numpy.prod",
"numpy.tile",
"numpy.ones",
"numpy.logical_and",
"robovat.math.Orientation",
"os.path.join",
"numpy.indices",
"robovat.math.Pose",
"numpy.array",
"numpy.dot",
"robovat.math.get_transform",
"numpy.linalg.inv",
"numpy.matmul",
"numpy.load",
"numpy.round"
] | [((1778, 1819), 'robovat.math.Pose', 'Pose', (['[self._translation, self._rotation]'], {}), '([self._translation, self._rotation])\n', (1782, 1819), False, 'from robovat.math import Pose\n'), ((3213, 3252), 'os.path.join', 'os.path.join', (['path', '"""IR_intrinsics.npy"""'], {}), "(path, 'IR_intrinsics.npy')\n", (3225... |
from maneuvers.maneuver import Maneuver
from rlutilities.linear_algebra import norm
from rlutilities.simulation import Car
FIRST_JUMP_DURATION = 0.1
BETWEEN_JUMPS_DELAY = 0.1
SECOND_JUMP_DURATION = 0.05
TIMEOUT = 2.0
class SpeedFlip(Maneuver):
def __init__(self, car: Car, right_handed=True, use_boost=... | [
"rlutilities.linear_algebra.norm"
] | [((725, 748), 'rlutilities.linear_algebra.norm', 'norm', (['self.car.velocity'], {}), '(self.car.velocity)\n', (729, 748), False, 'from rlutilities.linear_algebra import norm\n')] |
"""
Tools for editing and reshaping graphs
"""
import networkx as nx
def prune_below_degree(graph, minimum_degree=1):
"""
Trim nodes from graph below threshold
Args:
graph: NetworkX graph object to prune
minimum_degree: Integer of the minimum connections a node must have
Ret... | [
"networkx.degree"
] | [((394, 407), 'networkx.degree', 'nx.degree', (['g2'], {}), '(g2)\n', (403, 407), True, 'import networkx as nx\n')] |
#Cliente TCP
import socket
import rsa
def cifra_message(text, pub_key):
return rsa.encrypt(
text,
rsa.PublicKey.load_pkcs1(pub_key, format='PEM')
)
###
def captura_chave_pub():
arqnomepub='/home/mateus/projetos/Fatec/5sem/fateclando/fabio/.chavePubFabio.txt'
arq = open(arqnomepub,'r')
... | [
"rsa.PublicKey.load_pkcs1",
"socket.socket"
] | [((576, 625), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (589, 625), False, 'import socket\n'), ((119, 166), 'rsa.PublicKey.load_pkcs1', 'rsa.PublicKey.load_pkcs1', (['pub_key'], {'format': '"""PEM"""'}), "(pub_key, format='PEM')\n", (143,... |
import libra_client
from libra.transaction.change_set import ChangeSet
from libra.contract_event import ContractEvent
from libra.json_print import json_dumps
import pytest
import os
#import pdb
try:
os.environ['TESTNET_LOCAL']
TESTNET_LOCAL = True
except KeyError:
TESTNET_LOCAL = False
d... | [
"libra_client.Client"
] | [((348, 378), 'libra_client.Client', 'libra_client.Client', (['"""testnet"""'], {}), "('testnet')\n", (367, 378), False, 'import libra_client\n')] |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"mock.patch",
"azure.cli.core.extensions._index.ERR_TMPL_NO_NETWORK.format",
"azure.cli.core.extensions._index.get_index_extensions",
"azure.cli.core.extensions._index.get_index",
"azure.cli.core.extensions._index.ERR_TMPL_BAD_JSON.format",
"unittest.main",
"requests.exceptions.ConnectionError",
"azur... | [((4306, 4321), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4319, 4321), False, 'import unittest\n'), ((3553, 3629), 'mock.patch', 'mock.patch', (['"""azure.cli.core.extensions._index.logger.warning"""'], {'autospec': '(True)'}), "('azure.cli.core.extensions._index.logger.warning', autospec=True)\n", (3563, 36... |
from __future__ import print_function
import numpy as np
np.set_printoptions(threshold='nan')
import h5py
import theano
import argparse
import itertools
import subprocess
import logging
import time
import codecs
import os
from copy import deepcopy
import math
import sys
from data_generator import VisualWordDataGener... | [
"logging.getLogger",
"math.log",
"numpy.argsort",
"numpy.array",
"copy.deepcopy",
"os.listdir",
"argparse.ArgumentParser",
"sys.stdout.flush",
"subprocess.check_call",
"models.MRNN",
"itertools.takewhile",
"numpy.argmax",
"h5py.File",
"data_generator.VisualWordDataGenerator",
"codecs.ope... | [((58, 94), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': '"""nan"""'}), "(threshold='nan')\n", (77, 94), True, 'import numpy as np\n'), ((356, 414), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'stream': 'sys.stdout'}), '(level=logging.INFO, stream=sys.stdout)\n', ... |
from django.apps import AppConfig
class FacultymgrConfig(AppConfig):
name = "facultymgr"
def ready(self):
try:
from django.contrib.auth.models import Group
Group.objects.get_or_create(name="student")
Group.objects.get_or_create(name="faculty")
except Excep... | [
"django.contrib.auth.models.Group.objects.get_or_create"
] | [((200, 243), 'django.contrib.auth.models.Group.objects.get_or_create', 'Group.objects.get_or_create', ([], {'name': '"""student"""'}), "(name='student')\n", (227, 243), False, 'from django.contrib.auth.models import Group\n'), ((256, 299), 'django.contrib.auth.models.Group.objects.get_or_create', 'Group.objects.get_or... |
#!/usr/bin/env python3
"""
Create necessary scp files which specifies how the audio can be loaded.
"""
import argparse
import glob
import os
import subprocess
def sh(cmd):
subprocess.call(cmd, shell=True)
def create_scpdir(vystdir, outdir):
wav_scp = os.path.join(outdir, 'wav.scp')
utt2spk = os.path.joi... | [
"os.path.exists",
"argparse.ArgumentParser",
"os.path.join",
"os.path.realpath",
"subprocess.call",
"os.mkdir",
"os.path.basename",
"glob.glob"
] | [((178, 210), 'subprocess.call', 'subprocess.call', (['cmd'], {'shell': '(True)'}), '(cmd, shell=True)\n', (193, 210), False, 'import subprocess\n'), ((263, 294), 'os.path.join', 'os.path.join', (['outdir', '"""wav.scp"""'], {}), "(outdir, 'wav.scp')\n", (275, 294), False, 'import os\n'), ((309, 340), 'os.path.join', '... |
#!/usr/bin/python3
import sys
import os
import shutil
import subprocess
import re
import chardet
import itertools
from functools import reduce
from collections import defaultdict
import argparse
def get_max_common_beginning(sequences):
if not sequences:
return None
max_beginning = sequences[0]
for seq in sequence... | [
"re.search",
"os.path.exists",
"re.split",
"os.listdir",
"argparse.ArgumentParser",
"subprocess.Popen",
"os.path.split",
"chardet.detect",
"os.path.isdir",
"subprocess.check_call",
"functools.reduce",
"itertools.zip_longest",
"os.path.splitext",
"re.match",
"shutil.copyfile",
"re.sub",... | [((714, 730), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (725, 730), False, 'from collections import defaultdict\n'), ((998, 1009), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1007, 1009), False, 'import os\n'), ((1054, 1073), 'os.listdir', 'os.listdir', (['dirname'], {}), '(dirname)\n', (1064... |
import pytest
import re
from time import sleep
from datetime import datetime, timedelta
from emit.decorators import backoff_barrier, defer, unreliable, slow, delay
from ..helpers import TestCase
class BackoffFixture(object):
def __init__(self):
self.raise_exception = False
@backoff_barrier
def ba... | [
"emit.decorators.defer",
"datetime.datetime.utcnow",
"re.match",
"emit.decorators.slow",
"pytest.raises",
"emit.decorators.delay",
"emit.decorators.unreliable",
"datetime.timedelta",
"emit.decorators.backoff_barrier"
] | [((432, 464), 'emit.decorators.backoff_barrier', 'backoff_barrier', ([], {'max_attempts': '(10)'}), '(max_attempts=10)\n', (447, 464), False, 'from emit.decorators import backoff_barrier, defer, unreliable, slow, delay\n'), ((1299, 1327), 're.match', 're.match', (['exc_match', 'exc_val'], {}), '(exc_match, exc_val)\n',... |
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from direct.distributed.ClockDelta import *
import time
class DistributedTimerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedTimerAI")
def __init... | [
"direct.directnotify.DirectNotifyGlobal.directNotify.newCategory",
"direct.distributed.DistributedObjectAI.DistributedObjectAI.__init__"
] | [((239, 304), 'direct.directnotify.DirectNotifyGlobal.directNotify.newCategory', 'DirectNotifyGlobal.directNotify.newCategory', (['"""DistributedTimerAI"""'], {}), "('DistributedTimerAI')\n", (282, 304), False, 'from direct.directnotify import DirectNotifyGlobal\n'), ((343, 382), 'direct.distributed.DistributedObjectAI... |
"""Simple user-mean model."""
import itertools
class UserMean(object):
"""Class modelling the user-mean recommendation model."""
def __init__(self):
self.user_means = {}
def update(self, user, mean):
self.user_means[user] = mean
def get(self, user):
return self.user_means.get... | [
"itertools.groupby"
] | [((491, 534), 'itertools.groupby', 'itertools.groupby', (['data'], {'key': '(lambda t: t[0])'}), '(data, key=lambda t: t[0])\n', (508, 534), False, 'import itertools\n')] |
# Copyright 2017 <NAME>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sub... | [
"sqlalchemy.orm.sessionmaker",
"lookup.MultiLookup",
"sqlalchemy.create_engine",
"lookup.SingletonLookup",
"cred.Credentials",
"pyspark.SparkContext"
] | [((1272, 1285), 'cred.Credentials', 'Credentials', ([], {}), '()\n', (1283, 1285), False, 'from cred import Credentials\n'), ((1292, 1306), 'pyspark.SparkContext', 'SparkContext', ([], {}), '()\n', (1304, 1306), False, 'from pyspark import SparkContext\n'), ((1659, 1683), 'sqlalchemy.create_engine', 'create_engine', ([... |
"""
app.chat_server.consumers
-------------------------
Consumers for chat_server application
"""
from django.urls import re_path
from . import consumers
websocket_urlpatterns = [
re_path(r'ws/chat/(?P<room_name>\w+)/$', consumers.ChatConsumer),
]
| [
"django.urls.re_path"
] | [((188, 252), 'django.urls.re_path', 're_path', (['"""ws/chat/(?P<room_name>\\\\w+)/$"""', 'consumers.ChatConsumer'], {}), "('ws/chat/(?P<room_name>\\\\w+)/$', consumers.ChatConsumer)\n", (195, 252), False, 'from django.urls import re_path\n')] |
#!/usr/bin/env python3
from orger import Mirror
from orger.inorganic import node, link, OrgNode
from orger.common import dt_heading
from my.kobo import get_books_with_highlights, Highlight
class KoboView(Mirror):
def get_items(self) -> Mirror.Results:
def render_highlight(h: Highlight) -> OrgNode:
... | [
"my.kobo.get_books_with_highlights",
"orger.common.dt_heading"
] | [((634, 661), 'my.kobo.get_books_with_highlights', 'get_books_with_highlights', ([], {}), '()\n', (659, 661), False, 'from my.kobo import get_books_with_highlights, Highlight\n'), ((545, 570), 'orger.common.dt_heading', 'dt_heading', (['h.dt', 'heading'], {}), '(h.dt, heading)\n', (555, 570), False, 'from orger.common ... |
#Look through all memory files
from os import listdir
from os.path import isfile, join
from data_retrieval.jsonManager import jsonManager
import pandas as pd
mypath = "../completed_sessions"
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
print(onlyfiles)
ids = []
prolificID = []
goalChanged = []... | [
"os.listdir",
"pandas.read_csv",
"data_retrieval.jsonManager.jsonManager",
"os.path.join",
"pandas.DataFrame"
] | [((9389, 9423), 'pandas.read_csv', 'pd.read_csv', (['"""surveys/Consent.csv"""'], {}), "('surveys/Consent.csv')\n", (9400, 9423), True, 'import pandas as pd\n'), ((9442, 9482), 'pandas.read_csv', 'pd.read_csv', (['"""surveys/Questionnaire.csv"""'], {}), "('surveys/Questionnaire.csv')\n", (9453, 9482), True, 'import pan... |
from copy import deepcopy
from typing import List
from rdkit import Chem
from icolos.core.step_utils.obabel_structconvert import OBabelStructConvert
from icolos.utils.enums.compound_enums import (
CompoundContainerEnum,
EnumerationContainerEnum,
)
from icolos.utils.enums.program_parameters import SchrodingerEx... | [
"icolos.utils.enums.compound_enums.CompoundContainerEnum",
"numpy.min",
"numpy.max",
"icolos.utils.enums.write_out_enums.WriteOutEnum",
"icolos.core.step_utils.obabel_structconvert.OBabelStructConvert",
"rdkit.Chem.SDMolSupplier",
"copy.deepcopy",
"rdkit.Chem.SDWriter",
"icolos.utils.enums.compound_... | [((588, 602), 'icolos.utils.enums.write_out_enums.WriteOutEnum', 'WriteOutEnum', ([], {}), '()\n', (600, 602), False, 'from icolos.utils.enums.write_out_enums import WriteOutEnum\n'), ((610, 638), 'icolos.utils.enums.program_parameters.SchrodingerExecutablesEnum', 'SchrodingerExecutablesEnum', ([], {}), '()\n', (636, 6... |
import os
import shutil
from pathlib import Path
def make_dirs(path, clean=True):
if clean and os.path.exists(path):
shutil.rmtree(path)
try:
os.makedirs(path, exist_ok=True)
except FileNotFoundError:
return None
return Path(path) | [
"os.path.exists",
"shutil.rmtree",
"os.makedirs",
"pathlib.Path"
] | [((261, 271), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (265, 271), False, 'from pathlib import Path\n'), ((100, 120), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (114, 120), False, 'import os\n'), ((130, 149), 'shutil.rmtree', 'shutil.rmtree', (['path'], {}), '(path)\n', (143, 149), False... |
from PyQt5.QtWidgets import QHeaderView, QTableWidgetItem, QCheckBox, QWidget, QHBoxLayout, QLineEdit, QSpinBox, QDoubleSpinBox, QGroupBox
from PyQt5.QtCore import Qt, pyqtSignal
from .ui_tab import UiTab
from maidfiddler.ui.qt_elements import NumberElement, TextElement, CheckboxElement, MIN_MAX_DICT, FLOAT_TYPES
from ... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtCore.pyqtSignal",
"maidfiddler.util.translation.tr",
"PyQt5.QtWidgets.QDoubleSpinBox",
"PyQt5.QtWidgets.QHBoxLayout",
"maidfiddler.ui.qt_elements.NumberElement",
"PyQt5.QtWidgets.QCheckBox",
"PyQt5.QtWidgets.QTableWidgetItem",
"PyQt5.QtWidgets.QLineEdit"
] | [((426, 442), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', (['dict'], {}), '(dict)\n', (436, 442), False, 'from PyQt5.QtCore import Qt, pyqtSignal\n'), ((478, 494), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', (['dict'], {}), '(dict)\n', (488, 494), False, 'from PyQt5.QtCore import Qt, pyqtSignal\n'), ((664, 680), 'PyQt5.QtWid... |
# 在使用前,请通过「pip install scenedetect[opencv,progress_bar,scenedetect]」安装部分所需要的依赖~
from __future__ import print_function
import os
# Standard PySceneDetect imports:
from scenedetect.video_splitter import split_video_ffmpeg
from scenedetect.video_manager import VideoManager
from scenedetect.scene_manager import SceneMana... | [
"scenedetect.video_manager.VideoManager",
"scenedetect.scene_manager.SceneManager",
"os.path.exists",
"os.makedirs",
"scenedetect.stats_manager.StatsManager",
"os.path.splitext",
"os.path.split",
"os.getcwd",
"scenedetect.detectors.content_detector.ContentDetector",
"os.walk"
] | [((1983, 2009), 'scenedetect.video_manager.VideoManager', 'VideoManager', (['[video_path]'], {}), '([video_path])\n', (1995, 2009), False, 'from scenedetect.video_manager import VideoManager\n'), ((2034, 2048), 'scenedetect.stats_manager.StatsManager', 'StatsManager', ([], {}), '()\n', (2046, 2048), False, 'from scened... |
""" Implementation of various evaluation metrics """
from sklearn.metrics import mean_squared_error
from sklearn.metrics import make_scorer
import scipy
import math
def rmse(y_true, y_pred):
""" Root mean squared error """
return math.sqrt(mean_squared_error(y_true, y_pred))
def mse(y_true, y_pred):
""" ... | [
"scipy.stats.pearsonr",
"sklearn.metrics.make_scorer",
"sklearn.metrics.mean_squared_error"
] | [((586, 628), 'sklearn.metrics.make_scorer', 'make_scorer', (['rmse'], {'greater_is_better': '(False)'}), '(rmse, greater_is_better=False)\n', (597, 628), False, 'from sklearn.metrics import make_scorer\n'), ((642, 683), 'sklearn.metrics.make_scorer', 'make_scorer', (['mse'], {'greater_is_better': '(False)'}), '(mse, g... |
from typing import Optional, Dict, Union
import falcon
from falcon_multipart.middleware import MultipartMiddleware
from webtest.http import StopableWSGIServer
from py_fake_server.route import Route
from py_fake_server.endpoint import Endpoint
from py_fake_server.statistic import Statistic
class FakeServer(falcon.AP... | [
"py_fake_server.endpoint.Endpoint",
"falcon.RequestOptions",
"py_fake_server.route.Route",
"py_fake_server.statistic.Statistic",
"falcon_multipart.middleware.MultipartMiddleware",
"webtest.http.StopableWSGIServer.create"
] | [((821, 844), 'falcon.RequestOptions', 'falcon.RequestOptions', ([], {}), '()\n', (842, 844), False, 'import falcon\n'), ((1006, 1056), 'py_fake_server.route.Route', 'Route', (['request.method', 'self.base_uri', 'request.path'], {}), '(request.method, self.base_uri, request.path)\n', (1011, 1056), False, 'from py_fake_... |
"""
This module defines functions to install c extensions for all the platforms into
Kolibri.
It is required to have pip version greater than 19.3.1 to run this script.
Usage:
> python build_tools/install_cexts.py --file "requirements/cext.txt" --cache-path "/cext_cache"
It reads the package name and version from req... | [
"subprocess.check_output",
"os.listdir",
"argparse.ArgumentParser",
"os.path.join",
"requests.get",
"os.path.realpath",
"os.path.dirname",
"bs4.BeautifulSoup",
"sys.exit",
"os.remove"
] | [((2468, 2524), 'os.path.join', 'os.path.join', (['path', 'platform_split[0]', 'platform_split[1]'], {}), '(path, platform_split[0], platform_split[1])\n', (2480, 2524), False, 'import os\n'), ((9956, 10052), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Downloading and installing Pytho... |
import sys
import os
import yaml
import jinja2
import glob
from conda_build.config import Config
from conda_build.metadata import MetaData
from distutils.version import LooseVersion
config = Config()
recipe_metadata = MetaData(os.path.join(sys.argv[1]))
binary_package_glob = os.path.join(config.bldpkgs_dir, '{0}*.tar.... | [
"glob.glob",
"os.path.join",
"conda_build.config.Config"
] | [((192, 200), 'conda_build.config.Config', 'Config', ([], {}), '()\n', (198, 200), False, 'from conda_build.config import Config\n'), ((228, 253), 'os.path.join', 'os.path.join', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (240, 253), False, 'import os\n'), ((381, 411), 'glob.glob', 'glob.glob', (['binary_package_glob'],... |
#!/usr/bin/python3
'''
Abstract:
This is a program for ploting
Usage:
plot_signal_noise_ratio.py [sed data]
The input sed data should arranged like that:
[ S1, S2, S3, ..., N1, N2, N3, ...],
[ S1, S2, S3, ..., N1, N2, N3, ...],
...
Editor:
Jacob975
#################################... | [
"numpy.loadtxt",
"numpy.logspace",
"time.time",
"matplotlib.pyplot.subplots"
] | [((837, 848), 'time.time', 'time.time', ([], {}), '()\n', (846, 848), False, 'import time\n'), ((1269, 1289), 'numpy.loadtxt', 'np.loadtxt', (['sed_name'], {}), '(sed_name)\n', (1279, 1289), True, 'import numpy as np\n'), ((1635, 1699), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(3)', '(3)'], {'figsize': '(16, 12... |