code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from collections import deque
from collections import namedtuple
import sys
# with open('data/day18_test.txt') as f:
# # with open('data/day18.txt') as f:
# data = f.read().splitlines()
# C = len(data[0])
# R = len(data)
DR = [-1, 0, 1, 0]
DC = [0, 1, 0, -1]
# Pos = namedtuple('Pos', ['r', 'c', 'mykeys', 'd'])
# ... | [
"sys.exit",
"collections.namedtuple",
"collections.deque"
] | [((1683, 1743), 'collections.namedtuple', 'namedtuple', (['"""Pos"""', "['r', 'c', 'mykeys', 'd', 'id', 'others']"], {}), "('Pos', ['r', 'c', 'mykeys', 'd', 'id', 'others'])\n", (1693, 1743), False, 'from collections import namedtuple\n'), ((1767, 1774), 'collections.deque', 'deque', ([], {}), '()\n', (1772, 1774), Fal... |
from fractions import Fraction
from typing import List
from typing import Tuple
from adventofcode.util.helpers import solution_timer
from adventofcode.util.input_helpers import get_input_for_day
def print_board(board: List[List[int]]):
for row in board:
print("".join("." if x == 0 else str(x) for x in ro... | [
"adventofcode.util.input_helpers.get_input_for_day",
"fractions.Fraction",
"adventofcode.util.helpers.solution_timer"
] | [((1673, 1699), 'adventofcode.util.helpers.solution_timer', 'solution_timer', (['(2021)', '(5)', '(1)'], {}), '(2021, 5, 1)\n', (1687, 1699), False, 'from adventofcode.util.helpers import solution_timer\n'), ((2268, 2294), 'adventofcode.util.helpers.solution_timer', 'solution_timer', (['(2021)', '(5)', '(2)'], {}), '(2... |
"""
ffs.contrib.http
An HTTPath implementation on top of ffs.Path.
"""
#
# !!! We should do some further thinking around what constitutes
# an absolute path for http
#
import os
import urlparse
from lxml import html
import requests
import urlhelp
import ffs
from ffs.util import Flike, wraps
class HTTPFlike(Flike):
... | [
"ffs.exceptions.InappropriateError",
"ffs.path.BasePath.__iadd__",
"ffs.util.Flike.__init__",
"ffs.path.BasePath.__init__",
"urlhelp.find_links",
"lxml.html.fromstring",
"ffs.util.wraps",
"urlparse.urlparse",
"urlhelp.protocolise",
"requests.get"
] | [((4943, 4986), 'ffs.util.wraps', 'wraps', (['ffs.filesystem.BaseFilesystem.parent'], {}), '(ffs.filesystem.BaseFilesystem.parent)\n', (4948, 4986), False, 'from ffs.util import Flike, wraps\n'), ((729, 753), 'lxml.html.fromstring', 'html.fromstring', (['args[0]'], {}), '(args[0])\n', (744, 753), False, 'from lxml impo... |
import unittest
import copy
import os
from unittest.mock import patch, Mock
import weaviate
from test.util import replace_connection, mock_run_rest, check_error_message, check_startswith_error_message
from weaviate.connect import REST_METHOD_POST, REST_METHOD_DELETE, REST_METHOD_GET
from weaviate.exceptions import Sche... | [
"test.util.check_error_message",
"weaviate.schema.crud_schema._property_is_primitive",
"test.util.check_startswith_error_message",
"os.path.dirname",
"unittest.mock.Mock",
"test.util.replace_connection",
"weaviate.exceptions.RequestsConnectionError",
"weaviate.Client",
"test.util.mock_run_rest"
] | [((4392, 4432), 'weaviate.Client', 'weaviate.Client', (['"""http://localhost:8080"""'], {}), "('http://localhost:8080')\n", (4407, 4432), False, 'import weaviate\n'), ((4575, 4581), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (4579, 4581), False, 'from unittest.mock import patch, Mock\n'), ((4605, 4611), 'unittest.... |
# Generated by Django 3.2.4 on 2021-06-25 07:28
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('api_telemed', '0002_teste'),
]
operations = [
migrations.DeleteModel(
name='teste',
),
]
| [
"django.db.migrations.DeleteModel"
] | [((218, 254), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""teste"""'}), "(name='teste')\n", (240, 254), False, 'from django.db import migrations\n')] |
"""Build a project using PEP 517 hooks.
"""
import argparse
import logging
import os
import shutil
from .envbuild import BuildEnvironment
from pep517 import Pep517HookCaller
from pep517.pyproject import load_system, validate_system
from .dirtools import tempdir, mkdir_p
log = logging.getLogger(__name__)
def _do_bui... | [
"argparse.ArgumentParser",
"os.path.basename",
"pep517.pyproject.load_system",
"pep517.pyproject.validate_system",
"os.path.join",
"logging.getLogger"
] | [((279, 306), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (296, 306), False, 'import logging\n'), ((1405, 1430), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1428, 1430), False, 'import argparse\n'), ((1075, 1115), 'os.path.join', 'os.path.join', (['source_d... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import user_management.api.models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='AuthToken',
... | [
"django.db.models.CharField",
"django.db.models.DateTimeField"
] | [((365, 431), 'django.db.models.CharField', 'models.CharField', ([], {'primary_key': '(True)', 'serialize': '(False)', 'max_length': '(40)'}), '(primary_key=True, serialize=False, max_length=40)\n', (381, 431), False, 'from django.db import models, migrations\n'), ((462, 533), 'django.db.models.DateTimeField', 'models.... |
import json
import os
import numpy
import matplotlib.pyplot as plt
import networkx as nx
from scipy.misc import imread
from utils import root
import scipy.spatial
from global_map import plot_map
def graph_from_waypoints(filename):
with open(filename) as f:
car_graph = json.loads(f.read())
G = n... | [
"matplotlib.pyplot.show",
"networkx.draw",
"networkx.get_node_attributes",
"networkx.DiGraph",
"os.path.join",
"global_map.plot_map"
] | [((319, 331), 'networkx.DiGraph', 'nx.DiGraph', ([], {}), '()\n', (329, 331), True, 'import networkx as nx\n'), ((784, 794), 'global_map.plot_map', 'plot_map', ([], {}), '()\n', (792, 794), False, 'from global_map import plot_map\n'), ((806, 838), 'networkx.get_node_attributes', 'nx.get_node_attributes', (['G', '"""pos... |
import tkinter as tk
import colors as c
import random
class Game(tk.Frame):
def __init__(self):
tk.Frame.__init__(self)
self.grid()
self.master.title("2048")
self.main_grid = tk.Frame(
self, bg=c.GRID_COLOR, bd=3, width=600, height=600
)
self.main_grid.... | [
"random.randint",
"tkinter.Frame.__init__",
"random.choice",
"tkinter.Frame",
"tkinter.Label"
] | [((109, 132), 'tkinter.Frame.__init__', 'tk.Frame.__init__', (['self'], {}), '(self)\n', (126, 132), True, 'import tkinter as tk\n'), ((213, 273), 'tkinter.Frame', 'tk.Frame', (['self'], {'bg': 'c.GRID_COLOR', 'bd': '(3)', 'width': '(600)', 'height': '(600)'}), '(self, bg=c.GRID_COLOR, bd=3, width=600, height=600)\n', ... |
#!/bin/env python
import json
from websocket import create_connection # type: ignore
import logging
import sys
import os
## var setup
MYCROFTCL_LOGGING = os.environ.get("MYCROFTCL_LOGGING", logging.WARN)
logging.basicConfig(level=MYCROFTCL_LOGGING)
local_file_path = os.path.dirname(os.path.realpath(__file__))
MYCROFT... | [
"json.load",
"logging.debug",
"sys.stdin.isatty",
"logging.basicConfig",
"os.path.realpath",
"json.dumps",
"os.environ.get",
"websocket.create_connection"
] | [((156, 205), 'os.environ.get', 'os.environ.get', (['"""MYCROFTCL_LOGGING"""', 'logging.WARN'], {}), "('MYCROFTCL_LOGGING', logging.WARN)\n", (170, 205), False, 'import os\n'), ((206, 250), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'MYCROFTCL_LOGGING'}), '(level=MYCROFTCL_LOGGING)\n', (225, 250), Fal... |
import os
import hashlib
import requests
def get_checksums_and_file_names(path):
""" Reads the local checksums file """
with open(path) as in_f:
return zip(*[map(lambda x: x.strip('\n\r\t '), l.strip(" ").split(" ", maxsplit=1)) for l in in_f.readlines()])
def validate_sha256(local_path, sha256):
... | [
"hashlib.sha256",
"os.remove",
"os.path.exists",
"requests.get"
] | [((446, 462), 'hashlib.sha256', 'hashlib.sha256', ([], {}), '()\n', (460, 462), False, 'import hashlib\n'), ((954, 978), 'os.path.exists', 'os.path.exists', (['out_path'], {}), '(out_path)\n', (968, 978), False, 'import os\n'), ((1221, 1269), 'requests.get', 'requests.get', (['download_url'], {'allow_redirects': '(True... |
import model3 as M
import numpy as np
import tensorflow as tf
import data_reader
class VariationalDrop(M.Model):
# arxiv 1512.05287
def initialize(self, drop_rate):
self.drop_rate = drop_rate
def _get_mask(self, shape):
# (time, batch, dim)
mask = np.random.choice(2, size=(1, shape[1], shape[2]), p=[1-self... | [
"model3.Saver",
"model3.LSTM",
"tensorflow.square",
"data_reader.data_reader",
"tensorflow.convert_to_tensor",
"tensorflow.reduce_mean",
"tensorflow.optimizers.Adam",
"model3.Dense",
"numpy.random.choice",
"tensorflow.GradientTape"
] | [((1014, 1039), 'data_reader.data_reader', 'data_reader.data_reader', ([], {}), '()\n', (1037, 1039), False, 'import data_reader\n'), ((1067, 1092), 'tensorflow.optimizers.Adam', 'tf.optimizers.Adam', (['(0.001)'], {}), '(0.001)\n', (1085, 1092), True, 'import tensorflow as tf\n'), ((1102, 1116), 'model3.Saver', 'M.Sav... |
import importlib
import inspect
import pandas as pd
import pymarketstore as pymkts
from collections import defaultdict
from typing import *
from .base_symbol_analyzer import SymbolAnalyzer
class AnalyzersRunner:
def __init__(self, analyzers_module_name, day=None):
self.analyzers_module_name = analyzers_... | [
"collections.defaultdict",
"importlib.import_module",
"pymarketstore.Client"
] | [((377, 392), 'pymarketstore.Client', 'pymkts.Client', ([], {}), '()\n', (390, 392), True, 'import pymarketstore as pymkts\n'), ((1950, 2001), 'importlib.import_module', 'importlib.import_module', (['self.analyzers_module_name'], {}), '(self.analyzers_module_name)\n', (1973, 2001), False, 'import importlib\n'), ((2270,... |
import pygame
from settings import *
from os import listdir
class Paddle(pygame.sprite.Sprite):
def __init__(self, groups):
super().__init__(groups)
# Setup
# image is mandatory attribute for pygame sprites.
self.textures = []
for image in listdir(IMGS_DIR / 'paddle'):
... | [
"pygame.math.Vector2",
"pygame.transform.scale",
"pygame.image.load",
"pygame.key.get_pressed",
"os.listdir"
] | [((286, 314), 'os.listdir', 'listdir', (["(IMGS_DIR / 'paddle')"], {}), "(IMGS_DIR / 'paddle')\n", (293, 314), False, 'from os import listdir\n'), ((834, 855), 'pygame.math.Vector2', 'pygame.math.Vector2', ([], {}), '()\n', (853, 855), False, 'import pygame\n'), ((917, 941), 'pygame.key.get_pressed', 'pygame.key.get_pr... |
# -*- coding: utf-8 -*-
## @file testsuite/python/cvMatTest.py
## @date jan. 2017
## @author PhRG - opticalp.fr
##
## Test the cvMat data generator modules
#
# Copyright (c) 2017 <NAME> / Opticalp
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated d... | [
"instru.Factory",
"os.remove",
"os.path.basename",
"os.path.realpath",
"instru.dataLoggerClasses",
"os.path.dirname",
"time.sleep",
"instru.waitAll",
"instru.runModule",
"instru.DataLogger",
"os.listdir"
] | [((1563, 1588), 'instru.Factory', 'Factory', (['"""DataGenFactory"""'], {}), "('DataGenFactory')\n", (1570, 1588), False, 'from instru import Factory, DataLogger\n'), ((2264, 2281), 'instru.runModule', 'runModule', (['imgGen'], {}), '(imgGen)\n', (2273, 2281), False, 'from instru import bind, dataLoggerClasses, runModu... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from ...utils import common_utils
from .roi_head_template import RoIHeadTemplate
from ..model_utils.model_nms_utils import class_agnostic_nms
class CenterROIHead(RoIHeadTemplate):
def __init__(self, input_channels, model_cfg, num_class=1, code_si... | [
"torch.nn.Dropout",
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.nn.Conv1d",
"torch.nn.BatchNorm1d",
"torch.nn.init.normal_",
"torch.clamp",
"torch.nn.init.constant_",
"torch.floor",
"torch.no_grad"
] | [((1091, 1121), 'torch.nn.Sequential', 'nn.Sequential', (['*shared_fc_list'], {}), '(*shared_fc_list)\n', (1104, 1121), True, 'import torch.nn as nn\n'), ((2240, 2302), 'torch.nn.init.normal_', 'nn.init.normal_', (['self.reg_layers[-1].weight'], {'mean': '(0)', 'std': '(0.001)'}), '(self.reg_layers[-1].weight, mean=0, ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os, time, json, urllib3, mysql.connector
DB_DATA = {
"USER": "DB_admin",
"PASS": "<PASSWORD>",
"DB": "dispositivos"
}
EMULATOR_DATA = {
"IP": "172.22.0.98",
"PORT": "8000"
}
# We need to open a transaction for EACH access so that we see an updated version of the ... | [
"time.sleep",
"urllib3.PoolManager",
"json.loads"
] | [((990, 1011), 'urllib3.PoolManager', 'urllib3.PoolManager', ([], {}), '()\n', (1009, 1011), False, 'import os, time, json, urllib3, mysql.connector\n'), ((1247, 1272), 'json.loads', 'json.loads', (['response.data'], {}), '(response.data)\n', (1257, 1272), False, 'import os, time, json, urllib3, mysql.connector\n'), ((... |
import io
import locale
from datetime import datetime
strptime = datetime.strptime
from logging import info, exception
from os import mkdir, startfile
from os.path import join, splitext, split, exists
from re import findall, error
from subprocess import Popen, PIPE, STDOUT, getoutput
from tempfile import TemporaryDire... | [
"os.mkdir",
"threading.Thread.__init__",
"subprocess.Popen",
"tempfile.TemporaryDirectory",
"re.error",
"timerpy.Timer",
"os.path.exists",
"logging.info",
"re.findall",
"io.TextIOWrapper",
"os.path.splitext",
"locale.setlocale",
"subprocess.getoutput",
"os.path.join",
"os.startfile",
"... | [((1392, 1406), 'os.path.splitext', 'splitext', (['time'], {}), '(time)\n', (1400, 1406), False, 'from os.path import join, splitext, split, exists\n'), ((1418, 1449), 're.findall', 'findall', (['"""([1-9]\\\\d?)|00"""', 'time'], {}), "('([1-9]\\\\d?)|00', time)\n", (1425, 1449), False, 'from re import findall, error\n... |
import pandas as pd
from Bio import SeqIO
fasta_sequences = SeqIO.parse(open('sars2_8thApril2021/msa_0406/msa_0406.fasta'),'fasta')
meta_data = pd.read_csv('sars2_8thApril2021/metadata.tsv', delimiter="\t")
strains = tuple(meta_data['Virus name'])
epi = tuple(meta_data['Accession ID'])
host = tuple(meta_data['Host'])... | [
"pandas.read_csv"
] | [((145, 207), 'pandas.read_csv', 'pd.read_csv', (['"""sars2_8thApril2021/metadata.tsv"""'], {'delimiter': '"""\t"""'}), "('sars2_8thApril2021/metadata.tsv', delimiter='\\t')\n", (156, 207), True, 'import pandas as pd\n')] |
import argparse
import os
import sys
from pathlib import Path
from playlist.base import PlaylistGenerator
from playlist.config import settings
from playlist.utils.files import read_file
CWD = Path.cwd()
def read_file_in_root_directory(*names, **kwargs):
"""Read a file on root dir."""
return read_file(
... | [
"argparse.ArgumentParser",
"playlist.config.settings.get",
"os.path.dirname",
"platform.platform",
"sys.stderr.write",
"traceback.format_exc",
"pathlib.Path.cwd"
] | [((194, 204), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (202, 204), False, 'from pathlib import Path\n'), ((500, 565), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'usage': '"""%(prog)s [ spotify | inventory ]"""'}), "(usage='%(prog)s [ spotify | inventory ]')\n", (523, 565), False, 'import argpa... |
import regex
import pickle
import os.path
from pynab import log, root_dir
# category codes
# these are stored in the db, as well
CAT_GAME_NDS = 1010
CAT_GAME_PSP = 1020
CAT_GAME_WII = 1030
CAT_GAME_XBOX = 1040
CAT_GAME_XBOX360 = 1050
CAT_GAME_WIIWARE = 1060
CAT_GAME_XBOX360DLC = 1070
CAT_GAME_PS3 = 1080
CAT_MOVIE_FO... | [
"regex.findall"
] | [((1401, 1433), 'regex.findall', 'regex.findall', (['reg', 'str', 'regex.I'], {}), '(reg, str, regex.I)\n', (1414, 1433), False, 'import regex\n'), ((1594, 1624), 'regex.findall', 'regex.findall', (['"""[\\\\w\']+"""', 'name'], {}), '("[\\\\w\']+", name)\n', (1607, 1624), False, 'import regex\n')] |
import unittest
from py_kor.pk_types import *
from py_kor.pk_utilities import Scope
class ScopeTestCase(unittest.TestCase):
def setUp(self) -> None:
def increment(value: RInteger) -> None:
value += 1
pass
def decrement(value: RInteger) -> None:
value -= 1
... | [
"py_kor.pk_utilities.Scope"
] | [((522, 529), 'py_kor.pk_utilities.Scope', 'Scope', ([], {}), '()\n', (527, 529), False, 'from py_kor.pk_utilities import Scope\n')] |
from core import Variable
from operation import *
a = Variable(2)
b = square(a)
c = square(b)
d = square(c)
e = square(d)
e.backward()
print(a.grad)
| [
"core.Variable"
] | [((55, 66), 'core.Variable', 'Variable', (['(2)'], {}), '(2)\n', (63, 66), False, 'from core import Variable\n')] |
"""Custom parameter types for the click-based CLI"""
import click
from PIL import ImageColor
class Color(click.ParamType):
"""Parameter type representing a color as name, hex or rgb value"""
name = "color"
def convert(self, value, param, ctx):
if isinstance(value, tuple):
# click 8.... | [
"PIL.ImageColor.getrgb"
] | [((495, 519), 'PIL.ImageColor.getrgb', 'ImageColor.getrgb', (['value'], {}), '(value)\n', (512, 519), False, 'from PIL import ImageColor\n')] |
from collections import defaultdict
def distance(x1,y1,x2,y2):
return abs(x1-x2) + abs(y1-y2)
Cs = []
fname = 'input/day-06.txt'
with open(fname) as f:
content = f.read().splitlines()
for val in content:
x, y = [int(c) for c in val.split(',')]
Cs.append((x,y))
xmin = min([x for x,y in Cs... | [
"collections.defaultdict"
] | [((421, 437), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (432, 437), False, 'from collections import defaultdict\n'), ((648, 664), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (659, 664), False, 'from collections import defaultdict\n')] |
import sqlite3
connection = sqlite3.connect("data.db")
#When getting rows, use different method to print rows
connection.row_factory = sqlite3.Row
def create_table():
with connection:
connection.execute("CREATE TABLE IF NOT EXISTS entries (content TEXT, date TEXT);")
def add_entry(entry_content, entry_... | [
"sqlite3.connect"
] | [((28, 54), 'sqlite3.connect', 'sqlite3.connect', (['"""data.db"""'], {}), "('data.db')\n", (43, 54), False, 'import sqlite3\n')] |
from src.shared import db
# Required models
from src.models.account import Account
from src.models.tag import Tag
from src.models.response import Response
from typing import List
from string import ascii_letters, digits
import datetime
class Thread:
def __init__(self, uid: int, author: Account, tags: List[Tag],... | [
"src.shared.db.execute_query",
"src.shared.db.execute_update",
"src.models.response.Response.find_by_thread_id",
"src.models.response.Response.validate",
"src.models.response.Response.create",
"src.models.account.Account",
"src.models.tag.Tag.find_by_thread_id"
] | [((1453, 1585), 'src.shared.db.execute_query', 'db.execute_query', (['"""\n SELECT author_id FROM Thread\n WHERE id = %(id)s;\n """', "{'id': uid}"], {}), '(\n """\n SELECT author_id FROM Thread\n WHERE id = %(id)s;\n """\n , {\'id\': uid})\n', (14... |
import pytest
import numpy as np
from pytsmp import pytsmp
from tests import helpers
class TestMatrixProfile:
def test_MatrixProfile_init(self):
with pytest.raises(TypeError):
t = np.random.rand(1000)
mp = pytsmp.MatrixProfile(t, window_size=100, verbose=False)
class TestSTAMP:
... | [
"numpy.abs",
"numpy.allclose",
"tests.helpers.naive_matrix_profile",
"pytsmp.pytsmp.STAMP",
"pytsmp.pytsmp.SCRIMP",
"pytsmp.pytsmp.MatrixProfile",
"pytest.raises",
"numpy.random.randint",
"pytsmp.pytsmp.PreSCRIMP",
"numpy.loadtxt",
"numpy.tile",
"numpy.random.rand",
"pytest.mark.skip",
"py... | [((42167, 42281), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""Randomized tests on approximate algorithms do not seem a correct thing to do."""'}), "(reason=\n 'Randomized tests on approximate algorithms do not seem a correct thing to do.'\n )\n", (42183, 42281), False, 'import pytest\n'), ((43065,... |
# Copyright (c) 2018 <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, ... | [
"util.speech.Speech",
"time.time"
] | [((1418, 1426), 'util.speech.Speech', 'Speech', ([], {}), '()\n', (1424, 1426), False, 'from util.speech import Speech\n'), ((1210, 1221), 'time.time', 'time.time', ([], {}), '()\n', (1219, 1221), False, 'import time\n')] |
#!/usr/bin/env python2
import zipfile, argparse, sys, threading
def unz(zipf, pw):
zf = zipfile.ZipFile(zipf)
try:
pw = pw.strip('\n')
zf.extractall(pwd=pw)
print("[!] Found! Password = %s" % pw)
sys.exit()
except:
return
if __name__=="__main__":
ap = argparse.... | [
"threading.Thread",
"zipfile.ZipFile",
"argparse.ArgumentParser",
"sys.exit"
] | [((94, 115), 'zipfile.ZipFile', 'zipfile.ZipFile', (['zipf'], {}), '(zipf)\n', (109, 115), False, 'import zipfile, argparse, sys, threading\n'), ((311, 404), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Dictionary bruteforce password-protected zip file"""'}), "(description=\n 'Dicti... |
#!/home/andrew/.envs/venv38/bin/python3
import sys
import numpy as np
def get_input():
for line in sys.stdin:
line = line.strip()
if len(line) == 0:
continue
if line.startswith("target area:"):
fields = line.split()
x_region = tuple(int(x) for x in field... | [
"numpy.maximum",
"numpy.cumsum",
"numpy.max",
"numpy.array",
"numpy.arange"
] | [((1280, 1333), 'numpy.arange', 'np.arange', (["v0['y']", "(v0['y'] - n_points)", '(-1)'], {'dtype': 'int'}), "(v0['y'], v0['y'] - n_points, -1, dtype=int)\n", (1289, 1333), True, 'import numpy as np\n'), ((1356, 1379), 'numpy.cumsum', 'np.cumsum', (['velocities_y'], {}), '(velocities_y)\n', (1365, 1379), True, 'import... |
"""Scan for the PhysBryks and return a list of devices found.
"""
import asyncio
from physbrykweb import physbrykweb as pb
bryks = []
async def run():
bryks = await pb.bryks_discover()
if len(bryks):
for b in bryks:
print(f'{b.getName()} found @ {b.getAddress()}')
else:
print(... | [
"asyncio.get_event_loop",
"physbrykweb.physbrykweb.bryks_discover"
] | [((377, 401), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (399, 401), False, 'import asyncio\n'), ((172, 191), 'physbrykweb.physbrykweb.bryks_discover', 'pb.bryks_discover', ([], {}), '()\n', (189, 191), True, 'from physbrykweb import physbrykweb as pb\n')] |
import sys,os
from query import TCIAClient, get_response
import pandas as pd
import traceback
import zipfile
if __name__ == '__main__':
csv_file_path = sys.argv[1]
root_folder = sys.argv[2]
if csv_file_path.endswith('.csv'):
df = pd.read_csv(csv_file_path)
if csv_file_path.endswi... | [
"pandas.DataFrame",
"os.path.basename",
"pandas.read_csv",
"os.path.dirname",
"os.path.exists",
"query.TCIAClient",
"os.path.join"
] | [((257, 283), 'pandas.read_csv', 'pd.read_csv', (['csv_file_path'], {}), '(csv_file_path)\n', (268, 283), True, 'import pandas as pd\n'), ((756, 776), 'pandas.DataFrame', 'pd.DataFrame', (['mylist'], {}), '(mylist)\n', (768, 776), True, 'import pandas as pd\n'), ((1239, 1264), 'os.path.exists', 'os.path.exists', (['fil... |
import itertools
import logging
from collections import Counter
from distriopt.constants import AssignmentError, NodeResourceError
_log = logging.getLogger(__name__)
class Solution(object):
"""Represent the output of the placement mapping.
Examples
--------
>>> solution.node_info(u)
('t3.2xlarg... | [
"distriopt.constants.AssignmentError",
"distriopt.constants.NodeResourceError",
"logging.getLogger"
] | [((140, 167), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (157, 167), False, 'import logging\n'), ((1246, 1335), 'distriopt.constants.AssignmentError', 'AssignmentError', (['f"""{not_assigned_nodes} have not been assigned to any physical node"""'], {}), "(\n f'{not_assigned_nodes} h... |
from Plugins.Plugin import PluginDescriptor
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Screens.ChoiceBox import ChoiceBox
import Screens.Standby
from Components.ActionMap import ActionMap
from enigma import eTimer, eServiceCenter, iServiceInformation, eConsoleAppContainer, eEnv
fro... | [
"enigma.eEnv.resolve",
"os.chmod",
"enigma.eServiceCenter.getInstance",
"enigma.eConsoleAppContainer",
"enigma.eTimer",
"os.access"
] | [((367, 473), 'enigma.eEnv.resolve', 'eEnv.resolve', (['"""${libdir}/enigma2/python/Plugins/Extensions/ReconstructApSc/bin/reconstruct_apsc"""'], {}), "(\n '${libdir}/enigma2/python/Plugins/Extensions/ReconstructApSc/bin/reconstruct_apsc'\n )\n", (379, 473), False, 'from enigma import eTimer, eServiceCenter, iSer... |
import sqlalchemy
import folium
import markdown
import os
from threatmatrix import processing
from bokeh.embed import components
from flask import Flask, redirect, url_for, render_template, send_file, Markup
app = Flask(__name__)
df = processing.get_data(250)
@app.route("/")
def hello():
path = os.path.abspath(... | [
"os.path.abspath",
"threatmatrix.processing.get_data",
"threatmatrix.processing.create_bar_chart",
"flask.Flask",
"threatmatrix.processing.create_table",
"markdown.markdown",
"flask.render_template",
"threatmatrix.processing.create_map",
"flask.send_file",
"bokeh.embed.components"
] | [((216, 231), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (221, 231), False, 'from flask import Flask, redirect, url_for, render_template, send_file, Markup\n'), ((238, 262), 'threatmatrix.processing.get_data', 'processing.get_data', (['(250)'], {}), '(250)\n', (257, 262), False, 'from threatmatrix impo... |
import socket
import time
def get_time():
return time.strftime('%Y-%m-%d',time.localtime(time.time()))
def get_host_ip():
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('8.8.8.8', 80))
ip = s.getsockname()[0]
finally:
s.close()
return ip
p... | [
"socket.socket",
"time.time"
] | [((149, 197), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (162, 197), False, 'import socket\n'), ((94, 105), 'time.time', 'time.time', ([], {}), '()\n', (103, 105), False, 'import time\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018 All Rights Reserved
#
"""
File: data_processing.py
Author: shileicao(<EMAIL>)
Date: 11/03/2018 9:15 AM
"""
import csv
import argparse
import random
from itertools import chain
from func_utils import MIN_SEQ_LEN, MAX_SEQ_LEN, SIGNAL_WIDTH
def arg_... | [
"csv.reader",
"csv.writer",
"random.randint",
"argparse.ArgumentParser",
"itertools.chain.from_iterable"
] | [((343, 491), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""prepare_data"""', 'formatter_class': 'argparse.RawTextHelpFormatter', 'description': '"""Prepare data for input of deep model"""'}), "(prog='prepare_data', formatter_class=argparse.\n RawTextHelpFormatter, description='Prepare data... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
* Copyright (C) 2017 <NAME>
*
* This file is subject to the terms and conditions of the MIT License
* See the file LICENSE in the top level directory for more details.
"""
from __future__ import absolute_import, print_function, unicode_literals
import textwrap
... | [
"textwrap.dedent"
] | [((375, 910), 'textwrap.dedent', 'textwrap.dedent', (['"""\n <!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="utf-8">\n <meta name="viewport" content="width=device-width, initial-scale=1">\n \n <title>MyPiDrei API</title>\n... |
import pytest
from dotmailer.address_books import AddressBook
from dotmailer.contacts import Contact
@pytest.mark.notdemo
def test_add_contact(sample_address_book):
contact = Contact(email='<EMAIL>')
sample_address_book.add_contact(contact)
assert contact.id is not None
# Clean up by removing the c... | [
"dotmailer.contacts.Contact",
"pytest.raises",
"dotmailer.address_books.AddressBook"
] | [((183, 207), 'dotmailer.contacts.Contact', 'Contact', ([], {'email': '"""<EMAIL>"""'}), "(email='<EMAIL>')\n", (190, 207), False, 'from dotmailer.contacts import Contact\n'), ((507, 546), 'dotmailer.address_books.AddressBook', 'AddressBook', ([], {}), '(**sample_address_book_data)\n', (518, 546), False, 'from dotmaile... |
from django.urls import path
from languages.views import LanguagesListView
urlpatterns = [
path('', LanguagesListView.as_view(), name='LanguagesList'),
]
| [
"languages.views.LanguagesListView.as_view"
] | [((107, 134), 'languages.views.LanguagesListView.as_view', 'LanguagesListView.as_view', ([], {}), '()\n', (132, 134), False, 'from languages.views import LanguagesListView\n')] |
import json
from dotenv import load_dotenv
from square.client import Client
import pymongo
import os
import sys
import random
sys.path.insert(1, './discoverpage/')
sys.path.insert(2, './square-api/customer-api/')
sys.path.insert(3, './square-api/payments-api/')
from discoverpage_metrics import get_recommended_posts, g... | [
"discoverpage_metrics.get_recommended_posts",
"random.sample",
"create_customercard.CustomerCardCreation",
"sys.path.insert",
"json.dumps",
"dotenv.load_dotenv",
"discoverpage_metrics.get_trending_posts",
"discoverpage_metrics.get_hot_deals",
"os.getenv"
] | [((126, 163), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""./discoverpage/"""'], {}), "(1, './discoverpage/')\n", (141, 163), False, 'import sys\n'), ((164, 212), 'sys.path.insert', 'sys.path.insert', (['(2)', '"""./square-api/customer-api/"""'], {}), "(2, './square-api/customer-api/')\n", (179, 212), False, 'imp... |
from . import base
from . import mixins
from datetime import date
class TransformedRecord(
mixins.GenericCompensationMixin,
mixins.GenericDepartmentMixin, mixins.GenericIdentifierMixin,
mixins.GenericJobTitleMixin, mixins.GenericPersonMixin,
mixins.MembershipMixin, mixins.Organization... | [
"datetime.date"
] | [((1621, 1637), 'datetime.date', 'date', (['(2019)', '(2)', '(5)'], {}), '(2019, 2, 5)\n', (1625, 1637), False, 'from datetime import date\n')] |
from src.TreeNode import TreeNode
from operator import itemgetter
class TreeCrawler:
epsilon = 0.0
root = None
def __init__(self, root):
# print("made TreeNode")
if (not isinstance(root, TreeNode)):
print("WARNING: root is not of type TreeNode")
return
s... | [
"src.TreeNode.TreeNode.mergeNodes",
"operator.itemgetter"
] | [((1154, 1213), 'src.TreeNode.TreeNode.mergeNodes', 'TreeNode.mergeNodes', (["shortesDistances[0]['Node']", 'self.root'], {}), "(shortesDistances[0]['Node'], self.root)\n", (1173, 1213), False, 'from src.TreeNode import TreeNode\n'), ((608, 630), 'operator.itemgetter', 'itemgetter', (['"""distance"""'], {}), "('distanc... |
import collections
import fractions
import unittest
import utils
# O(n) time. O(1) space. Two pointers.
class Solution:
def reverseOnlyLetters(self, s):
"""
:type s: str
:rtype: str
"""
s = list(s)
lo = 0
hi = len(s) - 1
while True:
whil... | [
"unittest.main",
"utils.load_test_json"
] | [((998, 1013), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1011, 1013), False, 'import unittest\n'), ((726, 756), 'utils.load_test_json', 'utils.load_test_json', (['__file__'], {}), '(__file__)\n', (746, 756), False, 'import utils\n')] |
import os
PROJECT_ROOT_DIRECTORY = '/'.join(os.path.dirname(__file__).split(os.sep)[:-1])
# If you didn't install TestEngine in this project's root folder, change this to the path of your .dll folder
TEST_ENGINE_DIRECTORY = '{0}/Neo.TestEngine'.format(PROJECT_ROOT_DIRECTORY)
| [
"os.path.dirname"
] | [((45, 70), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (60, 70), False, 'import os\n')] |
"""
Given an undirected graph with n vertices and m edges, check whether it is bipartite.
An undirected graph is called bipartite if its vertices can be split into two parts such that each edge of the
graph joins to vertices from different parts. Bipartite graphs arise naturally in applications where a graph
is used t... | [
"collections.deque"
] | [((1031, 1038), 'collections.deque', 'deque', ([], {}), '()\n', (1036, 1038), False, 'from collections import deque\n')] |
from flask import Blueprint, request, g
from .. import api
inference_api = Blueprint('inference_api', __name__)
@inference_api.route('/v1/object_detection', methods=['POST'])
def get_object_detection_prediction():
confidence_thresh = request.json.get('confidence_threshold', 0.5)
attr_thresh = request.json.g... | [
"flask.request.json.get",
"flask.Blueprint"
] | [((77, 113), 'flask.Blueprint', 'Blueprint', (['"""inference_api"""', '__name__'], {}), "('inference_api', __name__)\n", (86, 113), False, 'from flask import Blueprint, request, g\n'), ((242, 287), 'flask.request.json.get', 'request.json.get', (['"""confidence_threshold"""', '(0.5)'], {}), "('confidence_threshold', 0.5... |
import numpy as np
class NeuralNetwork():
def __init__(self):
# DO NOT CHANGE PARAMETERS
self.input_to_hidden_weights = np.matrix('1 1; 1 1; 1 1')
self.hidden_to_output_weights = np.matrix('1 1 1')
self.biases = np.matrix('0; 0; 0')
self.learning_rate = .001
self.ep... | [
"numpy.matrix",
"numpy.vectorize",
"numpy.maximum",
"numpy.array",
"numpy.dot"
] | [((142, 168), 'numpy.matrix', 'np.matrix', (['"""1 1; 1 1; 1 1"""'], {}), "('1 1; 1 1; 1 1')\n", (151, 168), True, 'import numpy as np\n'), ((209, 227), 'numpy.matrix', 'np.matrix', (['"""1 1 1"""'], {}), "('1 1 1')\n", (218, 227), True, 'import numpy as np\n'), ((250, 270), 'numpy.matrix', 'np.matrix', (['"""0; 0; 0""... |
# -*- coding: utf-8 -*-
"""
blogger
-------
A personal blog framework with flask and sqlite3
:copyright: (c) 2017 by cjhang.
:license: MIT, see LICENSE for details.
"""
import os
import sqlite3
import codecs
from datetime import date
import markdown
from flask import Flask, request, g, redire... | [
"flask.flash",
"codecs.open",
"flask.Flask",
"datetime.date.today",
"flask.url_for",
"sqlite3.connect",
"flask.render_template",
"markdown.Markdown",
"flask.send_from_directory",
"flask.g.sqlite_db.close",
"os.path.join",
"os.listdir"
] | [((414, 429), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (419, 429), False, 'from flask import Flask, request, g, redirect, url_for, render_template, flash, send_from_directory\n'), ((458, 499), 'os.path.join', 'os.path.join', (['app.root_path', '"""blogger.db"""'], {}), "(app.root_path, 'blogger.db')\... |
from django.utils.text import slugify
from faker import Faker
import factory
from factory.django import DjangoModelFactory
from video.models import Videos
from areas.tests.faker_data import CityTownFactory
import random
fake = Faker()
class Climbing_Name_Random():
climbs = ['The Pocket', 'Ground Zero', 'Samu... | [
"factory.Faker",
"random.randint",
"faker.Faker",
"factory.SubFactory",
"django.utils.text.slugify"
] | [((232, 239), 'faker.Faker', 'Faker', ([], {}), '()\n', (237, 239), False, 'from faker import Faker\n'), ((463, 492), 'random.randint', 'random.randint', (['(0)', 'num_climbs'], {}), '(0, num_climbs)\n', (477, 492), False, 'import random\n'), ((665, 700), 'factory.SubFactory', 'factory.SubFactory', (['CityTownFactory']... |
from networkx import DiGraph
from tests.data.data_registry import PATH_INFO_GRAPH, PATH_INFO_GRAPH_OUTPUT
from thucydides.datasets.info_graph_dataset import InfoGraphDataSet
def test_info_graph_dataset_save() -> None:
if PATH_INFO_GRAPH_OUTPUT.is_file():
PATH_INFO_GRAPH_OUTPUT.unlink()
nx_g = DiGrap... | [
"networkx.DiGraph",
"tests.data.data_registry.PATH_INFO_GRAPH_OUTPUT.is_file",
"tests.data.data_registry.PATH_INFO_GRAPH_OUTPUT.unlink",
"thucydides.datasets.info_graph_dataset.InfoGraphDataSet"
] | [((228, 260), 'tests.data.data_registry.PATH_INFO_GRAPH_OUTPUT.is_file', 'PATH_INFO_GRAPH_OUTPUT.is_file', ([], {}), '()\n', (258, 260), False, 'from tests.data.data_registry import PATH_INFO_GRAPH, PATH_INFO_GRAPH_OUTPUT\n'), ((314, 323), 'networkx.DiGraph', 'DiGraph', ([], {}), '()\n', (321, 323), False, 'from networ... |
import pytest
from tekdrive import TekDrive
from tekdrive.exceptions import (
ClientException,
TekDriveAPIException,
FileGoneAPIException,
)
from .base import UnitTest
class TestTekDrive(UnitTest):
FAKE_KEY = "abc123"
def test_access_key_required(self):
with pytest.raises(ClientExceptio... | [
"pytest.raises",
"tekdrive.TekDrive"
] | [((556, 604), 'tekdrive.TekDrive', 'TekDrive', ([], {'access_key': '"""abc123"""', 'base_url': 'base_url'}), "(access_key='abc123', base_url=base_url)\n", (564, 604), False, 'from tekdrive import TekDrive\n'), ((292, 322), 'pytest.raises', 'pytest.raises', (['ClientException'], {}), '(ClientException)\n', (305, 322), F... |
from typing import Any, Dict, Optional
from apii.machine_calls import Caller, MachineCalls
class SDICalls:
"""
SDI_Calls class is the first link in the chain or responsibility. Retrieving calls from the APII, it either prepares
those calls for the Caller or passes it to the Machine_Calls class. Calls pre... | [
"apii.machine_calls.MachineCalls"
] | [((614, 634), 'apii.machine_calls.MachineCalls', 'MachineCalls', (['caller'], {}), '(caller)\n', (626, 634), False, 'from apii.machine_calls import Caller, MachineCalls\n')] |
#!/usr/bin/env python3
import itertools
import multiprocessing as mp
def isValid0(l):
return sum(l[0:3]) == 38 and sum(l[3:7]) == 38 and sum(l[7:12]) == 38 and sum(l[12:16]) == 38 and sum(l[16:19]) == 38
def rotate(it, indices):
return map(lambda index: it[index], indices)
rotation1 = [2, 6, 11, 1, 5, 10, 1... | [
"itertools.permutations",
"multiprocessing.cpu_count"
] | [((814, 828), 'multiprocessing.cpu_count', 'mp.cpu_count', ([], {}), '()\n', (826, 828), True, 'import multiprocessing as mp\n'), ((914, 945), 'itertools.permutations', 'itertools.permutations', (['numbers'], {}), '(numbers)\n', (936, 945), False, 'import itertools\n')] |
from matplotlib import pyplot as plt
import networkx as nx
graph = nx.Graph()
with open('model.out') as f:
for line in f:
line = line.split()
if line:
graph.add_edge(int(line[0]), int(line[1]))
# end if
# end for
# end with
with open('match.out') as f:
matched = [int(i... | [
"matplotlib.pyplot.show",
"networkx.draw_networkx_edges",
"matplotlib.pyplot.yticks",
"networkx.draw_networkx_nodes",
"networkx.Graph",
"networkx.draw_networkx_labels",
"matplotlib.pyplot.xticks",
"networkx.shell_layout"
] | [((68, 78), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (76, 78), True, 'import networkx as nx\n'), ((428, 450), 'networkx.shell_layout', 'nx.shell_layout', (['graph'], {}), '(graph)\n', (443, 450), True, 'import networkx as nx\n'), ((482, 588), 'networkx.draw_networkx_nodes', 'nx.draw_networkx_nodes', (['graph', '... |
#
# Copyright 2016-2017 Games Creators Club
#
# MIT License
#
import sys
import time
import pygame
import pyros
import pyros.gcc
import pyros.gccui
import pyros.agent
import pyros.pygamehelper
WHITE = (255, 255, 255)
MAX_PING_TIMEOUT = 1
INITIAL_SPEED = 40
INITIAL_SIDE_GAIN = 0.4
INITIAL_FORWARD_GAIN = 1.0
INITIAL_... | [
"pygame.quit",
"pyros.agent.keepAgents",
"pyros.gccui.initAll",
"pyros.gcc.drawConnection",
"pygame.event.get",
"pyros.publish",
"pyros.pygamehelper.processKeys",
"pyros.gccui.background",
"pyros.gcc.handleConnectKeyDown",
"pyros.loop",
"pyros.gccui.frameEnd",
"pyros.gcc.getPort",
"pyros.gcc... | [((746, 783), 'pyros.gccui.initAll', 'pyros.gccui.initAll', (['(600, 600)', '(True)'], {}), '((600, 600), True)\n', (765, 783), False, 'import pyros\n'), ((6403, 6458), 'pyros.subscribe', 'pyros.subscribe', (['"""maze/data/distances"""', 'handleDistances'], {}), "('maze/data/distances', handleDistances)\n", (6418, 6458... |
import requests
import time
from decimal import Decimal
CMC_API_KEY = None
class ExchangeRates():
def __init__(self):
self.limit = 200
self.cmc_url = 'https://pro-api.coinmarketcap.com/'
self.cmc_endpoint = 'v1/cryptocurrency/listings/latest?sort=market_cap&start=1&limit={}'.format(self.l... | [
"requests.get",
"decimal.Decimal"
] | [((722, 764), 'requests.get', 'requests.get', (['url'], {'headers': 'self.cmc_header'}), '(url, headers=self.cmc_header)\n', (734, 764), False, 'import requests\n'), ((1109, 1121), 'decimal.Decimal', 'Decimal', (['(1.0)'], {}), '(1.0)\n', (1116, 1121), False, 'from decimal import Decimal\n'), ((924, 959), 'decimal.Deci... |
import logging
import colorlog
__version__ = "0.0.1"
def format_logger(logger: logging.Logger, debug: bool):
message_format = "%(log_color)s[%(asctime)s.%(msecs).03d pid#%(process)d# %(levelname).1s] %(message)s"
date_format = "%Y%m%dT%H:%M:%S"
log_colors = {
"DEBUG": "cyan",
"INFO": "gre... | [
"colorlog.ColoredFormatter",
"logging.StreamHandler"
] | [((433, 523), 'colorlog.ColoredFormatter', 'colorlog.ColoredFormatter', (['message_format'], {'datefmt': 'date_format', 'log_colors': 'log_colors'}), '(message_format, datefmt=date_format, log_colors=\n log_colors)\n', (458, 523), False, 'import colorlog\n'), ((561, 584), 'logging.StreamHandler', 'logging.StreamHand... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | [
"openerp.osv.fields.many2one",
"openerp.osv.fields.many2many"
] | [((1118, 1175), 'openerp.osv.fields.many2one', 'fields.many2one', (['"""crm.case.section"""', '"""Default Sales Team"""'], {}), "('crm.case.section', 'Default Sales Team')\n", (1133, 1175), False, 'from openerp.osv import osv, fields\n'), ((1601, 1650), 'openerp.osv.fields.many2one', 'fields.many2one', (['"""crm.case.s... |
import datetime
import json
from http.client import CannotSendRequest
from json import JSONEncoder
from uuid import UUID
from xmlrpc.client import ServerProxy
from arcsecond import ArcsecondAPI
from playhouse.shortcuts import model_to_dict
from oort.shared.config import (
get_oort_config_folder_section,
get_o... | [
"oort.shared.config.get_oort_config_upload_folder_sections",
"arcsecond.ArcsecondAPI.is_logged_in",
"oort.shared.config.get_oort_config_folder_section",
"oort.shared.models.Upload.select",
"oort.shared.config.get_oort_config_value",
"json.dumps",
"datetime.datetime.utcnow",
"arcsecond.ArcsecondAPI.use... | [((942, 968), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (966, 968), False, 'import datetime\n'), ((1046, 1085), 'arcsecond.ArcsecondAPI.username', 'ArcsecondAPI.username', ([], {'debug': 'self.debug'}), '(debug=self.debug)\n', (1067, 1085), False, 'from arcsecond import ArcsecondAPI\n'),... |
#!/usr/bin/env python3
import os
def main(args):
table = {}
table['"'] = '\\"'
table['\\'] = '\\\\'
table['\n'] = '\\n'
for arg in args:
with open(arg, 'r') as f:
quoted_lines = []
for line in f:
escaped_line = line.translate(line.maketrans(table))... | [
"os.path.basename"
] | [((486, 507), 'os.path.basename', 'os.path.basename', (['arg'], {}), '(arg)\n', (502, 507), False, 'import os\n')] |
import FWCore.ParameterSet.Config as cms
from PhysicsTools.PatAlgos.recoLayer0.jetCorrFactors_cfi import *
from JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff import *
## for scheduled mode
patJetCorrectionsTask = cms.Task(patJetCorrFactors)
patJetCorrections = cms.Sequence(patJetCorrectionsTask)
| [
"FWCore.ParameterSet.Config.Sequence",
"FWCore.ParameterSet.Config.Task"
] | [((235, 262), 'FWCore.ParameterSet.Config.Task', 'cms.Task', (['patJetCorrFactors'], {}), '(patJetCorrFactors)\n', (243, 262), True, 'import FWCore.ParameterSet.Config as cms\n'), ((283, 318), 'FWCore.ParameterSet.Config.Sequence', 'cms.Sequence', (['patJetCorrectionsTask'], {}), '(patJetCorrectionsTask)\n', (295, 318)... |
# this file uses 'mbox.txt' and gets the mail address from that file
import re
file_name = input("Please enter file nane: ")
try:
file_handle = open(file_name)
except:
print("No such file found")
def example1(fh):
for line in fh:
line = line.rstrip()
x = re.findall("\S+@\S+", line)
... | [
"re.findall"
] | [((287, 316), 're.findall', 're.findall', (['"""\\\\S+@\\\\S+"""', 'line'], {}), "('\\\\S+@\\\\S+', line)\n", (297, 316), False, 'import re\n')] |
import tensorflow as tf
from tensorflow.keras import backend as K
from tensorflow.keras.losses import categorical_crossentropy
from config import epsilon, lambda_rpn_regr, lambda_rpn_class, lambda_cls_regr, lambda_cls_class
__all__ = [
'rpn_loss_regr',
'rpn_loss_cls',
'class_loss_regr',
'class_loss_cl... | [
"tensorflow.keras.backend.sum",
"tensorflow.keras.backend.binary_crossentropy",
"tensorflow.keras.backend.abs",
"tensorflow.keras.losses.categorical_crossentropy",
"tensorflow.keras.backend.less_equal"
] | [((838, 846), 'tensorflow.keras.backend.abs', 'K.abs', (['x'], {}), '(x)\n', (843, 846), True, 'from tensorflow.keras import backend as K\n'), ((2352, 2360), 'tensorflow.keras.backend.abs', 'K.abs', (['x'], {}), '(x)\n', (2357, 2360), True, 'from tensorflow.keras import backend as K\n'), ((909, 933), 'tensorflow.keras.... |
"""
This script is used to process the discharge-concentration data.
"""
# import packages
import numpy as np
import pandas as pd
import os
import datetime
# define the repository path
from common_settings import fpath
import matplotlib.pyplot as plt
import seaborn as sns
# Refer to rainfall data to split the data in... | [
"pandas.read_csv",
"datetime.date"
] | [((501, 533), 'pandas.read_csv', 'pd.read_csv', (['(filepath + filename)'], {}), '(filepath + filename)\n', (512, 533), True, 'import pandas as pd\n'), ((1009, 1064), 'datetime.date', 'datetime.date', (['rain.Year[i]', 'rain.Month[i]', 'rain.Day[i]'], {}), '(rain.Year[i], rain.Month[i], rain.Day[i])\n', (1022, 1064), F... |
import FWCore.ParameterSet.Config as cms
mergedtruth = cms.EDProducer("TrackingTruthProducer",
mixLabel = cms.string('mix'),
simHitLabel = cms.string('g4SimHits'),
volumeRadius = cms.double(1200.0),
vertexDistanceCut = cms.double(0.003),
volumeZ = cms.double(3000.0),
mergedBremsstrahlung = cms... | [
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.double",
"FWCore.ParameterSet.Config.bool",
"FWCore.ParameterSet.Config.vstring",
"FWCore.ParameterSet.Config.Sequence"
] | [((1429, 1454), 'FWCore.ParameterSet.Config.Sequence', 'cms.Sequence', (['mergedtruth'], {}), '(mergedtruth)\n', (1441, 1454), True, 'import FWCore.ParameterSet.Config as cms\n'), ((112, 129), 'FWCore.ParameterSet.Config.string', 'cms.string', (['"""mix"""'], {}), "('mix')\n", (122, 129), True, 'import FWCore.Parameter... |
'''
Created on 02/10/2013
@author: david
'''
from easycanvas import EasyCanvas
from algoritmia.datastructures.digraphs import UndirectedGraph
from math import pi
colors = [
"#000000", "#FFFF00", "#1CE6FF", "#FF34FF", "#FF4A46", "#008941", "#006FA6", "#A30059",
"#FFDBE5", "#7A4900", "#0000A6", "#63FFAC", "#B79... | [
"easycanvas.EasyCanvas.__init__",
"algoritmia.datastructures.digraphs.UndirectedGraph"
] | [((3641, 3698), 'algoritmia.datastructures.digraphs.UndirectedGraph', 'UndirectedGraph', ([], {'E': '[((-3, -2), (0, 0)), ((0, 0), (1, 1))]'}), '(E=[((-3, -2), (0, 0)), ((0, 0), (1, 1))])\n', (3656, 3698), False, 'from algoritmia.datastructures.digraphs import UndirectedGraph\n'), ((1764, 1789), 'easycanvas.EasyCanvas.... |
import numpy as np
from tensorflow.contrib.keras.api.keras.models import Sequential,load_model
from tensorflow.contrib.keras.api.keras.layers import Conv2D, MaxPooling2D
from tensorflow.contrib.keras.api.keras.layers import Dropout, Flatten, Dense
import cv2
class Classifier():
def __init__(self,img_shape):
... | [
"numpy.zeros_like",
"tensorflow.contrib.keras.api.keras.layers.Conv2D",
"tensorflow.contrib.keras.api.keras.models.Sequential",
"tensorflow.contrib.keras.api.keras.layers.MaxPooling2D",
"tensorflow.contrib.keras.api.keras.layers.Dense",
"tensorflow.contrib.keras.api.keras.layers.Flatten",
"numpy.array",... | [((408, 420), 'tensorflow.contrib.keras.api.keras.models.Sequential', 'Sequential', ([], {}), '()\n', (418, 420), False, 'from tensorflow.contrib.keras.api.keras.models import Sequential, load_model\n'), ((1527, 1549), 'tensorflow.contrib.keras.api.keras.models.load_model', 'load_model', (['model_path'], {}), '(model_p... |
# 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... | [
"osc_placement.version.lt",
"unittest.mock.Mock",
"six.text_type",
"osc_placement.version.eq",
"osc_placement.version.get_version",
"osc_placement.version.gt",
"osc_placement.version.le",
"osc_placement.version.ge"
] | [((3460, 3471), 'unittest.mock.Mock', 'mock.Mock', ([], {}), '()\n', (3469, 3471), False, 'from unittest import mock\n'), ((3553, 3564), 'unittest.mock.Mock', 'mock.Mock', ([], {}), '()\n', (3562, 3564), False, 'from unittest import mock\n'), ((5196, 5207), 'unittest.mock.Mock', 'mock.Mock', ([], {}), '()\n', (5205, 52... |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField, IntegerField
from wtforms import TextAreaField, SelectField, FieldList, FormField, DateField
from wtforms.validators import ValidationError, DataRequired, Email, EqualTo
from wtforms.validators import Length
from ... | [
"wtforms.SelectField",
"wtforms.validators.Email",
"wtforms.validators.Length",
"wtforms.BooleanField",
"app_source.models.User.query.filter_by",
"wtforms.TextAreaField",
"wtforms.SubmitField",
"wtforms.validators.EqualTo",
"wtforms.StringField",
"wtforms.validators.DataRequired",
"wtforms.valid... | [((589, 613), 'wtforms.SubmitField', 'SubmitField', (['"""Connexion"""'], {}), "('Connexion')\n", (600, 613), False, 'from wtforms import StringField, PasswordField, BooleanField, SubmitField, IntegerField\n'), ((979, 1001), 'wtforms.SubmitField', 'SubmitField', (['"""Valider"""'], {}), "('Valider')\n", (990, 1001), Fa... |
from rivescript import RiveScript
DEBUG_RIVESCRIPT=False
BRAIN='brain'
rs = None
def rs_init():
global rs
print("Loading rs brain")
rs = RiveScript(DEBUG_RIVESCRIPT, utf8=True)
rs.load_directory(BRAIN)
rs.sort_replies()
print("rs brain loaded")
def reply(user, msg):
global rs
return ... | [
"rivescript.RiveScript"
] | [((152, 191), 'rivescript.RiveScript', 'RiveScript', (['DEBUG_RIVESCRIPT'], {'utf8': '(True)'}), '(DEBUG_RIVESCRIPT, utf8=True)\n', (162, 191), False, 'from rivescript import RiveScript\n')] |
import logistic
import pandas
import neural
from sqlalchemy import create_engine
from sys import argv, exit
READ_NON_NULL_ENTRIES = """
SELECT * FROM articles
WHERE mean_word_length IS NOT NULL
AND mean_sentence_length IS NOT NULL
AND stddev_word_length IS NOT NULL
AND stddev_sentence_length IS NOT NULL;
"""
def ma... | [
"sqlalchemy.create_engine",
"sys.exit",
"logistic.find_accuracy",
"pandas.read_sql_query"
] | [((627, 656), 'sqlalchemy.create_engine', 'create_engine', (['connect_string'], {}), '(connect_string)\n', (640, 656), False, 'from sqlalchemy import create_engine\n'), ((717, 773), 'pandas.read_sql_query', 'pandas.read_sql_query', (['READ_NON_NULL_ENTRIES', 'connection'], {}), '(READ_NON_NULL_ENTRIES, connection)\n', ... |
# Copyright (c) 2012 - 2015 <NAME>, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
from __future__ import print_function
import click
from .utils import base_url_and_api
@click.command()
@click.option('--result', help="The result to set. Should probably be 'unstable'", defaul... | [
"click.option",
"click.command"
] | [((215, 230), 'click.command', 'click.command', ([], {}), '()\n', (228, 230), False, 'import click\n'), ((232, 338), 'click.option', 'click.option', (['"""--result"""'], {'help': '"""The result to set. Should probably be \'unstable\'"""', 'default': '"""unstable"""'}), '(\'--result\', help=\n "The result to set. Sho... |
## THIS FUNCTION IS UNUSED - THE ACTIVE VERSION LIES IN hs.py
from numba import double, jit, njit, vectorize
from numba import int32, float32, uint8, float64, int64, boolean
import numpy as np
import time
# Apply a line and step function
from numpy import cos, sin, radians
@njit#@vectorize(["boolean (float32, float3... | [
"numpy.stack",
"numpy.radians",
"numpy.meshgrid",
"numpy.multiply",
"numba.float32",
"numpy.zeros",
"numpy.sin",
"numpy.array",
"numpy.linspace",
"numpy.cos"
] | [((2085, 2109), 'numpy.stack', 'np.stack', (['(a, b)'], {'axis': '(2)'}), '((a, b), axis=2)\n', (2093, 2109), True, 'import numpy as np\n'), ((2125, 2186), 'numpy.zeros', 'np.zeros', (['(subsets.shape[0], subsets.shape[0])'], {'dtype': 'np.bool'}), '((subsets.shape[0], subsets.shape[0]), dtype=np.bool)\n', (2133, 2186)... |
# Environment Setup
import os
import shutil
from settings import settings
def main():
os.makedirs(settings['train_data_folder'], exist_ok=True)
products_folder = os.path.join(settings['train_data_folder'], 'products')
reviews_folder = os.path.join(settings['train_data_folder'], 'reviews')
os.makedirs... | [
"os.makedirs",
"os.path.exists",
"os.path.splitext",
"os.path.join",
"os.listdir"
] | [((93, 150), 'os.makedirs', 'os.makedirs', (["settings['train_data_folder']"], {'exist_ok': '(True)'}), "(settings['train_data_folder'], exist_ok=True)\n", (104, 150), False, 'import os\n'), ((173, 228), 'os.path.join', 'os.path.join', (["settings['train_data_folder']", '"""products"""'], {}), "(settings['train_data_fo... |
import unittest
import main
class TestResult(unittest.TestCase):
def test_res(self):
self.assertEqual(main.hello(), "Hello, Jenkins")
if __name__ == "__main__":
unittest.main()
| [
"unittest.main",
"main.hello"
] | [((200, 215), 'unittest.main', 'unittest.main', ([], {}), '()\n', (213, 215), False, 'import unittest\n'), ((119, 131), 'main.hello', 'main.hello', ([], {}), '()\n', (129, 131), False, 'import main\n')] |
import time
import os
import struct
import array
from fcntl import ioctl
import signal
import sys
from spotmicro.utilities.log import Logger
log = Logger().setup_logger('Remote controller')
class RemoteControllerController:
def __init__(self, communication_queues):
try:
log.debug('Starting... | [
"fcntl.ioctl",
"struct.unpack",
"time.sleep",
"array.array",
"signal.signal",
"spotmicro.utilities.log.Logger",
"os.listdir",
"sys.exit"
] | [((148, 156), 'spotmicro.utilities.log.Logger', 'Logger', ([], {}), '()\n', (154, 156), False, 'from spotmicro.utilities.log import Logger\n'), ((1381, 1392), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (1389, 1392), False, 'import sys\n'), ((3865, 3889), 'os.listdir', 'os.listdir', (['"""/dev/input"""'], {}), "('/... |
#!/usr/bin/python3
""" objects that handle all default RestFul API actions for Place - Amenity """
from models.place import Place
from models.amenity import Amenity
from models import storage
from api.v1.views import app_views
from os import environ
from flask import abort, jsonify, make_response, request
from flasgger... | [
"models.storage.get",
"flasgger.utils.swag_from",
"flask.abort",
"os.environ.get",
"flask.jsonify",
"models.storage.save",
"api.v1.views.app_views.route"
] | [((347, 436), 'api.v1.views.app_views.route', 'app_views.route', (['"""places/<place_id>/amenities"""'], {'methods': "['GET']", 'strict_slashes': '(False)'}), "('places/<place_id>/amenities', methods=['GET'],\n strict_slashes=False)\n", (362, 436), False, 'from api.v1.views import app_views\n'), ((451, 538), 'flasgg... |
from __future__ import absolute_import
import numpy as np
import os
import unittest
from numpy.testing import assert_array_almost_equal
from .. import parse_spectrum
FIXTURE_PATH = os.path.dirname(__file__)
FIXTURE_DATA = np.array([[0.4,3.2],[1.2,2.7],[2.0,5.4]])
class TextFormatTests(unittest.TestCase):
def test... | [
"unittest.main",
"os.path.dirname",
"numpy.array",
"numpy.testing.assert_array_almost_equal",
"os.path.join"
] | [((183, 208), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (198, 208), False, 'import os\n'), ((224, 270), 'numpy.array', 'np.array', (['[[0.4, 3.2], [1.2, 2.7], [2.0, 5.4]]'], {}), '([[0.4, 3.2], [1.2, 2.7], [2.0, 5.4]])\n', (232, 270), True, 'import numpy as np\n'), ((764, 779), 'unittest... |
"""
The ``ui.NamedFrame`` class is a variation of the ``ui.Frame`` which lets you
assign a name to the frame. Naming a frame allows you to refer to that frame
by name in Javascript code, and as the target for a hyperlink.
"""
from pyjamas.ui.SimplePanel import SimplePanel
from pyjamas.ui.VerticalPanel import VerticalP... | [
"pyjamas.ui.VerticalPanel.VerticalPanel",
"pyjamas.ui.NamedFrame.NamedFrame",
"pyjamas.ui.HTML.HTML",
"pyjamas.ui.SimplePanel.SimplePanel.__init__"
] | [((471, 497), 'pyjamas.ui.SimplePanel.SimplePanel.__init__', 'SimplePanel.__init__', (['self'], {}), '(self)\n', (491, 497), False, 'from pyjamas.ui.SimplePanel import SimplePanel\n'), ((516, 540), 'pyjamas.ui.VerticalPanel.VerticalPanel', 'VerticalPanel', ([], {'Spacing': '(5)'}), '(Spacing=5)\n', (529, 540), False, '... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __init__ import *
from GUI_BASE import GUIbase
#print base.messenger.toggleVerbose()
COMBO_TEXT = \
"""\
COMBO
{0}\
"""
class Play(GUIbase):
def __init__(self):
GUIbase.__init__(self)
#self.clear_status_bar['value'] = 0
#self.setup_play_GUI()
#taskMgr.... | [
"GUI_BASE.GUIbase.__init__"
] | [((217, 239), 'GUI_BASE.GUIbase.__init__', 'GUIbase.__init__', (['self'], {}), '(self)\n', (233, 239), False, 'from GUI_BASE import GUIbase\n')] |
from typing import Dict, List, Union, Any
import numpy as np
import numpy.linalg as la
from graphik.robots import RobotPlanar
from graphik.graphs.graph_base import ProblemGraph
from graphik.utils import *
from liegroups.numpy import SE2, SO2
import networkx as nx
from numpy import cos, pi
from math import sqrt
class ... | [
"numpy.math.atan2",
"liegroups.numpy.SO2.identity",
"numpy.linalg.norm",
"liegroups.numpy.SO2.from_angle",
"networkx.compose",
"networkx.empty_graph",
"numpy.array",
"numpy.cos",
"networkx.DiGraph",
"numpy.vstack"
] | [((597, 624), 'networkx.compose', 'nx.compose', (['base', 'structure'], {}), '(base, structure)\n', (607, 624), True, 'import networkx as nx\n'), ((860, 910), 'networkx.DiGraph', 'nx.DiGraph', (["[('p0', 'x'), ('p0', 'y'), ('x', 'y')]"], {}), "([('p0', 'x'), ('p0', 'y'), ('x', 'y')])\n", (870, 910), True, 'import netwo... |
# -*- coding: utf-8 -*-
"""
link_fastq_juno
~~~~~~~~~~~~~~~
:Description: console script for running process_fastq on manifest level on juno
"""
"""
Created on August 05, 2019
Description: console script for running process_fastq on manifest level on juno
@author: <NAME>
"""
import os
import sys
import logging
import... | [
"click.version_option",
"click.option",
"logging.Formatter",
"sys.exc_info",
"click.Path",
"os.path.join",
"click_log.simple_verbosity_option",
"logging.FileHandler",
"time.process_time",
"shlex.split",
"click.command",
"re.findall",
"subprocess.Popen",
"time.perf_counter",
"pandas.read_... | [((1106, 1137), 'logging.getLogger', 'logging.getLogger', (['"""link_fastq"""'], {}), "('link_fastq')\n", (1123, 1137), False, 'import logging\n'), ((1138, 1168), 'click_log.basic_config', 'click_log.basic_config', (['logger'], {}), '(logger)\n', (1160, 1168), False, 'import click_log\n'), ((1231, 1246), 'click.command... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 2 19:07:01 2021
@author: wyattpetryshen
"""
# Code templates for Ornstein-Uhlenbeck process and Brownian motion are from IPython Interactive Computing and Visualization Cookbook, Second Edition (2018), by <NAME>.
import numpy as np
import matplot... | [
"matplotlib.pyplot.title",
"numpy.subtract",
"matplotlib.pyplot.plot",
"numpy.random.randn",
"matplotlib.pyplot.scatter",
"numpy.zeros",
"matplotlib.pyplot.axis",
"time.time",
"numpy.sin",
"numpy.arange",
"numpy.linalg.norm",
"numpy.linspace",
"numpy.mean",
"numpy.dot",
"matplotlib.pyplo... | [((1568, 1601), 'numpy.arange', 'np.arange', (['(0)', '(10)', '(1 / sample_rate)'], {}), '(0, 10, 1 / sample_rate)\n', (1577, 1601), True, 'import numpy as np\n'), ((1904, 1926), 'numpy.linspace', 'np.linspace', (['(0.0)', 'T', 'n'], {}), '(0.0, T, n)\n', (1915, 1926), True, 'import numpy as np\n'), ((2026, 2037), 'num... |
from setuptools import setup, find_packages
try:
from pypandoc import convert
def read_markdown(file: str) -> str:
return convert(file, "rst")
except ImportError:
def read_markdown(file: str) -> str:
return open(file, "r").read()
setup(
name="gitsubrepo",
version="1.1.0",
packa... | [
"pypandoc.convert",
"setuptools.find_packages"
] | [((139, 159), 'pypandoc.convert', 'convert', (['file', '"""rst"""'], {}), "(file, 'rst')\n", (146, 159), False, 'from pypandoc import convert\n'), ((324, 356), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests']"}), "(exclude=['tests'])\n", (337, 356), False, 'from setuptools import setup, find_pac... |
import logging
import time
from django.conf import settings
from django.core.cache import cache
log = logging.getLogger(__name__)
def get_cached_with_mtime(cache_key, getter, max_mtime=60, default=None, expiry=86400):
"""
Get something with a maximum modification time.
I.e. if the data stored in the ca... | [
"django.core.cache.cache.set",
"django.core.cache.cache.get",
"logging.getLogger",
"time.time"
] | [((104, 131), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (121, 131), False, 'import logging\n'), ((930, 950), 'django.core.cache.cache.get', 'cache.get', (['cache_key'], {}), '(cache_key)\n', (939, 950), False, 'from django.core.cache import cache\n'), ((1170, 1211), 'django.core.cach... |
import pygame
from pygame.font import Font, SysFont
from pygame.locals import *
from ui.utils.sound import Sound
from ui.widgets.sprite import LcarsWidget, PowerWidget, ResetWidget, GeneralWidget
from ui import colours
class ModernButton(LcarsWidget):
def __init__(self, colour, pos, text, handler=None, rectSize=N... | [
"pygame.transform.flip",
"ui.widgets.sprite.PowerWidget.__init__",
"pygame.transform.rotate",
"pygame.Surface",
"ui.widgets.sprite.PowerWidget.handleEvent",
"ui.widgets.sprite.LcarsWidget.__init__",
"ui.widgets.sprite.LcarsWidget.handleEvent",
"pygame.font.Font",
"pygame.image.load",
"ui.utils.sou... | [((766, 798), 'pygame.font.Font', 'Font', (['"""assets/YukonTech.ttf"""', '(20)'], {}), "('assets/YukonTech.ttf', 20)\n", (770, 798), False, 'from pygame.font import Font, SysFont\n'), ((1077, 1131), 'ui.widgets.sprite.LcarsWidget.__init__', 'LcarsWidget.__init__', (['self', 'colour', 'pos', 'size', 'handler'], {}), '(... |
from ev3sim.visual.manager import ScreenObjectManager
from ev3sim.validation.bot_files import BotValidator
import os
import pygame
import pygame_gui
import yaml
from ev3sim.file_helper import find_abs, find_abs_directory
from ev3sim.validation.batch_files import BatchValidator
from ev3sim.visual.menus.base_menu import ... | [
"pygame.Rect",
"yaml.dump",
"yaml.safe_load",
"pygame_gui.core.ObjectID",
"ev3sim.search_locations.batch_locations",
"ev3sim.search_locations.preset_locations",
"ev3sim.validation.bot_files.BotValidator.validate_json",
"ev3sim.validation.batch_files.BatchValidator.all_valid_in_dir",
"ev3sim.file_hel... | [((3276, 3377), 'ev3sim.visual.manager.ScreenObjectManager.instance.pushScreen', 'ScreenObjectManager.instance.pushScreen', (['ScreenObjectManager.instance.SCREEN_SIM'], {'batch': 'sim_path'}), '(ScreenObjectManager.instance.\n SCREEN_SIM, batch=sim_path)\n', (3315, 3377), False, 'from ev3sim.visual.manager import S... |
#!/usr/bin/env python
import pickle
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
fast_file_name = 'photobleaching_mixture00_grid.csv'
slow_file_name = 'photobleaching_mixture01_grid.csv'
data_fast = np.genfromtxt(fast_file_name, delimiter = ',', skip_header = True)
data_slow = np.genfrom... | [
"pickle.dump",
"numpy.genfromtxt"
] | [((231, 293), 'numpy.genfromtxt', 'np.genfromtxt', (['fast_file_name'], {'delimiter': '""","""', 'skip_header': '(True)'}), "(fast_file_name, delimiter=',', skip_header=True)\n", (244, 293), True, 'import numpy as np\n'), ((310, 372), 'numpy.genfromtxt', 'np.genfromtxt', (['slow_file_name'], {'delimiter': '""","""', 's... |
"""
do gradients flow into vqvae codebook?
"""
import torch
from torch import nn, optim, autograd
import numpy as np
import math, time
def run():
num_codes = 5
N = 7
K = 3
np.random.seed(123)
torch.manual_seed(123)
Z = torch.from_numpy(np.random.choice(num_codes, N, replace=True))
print('Z'... | [
"torch.manual_seed",
"numpy.random.choice",
"numpy.random.seed",
"torch.rand"
] | [((189, 208), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (203, 208), True, 'import numpy as np\n'), ((213, 235), 'torch.manual_seed', 'torch.manual_seed', (['(123)'], {}), '(123)\n', (230, 235), False, 'import torch\n'), ((534, 550), 'torch.rand', 'torch.rand', (['N', 'K'], {}), '(N, K)\n', (544... |
import pytest
from auth_api.db import db
from auth_api.models import DbCompany
from auth_api.queries import CompanyQuery
from tests.auth_api.queries.query_base import (
COMPANY_LIST,
TestQueryBase,
)
class TestCompanyQueries(TestQueryBase):
"""Test user queries."""
@pytest.mark.parametrize('company'... | [
"pytest.mark.parametrize",
"auth_api.queries.CompanyQuery"
] | [((287, 335), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""company"""', 'COMPANY_LIST'], {}), "('company', COMPANY_LIST)\n", (310, 335), False, 'import pytest\n'), ((1660, 1708), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""company"""', 'COMPANY_LIST'], {}), "('company', COMPANY_LIST)\n", ... |
import codecs
import json
from sklearn.linear_model import LogisticRegression
def build_feature_RUSSE(row):
sentence1 = row["sentence1"].strip()
sentence2 = row["sentence2"].strip()
word = row["word"].strip()
label = row.get("label")
res = f"{sentence1} {sentence2} {word}"
return res, label
... | [
"sklearn.linear_model.LogisticRegression",
"codecs.open"
] | [((780, 800), 'sklearn.linear_model.LogisticRegression', 'LogisticRegression', ([], {}), '()\n', (798, 800), False, 'from sklearn.linear_model import LogisticRegression\n'), ((367, 406), 'codecs.open', 'codecs.open', (['path'], {'encoding': '"""utf-8-sig"""'}), "(path, encoding='utf-8-sig')\n", (378, 406), False, 'impo... |
import os
import sys
import re
import argparse
import neuralRisk
def init():
"""TODO: Docstring for __process_cl_args.
:returns: Function to be use
"""
parser = argparse.ArgumentParser(description='Loader for Risk Prediction')
parser.add_argument('commands', nargs='*')
parser.add_argument('--... | [
"argparse.ArgumentParser"
] | [((180, 245), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Loader for Risk Prediction"""'}), "(description='Loader for Risk Prediction')\n", (203, 245), False, 'import argparse\n')] |
from part1 import (
gamma_board,
gamma_busy_fields,
gamma_delete,
gamma_free_fields,
gamma_golden_move,
gamma_golden_possible,
gamma_move,
gamma_new,
)
"""
scenario: test_random_actions
uuid: 463878308
"""
"""
random actions, total chaos
"""
board = gamma_new(6, 6, 6, 3)
assert board is... | [
"part1.gamma_new",
"part1.gamma_busy_fields",
"part1.gamma_golden_move",
"part1.gamma_golden_possible",
"part1.gamma_move",
"part1.gamma_board",
"part1.gamma_free_fields",
"part1.gamma_delete"
] | [((283, 304), 'part1.gamma_new', 'gamma_new', (['(6)', '(6)', '(6)', '(3)'], {}), '(6, 6, 6, 3)\n', (292, 304), False, 'from part1 import gamma_board, gamma_busy_fields, gamma_delete, gamma_free_fields, gamma_golden_move, gamma_golden_possible, gamma_move, gamma_new\n'), ((1884, 1902), 'part1.gamma_board', 'gamma_board... |
from fastapi import HTTPException, status, Query
from tortoise.exceptions import DoesNotExist
from app.data.models.book import BookDB
from app.data.repository.book import BookRepository
from app.routers.library.models import BookIn, BookOut, BookUpdate
class BookController:
# region Utility
@classmethod
... | [
"app.routers.library.models.BookOut.from_orm",
"app.data.repository.book.BookRepository.get_by_id_or_exc",
"app.data.repository.book.BookRepository.get_all_ilike_by",
"app.data.repository.book.BookRepository.get_all",
"fastapi.HTTPException",
"fastapi.Query",
"app.data.repository.book.BookRepository.del... | [((868, 893), 'app.routers.library.models.BookOut.from_orm', 'BookOut.from_orm', (['book_db'], {}), '(book_db)\n', (884, 893), False, 'from app.routers.library.models import BookIn, BookOut, BookUpdate\n'), ((1013, 1040), 'fastapi.Query', 'Query', ([], {'default': '(100)', 'lte': '(100)'}), '(default=100, lte=100)\n', ... |
from setuptools import setup, find_packages
with open("README.md", "r") as f:
LONG_DESCRIPTION = f.read()
setup(
name="bigcode-embeddings",
version="0.1.2",
description="Tool generate and visualize embeddings from bigcode",
long_description=LONG_DESCRIPTION,
author="<NAME>",
author_email=... | [
"setuptools.find_packages"
] | [((563, 578), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (576, 578), False, 'from setuptools import setup, find_packages\n')] |
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings as django_settings
from silviacontrol.utils import debug_log
class Command(BaseCommand):
help = 'Registers functions for GPIO interrupts on pi'
def handle(self, *args, **options):
if django_settings.SIMU... | [
"silviacontrol.utils.debug_log",
"silviacontrol.display_cp.SilviaDisplay"
] | [((429, 446), 'silviacontrol.display_cp.SilviaDisplay', 'SilviaDisplay', (['(60)'], {}), '(60)\n', (442, 446), False, 'from silviacontrol.display_cp import SilviaDisplay\n'), ((554, 604), 'silviacontrol.utils.debug_log', 'debug_log', (['"""Nothing to display in simulation mode"""'], {}), "('Nothing to display in simula... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 27 20:42:07 2018
@author: allen
"""
import datetime
import pandas as pd
from functools import lru_cache
def _to_hours_mins_secs(time_taken):
"""Convert seconds to hours, mins, and seconds."""
... | [
"datetime.datetime.strptime",
"functools.lru_cache",
"pandas.Timestamp",
"datetime.datetime"
] | [((1414, 1429), 'functools.lru_cache', 'lru_cache', (['None'], {}), '(None)\n', (1423, 1429), False, 'from functools import lru_cache\n'), ((1582, 1598), 'functools.lru_cache', 'lru_cache', (['(20480)'], {}), '(20480)\n', (1591, 1598), False, 'from functools import lru_cache\n'), ((470, 490), 'pandas.Timestamp', 'pd.Ti... |
from abc import ABC, abstractmethod
from enum import Enum
from typing import Any, Dict, Generic, TypeVar
T = TypeVar('T')
class TelRemoteSpecProtocol(ABC):
"""
Base class defining interface between the diesel service and the auto-completion frontend.
"""
@abstractmethod
def to_remote_spec(self) ... | [
"typing.TypeVar"
] | [((110, 122), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (117, 122), False, 'from typing import Any, Dict, Generic, TypeVar\n')] |