code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import yaml
class ConfigChanger(object):
''' class to read/write the config file
'''
def __init__(self, location):
self.loc = location # path to yaml file
def config_file_ok(self):
''' returns boolean if config file is OK and contains good values,
or false if config need... | [
"yaml.load",
"yaml.dump"
] | [((1015, 1035), 'yaml.dump', 'yaml.dump', (['config', 'f'], {}), '(config, f)\n', (1024, 1035), False, 'import yaml\n'), ((1157, 1169), 'yaml.load', 'yaml.load', (['f'], {}), '(f)\n', (1166, 1169), False, 'import yaml\n'), ((539, 551), 'yaml.load', 'yaml.load', (['f'], {}), '(f)\n', (548, 551), False, 'import yaml\n')] |
from QuoteEngine import Ingestor, QuoteModel
from MemeGenerator import MemeEngine
from PIL import Image
import argparse
import random
import os
import textwrap
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s:%(levelname)s:%(message)s')
fil... | [
"logging.getLogger",
"logging.StreamHandler",
"random.choice",
"PIL.Image.open",
"logging.Formatter",
"os.path.join",
"textwrap.fill",
"logging.FileHandler",
"random.randint",
"os.walk",
"QuoteEngine.Ingestor.parse"
] | [((185, 212), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (202, 212), False, 'import logging\n'), ((257, 315), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s:%(levelname)s:%(message)s"""'], {}), "('%(asctime)s:%(levelname)s:%(message)s')\n", (274, 315), False, 'import logg... |
# -*- coding: utf-8 -*-
import requests
def get_all_commits(base_url, token, project_id, filter_author=''):
res = []
next_page = 1
url_format = '{}/api/v4/projects/{}/repository/commits?ref=master&per_page=100&page={}'
while next_page != '':
url = url_format.format(base_url, project_id, next_p... | [
"requests.get"
] | [((850, 901), 'requests.get', 'requests.get', (['url'], {'headers': "{'Private-Token': token}"}), "(url, headers={'Private-Token': token})\n", (862, 901), False, 'import requests\n'), ((340, 391), 'requests.get', 'requests.get', (['url'], {'headers': "{'Private-Token': token}"}), "(url, headers={'Private-Token': token}... |
import pandas as pd
df=pd.read_json("D:\eiaScrapper\eio.jl")
print(df.info()) | [
"pandas.read_json"
] | [((25, 64), 'pandas.read_json', 'pd.read_json', (['"""D:\\\\eiaScrapper\\\\eio.jl"""'], {}), "('D:\\\\eiaScrapper\\\\eio.jl')\n", (37, 64), True, 'import pandas as pd\n')] |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 21 20:00:50 2020
@author: takada
"""
import logging
import numpy as np
import functools
import operator
from typing import List, Dict, Callable
import time
import nidaqmx
from nidaqmx.stream_writers import (
DigitalSingleChannelWriter, AnalogMultiChannelWriter)
from... | [
"logging.getLogger",
"qcodes.dataset.sqlite.queries.get_last_run",
"functools.reduce",
"nidaqmx.Task",
"qcodes.dataset.sqlite.database.connect",
"qcodes.validators.Numbers",
"numpy.zeros",
"numpy.linspace",
"qcodes.validators.Ints",
"numpy.empty",
"qcodes.dataset.data_set.load_by_id",
"nidaqmx... | [((664, 691), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (681, 691), False, 'import logging\n'), ((29407, 29418), 'time.time', 'time.time', ([], {}), '()\n', (29416, 29418), False, 'import time\n'), ((7386, 7400), 'nidaqmx.Task', 'nidaqmx.Task', ([], {}), '()\n', (7398, 7400), False, ... |
from django.urls import path
from . import views
app_name = 'v2_trip'
urlpatterns = [
path('', views.main, name='main'),
path('<int:pk>/', views.item_form, name='item_form'),
path('persons/', views.go_persons, name='go_persons'),
path('trips/', views.go_trips, name='go_trips'),
... | [
"django.urls.path"
] | [((91, 124), 'django.urls.path', 'path', (['""""""', 'views.main'], {'name': '"""main"""'}), "('', views.main, name='main')\n", (95, 124), False, 'from django.urls import path\n'), ((145, 197), 'django.urls.path', 'path', (['"""<int:pk>/"""', 'views.item_form'], {'name': '"""item_form"""'}), "('<int:pk>/', views.item_f... |
from dataclasses import dataclass
from my_dataclasses.member import Member
from my_dataclasses.sport import Sport
@dataclass(order=True, frozen=True)
class Plays(object):
member: Member
sport: Sport
| [
"dataclasses.dataclass"
] | [((117, 151), 'dataclasses.dataclass', 'dataclass', ([], {'order': '(True)', 'frozen': '(True)'}), '(order=True, frozen=True)\n', (126, 151), False, 'from dataclasses import dataclass\n')] |
from flask_mail import Mail
from singletons.app import _app
mail = Mail(_app)
| [
"flask_mail.Mail"
] | [((68, 78), 'flask_mail.Mail', 'Mail', (['_app'], {}), '(_app)\n', (72, 78), False, 'from flask_mail import Mail\n')] |
#!/usr/bin/env python3
import sys, json, argparse
parser = argparse.ArgumentParser()
parser.add_argument("--empty_error", action="store_true", help="If present, do not print error message")
args = parser.parse_args()
data=json.load(sys.stdin)
if 'results' in data:
for result in data['results']:
if 'series' ... | [
"json.load",
"argparse.ArgumentParser"
] | [((60, 85), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (83, 85), False, 'import sys, json, argparse\n'), ((224, 244), 'json.load', 'json.load', (['sys.stdin'], {}), '(sys.stdin)\n', (233, 244), False, 'import sys, json, argparse\n')] |
# Copyright 2020 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"absl.flags.DEFINE_integer",
"absl.flags.DEFINE_string",
"absl.flags.DEFINE_boolean"
] | [((711, 783), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""ibmcloud_azone"""', 'None', '"""IBMCloud internal DC name"""'], {}), "('ibmcloud_azone', None, 'IBMCloud internal DC name')\n", (730, 783), False, 'from absl import flags\n'), ((805, 880), 'absl.flags.DEFINE_integer', 'flags.DEFINE_integer', (['"""i... |
import os
from utils import relative_path
# Hyperparams
ARCFACE_M = 0.5
ARCFACE_S = 10.
CENTERLOSS_ALPHA = 0.008
CENTERLOSS_LAMBDA = 0.5
EMBEDDING_SIZE = 256
MIN_FACES_PER_PERSON = 5 # Min num of samples per class - or class is removed
MAX_FACES_PER_PERSON = 200 # Max num of sampl... | [
"utils.relative_path"
] | [((910, 936), 'utils.relative_path', 'relative_path', (['"""../model/"""'], {}), "('../model/')\n", (923, 936), False, 'from utils import relative_path\n'), ((1204, 1267), 'utils.relative_path', 'relative_path', (['"""../data/vggface_bb_landmark/loose_bb_train.csv"""'], {}), "('../data/vggface_bb_landmark/loose_bb_trai... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from rasa_core.channels import UserMessage
from rasa_core.channels.direct import CollectingOutputChannel
from rasa_core.featurizers import BinaryFeaturizer
from rasa_core... | [
"rasa_core.channels.UserMessage",
"rasa_core.channels.direct.CollectingOutputChannel",
"rasa_core.tracker_store.InMemoryTrackerStore",
"rasa_core.processor.MessageProcessor",
"rasa_core.policies.scoring_policy.ScoringPolicy",
"rasa_core.featurizers.BinaryFeaturizer",
"rasa_core.interpreter.RegexInterpre... | [((881, 899), 'rasa_core.interpreter.RegexInterpreter', 'RegexInterpreter', ([], {}), '()\n', (897, 899), False, 'from rasa_core.interpreter import RegexInterpreter\n'), ((1048, 1084), 'rasa_core.tracker_store.InMemoryTrackerStore', 'InMemoryTrackerStore', (['default_domain'], {}), '(default_domain)\n', (1068, 1084), F... |
import uuid
from typing import Dict, List, Text, Union
import pandas as pd
import torch
from datasets import load_metric
from pytorch_lightning.metrics import Metric
from seqeval.metrics import classification_report
# MIT License
#
# Copyright (c) 2021 Université Paris-Saclay
# Copyright (c) 2021 Laboratoire national... | [
"seqeval.metrics.classification_report",
"datasets.load_metric",
"uuid.uuid4",
"torch.tensor",
"pandas.DataFrame",
"torch.argmax"
] | [((1492, 1504), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (1502, 1504), False, 'import uuid\n'), ((2336, 2390), 'datasets.load_metric', 'load_metric', (['name_or_path'], {'experiment_id': 'UNIQUE_RUN_ID'}), '(name_or_path, experiment_id=UNIQUE_RUN_ID)\n', (2347, 2390), False, 'from datasets import load_metric\n'), ... |
# Project Euler - Problem 4
# Find the largest palindrome made from the product of two 3-digit numbers.
import time
start = time.time()
def pal(s):
i = 0
j = len(s) - 1
while i < j:
if s[i] != s[j]:
return 0
i += 1
j -= 1
return 1
n1 = 100
n2 = 1000 # exclusive
mx = 0
for i in range(n1, n2):
for j in r... | [
"time.time"
] | [((125, 136), 'time.time', 'time.time', ([], {}), '()\n', (134, 136), False, 'import time\n'), ((402, 413), 'time.time', 'time.time', ([], {}), '()\n', (411, 413), False, 'import time\n')] |
#!/usr/bin/env python
###########################################################################
# Active Inference algorithm
#
# Execute the AI algorithm using the data from the
# /filter/y_coloured_noise topic and publish the results to the
# /filter/ai/output topic.
# Note that only the filtering part of the AI ... | [
"numpy.eye",
"numpy.sqrt",
"rospy.Subscriber",
"rospy.init_node",
"numpy.kron",
"numpy.zeros",
"numpy.linalg.inv",
"rospy.spin",
"scipy.linalg.block_diag",
"jackal_active_inference_versus_kalman_filter.msg.filt_output",
"numpy.matrix",
"rospy.Publisher",
"numpy.amax",
"numpy.cumprod"
] | [((3139, 3190), 'numpy.matrix', 'np.matrix', (['"""16.921645797507500 -16.921645797507500"""'], {}), "('16.921645797507500 -16.921645797507500')\n", (3148, 3190), True, 'import numpy as np\n'), ((3520, 3545), 'numpy.kron', 'np.kron', (['temp', 'self.x_ref'], {}), '(temp, self.x_ref)\n', (3527, 3545), True, 'import nump... |
import os, sys
import unittest
import subprocess
import shutil
import logging
import io
import stat
from pathlib import Path as _Path
from multiprocessing import freeze_support
from sys import platform as _platform
import json
from clang_build import cli
from clang_build import toolchain
from clang_build.errors impor... | [
"logging.getLogger",
"subprocess.check_output",
"json.loads",
"sys.path.insert",
"clang_build.cli.parse_args",
"os.path.exists",
"pylib.triple",
"pathlib.Path",
"os.listdir",
"logging.Formatter",
"os.path.join",
"os.chmod",
"clang_build.logging_tools.TqdmHandler",
"multiprocessing.freeze_s... | [((12753, 12769), 'multiprocessing.freeze_support', 'freeze_support', ([], {}), '()\n', (12767, 12769), False, 'from multiprocessing import freeze_support\n'), ((12774, 12789), 'unittest.main', 'unittest.main', ([], {}), '()\n', (12787, 12789), False, 'import unittest\n'), ((631, 660), 'os.chmod', 'os.chmod', (['path',... |
from typing import Callable, Mapping, TypedDict
import asyncio, aiohttp, discord
class Options(TypedDict):
interval: int
start: bool
class AutoPoster():
token: str
interval: int
bot: discord.Client
stopped: bool
_events: Mapping[str, Callable]
def __init__(self, token: str, bot: dis... | [
"aiohttp.ClientSession",
"asyncio.sleep"
] | [((1416, 1439), 'aiohttp.ClientSession', 'aiohttp.ClientSession', ([], {}), '()\n', (1437, 1439), False, 'import asyncio, aiohttp, discord\n'), ((1819, 1847), 'asyncio.sleep', 'asyncio.sleep', (['self.interval'], {}), '(self.interval)\n', (1832, 1847), False, 'import asyncio, aiohttp, discord\n')] |
from django.test import LiveServerTestCase
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from animais.models import Animal
class AnimaisTestCase(LiveServerTestCase):
def setUp(self):
chrome_options = Options()
chrome_options.add_argument('--headless')
... | [
"selenium.webdriver.chrome.options.Options",
"animais.models.Animal.objects.create",
"selenium.webdriver.Chrome"
] | [((253, 262), 'selenium.webdriver.chrome.options.Options', 'Options', ([], {}), '()\n', (260, 262), False, 'from selenium.webdriver.chrome.options import Options\n'), ((336, 424), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'executable_path': '"""chromedriver.exe"""', 'chrome_options': 'chrome_options'}), "(... |
import logging
import os
logging.basicConfig(level=os.environ.get('LOG_LEVEL', 'INFO'), format='[python %(name)s pid: %(process)d] %(levelname)s: %(message)s')
logger = logging.getLogger(__name__)
logger.info('{} imported'.format(__name__))
| [
"logging.getLogger",
"os.environ.get"
] | [((170, 197), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (187, 197), False, 'import logging\n'), ((52, 87), 'os.environ.get', 'os.environ.get', (['"""LOG_LEVEL"""', '"""INFO"""'], {}), "('LOG_LEVEL', 'INFO')\n", (66, 87), False, 'import os\n')] |
import os
import constants.constants as const
SVC_NAME = const.SVC_NAME
MODEL_CONFIG = {
'model_path': os.getenv('MODEL_PATH', 'data/model/crnn_model.h5')
}
LOGGER_CONFIG = {
'log_level': os.getenv('LOG_LEVEL', 'DEBUG'),
'log_handle': os.getenv('LOG_HANDLE', 'file'),
'log_path': os.getenv... | [
"os.getenv"
] | [((115, 166), 'os.getenv', 'os.getenv', (['"""MODEL_PATH"""', '"""data/model/crnn_model.h5"""'], {}), "('MODEL_PATH', 'data/model/crnn_model.h5')\n", (124, 166), False, 'import os\n'), ((209, 240), 'os.getenv', 'os.getenv', (['"""LOG_LEVEL"""', '"""DEBUG"""'], {}), "('LOG_LEVEL', 'DEBUG')\n", (218, 240), False, 'import... |
import logging
l = logging.getLogger("archr.analyzers.datascout")
from ..errors import ArchrError
from . import Analyzer
# Keystone engine 0.9.2 (incorrectly) defaults to radix 16. so we'd better off only using 0x-prefixed integers from now.
# See the related PR: https://github.com/keystone-engine/keystone/pull/382
... | [
"logging.getLogger"
] | [((20, 66), 'logging.getLogger', 'logging.getLogger', (['"""archr.analyzers.datascout"""'], {}), "('archr.analyzers.datascout')\n", (37, 66), False, 'import logging\n')] |
import pytest
from capreolus.collection import Collection, DummyCollection
from capreolus.index import Index
from capreolus.index import AnseriniIndex
from capreolus.tests.common_fixtures import tmpdir_as_cache, dummy_index
def test_anserini_create_index(tmpdir_as_cache):
index = AnseriniIndex({"_name": "anserin... | [
"capreolus.tests.common_fixtures.dummy_index.get_idf",
"capreolus.collection.DummyCollection",
"capreolus.tests.common_fixtures.dummy_index.get_docs",
"capreolus.tests.common_fixtures.dummy_index.get_df",
"capreolus.index.AnseriniIndex"
] | [((288, 366), 'capreolus.index.AnseriniIndex', 'AnseriniIndex', (["{'_name': 'anserini', 'indexstops': False, 'stemmer': 'porter'}"], {}), "({'_name': 'anserini', 'indexstops': False, 'stemmer': 'porter'})\n", (301, 366), False, 'from capreolus.index import AnseriniIndex\n'), ((401, 436), 'capreolus.collection.DummyCol... |
import logging
try:
from asyncpg import create_pool
except ModuleNotFoundError:
logging.warning('Database not set up, install asyncpg')
from noheavenbot.utils.constants import EnvVariables
class Database:
@classmethod
async def connect(cls):
credentials = {'user': EnvVariables.get('DB_USER'... | [
"noheavenbot.utils.constants.EnvVariables.get",
"logging.warning",
"asyncpg.create_pool"
] | [((89, 144), 'logging.warning', 'logging.warning', (['"""Database not set up, install asyncpg"""'], {}), "('Database not set up, install asyncpg')\n", (104, 144), False, 'import logging\n'), ((294, 321), 'noheavenbot.utils.constants.EnvVariables.get', 'EnvVariables.get', (['"""DB_USER"""'], {}), "('DB_USER')\n", (310, ... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | [
"pulumi.getter",
"pulumi.set",
"pulumi.ResourceOptions",
"pulumi.get"
] | [((1590, 1626), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""hostAccountIds"""'}), "(name='hostAccountIds')\n", (1603, 1626), False, 'import pulumi\n'), ((2004, 2032), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""hostId"""'}), "(name='hostId')\n", (2017, 2032), False, 'import pulumi\n'), ((2305, 2337), 'p... |
import pytest
from coordinator.api.models import Study, Task
from coordinator.api.factories.release import ReleaseFactory
ALL_TASKS = """
query (
$state: String,
$createdBefore: Float,
$createdAfter: Float,
$orderBy:String
) {
allTasks(
state: $state,
createdBefore: $createdBefore,... | [
"coordinator.api.models.Study",
"pytest.mark.parametrize",
"coordinator.api.factories.release.ReleaseFactory.create_batch"
] | [((575, 719), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""user_type,expected"""', "[('admin', lambda : 30), ('dev', lambda : 30), ('user', lambda : 20), (\n 'anon', lambda : 10)]"], {}), "('user_type,expected', [('admin', lambda : 30), (\n 'dev', lambda : 30), ('user', lambda : 20), ('anon', lambd... |
import random
print("\tWelcome to 'Guess My Number!'")
# This stores the previous guesses and tells us whether they are right
class oldGuesses(object):
def __init__(self, low, high):
# This is the initialization data
self.guesses = []
self.low = low
self.high = high
... | [
"random.randint"
] | [((1509, 1540), 'random.randint', 'random.randint', (['lowest', 'highest'], {}), '(lowest, highest)\n', (1523, 1540), False, 'import random\n')] |
#!/usr/bin/env python3
#coding:utf-8
import os, sys
from sys import exit
from utils.excel import read_excel_data
import utils.path as utils_path
from utils.logger import Logger
os.chdir(utils_path.TOOLS_ROOT_PATH)
key_map = {
"cmd" : "string",
"lang" : "string",
"script" : "s... | [
"utils.excel.read_excel_data",
"os.path.exists",
"os.makedirs",
"os.chdir",
"os.path.dirname",
"os.popen",
"utils.logger.Logger"
] | [((179, 215), 'os.chdir', 'os.chdir', (['utils_path.TOOLS_ROOT_PATH'], {}), '(utils_path.TOOLS_ROOT_PATH)\n', (187, 215), False, 'import os, sys\n'), ((444, 505), 'utils.excel.read_excel_data', 'read_excel_data', (['"""./export_cmds.xlsx"""', '"""main"""', 'key_map', '"""cmd"""'], {}), "('./export_cmds.xlsx', 'main', k... |
from django.conf.urls import url,include
from django.contrib import admin
from . import views
app_name = 'synchro'
urlpatterns =[
url(r'^semaphores/$', views.semaphores, name='semaphores'),
url(r'^socket/$', views.socket, name='socket'),
url(r'^deadlocks/$', views.deadlocks, name='deadlocks'),
... | [
"django.conf.urls.url"
] | [((141, 198), 'django.conf.urls.url', 'url', (['"""^semaphores/$"""', 'views.semaphores'], {'name': '"""semaphores"""'}), "('^semaphores/$', views.semaphores, name='semaphores')\n", (144, 198), False, 'from django.conf.urls import url, include\n'), ((206, 251), 'django.conf.urls.url', 'url', (['"""^socket/$"""', 'views... |
import websocket
from threading import Thread
from bot.Command import Command
import time
class Bot:
def __init__(self, username, password, host):
self.__commands = dict()
self._username = username
self._password = password
self.__host = host
self.__threadStarted = False
... | [
"threading.Thread",
"websocket.create_connection"
] | [((399, 439), 'websocket.create_connection', 'websocket.create_connection', (['self.__host'], {}), '(self.__host)\n', (426, 439), False, 'import websocket\n'), ((833, 890), 'threading.Thread', 'Thread', ([], {'target': 'self.__listen_function__', 'args': '(callback,)'}), '(target=self.__listen_function__, args=(callbac... |
try: # Python 2
from Tkinter import * # noqa
except ImportError: # Python 3
from tkinter import * # noqa
import time
from rectbutton import RectButton
from serial_connection import SerialConnection
UPDATE_MS = 20
DISPLAY_MS = 125
class DispensingScreen(Frame):
def __init__(self, master, recipe, amo... | [
"rectbutton.RectButton",
"serial_connection.SerialConnection"
] | [((429, 447), 'serial_connection.SerialConnection', 'SerialConnection', ([], {}), '()\n', (445, 447), False, 'from serial_connection import SerialConnection\n'), ((595, 660), 'rectbutton.RectButton', 'RectButton', (['self'], {'text': '"""Abbruch"""', 'command': 'self.handle_button_back'}), "(self, text='Abbruch', comma... |
import unittest
import mock
import Tkinter
from cursecreator import Application
class TestNPCCreator(unittest.TestCase):
def setUp(self):
root = Tkinter.Tk()
self.app = Application(root)
def test_attribute_fixer(self):
self.assertTrue(self.app.attribute_fixer("health", 0))
self.assertFalse(self.app.attribut... | [
"unittest.main",
"Tkinter.Tk",
"cursecreator.Application"
] | [((371, 386), 'unittest.main', 'unittest.main', ([], {}), '()\n', (384, 386), False, 'import unittest\n'), ((149, 161), 'Tkinter.Tk', 'Tkinter.Tk', ([], {}), '()\n', (159, 161), False, 'import Tkinter\n'), ((175, 192), 'cursecreator.Application', 'Application', (['root'], {}), '(root)\n', (186, 192), False, 'from curse... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Modbus TestKit: Implementation of Modbus protocol in python
(C)2009 - <NAME> - <EMAIL>
(C)2009 - Apidev - http://www.apidev.fr
This is distributed under GNU LGPL license, see license.txt
Make possible to write modbus TCP and RTU master and slave for te... | [
"logging.getLogger"
] | [((762, 792), 'logging.getLogger', 'logging.getLogger', (['"""modbus_tk"""'], {}), "('modbus_tk')\n", (779, 792), False, 'import logging\n')] |
from contextlib import contextmanager
from typing import Dict
from django.conf import settings
from django.contrib.auth.models import User
from django.core.cache import cache
from django.db import models, transaction
from django.utils.functional import cached_property, lazy
from django.utils.translation import gettext... | [
"django.db.models.OneToOneField",
"django.db.transaction.atomic",
"django.db.models.ForeignKey",
"django.core.cache.cache.delete",
"django.utils.translation.gettext_lazy",
"django.contrib.auth.models.User.objects.filter",
"django.utils.functional.lazy",
"django.core.cache.cache.set",
"django.core.ca... | [((4439, 4490), 'django.utils.functional.lazy', 'lazy', (['UserPermissions.get_for_user', 'UserPermissions'], {}), '(UserPermissions.get_for_user, UserPermissions)\n', (4443, 4490), False, 'from django.utils.functional import cached_property, lazy\n'), ((458, 552), 'django.db.models.OneToOneField', 'models.OneToOneFiel... |
#!/usr/bin/env python
# Copyright (c) 2011, <NAME> (Berlin, Germany)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this... | [
"DyMat.Export.formats.keys",
"DyMat.Export.export",
"DyMat.DyMatFile"
] | [((1649, 1676), 'DyMat.Export.formats.keys', 'DyMat.Export.formats.keys', ([], {}), '()\n', (1674, 1676), False, 'import DyMat, DyMat.Export, random\n'), ((1721, 1740), 'DyMat.DyMatFile', 'DyMat.DyMatFile', (['fi'], {}), '(fi)\n', (1736, 1740), False, 'import DyMat, DyMat.Export, random\n'), ((2006, 2037), 'DyMat.Expor... |
#!/usr/bin/env python
from distutils.core import setup
setup(name='longshot',
version='0.1alpha',
description='SMOK client connectivity library',
author='<EMAIL>k-serwis.pl',
author_email='<EMAIL>',
url='https://github.com/smok-serwis/longshot-python',
packages=['longshot', 'longsh... | [
"distutils.core.setup"
] | [((57, 319), 'distutils.core.setup', 'setup', ([], {'name': '"""longshot"""', 'version': '"""0.1alpha"""', 'description': '"""SMOK client connectivity library"""', 'author': '"""<EMAIL>k-serwis.pl"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/smok-serwis/longshot-python"""', 'packages': "['longsho... |
import sys
from asyncio.exceptions import CancelledError
from time import sleep
from usercodex import codex
from ..core.logger import logging
from ..core.managers import edit_or_reply
from ..sql_helper.global_collection import (
add_to_collectionlist,
del_keyword_collectionlist,
get_collectionlist_items,
... | [
"usercodex.codex.disconnect",
"sys.exit",
"time.sleep",
"usercodex.codex.cod_cmd"
] | [((497, 661), 'usercodex.codex.cod_cmd', 'codex.cod_cmd', ([], {'pattern': '"""restart$"""', 'command': "('restart', plugin_category)", 'info': "{'header': 'Restarts the bot !!', 'usage': '{tr}restart'}", 'disable_errors': '(True)'}), "(pattern='restart$', command=('restart', plugin_category),\n info={'header': 'Res... |
from utils import load, save, path_list, DEAD_PMTS
import nets
import torch
import numpy as np
import pandas as pd
from scipy import interpolate
import matplotlib.pyplot as plt
from matplotlib.ticker import PercentFormatter
from itertools import repeat
from multiprocessing import Pool
def neural_residual(root_dir):... | [
"matplotlib.ticker.PercentFormatter",
"utils.load",
"numpy.array",
"numpy.linalg.norm",
"scipy.interpolate.interp2d",
"nets.Net",
"itertools.repeat",
"numpy.histogram",
"matplotlib.pyplot.close",
"pandas.DataFrame",
"matplotlib.pyplot.savefig",
"nets.CNN1c",
"nets.Net2c",
"numpy.argmax",
... | [((2208, 2242), 'utils.load', 'load', (['"""src/pmtcoordinates_ID.json"""'], {}), "('src/pmtcoordinates_ID.json')\n", (2212, 2242), False, 'from utils import load, save, path_list, DEAD_PMTS\n'), ((2259, 2293), 'utils.load', 'load', (["(root_dir + '/testpaths.list')"], {}), "(root_dir + '/testpaths.list')\n", (2263, 22... |
import datetime as dt
import unittest
from AShareData import set_global_config
from AShareData.model import *
class MyTestCase(unittest.TestCase):
def setUp(self) -> None:
set_global_config('config.json')
def test_something(self):
self.assertEqual(True, False)
@staticmethod
def test... | [
"unittest.main",
"datetime.datetime",
"AShareData.set_global_config"
] | [((1865, 1880), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1878, 1880), False, 'import unittest\n'), ((187, 219), 'AShareData.set_global_config', 'set_global_config', (['"""config.json"""'], {}), "('config.json')\n", (204, 219), False, 'from AShareData import set_global_config\n'), ((438, 461), 'datetime.date... |
import torch
from collections.abc import Iterable
def _get_layers(model, all_layers=None, all_names=None, top_name=None, fn=None, sep='_'):
"""Auxiliar function. Recursive method for getting all in the model for which `fn(layer)=True`."""
if all_names is None:
all_names = []
if all_layers is None:... | [
"torch.zeros"
] | [((4141, 4174), 'torch.zeros', 'torch.zeros', (['shape'], {'dtype': 'x.dtype'}), '(shape, dtype=x.dtype)\n', (4152, 4174), False, 'import torch\n')] |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | [
"utils.raiseException"
] | [((2841, 2917), 'utils.raiseException', 'utils.raiseException', (['"""The function must be a method or function"""', 'TypeError'], {}), "('The function must be a method or function', TypeError)\n", (2861, 2917), False, 'import utils\n'), ((4425, 4495), 'utils.raiseException', 'utils.raiseException', (['"""Random option... |
"""Implements the test class for the spelling corrector"""
import json
import logging
import os
import sys
import unittest
from unittest import TestCase
from spelling_corrector import NorvigCorrector, SymmetricDeleteCorrector
class SpellingCorrectorTest(TestCase):
"""Implements the test class for the spelling c... | [
"logging.basicConfig",
"os.listdir",
"os.path.join",
"os.getcwd",
"json.load",
"spelling_corrector.NorvigCorrector",
"unittest.main",
"spelling_corrector.SymmetricDeleteCorrector",
"logging.info"
] | [((3930, 3989), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.DEBUG'}), '(stream=sys.stdout, level=logging.DEBUG)\n', (3949, 3989), False, 'import logging\n'), ((3994, 4009), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4007, 4009), False, 'import unittest\n'), ((... |
from django.conf import settings
from django.conf.urls import url, patterns, include
from django.contrib import admin
from django.core.urlresolvers import reverse_lazy
from django.http import HttpResponse
from django.views.decorators.cache import cache_page
from django.views.generic.base import TemplateView, RedirectVi... | [
"django.views.generic.base.TemplateView.as_view",
"django.http.HttpResponse",
"django.views.decorators.cache.cache_page",
"django.core.urlresolvers.reverse_lazy",
"django.contrib.admin.autodiscover"
] | [((575, 595), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (593, 595), False, 'from django.contrib import admin\n'), ((825, 856), 'django.views.decorators.cache.cache_page', 'cache_page', (['STANDARD_CACHE_TIME'], {}), '(STANDARD_CACHE_TIME)\n', (835, 856), False, 'from django.views.deco... |
from re import search
from editor import get_path
def count_spaces(line):
patter = r' {1,6}'
return search(patter, line).span()[1]
def replace():
steps={1:'Extracting content',2:'Starting edition',3:'Getting cuantity'}
actual=1
try:
file = get_path()
print(steps[1])
content = open(file).read()
line = ... | [
"editor.get_path",
"re.search"
] | [((251, 261), 'editor.get_path', 'get_path', ([], {}), '()\n', (259, 261), False, 'from editor import get_path\n'), ((104, 124), 're.search', 'search', (['patter', 'line'], {}), '(patter, line)\n', (110, 124), False, 'from re import search\n')] |
import geocoder
from .log_helper import LogHelper
_logger = LogHelper.getLogger()
class Geocoder:
def reverse_geocode(self, lat, lon):
"""Retrieves reverse geocoding informatioon for the given latitude and longitude.
Args:
lat, long: latitude and longitude to reverse geocode, as floa... | [
"geocoder.osm"
] | [((509, 551), 'geocoder.osm', 'geocoder.osm', (['[lat, lon]'], {'method': '"""reverse"""'}), "([lat, lon], method='reverse')\n", (521, 551), False, 'import geocoder\n')] |
import numpy as np
import cPickle
class Distribution(object):
def dim(self):
raise NotImplementedError('abstract base class')
def predict(self, cond=None):
raise NotImplementedError('abstract base class')
def sample(self, cond=None, key_prefix=""):
raise NotImplementedError('ab... | [
"cPickle.dump"
] | [((1903, 1950), 'cPickle.dump', 'cPickle.dump', (['self', 'f', 'cPickle.HIGHEST_PROTOCOL'], {}), '(self, f, cPickle.HIGHEST_PROTOCOL)\n', (1915, 1950), False, 'import cPickle\n')] |
from django.urls import path
from foodapp.views import *
from django.views.generic.base import TemplateView
from .views import FoodCreateView,FoodListView
from django.conf import settings
from django.conf.urls.static import static
'''
TemplateView is built-in django Class Based view Class
which is used to ren... | [
"django.views.generic.base.TemplateView.as_view"
] | [((445, 501), 'django.views.generic.base.TemplateView.as_view', 'TemplateView.as_view', ([], {'template_name': '"""foodapp/index.html"""'}), "(template_name='foodapp/index.html')\n", (465, 501), False, 'from django.views.generic.base import TemplateView\n')] |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import sys
import re
import urllib
import json
import socket
import time
import multiprocessing
from multiprocessing.dummy import Pool
from multiprocessing import Queue
import requests
timeout = 5
socket.setdefaulttimeout(timeout)
class Image(object):
"""图... | [
"os.path.exists",
"json.loads",
"os.listdir",
"requests.Session",
"os.path.join",
"time.sleep",
"requests.get",
"urllib.quote",
"os.mkdir",
"multiprocessing.dummy.Pool",
"json.load",
"multiprocessing.Queue",
"socket.setdefaulttimeout",
"re.search"
] | [((255, 288), 'socket.setdefaulttimeout', 'socket.setdefaulttimeout', (['timeout'], {}), '(timeout)\n', (279, 288), False, 'import socket\n'), ((5278, 5314), 'os.path.join', 'os.path.join', (['sys.path[0]', '"""results"""'], {}), "(sys.path[0], 'results')\n", (5290, 5314), False, 'import os\n'), ((964, 972), 'multiproc... |
from setuptools import setup, find_packages
from codecs import open
import os
# Get the long description from the README file
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "README.md")) as f:
long_description = f.read()
# Get the version
for line in open(os.path.join(here, "strup... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((151, 176), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (166, 176), False, 'import os\n'), ((295, 337), 'os.path.join', 'os.path.join', (['here', '"""strup"""', '"""__init__.py"""'], {}), "(here, 'strup', '__init__.py')\n", (307, 337), False, 'import os\n'), ((188, 219), 'os.path.join', ... |
# Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Runs a power flow.
"""
from sys import stdout, stderr
from os.path import dirname, join
from time import time
from numpy import r_, c_, ix_, zeros, pi, ones... | [
"numpy.angle",
"numpy.exp",
"pypower.newtonpf_fast.newtonpf_fast",
"time.time",
"pypower.makeSbus.makeSbus"
] | [((3722, 3728), 'time.time', 'time', ([], {}), '()\n', (3726, 3728), False, 'from time import time\n'), ((4014, 4041), 'pypower.makeSbus.makeSbus', 'makeSbus', (['baseMVA', 'bus', 'gen'], {}), '(baseMVA, bus, gen)\n', (4022, 4041), False, 'from pypower.makeSbus import makeSbus\n'), ((4090, 4139), 'pypower.newtonpf_fast... |
# This program imports the federal reserve economic data consumer price index
# values from 1990 and uses those values to get the real values or infaltion adjusted
# values of the sepcific commodities/markets.
# Then when a commdoity hits a specific low infaltion based price, the algo
# enters into a long psoiton and ... | [
"numpy.zeros",
"csv.reader",
"quantiacsToolbox.runts"
] | [((516, 532), 'numpy.zeros', 'numpy.zeros', (['(328)'], {}), '(328)\n', (527, 532), False, 'import numpy\n'), ((1860, 1881), 'numpy.zeros', 'numpy.zeros', (['nMarkets'], {}), '(nMarkets)\n', (1871, 1881), False, 'import numpy\n'), ((5505, 5537), 'quantiacsToolbox.runts', 'quantiacsToolbox.runts', (['__file__'], {}), '(... |
import contextlib
import random
import string
from password_strength import PasswordStats
from redbot.core import commands
from redbot.core.utils import chat_formatting as cf
from .word_list import *
GREEN_CIRCLE = "\N{LARGE GREEN CIRCLE}"
YELLOW_CIRCLE = "\N{LARGE YELLOW CIRCLE}"
ORANGE_CIRCLE = "\N{LARGE ORANGE CI... | [
"random.choice",
"redbot.core.utils.chat_formatting.quote",
"password_strength.PasswordStats",
"contextlib.suppress",
"redbot.core.commands.group",
"random.randint"
] | [((1274, 1290), 'redbot.core.commands.group', 'commands.group', ([], {}), '()\n', (1288, 1290), False, 'from redbot.core import commands\n'), ((2510, 2533), 'password_strength.PasswordStats', 'PasswordStats', (['password'], {}), '(password)\n', (2523, 2533), False, 'from password_strength import PasswordStats\n'), ((96... |
import numpy as np
gama = 0.5
alfa = 0.75
data = np.array([[1, 1, 1], [1, 2, -1], [2, 1, 1]]) #(s, s', R)
Q = np.zeros((data.shape[0]+1, 2)) #(iterations, |S|)
k = 1
for d in range(data.shape[0]):
R = data[d, 2] #inmediate reward
idx_s = data[d, 0] - 1 # index of state s in Q
idx_sp = data[d, 1] - 1 #ind... | [
"numpy.array",
"numpy.zeros"
] | [((50, 94), 'numpy.array', 'np.array', (['[[1, 1, 1], [1, 2, -1], [2, 1, 1]]'], {}), '([[1, 1, 1], [1, 2, -1], [2, 1, 1]])\n', (58, 94), True, 'import numpy as np\n'), ((111, 143), 'numpy.zeros', 'np.zeros', (['(data.shape[0] + 1, 2)'], {}), '((data.shape[0] + 1, 2))\n', (119, 143), True, 'import numpy as np\n')] |
import os
import numpy as np
import warnings
warnings.filterwarnings('ignore')
import torch
import torch.nn as nn
from torchvision.utils import save_image
from utils import get_lr_scheduler, sample_images, inference
# Reproducibility #
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
... | [
"numpy.average",
"utils.inference",
"torch.nn.L1Loss",
"utils.get_lr_scheduler",
"torch.cuda.is_available",
"utils.sample_images",
"warnings.filterwarnings"
] | [((45, 78), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (68, 78), False, 'import warnings\n'), ((365, 390), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (388, 390), False, 'import torch\n'), ((508, 519), 'torch.nn.L1Loss', 'nn.L1Loss', ([], {}... |
##############################
## MFP_K1000.py ##
## <NAME> ##
## Version 2020.03.25 ##
##############################
import os
import os.path as osp
import time
import subprocess as spc
import numpy as np
import scipy as sp
import astropy.io.fits as fits
import h... | [
"HEALPixFunctions.increaseResolution",
"HEALPixFunctions.loadFitsFullMap",
"HEALPixFunctions.saveFitsFullMap",
"astropy.io.fits.getdata",
"numpy.zeros",
"HEALPixFunctions.RADECToPatch",
"numpy.fmin"
] | [((2281, 2302), 'astropy.io.fits.getdata', 'fits.getdata', (['name', '(1)'], {}), '(name, 1)\n', (2293, 2302), True, 'import astropy.io.fits as fits\n'), ((2653, 2679), 'numpy.zeros', 'np.zeros', (['nbPix'], {'dtype': 'int'}), '(nbPix, dtype=int)\n', (2661, 2679), True, 'import numpy as np\n'), ((3065, 3110), 'HEALPixF... |
from django.contrib.auth.models import User
from mecc.apps.years.models import UniversityYear
class UsefullDisplay(object):
def process_request(self, request):
# always sent real user in order e.g. to display last first name
if request.session.get('is_spoofed_user'):
u = User.objects.... | [
"django.contrib.auth.models.User.objects.get",
"mecc.apps.years.models.UniversityYear.objects.filter"
] | [((307, 366), 'django.contrib.auth.models.User.objects.get', 'User.objects.get', ([], {'username': "request.session['real_username']"}), "(username=request.session['real_username'])\n", (323, 366), False, 'from django.contrib.auth.models import User\n'), ((489, 539), 'mecc.apps.years.models.UniversityYear.objects.filte... |
#!/usr/bin/env python
# Copyright (c) 2019, Solitude Developers
#
# This source code is licensed under the BSD-3-Clause license found in the
# COPYING file in the root directory of this source tree
from typing import List, Tuple # noqa
import sys
import os
import argparse
import datetime
import binascii
import json
... | [
"solitude.common.errors.CLIError",
"argparse.ArgumentParser",
"solitude.common.read_yaml_or_json",
"solitude.common.update_global_config",
"binascii.unhexlify"
] | [((518, 541), 'solitude.common.read_yaml_or_json', 'read_yaml_or_json', (['path'], {}), '(path)\n', (535, 541), False, 'from solitude.common import update_global_config, read_yaml_or_json, read_config_file\n'), ((546, 581), 'solitude.common.update_global_config', 'update_global_config', (['cfg_from_file'], {}), '(cfg_f... |
from pypy.rpython.lltypesystem import rffi, lltype
from pypy.rpython.lltypesystem.lltype import Ptr, FuncType, Void
from pypy.module.cpyext.api import (cpython_struct, Py_ssize_t, Py_ssize_tP,
PyVarObjectFields, PyTypeObject, PyTypeObjectPtr, FILEP,
Py_TPFLAGS_READYING, Py_TPFLAGS_READY, Py_TPFLAGS_HEAPTYPE)
fr... | [
"pypy.module.cpyext.api.cpython_struct",
"pypy.rpython.lltypesystem.lltype.Ptr",
"pypy.rpython.lltypesystem.lltype.Array"
] | [((2857, 2997), 'pypy.module.cpyext.api.cpython_struct', 'cpython_struct', (['"""PyGetSetDef"""', "(('name', rffi.CCHARP), ('get', getter), ('set', setter), ('doc', rffi.\n CCHARP), ('closure', rffi.VOIDP))"], {}), "('PyGetSetDef', (('name', rffi.CCHARP), ('get', getter), (\n 'set', setter), ('doc', rffi.CCHARP),... |
import os
import unittest
from aruco import ArucoDetector
class TestArucoDetectionBlue(unittest.TestCase):
ar = ArucoDetector()
BLUE = 13
def test_blue(self):
result = self.ar.read_image(os.path.abspath("./datasets/blue.jpg"))
self.assertEqual(self.BLUE, result)
def test_blue_tilt... | [
"unittest.main",
"aruco.ArucoDetector",
"os.path.abspath"
] | [((120, 135), 'aruco.ArucoDetector', 'ArucoDetector', ([], {}), '()\n', (133, 135), False, 'from aruco import ArucoDetector\n'), ((820, 846), 'unittest.main', 'unittest.main', ([], {'verbosity': '(3)'}), '(verbosity=3)\n', (833, 846), False, 'import unittest\n'), ((213, 251), 'os.path.abspath', 'os.path.abspath', (['""... |
import sys
import time
from datetime import datetime
from traceback import print_exc
import speedtest
from decorator import restartable
KILOBYTE = 1024
MEGABYTE = 1024 * KILOBYTE
REPORT_FREQ = 60
def test_setup(st):
st.get_servers()
st.get_best_server()
st.download() # bits/s
st.upload() # bi... | [
"datetime.datetime.now",
"traceback.print_exc",
"speedtest.Speedtest",
"time.sleep"
] | [((783, 804), 'speedtest.Speedtest', 'speedtest.Speedtest', ([], {}), '()\n', (802, 804), False, 'import speedtest\n'), ((1042, 1065), 'time.sleep', 'time.sleep', (['REPORT_FREQ'], {}), '(REPORT_FREQ)\n', (1052, 1065), False, 'import time\n'), ((1165, 1176), 'traceback.print_exc', 'print_exc', ([], {}), '()\n', (1174, ... |
import os
from importlib import import_module
from django.apps import apps
from django.db.migrations.loader import MigrationLoader
from django.db.migrations.serializer import serializer_factory
from django.db.models import ForeignKey, ManyToManyField
from django.utils.inspect import get_func_args
from django.utils.mod... | [
"importlib.import_module",
"django.utils.inspect.get_func_args",
"os.makedirs",
"os.path.join",
"django.db.migrations.serializer.serializer_factory",
"django.apps.apps.get_app_config",
"django.db.migrations.loader.MigrationLoader.migrations_module",
"os.path.isdir",
"django.utils.module_loading.modu... | [((5448, 5486), 'django.utils.inspect.get_func_args', 'get_func_args', (['self.operation.__init__'], {}), '(self.operation.__init__)\n', (5461, 5486), False, 'from django.utils.inspect import get_func_args\n'), ((6407, 6466), 'django.db.migrations.loader.MigrationLoader.migrations_module', 'MigrationLoader.migrations_m... |
#
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
"bigdl.util.engine.prepare_env",
"os.environ.get",
"pytest.main"
] | [((2128, 2141), 'pytest.main', 'pytest.main', ([], {}), '()\n', (2139, 2141), False, 'import pytest\n'), ((1460, 1494), 'os.environ.get', 'os.environ.get', (['"""BIGDL_JARS"""', 'None'], {}), "('BIGDL_JARS', None)\n", (1474, 1494), False, 'import os\n'), ((1524, 1563), 'os.environ.get', 'os.environ.get', (['"""SPARK_CL... |
# MIT License
# Copyright (c) 2019 JetsonHacks
# See license
# Using a CSI camera (such as the Raspberry Pi Version 2) connected to a
# NVIDIA Jetson Nano Developer Kit using OpenCV
# Drivers for the camera and OpenCV are included in the base image
from __future__ import print_function
import os
import argparse
impor... | [
"cv2.rectangle",
"cv2.imshow",
"torch.cuda.is_available",
"cv2.destroyAllWindows",
"argparse.ArgumentParser",
"cv2.threshold",
"torchvision.transforms.ToTensor",
"cv2.waitKey",
"cv2.putText",
"torchvision.transforms.Normalize",
"cv2.cvtColor",
"cv2.getWindowProperty",
"cv2.resize",
"cv2.Ga... | [((1392, 1449), 'cv2.resize', 'cv2.resize', (['image', '(28, 28)'], {'interpolation': 'cv2.INTER_AREA'}), '(image, (28, 28), interpolation=cv2.INTER_AREA)\n', (1402, 1449), False, 'import cv2\n'), ((1568, 1600), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['img', '(5, 5)', '(0)'], {}), '(img, (5, 5), 0)\n', (1584, 1600), ... |
from aoc.day06_1 import run
if __name__ == "__main__":
print(run(256))
| [
"aoc.day06_1.run"
] | [((66, 74), 'aoc.day06_1.run', 'run', (['(256)'], {}), '(256)\n', (69, 74), False, 'from aoc.day06_1 import run\n')] |
"""
Abinit workflows
"""
from __future__ import division, print_function
import sys
import os
import os.path
import shutil
import abc
import collections
import functools
import numpy as np
from pprint import pprint
from pymatgen.core.lattice import Lattice
from pymatgen.core.structure import Structure
from pymatgen.... | [
"pymatgen.core.physical_constants.Ha2meV",
"pymatgen.util.num_utils.chunks",
"pymatgen.core.structure.Structure",
"pymatgen.util.num_utils.iterator_from_slice",
"numpy.arange",
"os.path.exists",
"shutil.move",
"pymatgen.serializers.json_coders.json_pretty_dump",
"functools.wraps",
"numpy.max",
"... | [((1455, 1478), 'functools.wraps', 'functools.wraps', (['method'], {}), '(method)\n', (1470, 1478), False, 'import functools\n'), ((24139, 24151), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (24149, 24151), True, 'import matplotlib.pyplot as plt\n'), ((9780, 9820), 'pymatgen.serializers.json_coders.json... |
#!/usr/bin/env python
# coding: utf-8
# In[10]:
import os
import pandas as pd
import networkx as nx
import matplotlib.pyplot as plt
import random as rd
# In[11]:
def readFile(folderPath):
with open(folderPath, 'r') as f:
fileContents = f.readlines()
return fileContents
# In[12]:
def fillI... | [
"os.listdir",
"networkx.draw_networkx_edge_labels",
"networkx.get_edge_attributes",
"networkx.spring_layout",
"networkx.Graph",
"networkx.draw_networkx",
"matplotlib.pyplot.figure",
"pandas.DataFrame",
"networkx.draw_networkx_edges",
"random.randint",
"matplotlib.pyplot.show"
] | [((1771, 1937), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'info', 'columns': "['Instance Name', 'Number of Nodes', 'Number of Edges', 'Required Edges',\n 'Capacity', 'Number of Depot Nodes', 'Depot Nodes']"}), "(data=info, columns=['Instance Name', 'Number of Nodes',\n 'Number of Edges', 'Required Edges',... |
import pytest
from edera import Heap
def test_heap_is_initially_empty():
assert not Heap()
def test_pushing_items_increases_heap_size():
heap = Heap()
for i in range(1, 6):
heap.push(str(i), 0)
assert len(heap) == i
def test_top_of_heap_always_has_highest_priority():
heap = Heap()... | [
"edera.Heap",
"pytest.raises"
] | [((157, 163), 'edera.Heap', 'Heap', ([], {}), '()\n', (161, 163), False, 'from edera import Heap\n'), ((314, 320), 'edera.Heap', 'Heap', ([], {}), '()\n', (318, 320), False, 'from edera import Heap\n'), ((555, 561), 'edera.Heap', 'Heap', ([], {}), '()\n', (559, 561), False, 'from edera import Heap\n'), ((856, 862), 'ed... |
''' 7. Desenvolva um programa que leia as duas notas de um aluno, calcule
e mostre a sua média. '''
import sys
try:
n1 = float(input("Primeira nota do aluno: "))
except Exception as error:
print("Voce deve informar apenas numeros")
sys.exit()
try:
n2 = float(input("Segunda nota do aluno: "))
except ... | [
"sys.exit"
] | [((247, 257), 'sys.exit', 'sys.exit', ([], {}), '()\n', (255, 257), False, 'import sys\n'), ((391, 401), 'sys.exit', 'sys.exit', ([], {}), '()\n', (399, 401), False, 'import sys\n')] |
import streamlit as st
st.image(
"https://datascientest.com/wp-content/uploads/2020/10/logo-text-right.png.webp"
)
st.header("Développer et déployer une application de Machine learning en **Streamlit**")
st.info("Webinar du 04/05/2021")
st.markdown("---")
st.markdown(
"""
**Objectifs 🎯**
* Se f... | [
"streamlit.markdown",
"streamlit.image",
"streamlit.sidebar.text_input",
"streamlit.sidebar.multiselect",
"streamlit.sidebar.slider",
"streamlit.sidebar.selectbox",
"streamlit.info",
"streamlit.header"
] | [((24, 123), 'streamlit.image', 'st.image', (['"""https://datascientest.com/wp-content/uploads/2020/10/logo-text-right.png.webp"""'], {}), "(\n 'https://datascientest.com/wp-content/uploads/2020/10/logo-text-right.png.webp'\n )\n", (32, 123), True, 'import streamlit as st\n'), ((121, 219), 'streamlit.header', 'st... |
import discord
import json
import math
from discord.ext import commands
from common_functions import default_embed_template, use_exp_mat
MYSTIC = 10000
FINE = 2000
NORMAL = 400
ASCENSION_MILESTONES = [90, 80, 70, 60, 50, 40, 20]
class WeaponExpCalculator(commands.Cog):
def __init__(self, client):
self._client = c... | [
"discord.ext.commands.ArgumentParsingError",
"common_functions.default_embed_template",
"math.floor",
"discord.ext.commands.is_owner",
"common_functions.use_exp_mat",
"json.load",
"discord.ext.commands.command"
] | [((6129, 6147), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (6145, 6147), False, 'from discord.ext import commands\n'), ((7508, 7537), 'discord.ext.commands.command', 'commands.command', ([], {'hidden': '(True)'}), '(hidden=True)\n', (7524, 7537), False, 'from discord.ext import commands\n'), ... |
import datetime
from cerberus import Validator as _Validator
from sqlalchemy import inspect
from sqlalchemy.orm.collections import InstrumentedList
from sqlalchemy.exc import NoInspectionAvailable
def is_sqla_obj(obj):
"""Checks if an object is a SQLAlchemy model instance."""
try:
inspect(obj)
... | [
"sqlalchemy.inspect"
] | [((809, 842), 'sqlalchemy.inspect', 'inspect', (['model_instance.__class__'], {}), '(model_instance.__class__)\n', (816, 842), False, 'from sqlalchemy import inspect\n'), ((6844, 6864), 'sqlalchemy.inspect', 'inspect', (['model_class'], {}), '(model_class)\n', (6851, 6864), False, 'from sqlalchemy import inspect\n'), (... |
import collections
import datetime
import logging
import os
import sys
from pathlib import Path
import numpy as np
import pdfkit as pdfkit
from bs4 import BeautifulSoup
from sklearn.metrics import mean_absolute_error, mean_squared_error, confusion_matrix, classification_report, \
accuracy_score
from tldextract imp... | [
"logging.getLogger",
"sklearn.preprocessing.LabelEncoder",
"logging.StreamHandler",
"pandas.read_csv",
"sklearn.metrics.classification_report",
"trustworthiness.config.DeFactoConfig",
"os.walk",
"tldextract.tldextract.extract",
"pathlib.Path",
"logging.FileHandler",
"sklearn.metrics.mean_absolut... | [((739, 754), 'trustworthiness.config.DeFactoConfig', 'DeFactoConfig', ([], {}), '()\n', (752, 754), False, 'from trustworthiness.config import DeFactoConfig\n'), ((4423, 4451), 'sklearn.preprocessing.LabelEncoder', 'preprocessing.LabelEncoder', ([], {}), '()\n', (4449, 4451), False, 'from sklearn import preprocessing\... |
#!/usr/bin/python
#The MIT License (MIT)
#
#Copyright (c) 2017 <NAME>
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy... | [
"machine.Pin",
"machine.SPI"
] | [((4330, 4355), 'machine.Pin', 'Pin', (['cs_pin'], {'mode': 'Pin.OUT'}), '(cs_pin, mode=Pin.OUT)\n', (4333, 4355), False, 'from machine import Pin\n'), ((4417, 4496), 'machine.SPI', 'SPI', (['(0)'], {'mode': 'SPI.MASTER', 'baudrate': '(500000)', 'polarity': '(0)', 'phase': '(1)', 'firstbit': 'SPI.MSB'}), '(0, mode=SPI.... |
import torch
import re
import copy
import numpy
from torch.utils.data.dataloader import default_collate
from netdissect import nethook, imgviz, tally, unravelconv, upsample
def acts_image(model, dataset,
layer=None, unit=None,
thumbsize=None,
cachedir=None,
... | [
"netdissect.tally.gather_topk",
"netdissect.nethook.get_module",
"netdissect.tally.tally_second_moment",
"copy.deepcopy",
"netdissect.tally.tally_topk_and_quantile",
"netdissect.nethook.replace_module",
"torch.nn.functional.softmax",
"netdissect.upsample.upsampler",
"netdissect.tally.tally_each",
... | [((5083, 5320), 'netdissect.tally.tally_topk_and_quantile', 'tally.tally_topk_and_quantile', (['compute_samples', 'dataset'], {'k': 'k', 'r': 'r', 'batch_size': 'batch_size', 'num_workers': 'num_workers', 'pin_memory': 'pin_memory', 'sample_size': 'sample_size', 'cachefile': "(f'{cachedir}/acts_topk_rq.npz' if cachedir... |
from math import floor, log
n = lambda x: (x + 1) % 2 + 1
s = lambda x: floor(log(x + 1, 2))
r = lambda x: x // 2 - n(x) + 1 + n(x) * 2**(s(x) - 1)
pn = lambda p: r(p) + (n(p) == 2) * (r(r(p)) - r(p))
dn = lambda p, d: (d + (n(p) == n(d) == 2) * (n(r(p)) * 2**s(d)) - (n(p) == 1)) // (3 - n(p))
| [
"math.log"
] | [((82, 95), 'math.log', 'log', (['(x + 1)', '(2)'], {}), '(x + 1, 2)\n', (85, 95), False, 'from math import floor, log\n')] |
import warnings
import evidently.model_profile.sections
from evidently.model_profile.sections import *
__path__ = evidently.model_profile.sections.__path__ # type: ignore
warnings.warn("'import evidently.profile_sections' is deprecated, use 'import evidently.model_profile.sections'")
| [
"warnings.warn"
] | [((175, 298), 'warnings.warn', 'warnings.warn', (['"""\'import evidently.profile_sections\' is deprecated, use \'import evidently.model_profile.sections\'"""'], {}), '(\n "\'import evidently.profile_sections\' is deprecated, use \'import evidently.model_profile.sections\'"\n )\n', (188, 298), False, 'import warni... |
import functools
from .base_classes import Container, Void
class BaseURL(Void):
"""The HTML `<base>` element specifies the base URL to use for *all*
relative URLs in a document. There can be only one `<base>` element in a
document.
"""
__slots__ = ()
tag = "base"
Base = BaseURL
class Ext... | [
"functools.partial"
] | [((805, 862), 'functools.partial', 'functools.partial', (['ExternalResourceLink'], {'rel': '"""stylesheet"""'}), "(ExternalResourceLink, rel='stylesheet')\n", (822, 862), False, 'import functools\n')] |
# !/usr/bin/env python3
"""Importing"""
# Importing Inbuilt packages
from re import match
from shutil import rmtree
from uuid import uuid4
from os import makedirs
# Importing Credentials & Developer defined modules
from helper.downloader.urlDL import UrlDown
from helper.downloader.tgDL import TgDown
from helper.down... | [
"helper.downloader.tgDL.TgDown",
"os.makedirs",
"re.match",
"uuid.uuid4",
"helper.downloader.ytDL.YTDown",
"shutil.rmtree",
"helper.downloader.urlDL.UrlDown"
] | [((852, 881), 'os.makedirs', 'makedirs', (['self.Downloadfolder'], {}), '(self.Downloadfolder)\n', (860, 881), False, 'from os import makedirs\n'), ((1726, 1773), 'shutil.rmtree', 'rmtree', (['self.Downloadfolder'], {'ignore_errors': '(True)'}), '(self.Downloadfolder, ignore_errors=True)\n', (1732, 1773), False, 'from ... |
# -*- coding: utf-8 -*-
"""
Functionality for binding wx control label shortcut keys to events
automatically. In wx, a button with a label "E&xit" would be displayed as
having the label "Exit" with "x" underlined, indicating a keyboard shortcut,
but wx does not bind these shortcuts automatically, requiring constru... | [
"re.split",
"wx.FindWindowById",
"wx.AcceleratorTable",
"wx.CommandEvent",
"functools.partial",
"wx.Menu"
] | [((16908, 16917), 'wx.Menu', 'wx.Menu', ([], {}), '()\n', (16915, 16917), False, 'import wx\n'), ((17424, 17457), 'wx.AcceleratorTable', 'wx.AcceleratorTable', (['accelerators'], {}), '(accelerators)\n', (17443, 17457), False, 'import wx\n'), ((5205, 5248), 're.split', 're.split', (['"""\\\\(Alt-(.)\\\\)"""', 'text'], ... |
"""
from https://github.com/PoonLab/MiCall-Lite, which was forked from
https://github.com/cfe-lab/MiCall.
MiCall is distributed under a dual AGPLv3 license.
"""
import sys
import argparse
from csv import DictWriter
from struct import unpack
import csv
import os
from operator import itemgetter
import sys
import math
... | [
"argparse.FileType",
"argparse.ArgumentParser",
"csv.writer",
"math.copysign",
"struct.unpack",
"operator.itemgetter"
] | [((876, 897), 'struct.unpack', 'unpack', (['"""!BB"""', 'header'], {}), "('!BB', header)\n", (882, 897), False, 'from struct import unpack\n'), ((3948, 3995), 'csv.writer', 'csv.writer', (['out_file'], {'lineterminator': 'os.linesep'}), '(out_file, lineterminator=os.linesep)\n', (3958, 3995), False, 'import csv\n'), ((... |
import numpy as np
import cv2
import glob
import itertools
import os
from tqdm import tqdm
from ..models.config import IMAGE_ORDERING
from .augmentation import augment_seg
import random
random.seed(0)
class_colors = [ ( random.randint(0,255),random.randint(0,255),random.randint(0,255) ) for _ in range(5000) ]
... | [
"itertools.cycle",
"numpy.reshape",
"random.shuffle",
"tqdm.tqdm",
"os.path.join",
"numpy.rollaxis",
"random.seed",
"numpy.max",
"numpy.array",
"numpy.zeros",
"os.path.basename",
"cv2.resize",
"cv2.imread",
"random.randint"
] | [((189, 203), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (200, 203), False, 'import random\n'), ((1887, 1922), 'numpy.zeros', 'np.zeros', (['(height, width, nClasses)'], {}), '((height, width, nClasses))\n', (1895, 1922), True, 'import numpy as np\n'), ((2020, 2085), 'cv2.resize', 'cv2.resize', (['img', '(wi... |
# Shipment Details Download script
# Outputs CSV text report for purchased production shipments
#
# Usage:
# python3 ShipmentReport_3x.py "optional API KEY" (if not using env vars)
#
# 0.2 Revised API key display 02 Jan 2020 <EMAIL>
# 0.1 Corrected handling of zero shipments returned 02 Jan 2020 <EMAIL>... | [
"json.loads",
"datetime.datetime.utcnow",
"http.client.HTTPSConnection",
"csv.writer",
"os.path.join",
"datetime.datetime.now",
"urllib.parse.urlencode",
"os.path.expanduser"
] | [((1847, 1870), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (1865, 1870), False, 'import os\n'), ((2158, 2193), 'http.client.HTTPSConnection', 'HTTPSConnection', (['"""api.easypost.com"""'], {}), "('api.easypost.com')\n", (2173, 2193), False, 'from http.client import HTTPSConnection\n'), (... |
# coding: utf-8
#! /usr/bin/env python
# FrequencyJumpLibrary
import numpy as np
from scipy import stats
import math as math
def KM (y, delta_t=1, Moments = [1,2,4,6,8], bandwidth = 1.5, Lowerbound = False, Upperbound = False, Kernel = 'Epanechnikov'): #Kernel-based Regression
Moments = [0] + Moments
length... | [
"math.factorial",
"numpy.zeros",
"numpy.linspace",
"numpy.unique"
] | [((437, 463), 'numpy.zeros', 'np.zeros', (['[n + Mn, length]'], {}), '([n + Mn, length])\n', (445, 463), True, 'import numpy as np\n'), ((943, 972), 'numpy.linspace', 'np.linspace', (['Min', 'Max', '(n + Mn)'], {}), '(Min, Max, n + Mn)\n', (954, 972), True, 'import numpy as np\n'), ((1049, 1081), 'numpy.unique', 'np.un... |
# coding: utf-8
"""
Accounting Extension
These APIs allow you to interact with HubSpot's Accounting Extension. It allows you to: * Specify the URLs that HubSpot will use when making webhook requests to your external accounting system. * Respond to webhook calls made to your external accounting system by HubSp... | [
"six.iteritems",
"hubspot.crm.extensions.accounting.configuration.Configuration"
] | [((5163, 5196), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (5176, 5196), False, 'import six\n'), ((1613, 1628), 'hubspot.crm.extensions.accounting.configuration.Configuration', 'Configuration', ([], {}), '()\n', (1626, 1628), False, 'from hubspot.crm.extensions.accounting.... |
# -*- coding: utf-8 -*-
# @Time : 2020/4/2 22:55
# @Author : Nixin
# @Email : <EMAIL>
# @File : action_douyin.py
# @Software: PyCharm
from appium import webdriver
from time import sleep
import random
class Action():
def __init__(self):
# 初始化配置,设置Desired Capabilities参数
self.desired_caps =... | [
"time.sleep",
"appium.webdriver.Remote"
] | [((773, 821), 'appium.webdriver.Remote', 'webdriver.Remote', (['self.server', 'self.desired_caps'], {}), '(self.server, self.desired_caps)\n', (789, 821), False, 'from appium import webdriver\n'), ((1134, 1142), 'time.sleep', 'sleep', (['(3)'], {}), '(3)\n', (1139, 1142), False, 'from time import sleep\n'), ((1481, 148... |
from django import forms
from django.contrib.auth import authenticate
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from my_web_project.common.forms import BootstrapFormMixin
from my_web_project.main.models import S... | [
"django.contrib.auth.authenticate",
"django.core.exceptions.ValidationError",
"django.forms.PasswordInput",
"django.forms.CharField"
] | [((723, 753), 'django.forms.CharField', 'forms.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (738, 753), False, 'from django import forms\n'), ((899, 996), 'django.contrib.auth.authenticate', 'authenticate', ([], {'username': "self.cleaned_data['username']", 'password': "self.cleaned_data['password']"}... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 12 10:58:27 2020
Experiments where one marginal is fixed
"""
import os
import numpy as np
from joblib import Parallel, delayed
import torch
import ot
from unbalancedgw.batch_stable_ugw_solver import log_batch_ugw_sinkhorn
from unbalancedgw._batch_... | [
"unbalancedgw._batch_utils.compute_batch_flb_plan",
"unbalancedgw.batch_stable_ugw_solver.log_batch_ugw_sinkhorn",
"torch.cuda.device_count",
"torch.cuda.is_available",
"numpy.save",
"utils.draw_p_u_dataset_scar",
"torch.set_default_tensor_type",
"partial_gw.compute_cost_matrices",
"os.path.isdir",
... | [((461, 472), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (470, 472), False, 'import os\n'), ((497, 516), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (510, 516), False, 'import os\n'), ((522, 536), 'os.mkdir', 'os.mkdir', (['path'], {}), '(path)\n', (530, 536), False, 'import os\n'), ((571, 590), 'os.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 1 18:44:04 2018
@author: JavaWizards
"""
import numpy as np
file = "/Users/nuno_chicoria/Downloads/b_should_be_easy.in"
handle = open(file)
R, C, F, N, B, T = handle.readline().split()
rides = []
index = []
for i in range(int(N)):
index.a... | [
"numpy.delete",
"numpy.asarray",
"numpy.column_stack"
] | [((397, 414), 'numpy.asarray', 'np.asarray', (['rides'], {}), '(rides)\n', (407, 414), True, 'import numpy as np\n'), ((426, 460), 'numpy.column_stack', 'np.column_stack', (['[rides_np, index]'], {}), '([rides_np, index])\n', (441, 460), True, 'import numpy as np\n'), ((1455, 1485), 'numpy.delete', 'np.delete', (['ride... |
import arcade
from utils.loader import Loader
class keyFlags():
def __init__(self):
self.left = False
self.right = False
self.up = False
self.down = False
self.space = False
TITLE = "Raiden Py"
WINDOW = None
WIDTH = 600
HEIGHT = 600
SCREEN_WIDTH = WIDTH
SCREEN_HEIGHT = ... | [
"arcade.SpriteList",
"utils.loader.Loader"
] | [((358, 366), 'utils.loader.Loader', 'Loader', ([], {}), '()\n', (364, 366), False, 'from utils.loader import Loader\n'), ((430, 449), 'arcade.SpriteList', 'arcade.SpriteList', ([], {}), '()\n', (447, 449), False, 'import arcade\n'), ((466, 485), 'arcade.SpriteList', 'arcade.SpriteList', ([], {}), '()\n', (483, 485), F... |
from tnparser.pipeline import read_pipelines, Pipeline
text1="I have a dog! Let's see what I can do with Silo.ai. :) Can I tokenize it? I think so! Heading: This is the heading And here continues a new sentence and there's no dot."
text2="Some other text, to see we can tokenize more stuff without reloading the model..... | [
"tnparser.pipeline.Pipeline",
"tnparser.pipeline.read_pipelines"
] | [((396, 442), 'tnparser.pipeline.read_pipelines', 'read_pipelines', (['"""models_en_ewt/pipelines.yaml"""'], {}), "('models_en_ewt/pipelines.yaml')\n", (410, 442), False, 'from tnparser.pipeline import read_pipelines, Pipeline\n'), ((490, 531), 'tnparser.pipeline.Pipeline', 'Pipeline', (["available_pipelines['tokenize'... |
# -*- coding: utf-8 -*-
"""A rate network for neutral hydrogen following
Katz, Weinberg & Hernquist 1996, eq. 28-32."""
import os.path
import math
import numpy as np
import scipy.interpolate as interp
import scipy.optimize
class RateNetwork(object):
"""A rate network for neutral hydrogen following
Katz, Weinbe... | [
"numpy.ones_like",
"numpy.shape",
"numpy.log10",
"numpy.sqrt",
"numpy.power",
"numpy.log",
"numpy.logical_not",
"numpy.exp",
"scipy.interpolate.InterpolatedUnivariateSpline",
"numpy.loadtxt"
] | [((3983, 4033), 'scipy.interpolate.InterpolatedUnivariateSpline', 'interp.InterpolatedUnivariateSpline', (['zz', 'gray_opac'], {}), '(zz, gray_opac)\n', (4018, 4033), True, 'import scipy.interpolate as interp\n'), ((15357, 15378), 'numpy.sqrt', 'np.sqrt', (['(temp / temp0)'], {}), '(temp / temp0)\n', (15364, 15378), Tr... |
#!/usr/bin/env python3
# Author:: <NAME> (mailto:<EMAIL>)
"""
Simple Flask Server to Expose Credentials
"""
from flask import Flask, jsonify, redirect, render_template, request, session, url_for
from splitwise import Splitwise
from adjuftments.config import SplitwiseConfig
app = Flask(__name__)
app.secret_key ... | [
"flask.render_template",
"flask.request.args.get",
"flask.Flask",
"flask.url_for",
"flask.redirect",
"splitwise.Splitwise",
"flask.jsonify"
] | [((289, 304), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (294, 304), False, 'from flask import Flask, jsonify, redirect, render_template, request, session, url_for\n'), ((466, 494), 'flask.render_template', 'render_template', (['"""home.html"""'], {}), "('home.html')\n", (481, 494), False, 'from flask ... |
'''
# Config
'''
import cv2
import numpy as np
import platform
import time
import sys
##
## Open CV Variables
##
# show the debug output for the open cv
DEMO_MODE = True
# set some variables for testing output
FONT = cv2.FONT_HERSHEY_SIMPLEX
# Min and Max Area Sizes
AREA_SIZE_STOP = 30
AREA_SIZE_TURN = 35
AREA_SIZ... | [
"platform.system"
] | [((692, 709), 'platform.system', 'platform.system', ([], {}), '()\n', (707, 709), False, 'import platform\n')] |
# Developed by <NAME>
# Last Modified 13/04/19 16:04.
# Copyright (c) 2019 <NAME> and <NAME>
import pytest
from decouple import config
from django.contrib.auth.models import User
from django.test import LiveServerTestCase, TestCase
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementE... | [
"selenium.webdriver.support.wait.WebDriverWait",
"selenium.webdriver.firefox.options.Options",
"decouple.config",
"selenium.common.exceptions.NoSuchElementException"
] | [((680, 689), 'selenium.webdriver.firefox.options.Options', 'Options', ([], {}), '()\n', (687, 689), False, 'from selenium.webdriver.firefox.options import Options\n'), ((701, 726), 'decouple.config', 'config', (['"""MOZ_HEADLESS"""', '(0)'], {}), "('MOZ_HEADLESS', 0)\n", (707, 726), False, 'from decouple import config... |
"""
General tests that concern all recipes
"""
import os
import sys
from ._base import mock, RecipeTests, test_project
# we use the very simple manage.Recipe to test BaseRecipe functionalities
from djangorecipebook.recipes import manage
class GeneralRecipeTests(RecipeTests):
recipe_class = mana... | [
"os.path.normpath",
"os.path.join"
] | [((764, 809), 'os.path.join', 'os.path.join', (['self.buildout_dir', 'test_project'], {}), '(self.buildout_dir, test_project)\n', (776, 809), False, 'import os\n'), ((1650, 1669), 'os.path.normpath', 'os.path.normpath', (['p'], {}), '(p)\n', (1666, 1669), False, 'import os\n')] |
import pandas
from pandas import Timestamp
EXPECTED_CONFIG = {
"sheet_name": "df_dropper",
"sheet_key": "sample",
"target_schema": "sand",
"target_table": "bb_test_sheetwork",
"columns": [
{"name": "col_a", "datatype": "int"},
{"name": "col_b", "datatype": "varchar"},
{"name... | [
"pandas.Timestamp",
"pandas.DataFrame.from_dict"
] | [((3965, 3995), 'pandas.DataFrame.from_dict', 'pandas.DataFrame.from_dict', (['df'], {}), '(df)\n', (3991, 3995), False, 'import pandas\n'), ((2113, 2145), 'pandas.Timestamp', 'Timestamp', (['"""2019-01-01 00:00:00"""'], {}), "('2019-01-01 00:00:00')\n", (2122, 2145), False, 'from pandas import Timestamp\n'), ((2158, 2... |
#!/usr/local/bin/python
'''
Pipeline for converting CSV nsde data to JSON and importing into Elasticsearch.
'''
import glob
import os
from os.path import join, dirname
import luigi
from openfda import common, config, parallel, index_util
from openfda.common import newest_file_timestamp
NSDE_DOWNLOAD = \
'https:/... | [
"luigi.run",
"openfda.common.transform_dict",
"openfda.parallel.IdentityReducer",
"openfda.common.newest_file_timestamp",
"os.path.join",
"openfda.common.download",
"openfda.parallel.CSVDictLineInput",
"openfda.config.data_dir"
] | [((437, 464), 'openfda.config.data_dir', 'config.data_dir', (['"""nsde/raw"""'], {}), "('nsde/raw')\n", (452, 464), False, 'from openfda import common, config, parallel, index_util\n'), ((2753, 2764), 'luigi.run', 'luigi.run', ([], {}), '()\n', (2762, 2764), False, 'import luigi\n'), ((662, 690), 'os.path.join', 'join'... |
# Generated by Django 2.0.5 on 2019-06-10 00:03
from django.db import migrations, models
import localflavor.mx.models
class Migration(migrations.Migration):
dependencies = [
('INV', '0002_auto_20190608_2204'),
]
operations = [
migrations.AlterField(
model_name='fiscalmx',
... | [
"django.db.models.EmailField",
"django.db.models.CharField"
] | [((369, 533), 'django.db.models.EmailField', 'models.EmailField', ([], {'default': '"""<EMAIL>"""', 'help_text': '"""Correo donde llegarán las notificaciones sobre facturación"""', 'max_length': '(100)', 'verbose_name': '"""Email contacto"""'}), "(default='<EMAIL>', help_text=\n 'Correo donde llegarán las notificaci... |
"""Test functions for pem.fluid.ecl module
"""
import pytest
from pytest import approx
import numpy as np
import digirock.fluids.ecl as fluid_ecl
from inspect import getmembers, isfunction
@pytest.fixture
def tol():
return {
"rel": 0.05, # relative testing tolerance in percent
"abs... | [
"pytest.approx",
"digirock.fluids.ecl.oil_fvf_table",
"pytest.mark.parametrize",
"digirock.fluids.ecl.e100_oil_density",
"pytest.raises",
"numpy.loadtxt"
] | [((375, 580), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""pres, extrap, ans"""', "[(325, 'const', 1.4615), (325, 'pchip', 1.4615), (np.r_[325, 375], 'const',\n np.r_[1.4615, 1.4505]), (np.r_[325, 375], 'pchip', np.r_[1.4615, 1.4505])]"], {}), "('pres, extrap, ans', [(325, 'const', 1.4615), (325,\n ... |
'''
Created on: see version log.
@author: rigonz
coding: utf-8
IMPORTANT: requires py3.6 (rasterio)
Script that:
1) reads a series of raster files,
2) runs some checks,
3) makes charts showing the results.
The input data corresponds to a region of the world (ESP) and represents
the population density (pop/km2).
Each... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.hist",
"numpy.log10",
"matplotlib.pyplot.ylabel",
"numpy.array",
"numpy.delete",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.ylim",
"numpy.ceil",
"numpy.corrcoef",
"rasterio.open",
"matplotlib.pyplot.title",
"matp... | [((1327, 1352), 'rasterio.open', 'rasterio.open', (['FileNameI1'], {}), '(FileNameI1)\n', (1340, 1352), False, 'import rasterio\n'), ((1359, 1384), 'rasterio.open', 'rasterio.open', (['FileNameI2'], {}), '(FileNameI2)\n', (1372, 1384), False, 'import rasterio\n'), ((1391, 1416), 'rasterio.open', 'rasterio.open', (['Fil... |
"""
Hello World Component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/developers/development_101/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
# Initialize the logger
_LOGGER = logging.getLogger(__name__)
#... | [
"logging.getLogger",
"voluptuous.Required"
] | [((290, 317), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (307, 317), False, 'import logging\n'), ((568, 591), 'voluptuous.Required', 'vol.Required', (['CONF_TEXT'], {}), '(CONF_TEXT)\n', (580, 591), True, 'import voluptuous as vol\n')] |