code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
from os import path, makedirs, mkdir, listdir, walk, remove, symlink, chdir
from shutil import rmtree
import subprocess
import platform
import re
import os
def make_centralized_solution_links(dir_path):
if path.exists(dir_path):
rmtree(dir_path)
makedirs(dir... | [
"os.mkdir",
"os.walk",
"os.path.isfile",
"os.path.islink",
"shutil.rmtree",
"os.path.join",
"os.chdir",
"os.path.abspath",
"os.path.dirname",
"os.path.exists",
"os.startfile",
"subprocess.Popen",
"os.path.basename",
"os.path.realpath",
"platform.system",
"re.compile",
"os.makedirs",
... | [((256, 277), 'os.path.exists', 'path.exists', (['dir_path'], {}), '(dir_path)\n', (267, 277), False, 'from os import path, makedirs, mkdir, listdir, walk, remove, symlink, chdir\n'), ((308, 326), 'os.makedirs', 'makedirs', (['dir_path'], {}), '(dir_path)\n', (316, 326), False, 'from os import path, makedirs, mkdir, li... |
from flask import Flask, request, render_template, redirect
import random
from string import digits, punctuation, ascii_letters
def gerar_senha(parametros_senha: dict) -> str:
simbolos = ""
rand = random.SystemRandom()
if parametros_senha['letras']:
simbolos += ascii_letters
if parametros... | [
"random.SystemRandom",
"flask.redirect",
"flask.Flask",
"flask.request.get_data",
"flask.render_template"
] | [((949, 964), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (954, 964), False, 'from flask import Flask, request, render_template, redirect\n'), ((207, 228), 'random.SystemRandom', 'random.SystemRandom', ([], {}), '()\n', (226, 228), False, 'import random\n'), ((1318, 1395), 'flask.render_template', 'rend... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 7 18:44:59 2017
@author: pramos
Usufull functions for UVW velocity-space treatments
"""
import numpy as np
#constants
incl=np.deg2rad(62.87124882) #inclination of galactic plane
alom=np.deg2rad(282.8594813) #RA of the equatorial node
lom=n... | [
"numpy.arctan2",
"numpy.deg2rad",
"numpy.zeros",
"numpy.arcsin",
"numpy.sin",
"numpy.tan",
"numpy.cos",
"numpy.dot",
"numpy.sqrt"
] | [((198, 221), 'numpy.deg2rad', 'np.deg2rad', (['(62.87124882)'], {}), '(62.87124882)\n', (208, 221), True, 'import numpy as np\n'), ((261, 284), 'numpy.deg2rad', 'np.deg2rad', (['(282.8594813)'], {}), '(282.8594813)\n', (271, 284), True, 'import numpy as np\n'), ((319, 342), 'numpy.deg2rad', 'np.deg2rad', (['(32.936805... |
import json
import os
import csv
import yaml
from datetime import date
data = dict(
contact = dict(#mutiple submitters
full_name = "<NAME>", #autogenerated
first_name = "Vitaly",
last_name = "Sedlyarov",
country = "Austria", #country for phone number, better controlled
insti... | [
"json.dump",
"datetime.date.today"
] | [((7329, 7341), 'datetime.date.today', 'date.today', ([], {}), '()\n', (7339, 7341), False, 'from datetime import date\n'), ((7459, 7511), 'json.dump', 'json.dump', (['data', 'json_out'], {'indent': '(4)', 'sort_keys': '(False)'}), '(data, json_out, indent=4, sort_keys=False)\n', (7468, 7511), False, 'import json\n')] |
from ark_manager import *
import time
from random import choice
from locks import Lock
import argparse
parser = argparse.ArgumentParser(description='Restart ark server.')
parser.add_argument("--message", dest='message', default=None, help="Message to add to broadcast, usually reason for restart.")
args = parser.par... | [
"locks.Lock",
"random.choice",
"argparse.ArgumentParser",
"time.sleep"
] | [((116, 174), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Restart ark server."""'}), "(description='Restart ark server.')\n", (139, 174), False, 'import argparse\n'), ((826, 832), 'locks.Lock', 'Lock', ([], {}), '()\n', (830, 832), False, 'from locks import Lock\n'), ((1115, 1134), 't... |
#!/usr/bin/env python
# -----------------------------------------------------------------------------
# Copyright (c) 2018-2022, NeXpy Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING, distributed with this software.
# ---------------------------... | [
"os.path.realpath",
"argparse.ArgumentParser",
"nxrefine.nxsettings.NXSettings"
] | [((470, 529), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Set default settings"""'}), "(description='Set default settings')\n", (493, 529), False, 'import argparse\n'), ((947, 959), 'nxrefine.nxsettings.NXSettings', 'NXSettings', ([], {}), '()\n', (957, 959), False, 'from nxrefine.nxs... |
import os
import xml.etree.ElementTree as et
from typing import Text
import numpy as np
import pyroomacoustics as pra
import matplotlib.pyplot as plt
from stl import mesh
from pra_utils.core import BoundingBox, ComplexRoom, Limits
class SDFConverter:
def __init__(self, sdf_path, use_geometry='visual'):
assert u... | [
"xml.etree.ElementTree.parse",
"matplotlib.pyplot.show",
"pra_utils.core.ComplexRoom.from_stl",
"pra_utils.core.BoundingBox",
"stl.mesh.Mesh.from_file",
"os.path.isfile",
"pyroomacoustics.Material"
] | [((3287, 3297), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (3295, 3297), True, 'import matplotlib.pyplot as plt\n'), ((688, 711), 'xml.etree.ElementTree.parse', 'et.parse', (['self.sdf_path'], {}), '(self.sdf_path)\n', (696, 711), True, 'import xml.etree.ElementTree as et\n'), ((2322, 2351), 'stl.mesh.Mesh... |
from fontTools.ttLib import TTFont
import matplotlib.font_manager as mfm
def char_in_font(Unicode_char, font):
for cmap in font['cmap'].tables:
if cmap.isUnicode():
if ord(Unicode_char) in cmap.cmap:
return True
return False
uni_char = u"中"
# or uni_char = u"\u2739"
font_... | [
"fontTools.ttLib.TTFont"
] | [((448, 477), 'fontTools.ttLib.TTFont', 'TTFont', (['font[0]'], {'fontNumber': '(0)'}), '(font[0], fontNumber=0)\n', (454, 477), False, 'from fontTools.ttLib import TTFont\n')] |
import logging
from telegram.ext import Updater, CommandHandler
from telegram.bot import Bot
from telegram.parsemode import ParseMode
class CredstufferTelegram:
""" class Telegram to send telegram messages
USAGE:
telegram = CredstufferTelegram()
telegram.new_msg()
"""
def __i... | [
"telegram.ext.Updater",
"telegram.ext.CommandHandler",
"telegram.bot.Bot",
"logging.getLogger"
] | [((362, 394), 'logging.getLogger', 'logging.getLogger', (['"""credstuffer"""'], {}), "('credstuffer')\n", (379, 394), False, 'import logging\n'), ((507, 532), 'telegram.ext.Updater', 'Updater', ([], {'token': 'self.token'}), '(token=self.token)\n', (514, 532), False, 'from telegram.ext import Updater, CommandHandler\n'... |
from flask_restful import Resource
from flask import Response, current_app
import json
import os
def get_all_plans():
return sorted(os.listdir(os.path.join(current_app.static_folder, '../../runs')))
def get_plan(ix):
plans = get_all_plans()
if ix < 0 or ix >= len(plans): return None
return os.path.joi... | [
"os.path.join",
"json.dumps"
] | [((309, 373), 'os.path.join', 'os.path.join', (['current_app.static_folder', '"""../../runs"""', 'plans[ix]'], {}), "(current_app.static_folder, '../../runs', plans[ix])\n", (321, 373), False, 'import os\n'), ((148, 201), 'os.path.join', 'os.path.join', (['current_app.static_folder', '"""../../runs"""'], {}), "(current... |
import unittest
import next_prime_number
class NextPrimeNumber(unittest.TestCase):
def test_check_prime_number(self):
prime = next_prime_number.next_prime(3)
self.assertEqual(prime, True)
prime = next_prime_number.next_prime(5)
self.assertEqual(prime, True)
def test_check_is... | [
"next_prime_number.list_of_primes",
"next_prime_number.next_prime"
] | [((142, 173), 'next_prime_number.next_prime', 'next_prime_number.next_prime', (['(3)'], {}), '(3)\n', (170, 173), False, 'import next_prime_number\n'), ((228, 259), 'next_prime_number.next_prime', 'next_prime_number.next_prime', (['(5)'], {}), '(5)\n', (256, 259), False, 'import next_prime_number\n'), ((362, 393), 'nex... |
'''
map_water_assets.py
This script creates mapping between the JEM nodal file and the nismod.jamaica.water
sector assets. Specifically, it links each energy-consumptive water asset to the nearest
utility pole or substation in the energy sector nodal file.
'''
import geopandas as gpd
from shapely... | [
"shapely.ops.nearest_points",
"geopandas.read_file"
] | [((408, 467), 'geopandas.read_file', 'gpd.read_file', (['"""../data/spatial/infrasim-network/nodes.shp"""'], {}), "('../data/spatial/infrasim-network/nodes.shp')\n", (421, 467), True, 'import geopandas as gpd\n'), ((482, 536), 'geopandas.read_file', 'gpd.read_file', (['"""../data/water/merged_water_assets.shp"""'], {})... |
import os
import re
import csv
import time
import logging
import requests
import pandas as pd
from bs4 import BeautifulSoup
class sure_thread(object):
path = os.getcwd()
path = os.path.dirname(path)
# If directly run this file --> uncomment line 16 and 17.
path = os.path.dirname(path)
save_path = ... | [
"logging.basicConfig",
"os.getcwd",
"pandas.read_csv",
"os.path.dirname",
"time.split",
"time.sleep",
"requests.get",
"bs4.BeautifulSoup",
"os.path.join",
"re.sub",
"csv.DictWriter"
] | [((163, 174), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (172, 174), False, 'import os\n'), ((186, 207), 'os.path.dirname', 'os.path.dirname', (['path'], {}), '(path)\n', (201, 207), False, 'import os\n'), ((281, 302), 'os.path.dirname', 'os.path.dirname', (['path'], {}), '(path)\n', (296, 302), False, 'import os\n'),... |
import unittest
import numpy as np
from .. import getisord
from libpysal.weights.distance import DistanceBand
from libpysal.common import pandas
POINTS = [(10, 10), (20, 10), (40, 10), (15, 20), (30, 20), (30, 30)]
W = DistanceBand(POINTS, threshold=15)
Y = np.array([2, 3, 3.2, 5, 8, 7])
PANDAS_EXTINCT = pandas is N... | [
"pandas.DataFrame",
"unittest.skipIf",
"numpy.random.seed",
"unittest.TextTestRunner",
"unittest.TestSuite",
"numpy.array",
"unittest.TestLoader",
"libpysal.weights.distance.DistanceBand",
"numpy.testing.assert_allclose",
"numpy.unique"
] | [((221, 255), 'libpysal.weights.distance.DistanceBand', 'DistanceBand', (['POINTS'], {'threshold': '(15)'}), '(POINTS, threshold=15)\n', (233, 255), False, 'from libpysal.weights.distance import DistanceBand\n'), ((260, 290), 'numpy.array', 'np.array', (['[2, 3, 3.2, 5, 8, 7]'], {}), '([2, 3, 3.2, 5, 8, 7])\n', (268, 2... |
from django.shortcuts import render, get_object_or_404
from .models import Post
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.views.generic import ListView
class PostListView(ListView):
queryset = Post.published.all()
context_object_name = "posts"
paginate_by = 3
... | [
"django.shortcuts.render",
"django.shortcuts.get_object_or_404",
"django.core.paginator.Paginator",
"django.core.mail.send_mail"
] | [((500, 618), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['Post'], {'slug': 'post', 'status': '"""published"""', 'publish__year': 'year', 'publish__month': 'month', 'publish__day': 'day'}), "(Post, slug=post, status='published', publish__year=year,\n publish__month=month, publish__day=day)\n", (517,... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import platform
from emulator import Emulator
class B2GEmulator(Emulator):
def __init__(self, homedir... | [
"os.path.join",
"os.path.exists",
"platform.system",
"os.path.expanduser",
"os.getenv"
] | [((2347, 2391), 'os.path.join', 'os.path.join', (['"""out"""', '"""host"""', 'host_dir', '"""bin"""'], {}), "('out', 'host', host_dir, 'bin')\n", (2359, 2391), False, 'import os\n'), ((3071, 3105), 'os.path.join', 'os.path.join', (['self.homedir', 'kernel'], {}), '(self.homedir, kernel)\n', (3083, 3105), False, 'import... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Usage:
pearce [options]
Options:
-h --help Show this screen.
--version Show version.
-c, --colored Colored output if provided.
[default: False]
-i <n>, --it... | [
"logging.Formatter.format",
"logging.debug",
"random.randint",
"os.path.basename",
"logging.warning",
"logging.root.addHandler",
"os.path.realpath",
"logging.StreamHandler",
"time.sleep",
"termcolor.colored",
"random.seed",
"os.path.splitext",
"sys.exit",
"logging.root.setLevel"
] | [((3492, 3518), 'os.path.basename', 'os.path.basename', (['__file__'], {}), '(__file__)\n', (3508, 3518), False, 'import os\n'), ((4109, 4142), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (4130, 4142), False, 'import logging\n'), ((4191, 4227), 'logging.root.addHandler', 'l... |
from typing import Any, List, Literal, TypedDict
from .FHIR_Element import FHIR_Element
from .FHIR_string import FHIR_string
# A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage.
FHIR_AuditEvent_Detail = Typ... | [
"typing.TypedDict"
] | [((317, 611), 'typing.TypedDict', 'TypedDict', (['"""FHIR_AuditEvent_Detail"""', "{'id': FHIR_string, 'extension': List[Any], 'modifierExtension': List[Any],\n 'type': FHIR_string, '_type': FHIR_Element, 'valueString': str,\n '_valueString': FHIR_Element, 'valueBase64Binary': str,\n '_valueBase64Binary': FHIR_... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from ..models import Reference
class ReferenceForm(forms.ModelForm):
class Meta:
model = Reference
widgets = {
'recommend': forms.RadioSelect
}
def __init__(self, *args, **kwargs):
... | [
"django.forms.HiddenInput"
] | [((419, 438), 'django.forms.HiddenInput', 'forms.HiddenInput', ([], {}), '()\n', (436, 438), False, 'from django import forms\n'), ((488, 507), 'django.forms.HiddenInput', 'forms.HiddenInput', ([], {}), '()\n', (505, 507), False, 'from django import forms\n'), ((559, 578), 'django.forms.HiddenInput', 'forms.HiddenInput... |
# -*- coding: utf-8 -*-
from selenium.webdriver.firefox.webdriver import WebDriver
import unittest
from group import Group
from common import *
def is_alert_present(wd):
try:
wd.switch_to_alert().text
return True
except:
return False
class test_add_group(unittest.TestCase):
def s... | [
"unittest.main",
"group.Group",
"selenium.webdriver.firefox.webdriver.WebDriver"
] | [((2026, 2041), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2039, 2041), False, 'import unittest\n'), ((350, 361), 'selenium.webdriver.firefox.webdriver.WebDriver', 'WebDriver', ([], {}), '()\n', (359, 361), False, 'from selenium.webdriver.firefox.webdriver import WebDriver\n'), ((603, 648), 'group.Group', 'Gr... |
from re import A
from commons.external_call import APIInterface
from sql import config
from sql.crud.deployment_crud import CRUDDeployment
from sql.crud.operation_crud import CRUDOperations
from datetime import datetime
class ManageModelController:
def __init__(self):
self.CRUDDeployment = CRUDDeployment(... | [
"sql.crud.operation_crud.CRUDOperations",
"sql.config.get",
"commons.external_call.APIInterface.post",
"sql.crud.deployment_crud.CRUDDeployment",
"datetime.datetime.now"
] | [((305, 321), 'sql.crud.deployment_crud.CRUDDeployment', 'CRUDDeployment', ([], {}), '()\n', (319, 321), False, 'from sql.crud.deployment_crud import CRUDDeployment\n'), ((352, 368), 'sql.crud.operation_crud.CRUDOperations', 'CRUDOperations', ([], {}), '()\n', (366, 368), False, 'from sql.crud.operation_crud import CRU... |
from pathlib import Path
from typing import Optional
import click
from lhotse import FeatureSet, Features, LilcomURLWriter
from lhotse.audio import RecordingSet
from lhotse.bin.modes.cli_base import cli
from lhotse.features import (
Fbank,
FeatureExtractor,
FeatureSetBuilder,
create_default_feature_ex... | [
"lhotse.utils.fastcopy",
"lhotse.features.io.available_storage_backends",
"lhotse.audio.RecordingSet.from_json",
"lhotse.LilcomURLWriter",
"lhotse.features.FeatureSetBuilder",
"click.argument",
"tqdm.tqdm",
"concurrent.futures.ProcessPoolExecutor",
"click.option",
"lhotse.FeatureSet.open_writer",
... | [((500, 511), 'lhotse.bin.modes.cli_base.cli.group', 'cli.group', ([], {}), '()\n', (509, 511), False, 'from lhotse.bin.modes.cli_base import cli\n'), ((1623, 1807), 'click.option', 'click.option', (['"""-t"""', '"""--lilcom-tick-power"""'], {'type': 'int', 'default': '(-5)', 'help': '"""Determines the compression accu... |
from gpiozero import Device
from symbiotic import Symbiotic
from symbiotic.schedule import Schedule, Day
from symbiotic.colours import Colour
if __name__ == '__main__':
app = Symbiotic()
app.config.from_yaml('config.yaml')
# use remote motion sensor using pigpio
pin_factory = app.sensors.pin_factory(... | [
"symbiotic.schedule.Schedule",
"symbiotic.Symbiotic"
] | [((181, 192), 'symbiotic.Symbiotic', 'Symbiotic', ([], {}), '()\n', (190, 192), False, 'from symbiotic import Symbiotic\n'), ((979, 989), 'symbiotic.schedule.Schedule', 'Schedule', ([], {}), '()\n', (987, 989), False, 'from symbiotic.schedule import Schedule, Day\n'), ((1176, 1186), 'symbiotic.schedule.Schedule', 'Sche... |
import math
import cairo
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GLib # nopep8
class Animator(Gtk.DrawingArea):
def __init__(self, **properties):
super().__init__(**properties)
self.set_size_request(200, 80)
self.connect("draw", self.do_drawing)
G... | [
"gi.require_version",
"gi.repository.GLib.timeout_add",
"math.cos",
"math.sin"
] | [((35, 67), 'gi.require_version', 'gi.require_version', (['"""Gtk"""', '"""3.0"""'], {}), "('Gtk', '3.0')\n", (53, 67), False, 'import gi\n'), ((319, 350), 'gi.repository.GLib.timeout_add', 'GLib.timeout_add', (['(50)', 'self.tick'], {}), '(50, self.tick)\n', (335, 350), False, 'from gi.repository import Gtk, GLib\n'),... |
"""
### BEGIN NODE INFO
[info]
name = DC Server
version = 1.0.0
description = Communicates with the AMO8 box for control of all DC voltages.
instancename = DCServer
[startup]
cmdline = %PYTHON% %FILE%
timeout = 20
[shutdown]
message = 987654321
timeout = 20
### END NODE INFO
"""
from labrad.units import WithUnit
from... | [
"twisted.internet.defer.returnValue",
"time.sleep",
"labrad.server.setting",
"labrad.server.Signal",
"labrad.units.WithUnit"
] | [((775, 793), 'labrad.units.WithUnit', 'WithUnit', (['(5.0)', '"""s"""'], {}), "(5.0, 's')\n", (783, 793), False, 'from labrad.units import WithUnit\n'), ((851, 898), 'labrad.server.Signal', 'Signal', (['(999997)', '"""signal: toggle update"""', '"""(ib)"""'], {}), "(999997, 'signal: toggle update', '(ib)')\n", (857, 8... |
# Import flask dependencies
from flask import Blueprint, render_template, session, redirect, url_for
from dashboards.data import graph as g
from dashboards.data import filter as df
from dashboards.data import bbrc
import dashboards.pickle
import pickle
import dashboards
from dashboards import config
# Define the bluep... | [
"dashboards.data.bbrc.build_test_grid",
"flask.Blueprint",
"dashboards.pickle.get_project_details",
"flask.url_for",
"dashboards.pickle.get_projects_by_4",
"dashboards.data.filter.filter_data",
"flask.render_template",
"dashboards.pickle.get_stats",
"flask.session.clear"
] | [((389, 446), 'flask.Blueprint', 'Blueprint', (['"""dashboard"""', '__name__'], {'url_prefix': '"""/dashboard"""'}), "('dashboard', __name__, url_prefix='/dashboard')\n", (398, 446), False, 'from flask import Blueprint, render_template, session, redirect, url_for\n'), ((513, 528), 'flask.session.clear', 'session.clear'... |
import os
from tabulate import tabulate
class get_net_info:
'''
CLASS get_net_info PROVIDES THE CURRENT NETWORK CONNECTION STATUS, IP ADDRESS, NET MASK ADDRESS AND BROADCAST ADDRESS ALONGWITH ALL INTERFACE STATS.
get_net_info HAVE TWO METHODS:
1) __init__
2) work()
__init__ DOCFILE:
__init__ BLOCK HOLDS ALL ... | [
"os.popen",
"tabulate.tabulate"
] | [((3628, 3753), 'tabulate.tabulate', 'tabulate', (['self.interface'], {'headers': "['DEVICE INTERFACE', 'DEVICE TYPE', 'CONNECTION STATUS', 'DEVICE STATE',\n 'MAC ADDRESS']"}), "(self.interface, headers=['DEVICE INTERFACE', 'DEVICE TYPE',\n 'CONNECTION STATUS', 'DEVICE STATE', 'MAC ADDRESS'])\n", (3636, 3753), Fa... |
import os
from pathlib import Path
from unittest import TestCase
from unittest.mock import patch
from app.core.configuration import Configuration
class TestConfiguration(TestCase):
test_configuration = Path(os.path.realpath(__file__)).parent.joinpath('data', 'configuration.json')
@patch('sys.argv', ['_', '-... | [
"os.path.realpath",
"app.core.configuration.Configuration.load"
] | [((402, 422), 'app.core.configuration.Configuration.load', 'Configuration.load', ([], {}), '()\n', (420, 422), False, 'from app.core.configuration import Configuration\n'), ((919, 939), 'app.core.configuration.Configuration.load', 'Configuration.load', ([], {}), '()\n', (937, 939), False, 'from app.core.configuration i... |
#!/usr/bin/python3
import unittest
'''
Problem 2: https://projecteuler.net/problem=2
Each new term in the Fibonacci sequence is generated by adding the previous
two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence ... | [
"unittest.main"
] | [((1327, 1342), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1340, 1342), False, 'import unittest\n')] |
from Timeout import timeout
import time
@timeout(1)
def t(a):
while True:
a.append(1)
time.sleep(1)
def main():
a = []
try:
t(a)
except Exception as e:
print(e)
main() | [
"time.sleep",
"Timeout.timeout"
] | [((43, 53), 'Timeout.timeout', 'timeout', (['(1)'], {}), '(1)\n', (50, 53), False, 'from Timeout import timeout\n'), ((108, 121), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (118, 121), False, 'import time\n')] |
import yaml, json
with open("emojis.json", 'r') as json_in, open("emojis.yaml", "w") as yaml_out:
json_object = json.load(json_in)
yaml.dump(json_object, yaml_out) | [
"json.load",
"yaml.dump"
] | [((117, 135), 'json.load', 'json.load', (['json_in'], {}), '(json_in)\n', (126, 135), False, 'import yaml, json\n'), ((140, 172), 'yaml.dump', 'yaml.dump', (['json_object', 'yaml_out'], {}), '(json_object, yaml_out)\n', (149, 172), False, 'import yaml, json\n')] |
"""PyGoL CLI parser"""
import argparse
#: Argparse parser.
PARSER = argparse.ArgumentParser(description="Conway's Game of Life in Python")
PARSER.add_argument('display', choices=['terminal', 'pygame'],
help='Display to use for simulation')
PARSER.add_argument('-f', '--file', help='Path to RLE life... | [
"argparse.ArgumentParser"
] | [((69, 139), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Conway\'s Game of Life in Python"""'}), '(description="Conway\'s Game of Life in Python")\n', (92, 139), False, 'import argparse\n')] |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import logging
import collections.abc
from typing import Any, Dict, Union
from azure.ai.ml._restclient.v2022_05_01.models import (
Bat... | [
"azure.ai.ml._restclient.v2022_05_01.models.BatchDeploymentData",
"azure.ai.ml._restclient.v2022_05_01.models.IdAssetReference",
"azure.ai.ml._schema._deployment.batch.batch_deployment.BatchDeploymentSchema",
"azure.ai.ml._utils.utils.load_yaml",
"azure.ai.ml._ml_exceptions.ValidationException",
"azure.ai... | [((1321, 1348), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1338, 1348), False, 'import logging\n'), ((9490, 9578), 'azure.ai.ml._restclient.v2022_05_01.models.BatchDeploymentData', 'BatchDeploymentData', ([], {'location': 'location', 'properties': 'batch_deployment', 'tags': 'self.ta... |
# flake8: noqa E501
"""
*GameBot* {version}
Copyright (c) 2019 <NAME> <<EMAIL>> All rights reserved.
Copyright (C) 2015 Slackbot Contributors
Training / Presentation game bot
"""
import os
import logging
import time
import random
import pygame
import pygame.freetype
import re
import operator
import datetime
import su... | [
"pygame.freetype.Font",
"random.randint",
"webcolors.name_to_rgb",
"machine.plugins.decorators.schedule",
"pygame.display.set_mode",
"subprocess.check_output",
"machine.plugins.decorators.respond_to",
"pygame.init",
"pygame.display.flip",
"webcolors.hex_to_rgb",
"datetime.timedelta",
"better_p... | [((546, 573), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (563, 573), False, 'import logging\n'), ((3428, 3560), 'machine.plugins.decorators.respond_to', 'respond_to', (['"""game (?P<answer>\\\\d*.\\\\d*)(?:\\\\s+)((?P<rgb>#[A-Fa-f0-9]{6}|#[A-Fa-f0-9]{3})|(?P<color>\\\\w+))$"""', 're.I... |
"""
BSD 3-Clause License
Copyright (c) 2021-present, BenitzCoding
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list ... | [
"typing.TypeVar"
] | [((1598, 1625), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {'bound': '"""Array"""'}), "('T', bound='Array')\n", (1605, 1625), False, 'from typing import Any, TypeVar\n')] |
import random
import time
minm = 1
maxm = 6
roll_dice = "yes"
while roll_dice == "yes" or roll_dice == "y":
print("Rolling the dices now")
time.sleep(1)
print("Are you ready??????")
time.sleep(1)
print("The values are")
time.sleep(1)
print(random.randint(minm, maxm))
pri... | [
"random.randint",
"time.sleep"
] | [((158, 171), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (168, 171), False, 'import time\n'), ((211, 224), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (221, 224), False, 'import time\n'), ((259, 272), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (269, 272), False, 'import time\n'), ((284, 310), ... |
"""
models.py
database schemas for Kickstarter app
"""
# *** IMPORTS ***
from os import getenv
from flask_sqlalchemy import SQLAlchemy
import pandas as pd
# Comment out below when migrating to Heroku
# try:
# from .ref import DATABASE_URL
# except ImportError:
# raise ImportError('Did not find ref.py')
# Cr... | [
"pandas.read_csv",
"flask_sqlalchemy.SQLAlchemy",
"os.getenv"
] | [((342, 354), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (352, 354), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((405, 427), 'os.getenv', 'getenv', (['"""DATABASE_URL"""'], {}), "('DATABASE_URL')\n", (411, 427), False, 'from os import getenv\n'), ((1479, 1513), 'pandas.read_csv', 'pd.read_... |
import copy,random
from colorama import Fore, Style
def diceprogram():
dice=random.randint(1,6)
print("You got "+str(dice),end="")
if(dice==1):
print("""
_______
| |
| * |
|_______|""")
elif(dice==2):
print("""
_______
| |
|* *|
|_______|""")
elif(dice==3):
print("""
_______
... | [
"copy.deepcopy",
"random.randint"
] | [((78, 98), 'random.randint', 'random.randint', (['(1)', '(6)'], {}), '(1, 6)\n', (92, 98), False, 'import copy, random\n'), ((2282, 2298), 'copy.deepcopy', 'copy.deepcopy', (['L'], {}), '(L)\n', (2295, 2298), False, 'import copy, random\n')] |
from jdatetime import date
GENDERS = ['male', 'female']
UNDERWEIGHT = 'underweight'
NORMALWEIGHT = 'normalweight'
OVERWEIGHT = 'overweight'
OBESE = 'obese'
class Bmi:
def __init__(self, age, weight, height, gender):
'''
Standard BMI Calculation For Any Age And Gender
# Arguments... | [
"jdatetime.date",
"jdatetime.date.today"
] | [((3726, 3748), 'jdatetime.date', 'date', (['year', 'month', 'day'], {}), '(year, month, day)\n', (3730, 3748), False, 'from jdatetime import date\n'), ((3761, 3773), 'jdatetime.date.today', 'date.today', ([], {}), '()\n', (3771, 3773), False, 'from jdatetime import date\n')] |
# encoding=UTF-8
# Copyright © 2007-2012 <NAME> <<EMAIL>>
#
# 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, modif... | [
"syntax.declaration",
"syntax.program",
"type.simple_type",
"ply.yacc.yacc",
"syntax.evaluation",
"syntax.block_statement"
] | [((1446, 1477), 'ply.yacc.yacc', 'yacc.yacc', ([], {'module': 'self', 'debug': '(0)'}), '(module=self, debug=0)\n', (1455, 1477), True, 'import ply.yacc as yacc\n'), ((1663, 1683), 'syntax.program', 'syntax.program', (['p[1]'], {}), '(p[1])\n', (1677, 1683), False, 'import syntax\n'), ((2967, 2995), 'syntax.block_state... |
# ################################################################################
# ## DATE: 2019-17-07
# ## AUTHOR: <NAME>
# ##
# ################################################################################
# ## 1.0 initial release
from common_utils import menu_utils
from common_utils import var_utils
from vulne... | [
"common_utils.menu_utils.nice_menu",
"common_utils.menu_utils.highlighted_input"
] | [((436, 521), 'common_utils.menu_utils.nice_menu', 'menu_utils.nice_menu', (['"""Select hacking tool"""', "['Scapy', 'Nmap', 'Banner grabbing']"], {}), "('Select hacking tool', ['Scapy', 'Nmap',\n 'Banner grabbing'])\n", (456, 521), False, 'from common_utils import menu_utils\n'), ((689, 849), 'common_utils.menu_uti... |
#! /usr/bin/python
import sys
import addressbook_pb2
def list_people(address_book):
"""Iterates though all people in the AddressBook and prints info about
them."""
for person in address_book.people:
print ("Person ID:", person.id)
print (" Name:", person.name)
if person.HasField('email'):
pri... | [
"addressbook_pb2.AddressBook",
"sys.exit"
] | [((1007, 1036), 'addressbook_pb2.AddressBook', 'addressbook_pb2.AddressBook', ([], {}), '()\n', (1034, 1036), False, 'import addressbook_pb2\n'), ((976, 988), 'sys.exit', 'sys.exit', (['(-1)'], {}), '(-1)\n', (984, 988), False, 'import sys\n')] |
"""
Inspect a model with specific parameters defined in config_sandbox.py
"""
from __future__ import print_function
import visualutil
import setuputil
import yaml
import numpy
import lensutil
import os
from astropy.io import fits
from subprocess import call
import sample_vis
import uvutil
def plot(cleanup=True, ... | [
"yaml.load",
"numpy.abs",
"sample_vis.uvmodel",
"scipy.stats.norm",
"numpy.isfinite",
"numpy.append",
"lensutil.sbmap",
"setuputil.loadParams",
"uvutil.uvload",
"uvutil.pcdload",
"os.system",
"subprocess.call",
"astropy.io.fits.open",
"os.getpid",
"numpy.log",
"astropy.io.fits.writeto"... | [((594, 615), 'yaml.load', 'yaml.load', (['configfile'], {}), '(configfile)\n', (603, 615), False, 'import yaml\n'), ((634, 662), 'setuputil.loadParams', 'setuputil.loadParams', (['config'], {}), '(config)\n', (654, 662), False, 'import setuputil\n'), ((677, 708), 'setuputil.fixParams', 'setuputil.fixParams', (['paramS... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 Intel Corporation
#
# 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
#
# Unl... | [
"numpy.load",
"numpy.save",
"os.makedirs",
"os.getcwd",
"os.path.isdir",
"neural_compressor.utils.utility.LazyImport",
"neural_compressor.utils.utility.logger.warning",
"os.path.dirname",
"os.path.exists",
"neural_compressor.utils.utility.logger.info",
"os.path.isfile",
"neural_compressor.conf... | [((975, 994), 'neural_compressor.utils.utility.LazyImport', 'LazyImport', (['"""torch"""'], {}), "('torch')\n", (985, 994), False, 'from neural_compressor.utils.utility import logger, LazyImport\n'), ((3368, 3409), 'os.path.join', 'os.path.join', (['res_save_path', '"""NASResults"""'], {}), "(res_save_path, 'NASResults... |
import os
def py2_to_py3(path):
Filelist = []
DirList = []
for home, dirs, files in os.walk(path):
for filename in files:#get file name
[name, extension] = os.path.splitext(filename)#split file name for judge suffix
if extension=='.py':
output=os.pop... | [
"os.walk",
"os.path.splitext"
] | [((102, 115), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (109, 115), False, 'import os\n'), ((196, 222), 'os.path.splitext', 'os.path.splitext', (['filename'], {}), '(filename)\n', (212, 222), False, 'import os\n')] |
#!/usr/bin/env python
#
# Copyright (c) 2019, Pycom Limited.
#
# This software is licensed under the GNU GPL version 3 or any
# later version, with permitted additional terms. For more information
# see the Pycom Licence v1.0 document supplied with this file, or
# available at https://www.pycom.io/opensource/licensing
... | [
"Message.Message.fromString",
"socket.socket",
"network.LoRa",
"pycom.heartbeat",
"pycom.wifi_on_boot",
"builtins.int.from_bytes",
"time.time",
"loramesh.Loramesh"
] | [((1550, 1575), 'pycom.wifi_on_boot', 'pycom.wifi_on_boot', (['(False)'], {}), '(False)\n', (1568, 1575), False, 'import pycom\n'), ((1584, 1606), 'pycom.heartbeat', 'pycom.heartbeat', (['(False)'], {}), '(False)\n', (1599, 1606), False, 'import pycom\n'), ((1627, 1698), 'network.LoRa', 'LoRa', ([], {'mode': 'LoRa.LORA... |
import Synthesis.post as post
from Synthesis.post.plot import *
from Synthesis.units import *
from importlib import reload
POP = post.population('SynthesisRuns/combined', 242)
POP.switch_plot_config('paper')
print(POP)
# Limits for Terrestrial Planets
m_low_lim = 1 * M_ME / M_E
a_up_lim = 2
# m_low_lim = 0
# a_up_l... | [
"Synthesis.post.population"
] | [((130, 176), 'Synthesis.post.population', 'post.population', (['"""SynthesisRuns/combined"""', '(242)'], {}), "('SynthesisRuns/combined', 242)\n", (145, 176), True, 'import Synthesis.post as post\n')] |
import pytest
import npc
from npc.formatters.sectioners import LastInitialSectioner
from npc.character import Character
def test_uses_tag_data(prefs):
sectioner = LastInitialSectioner(1, prefs)
character = Character(attributes={'name': ['<NAME>']})
assert sectioner.text_for(character) == 'M'
def test_us... | [
"npc.character.Character",
"npc.formatters.sectioners.LastInitialSectioner"
] | [((169, 199), 'npc.formatters.sectioners.LastInitialSectioner', 'LastInitialSectioner', (['(1)', 'prefs'], {}), '(1, prefs)\n', (189, 199), False, 'from npc.formatters.sectioners import LastInitialSectioner\n'), ((216, 258), 'npc.character.Character', 'Character', ([], {'attributes': "{'name': ['<NAME>']}"}), "(attribu... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-09-10 07:56
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('games', '0002_auto_20160910_0745'),
]
operations = [
migrations.AlterField(
... | [
"django.db.models.DateTimeField"
] | [((404, 481), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'blank': '(True)', 'null': '(True)', 'verbose_name': '"""date soft deleted"""'}), "(blank=True, null=True, verbose_name='date soft deleted')\n", (424, 481), False, 'from django.db import migrations, models\n')] |
import torch
import torch.nn as nn
import torch.nn.functional as F
class MutualLoss(nn.Module):
def __init__(self, criterion=None):
super(MutualLoss, self).__init__()
self.criterion = criterion
if self.criterion is None:
self.loss_fn = torch.nn.MSELoss()
elif self.crite... | [
"torch.nn.MSELoss",
"torch.tensor",
"torch.nn.KLDivLoss",
"torch.mm"
] | [((278, 296), 'torch.nn.MSELoss', 'torch.nn.MSELoss', ([], {}), '()\n', (294, 296), False, 'import torch\n'), ((362, 380), 'torch.nn.MSELoss', 'torch.nn.MSELoss', ([], {}), '()\n', (378, 380), False, 'import torch\n'), ((445, 486), 'torch.nn.KLDivLoss', 'torch.nn.KLDivLoss', ([], {'reduction': '"""batchmean"""'}), "(re... |
## @ingroupMethods-Noise-Fidelity_One-Airframe
# noise_clean_wing.py
#
# Created: Jun 2015, <NAME>
# Modified: Jan 2016, <NAME>
# ----------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------
import numpy as np... | [
"numpy.abs",
"numpy.zeros",
"numpy.sin",
"numpy.cos",
"numpy.log10"
] | [((2524, 2535), 'numpy.cos', 'np.cos', (['phi'], {}), '(phi)\n', (2530, 2535), True, 'import numpy as np\n'), ((2613, 2625), 'numpy.zeros', 'np.zeros', (['(24)'], {}), '(24)\n', (2621, 2625), True, 'import numpy as np\n'), ((2570, 2581), 'numpy.sin', 'np.sin', (['phi'], {}), '(phi)\n', (2576, 2581), True, 'import numpy... |
from CommonUtils import open_config_file
from QuerySmc import run_query_and_upload
import time
cfg = open_config_file()
if __name__ == '__main__':
time_to_run = int(cfg.get('run-interval', 900)) if int(cfg.get('run-interval', 900)) > 300 else 300
while True:
run_query_and_upload()
time.sleep(t... | [
"CommonUtils.open_config_file",
"QuerySmc.run_query_and_upload",
"time.sleep"
] | [((102, 120), 'CommonUtils.open_config_file', 'open_config_file', ([], {}), '()\n', (118, 120), False, 'from CommonUtils import open_config_file\n'), ((277, 299), 'QuerySmc.run_query_and_upload', 'run_query_and_upload', ([], {}), '()\n', (297, 299), False, 'from QuerySmc import run_query_and_upload\n'), ((308, 331), 't... |
import argparse
import logging
import sbol3
# This example demonstrates how to use the visitor pattern
# in pySBOL3 to navigate a document
#
# Usage:
#
# python3 visitor.py [-d] SBOL_FILE_NAME
class MyVisitor:
"""An example visitor.
"""
def visit_document(self, doc: sbol3.Document):
for obj... | [
"sbol3.Document",
"argparse.ArgumentParser",
"logging.basicConfig"
] | [((821, 846), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (844, 846), False, 'import argparse\n'), ((1219, 1291), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': 'msg_format', 'datefmt': 'date_format', 'level': 'level'}), '(format=msg_format, datefmt=date_format, level=level)\n... |
import random
import perimeter
import numpy as np
import unittest
import slice
from util import printBigArray
class PerimeterTest(unittest.TestCase):
def test_lines_to_pixels(self):
test = [[(0, 0, 0), (3, 0, 0)],
[(9, 9, 0), (3, 9, 0)],
[(3, 0, 0), (9, 9, 0)],
... | [
"unittest.main",
"perimeter.linesToVoxels",
"perimeter.onLine",
"numpy.zeros"
] | [((1617, 1632), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1630, 1632), False, 'import unittest\n'), ((365, 395), 'numpy.zeros', 'np.zeros', (['(13, 13)'], {'dtype': 'bool'}), '((13, 13), dtype=bool)\n', (373, 395), True, 'import numpy as np\n'), ((404, 441), 'perimeter.linesToVoxels', 'perimeter.linesToVoxel... |
# -------------------------------------------------------------------------------------------------
# scientific
import numpy as np
# -------------------------------------------------------------------------------------------------
# system
from math import sqrt
from PyQuantum.Common.html import *
import copy
# -------... | [
"numpy.shape",
"webbrowser.open",
"numpy.sum",
"math.sqrt"
] | [((1600, 1617), 'numpy.sum', 'np.sum', (['self.DIME'], {}), '(self.DIME)\n', (1606, 1617), True, 'import numpy as np\n'), ((5895, 5920), 'webbrowser.open', 'webbrowser.open', (['filename'], {}), '(filename)\n', (5910, 5920), False, 'import webbrowser\n'), ((3328, 3354), 'numpy.shape', 'np.shape', (['self.matrix.data'],... |
import pygame
import random
import math
from userSession import userSession
"""
Pygame Pursuit-Evader Simulation
"""
"""
Stage 1: One human, one robot. Human is the pursuer and robot is the evader who aims to get a target from two possibilities.
Experiment set up: Record the EEG signals of the human pur... | [
"pygame.quit",
"random.randint",
"pygame.draw.circle",
"pygame.draw.rect",
"pygame.display.set_mode",
"pygame.event.get",
"pygame.time.delay",
"pygame.init",
"math.sin",
"pygame.display.update",
"userSession.userSession",
"pygame.time.get_ticks",
"pygame.display.set_caption",
"pygame.key.g... | [((1015, 1028), 'pygame.init', 'pygame.init', ([], {}), '()\n', (1026, 1028), False, 'import pygame\n'), ((1077, 1133), 'pygame.display.set_caption', 'pygame.display.set_caption', (['"""Pursuit-Evasion Simulation"""'], {}), "('Pursuit-Evasion Simulation')\n", (1103, 1133), False, 'import pygame\n'), ((1180, 1217), 'pyg... |
from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.sql import func
from sqlalchemy.sql import desc
from flask import Flask, jsonify
from datetime import timedelta
from flask import Response
import json
from cryptography.fernet import Fernet
import os
root_path =... | [
"json.load",
"os.path.realpath",
"flask.Flask",
"sqlalchemy.sql.func.sum",
"flask_sqlalchemy.SQLAlchemy",
"datetime.timedelta",
"flask.render_template"
] | [((883, 898), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (888, 898), False, 'from flask import Flask, jsonify\n'), ((1202, 1217), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (1212, 1217), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((337, 363), 'os.path.realpath', 'o... |
import unittest
from models import *
from utils.handle_transcript import TranscriptionParser, OmekaXML, om
from test_data import TRANSCRIPTIONS
OMEKA_COLLECTION = "test_omeka_collection.xml"
# User, Transcription, Joke, Picture
class TestUserClass(unittest.TestCase):
def setUp(self):
self.TP = Transcription... | [
"utils.handle_transcript.TranscriptionParser",
"database.init_test_db",
"utils.handle_transcript.OmekaXML"
] | [((307, 328), 'utils.handle_transcript.TranscriptionParser', 'TranscriptionParser', ([], {}), '()\n', (326, 328), False, 'from utils.handle_transcript import TranscriptionParser, OmekaXML, om\n'), ((342, 352), 'utils.handle_transcript.OmekaXML', 'OmekaXML', ([], {}), '()\n', (350, 352), False, 'from utils.handle_transc... |
import unittest
import xml.etree.ElementTree as ET
from gocdapi.admin import ConfigXML
from gocdapi.custom_exceptions import GoCdApiException
class TestConfigXML(unittest.TestCase):
DATA0 = """
<cruise >
<server artifactsdir="artifacts" commandRepositoryLocation="default"
serverId=... | [
"unittest.main",
"gocdapi.admin.ConfigXML",
"xml.etree.ElementTree.fromstring"
] | [((7468, 7483), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7481, 7483), False, 'import unittest\n'), ((1333, 1354), 'gocdapi.admin.ConfigXML', 'ConfigXML', (['self.DATA0'], {}), '(self.DATA0)\n', (1342, 1354), False, 'from gocdapi.admin import ConfigXML\n'), ((2198, 2223), 'xml.etree.ElementTree.fromstring', ... |
import sys
import matplotlib.pyplot as plt
import numpy as np
def isReal(txt):
try:
float(txt)
return True
except ValueError:
return False
#dicionários
med_dic={1:{'ID':1,'Nome Comercial':0,'Composto principal':0,'Fórmula Química':0,'Meia-vida de eliminação':0,'Número de ... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.show",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.legend",
"numpy.arange",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots",
"sys.exit"
] | [((9062, 9076), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (9074, 9076), True, 'import matplotlib.pyplot as plt\n'), ((9086, 9098), 'numpy.arange', 'np.arange', (['i'], {}), '(i)\n', (9095, 9098), True, 'import numpy as np\n'), ((9144, 9235), 'matplotlib.pyplot.bar', 'plt.bar', (['index', 'mpef_lis... |
import pickle
import nltk
text = "Veja nesta aula uma boa introducao pratica a biblioteca NLTK (Natural Language Toolkit) em Python para Processamento de Linguagem Natural. Eu mostro passo a passo os recursos basicos dessa biblioteca para voce iniciar o estudo nessa area! Veja tambem como o Google utiliza essas tecnic... | [
"nltk.data.load",
"nltk.word_tokenize"
] | [((423, 475), 'nltk.data.load', 'nltk.data.load', (['"""tokenizers/punkt/portuguese.pickle"""'], {}), "('tokenizers/punkt/portuguese.pickle')\n", (437, 475), False, 'import nltk\n'), ((548, 576), 'nltk.word_tokenize', 'nltk.word_tokenize', (['sentence'], {}), '(sentence)\n', (566, 576), False, 'import nltk\n')] |
"""Module that allows calibrating image matrices using calibration vectors.
The calibration formula is Γ² = γ * α² where Γ is the calibrated
matrix, γ is the uncorrected matrix, and α is the calibration vector.
Note that α and γ must share the same dimension (if the matrix of
pixels is m by n , then α must be length m... | [
"json.load",
"numpy.sqrt"
] | [((2299, 2312), 'json.load', 'json.load', (['fd'], {}), '(fd)\n', (2308, 2312), False, 'import json\n'), ((3024, 3053), 'numpy.sqrt', 'np.sqrt', (['(matrix * vector ** 2)'], {}), '(matrix * vector ** 2)\n', (3031, 3053), True, 'import numpy as np\n')] |
import tensorflow as tf
import numpy as np
import time
from imageLoader import getPaddedROI,training_data_feeder
import math
'''
created by <NAME>
a sub-model for human pose estimation
'''
#input data feeder !!! important !!! The hintSetx_norm_batches are 5d tensors!!! To accommodate, the batch size are fixed to 2
def... | [
"tensorflow.reduce_sum",
"tensorflow.trainable_variables",
"tensorflow.constant_initializer",
"tensorflow.reshape",
"numpy.shape",
"tensorflow.nn.relu6",
"tensorflow.subtract",
"tensorflow.variable_scope",
"tensorflow.stack",
"tensorflow.placeholder",
"tensorflow.cast",
"tensorflow.summary.Fil... | [((8997, 9072), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '(16, roi_size, roi_size, 3)'], {'name': '"""inputs_b1h1"""'}), "(tf.float32, (16, roi_size, roi_size, 3), name='inputs_b1h1')\n", (9011, 9072), True, 'import tensorflow as tf\n'), ((9088, 9163), 'tensorflow.placeholder', 'tf.placeholder', (['t... |
from django.contrib import admin
from conquista.models import Conquista
# Register your models here.
admin.site.register(Conquista)
| [
"django.contrib.admin.site.register"
] | [((101, 131), 'django.contrib.admin.site.register', 'admin.site.register', (['Conquista'], {}), '(Conquista)\n', (120, 131), False, 'from django.contrib import admin\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import setuptools
import kipart
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = ... | [
"setuptools.find_packages"
] | [((805, 831), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (829, 831), False, 'import setuptools\n')] |
from typing import List
from shutil import make_archive
from os.path import splitext
from tempfile import TemporaryDirectory
from click import echo
from electionguard.encrypt import EncryptionDevice
from electionguard.constants import get_constants
from electionguard_tools.helpers.export import export_record
from .im... | [
"tempfile.TemporaryDirectory",
"shutil.make_archive",
"click.echo",
"os.path.splitext",
"electionguard.constants.get_constants"
] | [((1019, 1034), 'electionguard.constants.get_constants', 'get_constants', ([], {}), '()\n', (1032, 1034), False, 'from electionguard.constants import get_constants\n'), ((1138, 1158), 'tempfile.TemporaryDirectory', 'TemporaryDirectory', ([], {}), '()\n', (1156, 1158), False, 'from tempfile import TemporaryDirectory\n')... |
# Author: <NAME> <<EMAIL>>
import logging
import torch
import torch.nn as nn
import torch.nn.functional as tf
from losses import factory
def elementwise_epe(input_flow, target_flow):
residual = target_flow - input_flow
return torch.norm(residual, p=2, dim=1)
def downsample2d_as(inputs, ta... | [
"losses.factory.register",
"torch.norm",
"torch.nn.functional.adaptive_avg_pool2d"
] | [((2622, 2670), 'losses.factory.register', 'factory.register', (['"""MultiScaleEPE"""', 'MultiScaleEPE'], {}), "('MultiScaleEPE', MultiScaleEPE)\n", (2638, 2670), False, 'from losses import factory\n'), ((252, 284), 'torch.norm', 'torch.norm', (['residual'], {'p': '(2)', 'dim': '(1)'}), '(residual, p=2, dim=1)\n', (262... |
# Generated by Django 3.2.4 on 2021-06-19 11:48
from django.db import migrations, models
import phonenumber_field.modelfields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='User',
fields=[
... | [
"django.db.models.CharField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField",
"django.db.models.EmailField"
] | [((342, 396), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'primary_key': '(True)', 'serialize': '(False)'}), '(primary_key=True, serialize=False)\n', (361, 396), False, 'from django.db import migrations, models\n'), ((430, 462), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(1... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
We want to implement a simple birth–death process where births happen with a constant rate of :math:`α=0.1` and each individual dies with a rate of :math:`ω=0.001`, starting at a population of :math:`N=0`.
We start with importing the Gillespie class as well as setting th... | [
"oogillespie.Event"
] | [((2977, 2985), 'oogillespie.Event', 'Event', (['α'], {}), '(α)\n', (2982, 2985), False, 'from oogillespie import Gillespie, Event\n'), ((3072, 3089), 'oogillespie.Event', 'Event', (['death_rate'], {}), '(death_rate)\n', (3077, 3089), False, 'from oogillespie import Gillespie, Event\n')] |
from scripts.helpful_scripts import get_account, encode_function_data, upgrade
from brownie import network, Box, BoxV2, ProxyAdmin, TransparentUpgradeableProxy, Contract, config
def main():
account = get_account()
print(f"Deploying to {network.show_active()}")
box = Box.deploy(
{"from": account},
... | [
"scripts.helpful_scripts.encode_function_data",
"scripts.helpful_scripts.get_account",
"brownie.Contract.from_abi",
"scripts.helpful_scripts.upgrade",
"brownie.network.show_active"
] | [((206, 219), 'scripts.helpful_scripts.get_account', 'get_account', ([], {}), '()\n', (217, 219), False, 'from scripts.helpful_scripts import get_account, encode_function_data, upgrade\n'), ((714, 736), 'scripts.helpful_scripts.encode_function_data', 'encode_function_data', ([], {}), '()\n', (734, 736), False, 'from sc... |
import numpy as np
import scipy as sp
from argparse import ArgumentParser
from sklearn.datasets import load_breast_cancer, load_iris, load_boston, load_wine
from sklearn.model_selection import train_test_split
from sklearn.metrics import r2_score, roc_auc_score
from gp_lib.gp import ConstantMeanGP
from gp_lib.sparse im... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"numpy.std",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.r2_score",
"numpy.ones",
"sklearn.datasets.load_boston",
"numpy.mean",
"numpy.random.shuffle"
] | [((397, 416), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (411, 416), True, 'import numpy as np\n'), ((434, 450), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (448, 450), False, 'from argparse import ArgumentParser\n'), ((851, 868), 'sklearn.datasets.load_boston', 'load_boston',... |
# pylint: disable=redefined-outer-name
# pylint: disable=unused-argument
# pylint: disable=unused-variable
# pylint:disable=no-value-for-parameter
import json
import logging
import os
from copy import deepcopy
from pathlib import Path
from pprint import pformat
from typing import Any, AsyncIterable, Dict, Iterable
im... | [
"copy.deepcopy",
"pprint.pformat",
"simcore_service_director_v2.core.application.init_app",
"models_library.projects.Node.parse_obj",
"starlette.testclient.TestClient",
"simcore_service_director_v2.core.settings.AppSettings.create_from_envs",
"asgi_lifespan.LifespanManager",
"pytest.fixture",
"os.en... | [((1464, 1491), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1481, 1491), False, 'import logging\n'), ((1495, 1526), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (1509, 1526), False, 'import pytest\n'), ((1821, 1852), 'pytest.fixture', 'p... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2021 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... | [
"improver.developer_tools.metadata_interpreter.display_interpretation"
] | [((1958, 1993), 'improver.developer_tools.metadata_interpreter.display_interpretation', 'display_interpretation', (['interpreter'], {}), '(interpreter)\n', (1980, 1993), False, 'from improver.developer_tools.metadata_interpreter import display_interpretation\n'), ((2514, 2549), 'improver.developer_tools.metadata_interp... |
import sys
import os
import json
import logging
import urllib
import re
import requests
from datetime import datetime
from bs4 import BeautifulSoup
import decimal
try:
from version import __version__, useragentname, useragentcomment
from util import StyledLazyBuilder
except ModuleNotFoundError:
include = o... | [
"json.load",
"logging.basicConfig",
"re.compile",
"requests.Session",
"os.path.dirname",
"sys.path.insert",
"json.dumps",
"requests.utils.default_user_agent",
"urllib.parse.quote",
"re.findall",
"util.StyledLazyBuilder",
"datetime.datetime.now",
"bs4.BeautifulSoup"
] | [((903, 921), 'requests.Session', 'requests.Session', ([], {}), '()\n', (919, 921), False, 'import requests\n'), ((547, 572), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (562, 572), False, 'import os\n'), ((627, 652), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n'... |
import requests
import bs4
import json
import re
import sys
import getopt
# Define filter for new releases tag (different in main page vs browse by tag)
def pnrFilter(id):
new = (id == "tab_newreleases_content" or id == "tab_PopularNewReleases_content") and bNew
top = (id == "tab_topsellers_content" or id == ... | [
"getopt.getopt",
"json.dumps",
"requests.get",
"bs4.BeautifulSoup",
"sys.exit",
"re.compile"
] | [((1042, 1115), 'getopt.getopt', 'getopt.getopt', (['sys.argv[1:]', '"""hj"""', "['new', 'top', 'tag=', 'max=', 'out=']"], {}), "(sys.argv[1:], 'hj', ['new', 'top', 'tag=', 'max=', 'out='])\n", (1055, 1115), False, 'import getopt\n'), ((2492, 2511), 'requests.get', 'requests.get', (['store'], {}), '(store)\n', (2504, 2... |
from flask import Flask, render_template
from flask_bcrypt import Bcrypt
from flask_bootstrap import Bootstrap
from flask_cors import CORS
from app.admin.ui.views import admin_blueprint
from app.auth.ui.views import auth_blueprint
from app.equipments.ui.views import equipment_blueprint
from app.practice_centers.ui.vie... | [
"flask_cors.CORS",
"flask.Flask",
"flask.render_template",
"flask_bcrypt.Bcrypt",
"flask_bootstrap.Bootstrap"
] | [((552, 598), 'flask.Flask', 'Flask', (['__name__'], {'instance_relative_config': '(True)'}), '(__name__, instance_relative_config=True)\n', (557, 598), False, 'from flask import Flask, render_template\n'), ((645, 656), 'flask_bcrypt.Bcrypt', 'Bcrypt', (['app'], {}), '(app)\n', (651, 656), False, 'from flask_bcrypt imp... |
import pytest
import lagtraj.forcings.create
from lagtraj.forcings import ForcingLevelsDefinition, ForcingSamplingDefinition
from lagtraj.utils import validation
import tempfile
AVAILABLE_CONVERSIONS = [None, "lagtraj://kpt", "lagtraj://dephy"]
@pytest.mark.parametrize(
"gradient_method, advection_velocity_sa... | [
"tempfile.TemporaryDirectory",
"lagtraj.forcings.ForcingSamplingDefinition",
"pytest.mark.parametrize",
"lagtraj.forcings.ForcingLevelsDefinition",
"lagtraj.utils.validation.validate_forcing_profiles",
"lagtraj.utils.validation.check_for_ncview_warnings"
] | [((252, 449), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""gradient_method, advection_velocity_sampling_method"""', "[('boundary', 'domain_mean'), ('regression', 'domain_mean'), ('boundary',\n 'local'), ('regression', 'local')]"], {}), "('gradient_method, advection_velocity_sampling_method',\n [('b... |
#!/usr/bin/env python3
import serial
import sys
COM = '/dev/ttyACM0'
BAUD = 9600
ser = serial.Serial(COM, BAUD, timeout=.1)
print('Waiting for device')
print(ser.name)
# check args
if("-m" in sys.argv or "--monitor" in sys.argv):
monitor = True
else:
monitor = False
while True:
# Capture serial outpu... | [
"serial.Serial"
] | [((91, 128), 'serial.Serial', 'serial.Serial', (['COM', 'BAUD'], {'timeout': '(0.1)'}), '(COM, BAUD, timeout=0.1)\n', (104, 128), False, 'import serial\n')] |
import logging
import os
from typing import Dict, Optional, Tuple
from ray import tune
import transformers
from transformers.file_utils import is_torch_tpu_available
from transformers.trainer_utils import PREFIX_CHECKPOINT_DIR
import torch
from torch.utils.data import Dataset
import wandb
logger = logging.getLogge... | [
"ray.tune.get_trial_dir",
"transformers.file_utils.is_torch_tpu_available",
"ray.tune.checkpoint_dir",
"os.path.join",
"ray.tune.report",
"logging.getLogger"
] | [((304, 331), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (321, 331), False, 'import logging\n'), ((1333, 1362), 'ray.tune.report', 'tune.report', ([], {}), '(**output.metrics)\n', (1344, 1362), False, 'from ray import tune\n'), ((1461, 1503), 'ray.tune.checkpoint_dir', 'tune.checkpoin... |
# Generated by Django 3.2.8 on 2021-10-16 19:40
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('rooms', '0005_auto_20211016_2228'),
]
operations = [
migrations.CreateMo... | [
"django.db.models.BigAutoField",
"django.db.models.DateTimeField",
"django.db.models.ForeignKey"
] | [((400, 496), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (419, 496), False, 'from django.db import migrations, m... |
from __future__ import unicode_literals
import requests
import seeuletter
from seeuletter import error
from seeuletter.version import VERSION
def _is_file_like(obj):
# https://stackoverflow.com/questions/1661262/check-if-object-is-file-like-in-python
return hasattr(obj, 'read') and hasattr(obj, 'seek')
cl... | [
"seeuletter.error.InvalidRequestError",
"seeuletter.error.APIConnectionError",
"requests.delete",
"seeuletter.error.APIError",
"requests.get",
"seeuletter.error.AuthenticationError",
"requests.post"
] | [((520, 616), 'seeuletter.error.APIConnectionError', 'error.APIConnectionError', (['(resp.content or resp.reason)', 'resp.content', 'resp.status_code', 'resp'], {}), '(resp.content or resp.reason, resp.content, resp.\n status_code, resp)\n', (544, 616), False, 'from seeuletter import error\n'), ((807, 904), 'seeulet... |
"""Special variables to be used in rendering."""
import os
import platform
import distro
from typing import TYPE_CHECKING
import csv
if TYPE_CHECKING:
from tackle.models import Context
def get_linux_distribution():
"""Return the equivalent of lsb_release -a."""
if platform.system() == 'Linux':
... | [
"platform.processor",
"csv.reader",
"platform.architecture",
"os.getcwd",
"platform.platform",
"platform.version",
"platform.system",
"platform.release",
"os.path.expanduser",
"distro.linux_distribution"
] | [((283, 300), 'platform.system', 'platform.system', ([], {}), '()\n', (298, 300), False, 'import platform\n'), ((1251, 1262), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1260, 1262), False, 'import os\n'), ((1284, 1307), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (1302, 1307), False, 'im... |
# Database operations for CoreStore
from corestore import app
from tinydb import TinyDB, where, Query
class WarriorExistsWithThatNameException (Exception):
pass
class WarriorExistsWithThatAuthorException (Exception):
pass
def open_warrior_database():
'Get an object from which warriors can be recovered... | [
"tinydb.Query",
"tinydb.TinyDB"
] | [((332, 361), 'tinydb.TinyDB', 'TinyDB', (["app.config['DB_PATH']"], {}), "(app.config['DB_PATH'])\n", (338, 361), False, 'from tinydb import TinyDB, where, Query\n'), ((744, 751), 'tinydb.Query', 'Query', ([], {}), '()\n', (749, 751), False, 'from tinydb import TinyDB, where, Query\n'), ((881, 888), 'tinydb.Query', 'Q... |
import numpy as np
# Define conversions in x and y from pixels space to meters
ym_per_pix = 30/720 # meters per pixel in y dimension
xm_per_pix = 3.7/700 # meters per pixel in x dimension
def measure(ploty, leftx, rightx):
'''
Calculates the curvature of polynomial functions in meters.
'''
left_fit_cr = np.poly... | [
"numpy.absolute",
"numpy.max",
"numpy.polyfit"
] | [((313, 366), 'numpy.polyfit', 'np.polyfit', (['(ploty * ym_per_pix)', '(leftx * xm_per_pix)', '(2)'], {}), '(ploty * ym_per_pix, leftx * xm_per_pix, 2)\n', (323, 366), True, 'import numpy as np\n'), ((379, 433), 'numpy.polyfit', 'np.polyfit', (['(ploty * ym_per_pix)', '(rightx * xm_per_pix)', '(2)'], {}), '(ploty * ym... |
#!/usr/bin/env python3
import sys
import os
#para executar(no linux) coloque python3 no terminal + nome arquivo .py
argumentos = sys.argv
print(argumentos)
qtd_argumentos = len(argumentos)
if qtd_argumentos <= 1:
print('Faltando argumentos:')
print('-a', 'para listar todos os arquivos nesta pasta', sep='\t')
... | [
"os.path.isdir",
"os.path.isfile",
"os.listdir",
"sys.exit"
] | [((560, 575), 'os.listdir', 'os.listdir', (['"""."""'], {}), "('.')\n", (570, 575), False, 'import os\n'), ((396, 406), 'sys.exit', 'sys.exit', ([], {}), '()\n', (404, 406), False, 'import sys\n'), ((608, 631), 'os.path.isfile', 'os.path.isfile', (['arquivo'], {}), '(arquivo)\n', (622, 631), False, 'import os\n'), ((69... |
from typing import Set, Type, TypeVar, Iterable
from sqlalchemy.orm.base import manager_of_class
from sqlalchemy.orm.state import InstanceState
def loaded_attribute_names(state: InstanceState) -> Set[str]:
""" Get the set of loaded attribute names """
# This is the opposite of InstanceState.unloaded which is... | [
"typing.TypeVar",
"sqlalchemy.orm.base.manager_of_class"
] | [((635, 653), 'typing.TypeVar', 'TypeVar', (['"""Class_T"""'], {}), "('Class_T')\n", (642, 653), False, 'from typing import Set, Type, TypeVar, Iterable\n'), ((586, 610), 'sqlalchemy.orm.base.manager_of_class', 'manager_of_class', (['class_'], {}), '(class_)\n', (602, 610), False, 'from sqlalchemy.orm.base import manag... |
from django.test import TestCase
from search.forms import RegisterForm, UserForm
from django.contrib.auth.models import User
# Create your tests here.
class FormTest(TestCase):
@classmethod
def setUpTestData(cls):
cls.data = {
"email": "<EMAIL>",
"password": "<PASSWORD>",
... | [
"search.forms.RegisterForm",
"django.contrib.auth.models.User.objects.create_user",
"search.forms.UserForm"
] | [((458, 581), 'django.contrib.auth.models.User.objects.create_user', 'User.objects.create_user', ([], {'username': '"""test"""', 'email': '"""<EMAIL>"""', 'password': '"""<PASSWORD>"""', 'last_name': '"""test"""', 'first_name': '"""Test"""'}), "(username='test', email='<EMAIL>', password=\n '<PASSWORD>', last_name='... |
import autograd.numpy as np
import gym
from trajopt.rgps import MFRGPS
import warnings
warnings.filterwarnings("ignore")
from joblib import Parallel, delayed
def create_job(kwargs):
import warnings
warnings.filterwarnings("ignore")
np.random.seed(kwargs['seed'])
# pendulum task
env = gym.make... | [
"matplotlib.pyplot.show",
"gym.make",
"warnings.filterwarnings",
"matplotlib.pyplot.legend",
"autograd.numpy.array",
"matplotlib.pyplot.figure",
"joblib.delayed",
"autograd.numpy.random.seed"
] | [((89, 122), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (112, 122), False, 'import warnings\n'), ((1238, 1250), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1248, 1250), True, 'import matplotlib.pyplot as plt\n'), ((1322, 1334), 'matplotlib.pyplot.legen... |
import unittest
import os
from pathlib import Path
from yelp_reviews.visualization.map_functions import (
get_map_df,
get_center,
get_indicators,
get_filter_indicator_df,
get_filter_df,
get_viz
)
DIR_PATH = str(Path(os.getcwd()))
DATA_FOLDER = "yelp_reviews/tests/data"
API_KEY = Path(os.path.jo... | [
"unittest.main",
"yelp_reviews.visualization.map_functions.get_indicators",
"yelp_reviews.visualization.map_functions.get_center",
"os.getcwd",
"yelp_reviews.visualization.map_functions.get_filter_indicator_df",
"os.path.join",
"yelp_reviews.visualization.map_functions.get_filter_df"
] | [((390, 436), 'os.path.join', 'os.path.join', (['DIR_PATH', 'DATA_FOLDER', '"""url.txt"""'], {}), "(DIR_PATH, DATA_FOLDER, 'url.txt')\n", (402, 436), False, 'import os\n'), ((455, 518), 'os.path.join', 'os.path.join', (['DIR_PATH', '"""yelp_reviews/tests/data"""', '"""test1.html"""'], {}), "(DIR_PATH, 'yelp_reviews/tes... |
"""
local.py
--------
A simple local key-value store.
** Keys are not case-sensitive. **
"""
import os
from pathlib import Path
import shutil
from tempfile import NamedTemporaryFile
STORAGE_DIR = Path(".kappa-store")
def _bucket_path(bucket):
"""
Internal method, generates a Path to a bucket.
:param buc... | [
"shutil.rmtree",
"pathlib.Path",
"tempfile.NamedTemporaryFile"
] | [((198, 218), 'pathlib.Path', 'Path', (['""".kappa-store"""'], {}), "('.kappa-store')\n", (202, 218), False, 'from pathlib import Path\n'), ((3458, 3484), 'shutil.rmtree', 'shutil.rmtree', (['STORAGE_DIR'], {}), '(STORAGE_DIR)\n', (3471, 3484), False, 'import shutil\n'), ((2074, 2112), 'tempfile.NamedTemporaryFile', 'N... |
from random import shuffle
from pymetaheuristics.utils.distances import euclidian_distance
from pymetaheuristics.genetic_algorithm.steps.crossovers import (
pmx_single_point)
from pymetaheuristics.genetic_algorithm.model import GeneticAlgorithm
from pymetaheuristics.genetic_algorithm.types import Genome
cities_l... | [
"pymetaheuristics.utils.distances.euclidian_distance",
"random.shuffle",
"pymetaheuristics.genetic_algorithm.model.GeneticAlgorithm"
] | [((924, 1015), 'pymetaheuristics.genetic_algorithm.model.GeneticAlgorithm', 'GeneticAlgorithm', ([], {'fitness_function': 'fitness_function', 'genome_generator': 'genome_generator'}), '(fitness_function=fitness_function, genome_generator=\n genome_generator)\n', (940, 1015), False, 'from pymetaheuristics.genetic_alg... |
"""
Credits:
Copyright (c) 2017-2019 <NAME>, <NAME>, <NAME>, <NAME> (Sinergise)
Copyright (c) 2017-2019 <NAME>, <NAME>, <NAME>, <NAME>, <NAME> (Sinergise)
Copyright (c) 2017-2019 <NAME>, <NAME>, <NAME>, <NAME> (Sinergise)
This source code is licensed under the MIT license found in the LICENSE
file in the root director... | [
"unittest.main",
"numpy.count_nonzero",
"numpy.amin",
"numpy.median",
"shapely.geometry.Polygon.from_bounds",
"eolearn.core.EOPatch.load",
"os.path.realpath",
"numpy.amax",
"numpy.mean",
"numpy.array_equal",
"eolearn.geometry.VectorToRaster",
"eolearn.geometry.RasterToVector"
] | [((14518, 14533), 'unittest.main', 'unittest.main', ([], {}), '()\n', (14531, 14533), False, 'import unittest\n'), ((7715, 7739), 'eolearn.core.EOPatch.load', 'EOPatch.load', (['patch_path'], {}), '(patch_path)\n', (7727, 7739), False, 'from eolearn.core import EOPatch, FeatureType\n'), ((8283, 8317), 'shapely.geometry... |
#! /usr/bin/env python2
import ioutil
import cv2
import dlib
import base64
import numpy as np
import json
from camShift import camshiftTracker, meanshiftTracker
from demo_config import Config
LOG = ioutil.getLogger(__name__)
def clamp(n, minn, maxn):
return max(min(maxn, n), minn)
# Tracking
class TrackerInit... | [
"numpy.minimum",
"numpy.maximum",
"cv2.putText",
"cv2.cvtColor",
"cv2.imwrite",
"camShift.meanshiftTracker",
"ioutil.getLogger",
"dlib.rectangles",
"json.dumps",
"cv2.rectangle",
"base64.b64encode",
"cv2.imencode",
"dlib.correlation_tracker",
"dlib.rectangle",
"cv2.resize",
"cv2.Laplac... | [((201, 227), 'ioutil.getLogger', 'ioutil.getLogger', (['__name__'], {}), '(__name__)\n', (217, 227), False, 'import ioutil\n'), ((540, 566), 'dlib.correlation_tracker', 'dlib.correlation_tracker', ([], {}), '()\n', (564, 566), False, 'import dlib\n'), ((2345, 2372), 'cv2.imencode', 'cv2.imencode', (['""".jpg"""', 'fra... |
import os
import torch.utils.data as data
from ..load_3D import load_3D
VALID_EXTENSIONS = [
'OFF',
'OBJ',
'PCD',
'PLY'
]
def is_3D_file(filename):
return filename.split(".")[-1].upper() in VALID_EXTENSIONS
def find_classes(dir):
classes = [d for d in os.listdir(
dir) if os.path.is... | [
"os.path.isdir",
"os.walk",
"os.path.join",
"os.listdir"
] | [((537, 552), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (547, 552), False, 'import os\n'), ((566, 591), 'os.path.join', 'os.path.join', (['dir', 'target'], {}), '(dir, target)\n', (578, 591), False, 'import os\n'), ((282, 297), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (292, 297), False, 'import... |
#coding:utf-8
import os
import sys
import torch
from torch import nn
import torch.nn.functional as F
from modules.module_util import initial_parameter
class CnnMaxpoolLayer(nn.Module):
def __init__(self, input_num, output_num,
filter_size, stride=1, padding=0,
activation='relu', i... | [
"torch.nn.Conv1d",
"torch.nn.functional.max_pool1d",
"torch.cat",
"torch.transpose"
] | [((1950, 1978), 'torch.transpose', 'torch.transpose', (['input', '(1)', '(2)'], {}), '(input, 1, 2)\n', (1965, 1978), False, 'import torch\n'), ((2448, 2470), 'torch.cat', 'torch.cat', (['tmp'], {'dim': '(-1)'}), '(tmp, dim=-1)\n', (2457, 2470), False, 'import torch\n'), ((2346, 2388), 'torch.nn.functional.max_pool1d',... |
"""Maintenance and querying of permissions"""
import flask
import psycopg2.extensions
import psycopg2.extras
import sqlalchemy.orm
from sqlalchemy.ext.declarative import declarative_base
import mara_db.postgresql
from mara_acl import config, keys, users
from mara_page import acl
Base = declarative_base()
class Per... | [
"flask.flash",
"mara_acl.config.initial_permissions",
"mara_acl.keys.resource_key",
"sqlalchemy.ext.declarative.declarative_base",
"mara_acl.users.login"
] | [((290, 308), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (306, 308), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((2011, 2029), 'mara_acl.users.login', 'users.login', (['email'], {}), '(email)\n', (2022, 2029), False, 'from mara_acl import config, keys,... |
import re
def normalise(pmcid):
pmcid = pmcid.strip()
rx = r"^(PMC){0,1}[\d]{5,7}$"
if not pmcid.startswith("PMC"):
pmcid = "PMC" + pmcid
result = re.match(rx, pmcid)
if result is None:
raise ValueError(pmcid + " does not seem to be a valid PMCID")
return pmcid | [
"re.match"
] | [((175, 194), 're.match', 're.match', (['rx', 'pmcid'], {}), '(rx, pmcid)\n', (183, 194), False, 'import re\n')] |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"grpc.method_handlers_generic_handler",
"grpc.unary_stream_rpc_method_handler",
"grpc.unary_unary_rpc_method_handler",
"grpc.stream_unary_rpc_method_handler",
"grpc.experimental.unary_stream",
"grpc.experimental.stream_unary",
"grpc.experimental.unary_unary"
] | [((22939, 23015), 'grpc.method_handlers_generic_handler', 'grpc.method_handlers_generic_handler', (['"""UntrustedRunner"""', 'rpc_method_handlers'], {}), "('UntrustedRunner', rpc_method_handlers)\n", (22975, 23015), False, 'import grpc\n'), ((14708, 15024), 'grpc.unary_unary_rpc_method_handler', 'grpc.unary_unary_rpc_m... |
from setuptools import setup
setup(
name='rl_unplugged',
version='1.0',
description='A useful module',
author='<NAME>',
author_email='<EMAIL>',
packages=['rl_unplugged'], #same as name
)
| [
"setuptools.setup"
] | [((30, 174), 'setuptools.setup', 'setup', ([], {'name': '"""rl_unplugged"""', 'version': '"""1.0"""', 'description': '"""A useful module"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'packages': "['rl_unplugged']"}), "(name='rl_unplugged', version='1.0', description='A useful module',\n author='<NA... |
'''
改自 https://github.com/switchablenorms/Switchable-Normalization/blob/master/devkit/ops/switchable_norm.py
SwitchableNorm 和 SwitchableNorm1D 可能会有点问题,这里的IN就是他们自身。
2021-9-12
修改了几句,使其兼容 torch.jit.script
'''
import torch
import torch.nn as nn
class SwitchableNormND(nn.Module):
def __init__(self, N, num_features, ... | [
"torch.zeros",
"torch.ones",
"torch.softmax"
] | [((2993, 3027), 'torch.softmax', 'torch.softmax', (['self.mean_weight', '(0)'], {}), '(self.mean_weight, 0)\n', (3006, 3027), False, 'import torch\n'), ((3049, 3082), 'torch.softmax', 'torch.softmax', (['self.var_weight', '(0)'], {}), '(self.var_weight, 0)\n', (3062, 3082), False, 'import torch\n'), ((691, 721), 'torch... |