code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import argparse
import os
from collections import defaultdict
if __name__ == '__main__':
parser = argparse.ArgumentParser('Get MeSH mapping from ID to name')
parser.add_argument('--meshDir',required=True,type=str,help='Input directory of MeSH ASCII bin files')
parser.add_argument('--omimTitles',required=True,type=s... | [
"collections.defaultdict",
"os.path.join",
"argparse.ArgumentParser",
"os.listdir"
] | [((100, 159), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Get MeSH mapping from ID to name"""'], {}), "('Get MeSH mapping from ID to name')\n", (123, 159), False, 'import argparse\n'), ((1297, 1314), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1308, 1314), False, 'from collect... |
import client
import pickle
import logging
import os
import json
logging.basicConfig(level=logging.DEBUG)
rCache = client.RedisCache(host='localhost', port=6379)
test_data = {
'name': 'test_data',
'data': [
{
'key': 'key1',
'value': 'value1'
},
{
'key... | [
"os.remove",
"logging.basicConfig",
"json.dumps",
"logging.info",
"client.RedisCache",
"pickle.dumps"
] | [((66, 106), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (85, 106), False, 'import logging\n'), ((116, 162), 'client.RedisCache', 'client.RedisCache', ([], {'host': '"""localhost"""', 'port': '(6379)'}), "(host='localhost', port=6379)\n", (133, 162), False,... |
# -*- coding: utf-8 -*-
from setuptools import setup
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
package_dir = \
{'': '.'}
packages = \
['formchen']
package_data = \
{'': ['*'], 'formchen': ['tests/*']}
install_requires = \
['gridchen>=0.1.3,<0.2.0']
setup(
name='for... | [
"setuptools.setup"
] | [((300, 777), 'setuptools.setup', 'setup', ([], {'name': '"""formchen"""', 'version': '"""0.1.6"""', 'description': '"""Generate HTML forms and bind hierarchical and tabular data."""', 'long_description': 'long_description', 'long_description_content_type': '"""text/markdown"""', 'author': '"""<NAME>"""', 'author_email... |
# -*- coding: utf-8 -*-
import pytest
from comport.department.models import Department, Extractor
from comport.data.models import IncidentsUpdated, OfficerInvolvedShootingSRPD, UseOfForceIncidentSRPD, CitizenComplaintSRPD, PursuitSRPD
from testclient.JSON_test_client import JSONTestClient
@pytest.mark.usefixtures('db'... | [
"comport.data.models.IncidentsUpdated.query.filter_by",
"comport.data.models.PursuitSRPD.query.filter_by",
"comport.department.models.Extractor.from_department_and_password",
"comport.data.models.CitizenComplaintSRPD.query.all",
"comport.data.models.UseOfForceIncidentSRPD.query.filter_by",
"comport.data.m... | [((292, 321), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""db"""'], {}), "('db')\n", (315, 321), False, 'import pytest\n'), ((537, 627), 'comport.department.models.Department.create', 'Department.create', ([], {'name': '"""SR Police Department"""', 'short_name': '"""SRPD"""', 'load_defaults': '(False)'})... |
# Tensorflow and numpy to create the neural network
import tensorflow as tf
import numpy as np
# Matplotlib to plot info to show our results
import matplotlib.pyplot as plt
# OS to load files and save checkpoints
import os
# Load MNIST data from tf examples
image_height = 28
image_width = 28
color_channels = 1
mo... | [
"tensorflow.reset_default_graph",
"tensorflow.local_variables_initializer",
"pickle.load",
"tensorflow.layers.max_pooling2d",
"tensorflow.nn.softmax",
"tensorflow.metrics.accuracy",
"numpy.transpose",
"os.path.exists",
"numpy.append",
"tensorflow.placeholder",
"tensorflow.cast",
"numpy.reshape... | [((348, 395), 'tensorflow.contrib.learn.datasets.load_dataset', 'tf.contrib.learn.datasets.load_dataset', (['"""mnist"""'], {}), "('mnist')\n", (386, 395), True, 'import tensorflow as tf\n'), ((444, 490), 'numpy.asarray', 'np.asarray', (['mnist.train.labels'], {'dtype': 'np.int32'}), '(mnist.train.labels, dtype=np.int3... |
import os
import sys
import copy
import pickle
import numpy as np
import pandas as pd
from inspect import signature
from tensorflow import keras
from skorch.net import NeuralNet
from abc import ABCMeta, abstractmethod
from commonmodels2.utils.utils import *
from commonmodels2.log.logger import Logger
class ModelBase(m... | [
"copy.deepcopy",
"pickle.dump",
"tensorflow.keras.models.load_model",
"os.makedirs",
"os.path.isdir",
"os.path.dirname",
"numpy.any",
"pickle.load",
"inspect.signature",
"numpy.array",
"os.path.join",
"skorch.net.NeuralNet"
] | [((718, 733), 'inspect.signature', 'signature', (['func'], {}), '(func)\n', (727, 733), False, 'from inspect import signature\n'), ((1312, 1339), 'copy.deepcopy', 'copy.deepcopy', (['self._params'], {}), '(self._params)\n', (1325, 1339), False, 'import copy\n'), ((1398, 1419), 'copy.deepcopy', 'copy.deepcopy', (['param... |
# tests/test_functional.py
import unittest
from flask_login import current_user
from project.util import BaseTestCase
class TestPublic(BaseTestCase):
def test_main_route_requires_login(self):
# Ensure main route requres logged in user.
response = self.client.get('/', follow_redirects=True)
... | [
"unittest.main",
"flask_login.current_user.is_active"
] | [((1808, 1823), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1821, 1823), False, 'import unittest\n'), ((1188, 1212), 'flask_login.current_user.is_active', 'current_user.is_active', ([], {}), '()\n', (1210, 1212), False, 'from flask_login import current_user\n')] |
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | [
"netforce.model.fields.Selection",
"netforce.model.fields.Decimal",
"netforce.model.get_model",
"netforce.model.fields.Text",
"netforce.model.fields.Date",
"netforce.model.fields.Many2Many",
"netforce.model.fields.Many2One"
] | [((1290, 1381), 'netforce.model.fields.Many2One', 'fields.Many2One', (['"""purchase.order"""', '"""Purchase Order"""'], {'required': '(True)', 'on_delete': '"""cascade"""'}), "('purchase.order', 'Purchase Order', required=True,\n on_delete='cascade')\n", (1305, 1381), False, 'from netforce.model import Model, fields... |
# Generated by Django 3.2.2 on 2021-05-10 01:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("core", "0125_alter_callrequest_created_at"),
]
operations = [
migrations.AddIndex(
model_name="sourcelocation",
inde... | [
"django.db.models.Index"
] | [((322, 407), 'django.db.models.Index', 'models.Index', ([], {'fields': "['matched_location']", 'name': '"""source_loca_matched_d1b866_idx"""'}), "(fields=['matched_location'], name='source_loca_matched_d1b866_idx'\n )\n", (334, 407), False, 'from django.db import migrations, models\n')] |
import pymysql
def connect():
connection = pymysql.connect(host='ec2db.cmvp0kxmic2d.ap-southeast-2.rds.amazonaws.com', port=3306, user='bahamutedean', passwd='<PASSWORD>',
db='Aussie',charset='utf8' )
return connection
| [
"pymysql.connect"
] | [((48, 213), 'pymysql.connect', 'pymysql.connect', ([], {'host': '"""ec2db.cmvp0kxmic2d.ap-southeast-2.rds.amazonaws.com"""', 'port': '(3306)', 'user': '"""bahamutedean"""', 'passwd': '"""<PASSWORD>"""', 'db': '"""Aussie"""', 'charset': '"""utf8"""'}), "(host='ec2db.cmvp0kxmic2d.ap-southeast-2.rds.amazonaws.com',\n ... |
"""
# Generate a gap report between deafrica-landsat-dev and usgs-landsat buckets
This DAG runs weekly and creates a gap report in the folowing location:
s3://deafrica-landsat-dev/<date>/status-report
#### Utility utilization
The DAG can be parameterized with run time configurations `update_stac`.
* The option updat... | [
"logging.error",
"traceback.print_exc",
"airflow.DAG",
"utils.inventory.InventoryUtils",
"utils.sync_utils.read_big_csv_files_from_gzip",
"utils.sync_utils.time_process",
"datetime.datetime",
"time.time",
"logging.info",
"utils.aws_utils.S3",
"utils.sync_utils.read_csv_from_gzip",
"utils.sync_... | [((1748, 1769), 'datetime.datetime', 'datetime', (['(2021)', '(3)', '(29)'], {}), '(2021, 3, 29)\n', (1756, 1769), False, 'from datetime import datetime\n'), ((2850, 2936), 'logging.info', 'logging.info', (['f"""Retrieving allowed Africa Pathrows from {AFRICA_GZ_PATHROWS_URL}"""'], {}), "(\n f'Retrieving allowed Afr... |
import re
import string
from functools import partial
from typing import Optional, List, Callable, TypeVar, Union, Type
from company_graph.rules import RuleMatcher
def strip_match(s, pattern):
return pattern.sub(" ", s)
def to_lowercase(s):
return s.lower()
RE_PUNCTUATION = re.compile(r'([%s])+' % re.es... | [
"functools.partial",
"re.escape",
"re.compile"
] | [((371, 392), 're.compile', 're.compile', (['"""( {2,})"""'], {}), "('( {2,})')\n", (381, 392), False, 'import re\n'), ((703, 747), 'functools.partial', 'partial', (['strip_match'], {'pattern': 'RE_PUNCTUATION'}), '(strip_match, pattern=RE_PUNCTUATION)\n', (710, 747), False, 'from functools import partial\n'), ((776, 8... |
#!/usr/bin/env python
# coding=utf-8
from .registry import register
import inspect
from functools import partial
import re
class Context:
def __init__(self, **entries):
self.__dict__.update(entries)
def name_convert_to_camel(name):
contents = re.findall('_[a-z]+', name)
for content in set(content... | [
"functools.partial",
"re.findall",
"inspect.signature",
"megflow.Envelope.pack"
] | [((262, 289), 're.findall', 're.findall', (['"""_[a-z]+"""', 'name'], {}), "('_[a-z]+', name)\n", (272, 289), False, 'import re\n'), ((443, 466), 'inspect.signature', 'inspect.signature', (['func'], {}), '(func)\n', (460, 466), False, 'import inspect\n'), ((2516, 2558), 'megflow.Envelope.pack', 'Envelope.pack', (['msg'... |
from Servers.optimizers.server_optimizer import server_optimizer
from collections import defaultdict
class SGD(server_optimizer):
def __init__(self,lr=1,momentum=0,tau=0):
super().__init__()
self.tau = tau
self.momentum = momentum
self.b_t = defaultdict(lambda: 0)
self.lr = ... | [
"collections.defaultdict"
] | [((279, 302), 'collections.defaultdict', 'defaultdict', (['(lambda : 0)'], {}), '(lambda : 0)\n', (290, 302), False, 'from collections import defaultdict\n')] |
import dao as Bank
import defs_workstation as function
from flask import Flask, redirect, url_for, session, render_template, request
import random
app = Flask(__name__)
@app.route("/")
def index():
return render_template("index.html")
@app.route("/login")
def login():
return render_template('login.html')
... | [
"dao.query_exist_cpf",
"defs_workstation.is_cpf",
"random.randint",
"defs_workstation.check",
"defs_workstation.validates",
"dao.save_user",
"dao.update_user",
"flask.Flask",
"defs_workstation.validates_pj",
"dao.search_pj",
"dao.query_exist_cnpj",
"dao.query_exist_email",
"flask.url_for",
... | [((154, 169), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (159, 169), False, 'from flask import Flask, redirect, url_for, session, render_template, request\n'), ((212, 241), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (227, 241), False, 'from flask import ... |
from __future__ import absolute_import
from create_multi_langs.creater.typescript_frontend import CreaterTypeScriptFrontEnd # noqa: E501
from . import TYPESCRIPT_FRONTEND_OUTPUT, TYPESCRIPT_FRONTEND_EXPECT_FILE, create_and_compare, ROOT_DIR # noqa: E501
import os
from subprocess import call
def test_create_python_f... | [
"os.remove",
"subprocess.call",
"os.chdir"
] | [((482, 546), 'subprocess.call', 'call', (["['ts-node', 'tests/typescript/generated_frontend.test.ts']"], {}), "(['ts-node', 'tests/typescript/generated_frontend.test.ts'])\n", (486, 546), False, 'from subprocess import call\n'), ((693, 730), 'os.remove', 'os.remove', (['TYPESCRIPT_FRONTEND_OUTPUT'], {}), '(TYPESCRIPT_... |
"""
Given two files containing lines with separate sentences in different styles creates file structure needed by
make_csv.py.
"""
import os
import pathlib
import tarfile
import shutil
first_file = "yelp/sentiment.train.0"
second_file = "yelp/sentiment.train.1"
tmp_output_folder = "text"
PLACEHOLDER = "<PLACEHOLDER>... | [
"pathlib.Path",
"tarfile.open",
"shutil.rmtree",
"os.path.split",
"os.path.join"
] | [((651, 694), 'os.path.join', 'os.path.join', (['output_folder', 'subfolder_name'], {}), '(output_folder, subfolder_name)\n', (663, 694), False, 'import os\n'), ((1202, 1234), 'shutil.rmtree', 'shutil.rmtree', (['tmp_output_folder'], {}), '(tmp_output_folder)\n', (1215, 1234), False, 'import shutil\n'), ((610, 635), 'o... |
# coding: utf8
# !/usr/env/python
# coding: utf8
# !/usr/env/python
import numpy as np
import pytest
from numpy.testing import assert_array_almost_equal
from terrainbento import BasicHySa, NotCoreNodeBaselevelHandler, PrecipChanger
@pytest.mark.parametrize("m_sp,n_sp", [(1.0 / 3, 2.0 / 3.0), (0.5, 1.0)])
@pytest.ma... | [
"terrainbento.NotCoreNodeBaselevelHandler",
"numpy.power",
"terrainbento.BasicHySa",
"terrainbento.PrecipChanger",
"pytest.raises",
"pytest.mark.parametrize",
"numpy.testing.assert_array_almost_equal"
] | [((237, 309), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""m_sp,n_sp"""', '[(1.0 / 3, 2.0 / 3.0), (0.5, 1.0)]'], {}), "('m_sp,n_sp', [(1.0 / 3, 2.0 / 3.0), (0.5, 1.0)])\n", (260, 309), False, 'import pytest\n'), ((311, 396), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""depression_finder"""... |
# -*- coding:utf-8 -*-
import socket
import sys
import threading
clist = []
def main(argc, argv):
# メッセージ入力スレッド
th = threading.Thread(target=send_loop)
th.start()
# サーバ起動
ssock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ssock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
... | [
"threading.Thread",
"socket.socket",
"sys.exit"
] | [((128, 162), 'threading.Thread', 'threading.Thread', ([], {'target': 'send_loop'}), '(target=send_loop)\n', (144, 162), False, 'import threading\n'), ((203, 252), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (216, 252), False, 'import socke... |
from PIL import Image
import numpy as np
from blend_modes import soft_light, multiply
from core_def import CoreModeKey, BlendKey
class Blend(object):
@staticmethod
def run(image, config, show):
return Blend.__do_blend(image, config[CoreModeKey.MODE], config[BlendKey.OPACITY], show)
@staticmetho... | [
"PIL.Image.fromarray",
"numpy.uint8"
] | [((776, 803), 'numpy.uint8', 'np.uint8', (['blended_img_float'], {}), '(blended_img_float)\n', (784, 803), True, 'import numpy as np\n'), ((912, 940), 'PIL.Image.fromarray', 'Image.fromarray', (['blended_img'], {}), '(blended_img)\n', (927, 940), False, 'from PIL import Image\n')] |
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"tensorflow.test.main",
"apache_beam.testing.util.assert_that",
"apache_beam.Create",
"apache_beam.Map",
"tensorflow_model_analysis.metrics.metric_types.MetricKey",
"apache_beam.Pipeline",
"apache_beam.testing.util.BeamAssertException",
"apache_beam.CombinePerKey",
"absl.testing.parameterized.named_... | [((1097, 1320), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (["('unweighted', '', '', False)", "('basic', '', '', True)", "('multi-model', 'model', '', True)", "('multi-output', '', 'output', True)", "('multi-model-multi-output', 'model', 'output', True)"], {}), "(('unweighted', '',... |
"""
テスト全実行
testsディレクトリ内(サブディレクトリも)のtest*.pyを実行
主に coverage 向け
coverage run --branch --source=niascape tests
"""
import unittest
import os
import sys
import json
from pprint import pformat
import logging.config
if __name__ == "__main__":
verbosity = 1
if __file__ == "tests": # coverage 通すとディレクトリ実行時__file__がtests... | [
"os.path.abspath",
"pprint.pformat",
"json.load",
"unittest.TextTestRunner",
"os.getcwd",
"os.path.dirname",
"unittest.TestLoader"
] | [((349, 374), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (364, 374), False, 'import os\n'), ((1048, 1059), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1057, 1059), False, 'import os\n'), ((1159, 1184), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (1174, 1184)... |
from django.db import models
from django.urls import reverse
class Course(models.Model):
slug = models.SlugField() # Для создания своего URL адреса
title = models.CharField(max_length=120)
description = models.TextField()
img = models.ImageField(default='default.png', upload_to='course_images')
fre... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.SlugField",
"django.db.models.ImageField",
"django.db.models.IntegerField",
"django.urls.reverse"
] | [((101, 119), 'django.db.models.SlugField', 'models.SlugField', ([], {}), '()\n', (117, 119), False, 'from django.db import models\n'), ((165, 197), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(120)'}), '(max_length=120)\n', (181, 197), False, 'from django.db import models\n'), ((216, 234), '... |
from django.contrib import admin
from .models import Noticia, Universidad, Region
# Register your models here.
class UniversidadAdmin(admin.ModelAdmin):
readonly_fields = ('created', 'updated', 'id_universidad')
list_display = ('id_universidad', 'nombre', 'alias', 'region')
list_filter = ('region',)
class... | [
"django.contrib.admin.site.register"
] | [((1173, 1215), 'django.contrib.admin.site.register', 'admin.site.register', (['Noticia', 'NoticiaAdmin'], {}), '(Noticia, NoticiaAdmin)\n', (1192, 1215), False, 'from django.contrib import admin\n'), ((1216, 1266), 'django.contrib.admin.site.register', 'admin.site.register', (['Universidad', 'UniversidadAdmin'], {}), ... |
"""
Usage:
python scripts/presplit_sentences_json.py <original loose json file> <output loose json file>
"""
import sys
import json
import nltk
nltk.download('punkt')
input_file = sys.argv[1]
output_file = sys.argv[2]
line_seperator = "\n"
with open(input_file, 'r') as ifile:
with open(output_file, "w") as ofil... | [
"nltk.download",
"nltk.tokenize.sent_tokenize",
"json.loads",
"json.dumps"
] | [((147, 169), 'nltk.download', 'nltk.download', (['"""punkt"""'], {}), "('punkt')\n", (160, 169), False, 'import nltk\n'), ((372, 387), 'json.loads', 'json.loads', (['doc'], {}), '(doc)\n', (382, 387), False, 'import json\n'), ((620, 638), 'json.dumps', 'json.dumps', (['parsed'], {}), '(parsed)\n', (630, 638), False, '... |
# html template generator
# input a 512x512 px file and a site name to start
from PIL import Image
from bs4 import BeautifulSoup, Tag
from enum import Enum
import sys, getopt
import urllib.request
import json
import os
def main(argv):
class SizeType(Enum):
DEFAULT = 1
APPLE = 2
WINDOWS = 3... | [
"os.listdir",
"json.load",
"getopt.getopt",
"json.dumps",
"PIL.Image.open",
"bs4.BeautifulSoup",
"os.path.join",
"bs4.Tag",
"sys.exit"
] | [((649, 726), 'getopt.getopt', 'getopt.getopt', (['argv', '"""t:i:c:j:"""', "['icon=', 'title=', 'tileColor=', 'jQuery=']"], {}), "(argv, 't:i:c:j:', ['icon=', 'title=', 'tileColor=', 'jQuery='])\n", (662, 726), False, 'import sys, getopt\n'), ((1334, 1354), 'PIL.Image.open', 'Image.open', (['iconFile'], {}), '(iconFil... |
# -*- coding: utf-8 -*-
import hmac
import hashlib
import time
import urllib
import urllib2
import json
import sys
from pprint import pprint
__author__ = 'concongo'
__version__ = '0.1.0'
class mrr_api:
__api_key = ''
__api_secret = ''
__nonce_v = ''
__api_base = 'https://www.miningrigrentals.com/api/... | [
"json.loads",
"hmac.new",
"urllib2.Request",
"time.time",
"urllib.urlencode",
"urllib2.urlopen"
] | [((1414, 1438), 'urllib.urlencode', 'urllib.urlencode', (['params'], {}), '(params)\n', (1430, 1438), False, 'import urllib\n'), ((1917, 1935), 'json.loads', 'json.loads', (['answer'], {}), '(answer)\n', (1927, 1935), False, 'import json\n'), ((1483, 1555), 'urllib2.Request', 'urllib2.Request', (["(self.__api_base + en... |
import subprocess as sp
import fcntl
import time
import shutil
import signal
from queue import Queue
from typing import Dict, Tuple
from .message import *
def pretty(msg):
return json.dumps(msg, indent=4, sort_keys=True)
def default_sigpipe():
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
class RPCClient:... | [
"subprocess.Popen",
"time.sleep",
"time.time",
"signal.signal",
"queue.Queue",
"shutil.copy"
] | [((256, 301), 'signal.signal', 'signal.signal', (['signal.SIGPIPE', 'signal.SIG_DFL'], {}), '(signal.SIGPIPE, signal.SIG_DFL)\n', (269, 301), False, 'import signal\n'), ((368, 435), 'subprocess.Popen', 'sp.Popen', (["['clangd']"], {'stdout': 'sp.PIPE', 'stdin': 'sp.PIPE', 'stderr': 'sp.PIPE'}), "(['clangd'], stdout=sp.... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0067_auto_20151229_1542'),
]
operations = [
migrations.AddField(
model_name='person2person',
... | [
"django.db.models.ForeignKey"
] | [((359, 478), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'verbose_name': '"""Декларація, що підтверджує зв\'язок"""', 'blank': '(True)', 'to': '"""core.Declaration"""', 'null': '(True)'}), '(verbose_name="Декларація, що підтверджує зв\'язок", blank=\n True, to=\'core.Declaration\', null=True)\n', (376... |
import pygame
from random import randint, choice
from .graphics import RenderPlayer, RenderNPC
from .weapon import BaseWeapon
class BaseEntity(pygame.sprite.Sprite):
"""
What is Entity?
Entity is everything that implies life creature or in simple words everything that's alive
It's a base class of Ent... | [
"random.choice",
"random.randint"
] | [((11188, 11226), 'random.randint', 'randint', (['(0)', '(map_width * tile_size // 2)'], {}), '(0, map_width * tile_size // 2)\n', (11195, 11226), False, 'from random import randint, choice\n'), ((11253, 11292), 'random.randint', 'randint', (['(0)', '(map_height * tile_size // 2)'], {}), '(0, map_height * tile_size // ... |
from pathlib import Path
from sphinx_testing import with_app
@with_app(buildername="html", srcdir="doc_test/doc_needextend")
def test_doc_needextend_html(app, status, warning):
app.build()
index_html = Path(app.outdir, "index.html").read_text()
assert "extend_test_003" in index_html
assert (
... | [
"sphinx_testing.with_app",
"pathlib.Path"
] | [((65, 127), 'sphinx_testing.with_app', 'with_app', ([], {'buildername': '"""html"""', 'srcdir': '"""doc_test/doc_needextend"""'}), "(buildername='html', srcdir='doc_test/doc_needextend')\n", (73, 127), False, 'from sphinx_testing import with_app\n'), ((213, 243), 'pathlib.Path', 'Path', (['app.outdir', '"""index.html"... |
import requests
import MySQLdb
import re
from bs4 import BeautifulSoup
from selenium.webdriver.support.select import Select
from selenium import webdriver
from time import sleep
import datetime
import os
conn = MySQLdb.connect(
host='localhost',
port=3306,
user='root',
password='',
database='stockd... | [
"MySQLdb.connect"
] | [((212, 346), 'MySQLdb.connect', 'MySQLdb.connect', ([], {'host': '"""localhost"""', 'port': '(3306)', 'user': '"""root"""', 'password': '""""""', 'database': '"""stockdatabase"""', 'use_unicode': '(True)', 'charset': '"""utf8"""'}), "(host='localhost', port=3306, user='root', password='',\n database='stockdatabase'... |
import subprocess
from datetime import date
from typing import overload
from mining.cmd import Command
class CommandOutputConsumer:
@overload
def consum(self, output_line: str):
pass
class CommandExecutor:
def __init__(self, output_consumer: CommandOutputConsumer):
self.output_consume... | [
"datetime.date.today"
] | [((2227, 2239), 'datetime.date.today', 'date.today', ([], {}), '()\n', (2237, 2239), False, 'from datetime import date\n')] |
from bs4 import BeautifulSoup
from dataknead import Knead
import re
NUMBER = re.compile("^([\d|\.]+)")
def get_number(s):
s = s.strip()
return int(NUMBER.findall(s)[0].replace(".", ""))
def get_reference(el, soup):
ref = el.select_one(".reference")
if not ref:
return None
ref_href = ref... | [
"dataknead.Knead",
"re.compile"
] | [((78, 105), 're.compile', 're.compile', (['"""^([\\\\d|\\\\.]+)"""'], {}), "('^([\\\\d|\\\\.]+)')\n", (88, 105), False, 'import re\n'), ((1344, 1359), 'dataknead.Knead', 'Knead', (['churches'], {}), '(churches)\n', (1349, 1359), False, 'from dataknead import Knead\n')] |
from unittest import TestCase
from npss import npss, argv_pars, main
class TestArgvPars(TestCase):
arguments_list = {
30: [],
30: ["main.py"],
1: ["main.py", "-1"],
1: ["main.py", "-1", "0"],
1: ["main.py", "-1", "0", "1"],
1: ["main.py", "-1", "0", "2"],
1... | [
"npss.argv_pars",
"npss.npss",
"npss.main"
] | [((891, 897), 'npss.main', 'main', ([], {}), '()\n', (895, 897), False, 'from npss import npss, argv_pars, main\n'), ((713, 720), 'npss.npss', 'npss', (['i'], {}), '(i)\n', (717, 720), False, 'from npss import npss, argv_pars, main\n'), ((590, 610), 'npss.argv_pars', 'argv_pars', (['arguments'], {}), '(arguments)\n', (... |
from rx.subject import Subject
from pyannote.audio.core.io import Audio, AudioFile
from pyannote.core import SlidingWindow
import random
from typing import Tuple
import time
import sounddevice as sd
class AudioSource:
def __init__(self, uri: str, sample_rate: int):
self.uri = uri
self.sample_rate ... | [
"random.uniform",
"rx.subject.Subject",
"pyannote.audio.core.io.Audio",
"pyannote.core.SlidingWindow",
"time.sleep",
"sounddevice.InputStream"
] | [((356, 365), 'rx.subject.Subject', 'Subject', ([], {}), '()\n', (363, 365), False, 'from rx.subject import Subject\n'), ((592, 633), 'pyannote.audio.core.io.Audio', 'Audio', ([], {'sample_rate': 'sample_rate', 'mono': '(True)'}), '(sample_rate=sample_rate, mono=True)\n', (597, 633), False, 'from pyannote.audio.core.io... |
from beir import util, LoggingHandler
from beir.datasets.data_loader import GenericDataLoader
from beir.retrieval.evaluation import EvaluateRetrieval
from beir.retrieval.search.dense import DenseRetrievalExactSearch as DRES
from typing import List, Dict
import logging
import numpy as np
import pathlib, os
import rando... | [
"beir.datasets.data_loader.GenericDataLoader",
"beir.LoggingHandler",
"pathlib.Path",
"beir.util.download_and_unzip",
"beir.retrieval.evaluation.EvaluateRetrieval"
] | [((1771, 1808), 'beir.util.download_and_unzip', 'util.download_and_unzip', (['url', 'out_dir'], {}), '(url, out_dir)\n', (1794, 1808), False, 'from beir import util, LoggingHandler\n'), ((2163, 2187), 'beir.retrieval.evaluation.EvaluateRetrieval', 'EvaluateRetrieval', (['model'], {}), '(model)\n', (2180, 2187), False, ... |
from django import template
from joblistings.models import Job
from companies.models import Company
register = template.Library()
@register.inclusion_tag('navbar.html')
def get_navbar(*args, **kwargs):
queryset = None
user = kwargs["user"]
notifications= []
if user.is_authenticated:
notific... | [
"django.template.Library"
] | [((114, 132), 'django.template.Library', 'template.Library', ([], {}), '()\n', (130, 132), False, 'from django import template\n')] |
from openpyxl import (
load_workbook,
Workbook
)
from openpyxl.worksheet.pagebreak import Break
from openpyxl.utils import get_column_letter
from openpyxl.styles import (
NamedStyle,
Protection
)
from openpyxl.worksheet.page import (
PageMargins,
PrintOptions,
PrintPageSetup,
... | [
"openpyxl.utils.cell.column_index_from_string",
"openpyxl.worksheet.page.PrintPageSetup",
"openpyxl.Workbook",
"openpyxl.worksheet.page.PageMargins",
"openpyxl.worksheet.page.PrintOptions",
"openpyxl.styles.NamedStyle",
"openpyxl.load_workbook",
"re.match",
"pandas.read_excel",
"openpyxl.worksheet... | [((5026, 5055), 'pandas.read_excel', 'pd.read_excel', (['self.data_file'], {}), '(self.data_file)\n', (5039, 5055), True, 'import pandas as pd\n'), ((5119, 5129), 'openpyxl.Workbook', 'Workbook', ([], {}), '()\n', (5127, 5129), False, 'from openpyxl import load_workbook, Workbook\n'), ((5331, 5363), 'openpyxl.load_work... |
from setuptools import setup
with open("requirements.txt") as f:
required = f.read().splitlines()
setup(
name="convergent-remote",
version="0.0.4",
description="A remote.",
url="https://github.com/TxConvergentAdmin/remote",
author="<NAME>",
license="MIT",
packages=["remote"],
entr... | [
"setuptools.setup"
] | [((105, 421), 'setuptools.setup', 'setup', ([], {'name': '"""convergent-remote"""', 'version': '"""0.0.4"""', 'description': '"""A remote."""', 'url': '"""https://github.com/TxConvergentAdmin/remote"""', 'author': '"""<NAME>"""', 'license': '"""MIT"""', 'packages': "['remote']", 'entry_points': "{'console_scripts': ['s... |
import sys
import os
from os.path import join, pathsep, dirname
import subprocess
import argparse
parser = argparse.ArgumentParser(
description="""A launcher for running Python apps on Windows, potentially in conda
environments. This script can be run with either pythonw.exe or python.exe, but
in t... | [
"argparse.ArgumentParser",
"os.environ.copy",
"os.path.dirname",
"subprocess.call",
"sys.executable.lower",
"os.path.join"
] | [((108, 881), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""A launcher for running Python apps on Windows, potentially in conda\n environments. This script can be run with either pythonw.exe or python.exe, but\n in the former case it will launch the app using python.exe wi... |
from typing import Dict, List
import numpy as np
from matplotlib import pyplot as plt
from src.bounding_box import BoundingBox
from src.evaluators.pascal_voc_evaluator import calculate_ap_every_point
from doors_detector.evaluators.model_evaluator import ModelEvaluator
class MyEvaluator(ModelEvaluator):
def get... | [
"matplotlib.pyplot.title",
"numpy.divide",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"numpy.count_nonzero",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"src.bounding_box.BoundingBox.iou",
"numpy.array",
"src.evaluators.pa... | [((9198, 9253), 'numpy.divide', 'np.divide', (['accumulate_tp', '(accumulate_tp + accumulate_fp)'], {}), '(accumulate_tp, accumulate_tp + accumulate_fp)\n', (9207, 9253), True, 'import numpy as np\n'), ((9291, 9334), 'src.evaluators.pascal_voc_evaluator.calculate_ap_every_point', 'calculate_ap_every_point', (['recall',... |
import sys
sys.path.append("..")
from django.db import models
from customers.models import Customer
from rest_framework import serializers
class DataSet(models.Model):
name = models.CharField(max_length=256)
description = models.CharField(max_length=4096)
folder_path = models.CharField(max_length=4096)
... | [
"sys.path.append",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.FloatField"
] | [((11, 32), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (26, 32), False, 'import sys\n'), ((181, 213), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(256)'}), '(max_length=256)\n', (197, 213), False, 'from django.db import models\n'), ((232, 265), 'django.db.models.Cha... |
"""
Dummy conftest.py for kubi.
If you don't know what this is for, just leave it empty.
Read more about conftest.py under:
- https://docs.pytest.org/en/stable/fixture.html
- https://docs.pytest.org/en/stable/writing_plugins.html
"""
# import pytest
import os
import glob
import shutil
import urlli... | [
"os.remove",
"os.makedirs",
"os.path.exists",
"glob.glob",
"shutil.copyfile",
"shutil.rmtree",
"shutil.copyfileobj"
] | [((515, 548), 'os.path.exists', 'os.path.exists', (["(path_out + '/sub')"], {}), "(path_out + '/sub')\n", (529, 548), False, 'import os\n'), ((596, 631), 'os.path.exists', 'os.path.exists', (["(path_out + '/tiled')"], {}), "(path_out + '/tiled')\n", (610, 631), False, 'import os\n'), ((694, 735), 'glob.glob', 'glob.glo... |
import re
import torch
from torch.utils.data import Dataset
class Dataset(Dataset):
"""Generates a dataset for Smith
Args:
file: str, path to raw dataset where each line is a data sample
tokenizer: BertTokenizer, a tokenizer to generate tokens and convert to ids
sentence_block_length:... | [
"torch.ones",
"torch.randint",
"re.split",
"torch.topk",
"torch.ceil",
"torch.arange",
"torch.zeros",
"torch.sum",
"torch.tensor"
] | [((5561, 5618), 'torch.zeros', 'torch.zeros', (['self.sentence_block_length'], {'dtype': 'torch.long'}), '(self.sentence_block_length, dtype=torch.long)\n', (5572, 5618), False, 'import torch\n'), ((5647, 5690), 'torch.arange', 'torch.arange', (['(0)', 'self.sentence_block_length'], {}), '(0, self.sentence_block_length... |
# Local modules
import walk
import edit
def batch_insert_meta(limit=1):
"""
rename utf-8 text files without markdown extension to file-name.md
limit: is the number of files can be processed.
"""
i = 0
for fp in walk.get_files():
print (i, fp)
if edit.add_title(fp):
... | [
"edit.add_title",
"walk.get_files"
] | [((239, 255), 'walk.get_files', 'walk.get_files', ([], {}), '()\n', (253, 255), False, 'import walk\n'), ((291, 309), 'edit.add_title', 'edit.add_title', (['fp'], {}), '(fp)\n', (305, 309), False, 'import edit\n')] |
'''
Test clingo's Application class.
'''
from typing import Any, Callable, List, Sequence, Tuple
from unittest import TestCase
from tempfile import NamedTemporaryFile
from multiprocessing import Process, Queue
import os
import re
from .util import _MCB
from ..core import MessageCode
from ..application import Applicat... | [
"tempfile.NamedTemporaryFile",
"re.sub",
"os.unlink",
"multiprocessing.Queue"
] | [((2622, 2629), 'multiprocessing.Queue', 'Queue', ([], {}), '()\n', (2627, 2629), False, 'from multiprocessing import Process, Queue\n'), ((1922, 1965), 'tempfile.NamedTemporaryFile', 'NamedTemporaryFile', ([], {'mode': '"""wt"""', 'delete': '(False)'}), "(mode='wt', delete=False)\n", (1940, 1965), False, 'from tempfil... |
# Tests to check the api calls being made by the script
import pytest
import requests
import json
import time
import logging
import responses
from collectioncode import utils, collect
from mock import Mock, patch
# Setting up the vars for use in the api calls
baseurl = "https://10.135.7.222/restconf"
# uri = "/data/v1... | [
"mock.patch.object",
"json.loads",
"collectioncode.utils.Circuit_breaker",
"collectioncode.collect.collect_hostnames_json",
"mock.Mock",
"collectioncode.utils.rest_post_json",
"collectioncode.collect.collect_mpls_topo_json",
"logging.getLogger"
] | [((648, 675), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (665, 675), False, 'import logging\n'), ((4980, 5009), 'mock.patch.object', 'patch.object', (['requests', '"""get"""'], {}), "(requests, 'get')\n", (4992, 5009), False, 'from mock import Mock, patch\n'), ((5421, 5450), 'mock.pat... |
import json
import warnings
def read_scenario(path="scenarios/rimea6.scenario"):
"""
Loads a scenario file with json
:param path: the path of the scenario file
:return: the dictionary containing the scenario's data
"""
with open(path, 'r') as f:
scenario = json.load(f)
return s... | [
"json.dump",
"json.load",
"warnings.warn"
] | [((291, 303), 'json.load', 'json.load', (['f'], {}), '(f)\n', (300, 303), False, 'import json\n'), ((6434, 6469), 'json.dump', 'json.dump', (['scenario', 'f'], {'indent': '""" """'}), "(scenario, f, indent=' ')\n", (6443, 6469), False, 'import json\n'), ((2543, 2577), 'warnings.warn', 'warnings.warn', (['msg', 'Runti... |
import csv
import datetime
from dateutil.parser import parse
import discord
import os
import yaml
import urllib.request
from discord.ext import commands
import matplotlib.pyplot as plt
"""----------CONSTANTS AND GLOBAL VARIABLES----------"""
bot = commands.Bot(command_prefix='!')
bot.remove_command('help')
LAST_ARC... | [
"matplotlib.pyplot.title",
"os.remove",
"dateutil.parser.parse",
"matplotlib.pyplot.locator_params",
"discord.Embed",
"matplotlib.pyplot.plot",
"discord.File",
"csv.DictReader",
"yaml.dump",
"datetime.date",
"datetime.date.today",
"os.path.isfile",
"discord.Game",
"yaml.safe_load",
"disc... | [((251, 283), 'discord.ext.commands.Bot', 'commands.Bot', ([], {'command_prefix': '"""!"""'}), "(command_prefix='!')\n", (263, 283), False, 'from discord.ext import commands\n'), ((328, 353), 'datetime.date', 'datetime.date', (['(1970)', '(1)', '(1)'], {}), '(1970, 1, 1)\n', (341, 353), False, 'import datetime\n'), ((6... |
# Copyright 2017 Battelle Energy Alliance, 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 t... | [
"math.exp"
] | [((4470, 4543), 'math.exp', 'math.exp', (['(-(monitored.time - (auxiliary.scram_start_time + +100.0)) / 4.0)'], {}), '(-(monitored.time - (auxiliary.scram_start_time + +100.0)) / 4.0)\n', (4478, 4543), False, 'import math\n'), ((5278, 5351), 'math.exp', 'math.exp', (['(-(monitored.time - (auxiliary.scram_start_time + +... |
import random
import numpy as np
from albumentations import DualTransform
from skimage.transform import PiecewiseAffineTransform, warp
class CustomPiecewiseAffineTransform(DualTransform):
"""
Add sine-wave piecewise affine transform to the image
Args:
phase_shift_limit, amplitude_limit, w_limit:... | [
"numpy.dstack",
"skimage.transform.PiecewiseAffineTransform",
"numpy.meshgrid",
"random.uniform",
"skimage.transform.warp",
"numpy.linspace",
"numpy.vstack"
] | [((770, 796), 'skimage.transform.PiecewiseAffineTransform', 'PiecewiseAffineTransform', ([], {}), '()\n', (794, 796), False, 'from skimage.transform import PiecewiseAffineTransform, warp\n'), ((1816, 1840), 'numpy.linspace', 'np.linspace', (['(0)', 'cols', '(20)'], {}), '(0, cols, 20)\n', (1827, 1840), True, 'import nu... |
# 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.get",
"pulumi.getter",
"pulumi.ResourceOptions",
"pulumi.set"
] | [((2429, 2460), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""publicKey"""'}), "(name='publicKey')\n", (2442, 2460), False, 'import pulumi\n'), ((3603, 3635), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""valueSpecs"""'}), "(name='valueSpecs')\n", (3616, 3635), False, 'import pulumi\n'), ((6890, 6922), 'pul... |
"""Notification related push plugins."""
from typing import Any, Dict, List, Optional
import slacker
from pnp.plugins.push import SyncPush, enveloped, parse_envelope
from pnp.typing import Envelope, Payload
from pnp.utils import make_list
class Slack(SyncPush):
"""
Sends a message to slack. Optionally you ... | [
"pnp.utils.make_list",
"slacker.Slacker",
"pnp.plugins.push.parse_envelope"
] | [((3132, 3157), 'pnp.plugins.push.parse_envelope', 'parse_envelope', (['"""channel"""'], {}), "('channel')\n", (3146, 3157), False, 'from pnp.plugins.push import SyncPush, enveloped, parse_envelope\n'), ((3163, 3189), 'pnp.plugins.push.parse_envelope', 'parse_envelope', (['"""username"""'], {}), "('username')\n", (3177... |
"""
Author: <NAME>
Created: 4/13/2022
Last Updated: 4/20/2022
Based on this paper: https://arxiv.org/pdf/astro-ph/0609736.pdf
This program calculates a Cousins R (R_c) filter band value from a given Johnson V and B, and g' and r'.
"""
import pandas as pd
import numpy as np
# noinspection PyUnboundLocal... | [
"pandas.read_csv",
"pandas.DataFrame"
] | [((1149, 1208), 'pandas.read_csv', 'pd.read_csv', (['input_file'], {'header': 'None', 'skiprows': '[0]', 'sep': '""","""'}), "(input_file, header=None, skiprows=[0], sep=',')\n", (1160, 1208), True, 'import pandas as pd\n'), ((3366, 3482), 'pandas.DataFrame', 'pd.DataFrame', (["{'RA': ra, 'DEC': dec, 'BMag': B, 'e_BMag... |
#!/usr/bin/env python
import time
from flask import Flask, render_template, session, request
from flask_socketio import SocketIO, emit, join_room, leave_room, close_room, rooms, disconnect
from libs.SevenSegment import SevenSegment
async_mode = None
room_name = 'The Library'
app = Flask(__name__)
app.config['SECRET_... | [
"flask.Flask",
"time.time",
"flask.render_template",
"flask_socketio.SocketIO",
"libs.SevenSegment.SevenSegment"
] | [((285, 300), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (290, 300), False, 'from flask import Flask, render_template, session, request\n'), ((349, 385), 'flask_socketio.SocketIO', 'SocketIO', (['app'], {'async_mode': 'async_mode'}), '(app, async_mode=async_mode)\n', (357, 385), False, 'from flask_sock... |
# Generated by Django 2.0.4 on 2018-06-22 13:20
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('authentication', '0002_user_avatar'),
('gallery', '0001_initial'),
]
operations = [
migrations.Alte... | [
"django.db.models.OneToOneField"
] | [((404, 534), 'django.db.models.OneToOneField', 'models.OneToOneField', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'related_name': '"""avatar_user"""', 'to': '"""gallery.Image"""'}), "(null=True, on_delete=django.db.models.deletion.\n SET_NULL, related_name='avatar_user', to='gallery.... |
from lark.visitors import Transformer, v_args
from ebl.transliteration.domain import atf
from ebl.transliteration.domain.atf import sub_index_to_int
from ebl.transliteration.domain.egyptian_metrical_feet_separator_token import (
EgyptianMetricalFeetSeparator,
)
from ebl.transliteration.domain.sign_tokens import (
... | [
"lark.visitors.v_args",
"ebl.transliteration.domain.tokens.UnknownNumberOfSigns.of",
"ebl.transliteration.domain.egyptian_metrical_feet_separator_token.EgyptianMetricalFeetSeparator.of",
"ebl.transliteration.domain.unknown_sign_tokens.UnidentifiedSign.of",
"ebl.transliteration.domain.unknown_sign_tokens.Unc... | [((661, 680), 'lark.visitors.v_args', 'v_args', ([], {'inline': '(True)'}), '(inline=True)\n', (667, 680), False, 'from lark.visitors import Transformer, v_args\n'), ((788, 807), 'lark.visitors.v_args', 'v_args', ([], {'inline': '(True)'}), '(inline=True)\n', (794, 807), False, 'from lark.visitors import Transformer, v... |
from timeit import default_timer as timer
class Timer(object):
def __init__(self, name='Timer'):
self.name = name
def __enter__(self):
self.start = timer()
def __exit__(self, *args):
self.end = timer()
self.duration = self.end - self.start
print('%s:' % self.name, ... | [
"timeit.default_timer"
] | [((174, 181), 'timeit.default_timer', 'timer', ([], {}), '()\n', (179, 181), True, 'from timeit import default_timer as timer\n'), ((233, 240), 'timeit.default_timer', 'timer', ([], {}), '()\n', (238, 240), True, 'from timeit import default_timer as timer\n')] |
import sys
import Main
if __name__ == '__main__':
if len (sys.argv) >= 1:
Path = sys.argv[1]
if not Path.endswith ('.plist'):
Path += '.plist'
Instance = Main.Plistr (Path)
Instance.Run ()
| [
"Main.Plistr"
] | [((198, 215), 'Main.Plistr', 'Main.Plistr', (['Path'], {}), '(Path)\n', (209, 215), False, 'import Main\n')] |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect
from django.contrib.contenttypes.models import ContentType
from django.urls import reverse
from django.http import JsonResponse
from comment.models import Comment
from comment.forms import CommentForm
def update_c... | [
"comment.models.Comment",
"comment.forms.CommentForm",
"django.contrib.contenttypes.models.ContentType.objects.get_for_model",
"django.http.JsonResponse",
"django.urls.reverse"
] | [((1397, 1441), 'comment.forms.CommentForm', 'CommentForm', (['request.POST'], {'user': 'request.user'}), '(request.POST, user=request.user)\n', (1408, 1441), False, 'from comment.forms import CommentForm\n'), ((2817, 2835), 'django.http.JsonResponse', 'JsonResponse', (['data'], {}), '(data)\n', (2829, 2835), False, 'f... |
from django.contrib import admin
# Register your models here.
from apps.inventario.models import Inventario
admin.site.register(Inventario) | [
"django.contrib.admin.site.register"
] | [((110, 141), 'django.contrib.admin.site.register', 'admin.site.register', (['Inventario'], {}), '(Inventario)\n', (129, 141), False, 'from django.contrib import admin\n')] |
import importlib
import os
import warnings
from e2edet.optim.scheduler.lr_scheduler import BaseScheduler
SCHEDULER_REGISTRY = {}
__all__ = ["BaseScheduler"]
def build_scheduler(config, optimizer):
scheduler_config = config.get("scheduler", {})
if not hasattr(scheduler_config, "type"):
raise Value... | [
"importlib.import_module",
"os.path.isdir",
"os.path.dirname",
"warnings.warn",
"os.path.join",
"os.listdir"
] | [((1469, 1494), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1484, 1494), False, 'import os\n'), ((1507, 1533), 'os.listdir', 'os.listdir', (['schedulers_dir'], {}), '(schedulers_dir)\n', (1517, 1533), False, 'import os\n'), ((1546, 1580), 'os.path.join', 'os.path.join', (['schedulers_dir'... |
import pytest
from astropy.table import Table
from a_download_decals.setup.join_brick_tables import *
@pytest.fixture()
def coordinate_catalog():
return Table([
{'ra': 1.0,
'dec': 11.0,
'example_edge': 0.5,
'brickname': 'simple_match'},
{'ra': 2.0,
'dec': 12.... | [
"astropy.table.Table",
"pytest.fixture"
] | [((107, 123), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (121, 123), False, 'import pytest\n'), ((398, 414), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (412, 414), False, 'import pytest\n'), ((161, 324), 'astropy.table.Table', 'Table', (["[{'ra': 1.0, 'dec': 11.0, 'example_edge': 0.5, 'brickname':... |
import pandas as pd
import pylab
import numpy as np
import tensorflow as tf
import os
import gc
import librosa
import librosa.display
import matplotlib
import matplotlib.pyplot as plt
from keras.preprocessing.image import img_to_array, load_img
from keras.models import Model, Sequential
from keras.optimizer... | [
"matplotlib.pyplot.title",
"pandas.read_csv",
"numpy.around",
"keras.optimizers.SGD",
"keras.layers.Flatten",
"sklearn.preprocessing.LabelEncoder",
"keras.utils.np_utils.to_categorical",
"keras.layers.MaxPooling2D",
"matplotlib.pyplot.show",
"keras.layers.Convolution2D",
"keras.layers.Dropout",
... | [((1962, 1993), 'numpy.around', 'np.around', (['(output_image / 255.0)'], {}), '(output_image / 255.0)\n', (1971, 1993), True, 'import numpy as np\n'), ((2079, 2103), 'pandas.read_csv', 'pd.read_csv', (['"""train.csv"""'], {}), "('train.csv')\n", (2090, 2103), True, 'import pandas as pd\n'), ((2642, 2707), 'sklearn.mod... |
# Copyright 2021 The Kubric 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 w... | [
"json.load",
"tensorflow_datasets.public_api.features.ClassLabel",
"tensorflow_datasets.public_api.features.Text",
"tensorflow_datasets.public_api.features.Image",
"tensorflow_datasets.public_api.features.Tensor",
"tensorflow_datasets.public_api.core.Version",
"numpy.array",
"tensorflow_datasets.publi... | [((3601, 3627), 'tensorflow_datasets.public_api.core.Version', 'tfds.core.Version', (['"""1.0.0"""'], {}), "('1.0.0')\n", (3618, 3627), True, 'import tensorflow_datasets.public_api as tfds\n'), ((7727, 7754), 'tensorflow_datasets.public_api.core.as_path', 'tfds.core.as_path', (['filename'], {}), '(filename)\n', (7744, ... |
import cv2
import os.path
import numpy as np
from os.path import dirname,exists
from tensorflow.keras.models import load_model
# make prediction on image saved on disk
def prediction_path(path_img,path_res,model_name="model.h5"):
if not exists("models/"+model_name):
print('Model '+model_name+' not found !!... | [
"tensorflow.keras.models.load_model",
"numpy.argmax",
"cv2.cvtColor",
"os.path.dirname",
"os.path.exists",
"cv2.imread",
"numpy.reshape",
"cv2.resize"
] | [((395, 429), 'tensorflow.keras.models.load_model', 'load_model', (["('models/' + model_name)"], {}), "('models/' + model_name)\n", (405, 429), False, 'from tensorflow.keras.models import load_model\n'), ((999, 1036), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (1... |
# -*- coding: UTF-8 -*-
class Neuron(object):
'''
A spiking neuron model based on:
<NAME>.
Simple Model of Spiking Neurons
IEEE TRANSACTIONS ON NEURAL NETWORKS, VOL. 14, NO. 6, NOVEMBER 2003
'''
def __init__(self, bias = 0, a = 0.02, b = 0.2, c = -65.0, d = 8.0):
'''
a, b,... | [
"neat.visualize.plot_spikes"
] | [((2983, 3021), 'neat.visualize.plot_spikes', 'visualize.plot_spikes', (['neuron_membrane'], {}), '(neuron_membrane)\n', (3004, 3021), False, 'from neat import visualize\n')] |
from collections import namedtuple
from copy import deepcopy
import numpy as np
def powers2(num):
'''List (descending) of powers of two in the number'''
powers = [int(power)
for power, value in enumerate(reversed(format(num, 'b')))
if value != '0']
return powers[::-1]
# asser... | [
"copy.deepcopy",
"collections.namedtuple",
"numpy.copy"
] | [((397, 497), 'collections.namedtuple', 'namedtuple', (['"""Tile"""', "('coords', 'cells', 'master_vertices', 'slave_vertices', 'mappings', 'data')"], {}), "('Tile', ('coords', 'cells', 'master_vertices', 'slave_vertices',\n 'mappings', 'data'))\n", (407, 497), False, 'from collections import namedtuple\n'), ((916, ... |
import numpy as np
import torch
def get_coordinate_tensors(x_max, y_max):
x_map = np.tile(np.arange(x_max), (y_max,1))/x_max*2 - 1.0
y_map = np.tile(np.arange(y_max), (x_max,1)).T/y_max*2 - 1.0
x_map_tensor = torch.from_numpy(x_map.astype(np.float32)).cuda()
y_map_tensor = torch.from_numpy(y_map.asty... | [
"torch.stack",
"numpy.arange",
"torch.cat"
] | [((1278, 1303), 'torch.cat', 'torch.cat', (['centers'], {'dim': '(0)'}), '(centers, dim=0)\n', (1287, 1303), False, 'import torch\n'), ((1503, 1533), 'torch.cat', 'torch.cat', (['centers_list'], {'dim': '(0)'}), '(centers_list, dim=0)\n', (1512, 1533), False, 'import torch\n'), ((96, 112), 'numpy.arange', 'np.arange', ... |
# -*- coding: utf-8 -*-
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.core.mail import send_mail
import random
import string
JOB_ROLES = (
# ('_database_', '_visible_'),
('supplier', 'Supplier'),
('company', 'Company'),
('manager', 'Manager'),
('employ... | [
"django.db.models.CharField",
"django.core.mail.send_mail",
"random.choice",
"django.db.models.EmailField"
] | [((700, 777), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(6)', 'default': 'uniqueId', 'editable': '(False)', 'unique': '(True)'}), '(max_length=6, default=uniqueId, editable=False, unique=True)\n', (716, 777), False, 'from django.db import models\n'), ((795, 838), 'django.db.models.CharField... |
from importlib import import_module
from flask import Flask, render_template, Response
import cv2
import time
app = Flask(__name__)
@app.route('/')
def index():
"""Video streaming home page."""
return render_template('index.html')
def gen(camera_stream, feed_type, device):
"""Video streaming generator... | [
"importlib.import_module",
"flask.Flask",
"time.time",
"flask.render_template",
"cv2.imencode"
] | [((118, 133), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (123, 133), False, 'from flask import Flask, render_template, Response\n'), ((213, 242), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (228, 242), False, 'from flask import Flask, render_template, Res... |
import os
import re
import numpy as np
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException, \
UnexpectedAlertPresentException, StaleElementReferenceException, \
NoSuchWindowException, WebDriverException
from enum import Enum, auto
from threading import Thread, Event
f... | [
"threading.Thread",
"numpy.zeros",
"re.match",
"threading.Event",
"selenium.webdriver.ChromeOptions",
"selenium.webdriver.Chrome",
"enum.auto",
"numpy.all"
] | [((539, 545), 'enum.auto', 'auto', ([], {}), '()\n', (543, 545), False, 'from enum import Enum, auto\n'), ((560, 566), 'enum.auto', 'auto', ([], {}), '()\n', (564, 566), False, 'from enum import Enum, auto\n'), ((581, 587), 'enum.auto', 'auto', ([], {}), '()\n', (585, 587), False, 'from enum import Enum, auto\n'), ((60... |
from baselines.deepqnaf.learn import learn
import gym
import tensorflow as tf
import argparse
#parser
parser = argparse.ArgumentParser()
parser.add_argument('--environment', dest='environment', type=str, default='MountainCarContinuous-v0')
parser.add_argument('--num_timesteps', dest='num_timesteps', type=int, default=... | [
"tensorflow.Session",
"argparse.ArgumentParser"
] | [((112, 137), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (135, 137), False, 'import argparse\n'), ((429, 441), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (439, 441), True, 'import tensorflow as tf\n')] |
# -*- coding: utf-8 -*-
"""Configuration for the h application."""
from __future__ import unicode_literals
import logging
import os
from pyramid.config import Configurator
from pyramid.settings import asbool
from h.security import derive_key
from h.settings import DockerSetting
from h.settings import EnvSetting
fr... | [
"h.settings.EnvSetting",
"h.settings.DockerSetting",
"pyramid.config.Configurator",
"os.urandom",
"logging.getLogger"
] | [((464, 491), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (481, 491), False, 'import logging\n'), ((819, 925), 'h.settings.DockerSetting', 'DockerSetting', (['"""es.host"""', '"""elasticsearch"""'], {'pattern': '"""http://{port_9200_tcp_addr}:{port_9200_tcp_port}"""'}), "('es.host', 'e... |
import pygame
from pygame.locals import *
from numpy import reshape
import sys
import traceback
import random
import math
from .game import Game
def rndint(x):
return int(round(x))
def clamp(x, minimum, maximum):
if x < minimum:
return minimum
if x > maximum:
return maximum
return x
... | [
"random.randint",
"pygame.font.SysFont",
"pygame.event.get",
"pygame.draw.rect",
"math.sin",
"pygame.display.flip",
"numpy.reshape",
"math.cos",
"pygame.time.Clock",
"pygame.key.get_pressed"
] | [((701, 743), 'pygame.font.SysFont', 'pygame.font.SysFont', (['"""Times New Roman"""', '(18)'], {}), "('Times New Roman', 18)\n", (720, 743), False, 'import pygame\n'), ((1344, 1363), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (1361, 1363), False, 'import pygame\n'), ((1808, 1841), 'numpy.reshape', 're... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data.dataloader import DataLoader
from modules import MLP, Attention, NoteEmbed
from preprocess import MidiDataset
import math
class Transformer(nn.Module):
def __init__(self, embedding_dim, seq_length, num_heads) -> None:
... | [
"torch.nn.Dropout",
"modules.MLP",
"torch.stack",
"modules.Attention",
"preprocess.MidiDataset",
"torch.zeros",
"torch.nn.functional.cross_entropy",
"torch.nn.LayerNorm",
"torch.cos",
"modules.NoteEmbed",
"torch.arange",
"torch.utils.data.dataloader.DataLoader",
"math.log",
"torch.sin"
] | [((2840, 2864), 'preprocess.MidiDataset', 'MidiDataset', ([], {'seq_len': '(512)'}), '(seq_len=512)\n', (2851, 2864), False, 'from preprocess import MidiDataset\n'), ((2878, 2911), 'torch.utils.data.dataloader.DataLoader', 'DataLoader', (['dataset'], {'batch_size': '(2)'}), '(dataset, batch_size=2)\n', (2888, 2911), Fa... |
# -*- coding: utf-8 -*-
import os
from dba.mongodb.backup.config import Config
Config.AWS_PROFILE = "sanhe"
HOME = os.path.expanduser("~")
Config.MONGO_BACKUP_DIR = os.path.join(HOME, "Documents", "mongo-backup")
Config.MONGO_BACKUP_S3_BUCKET = "pyrabbit"
Config.MONGO_BACKUP_S3_PREFIX = "mongodb-backup"
| [
"os.path.expanduser",
"os.path.join"
] | [((118, 141), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (136, 141), False, 'import os\n'), ((168, 215), 'os.path.join', 'os.path.join', (['HOME', '"""Documents"""', '"""mongo-backup"""'], {}), "(HOME, 'Documents', 'mongo-backup')\n", (180, 215), False, 'import os\n')] |
from pash.cli_utils.pass_generator import generator, get_generator_by_questions
from pash.cli_utils.questions import password_questions
from pash.cli_utils.config_mode_utils import get_password_formated
from PyInquirer import prompt
import pyperclip
import click
import colorama
colorama.init()
@click.group()
def cli(... | [
"colorama.init",
"pash.cli_utils.questions.password_questions",
"pash.cli_utils.pass_generator.get_generator_by_questions",
"pash.cli_utils.config_mode_utils.get_password_formated",
"pash.cli_utils.pass_generator.generator",
"pyperclip.copy",
"click.group",
"click.secho"
] | [((280, 295), 'colorama.init', 'colorama.init', ([], {}), '()\n', (293, 295), False, 'import colorama\n'), ((298, 311), 'click.group', 'click.group', ([], {}), '()\n', (309, 311), False, 'import click\n'), ((535, 546), 'pash.cli_utils.pass_generator.generator', 'generator', ([], {}), '()\n', (544, 546), False, 'from pa... |
from __future__ import print_function
import argparse
import atexit
import boto3
import logging
import sys
import time
if sys.argv[0].endswith("__main__.py"):
sys.argv[0] = "python -m appsync_schema_uploader"
@atexit.register
def app_exit():
logging.getLogger().info("Terminating")
def _parse_command_line... | [
"logging.getLogger",
"argparse.ArgumentParser",
"boto3.client",
"time.sleep"
] | [((352, 377), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (375, 377), False, 'import argparse\n'), ((1222, 1375), 'boto3.client', 'boto3.client', (['"""appsync"""'], {'aws_access_key_id': 'args.aws_access_key_id', 'aws_secret_access_key': 'args.aws_secret_access_key', 'region_name': 'args.aw... |
from flask_wtf import FlaskForm
from wtforms import StringField, RadioField, SelectField
from flask_wtf.file import FileRequired, FileField
from wtforms.validators import InputRequired, DataRequired
class AddFamiliesForm(FlaskForm):
method_description = StringField('Description', [InputRequired])
source = Sel... | [
"flask_wtf.file.FileField",
"wtforms.StringField",
"wtforms.SelectField"
] | [((260, 303), 'wtforms.StringField', 'StringField', (['"""Description"""', '[InputRequired]'], {}), "('Description', [InputRequired])\n", (271, 303), False, 'from wtforms import StringField, RadioField, SelectField\n'), ((317, 424), 'wtforms.SelectField', 'SelectField', (['"""Source"""'], {'choices': "[('mcl', 'MCL'), ... |
import os
import unittest
import warnings
# prevent excessive warning logs
warnings.filterwarnings('ignore')
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import numpy as np
import random
from sklearn.model_selection import train_test_split
from finetune import ComparisonRegressor
class TestComparisonRegression(unittes... | [
"unittest.main",
"numpy.random.seed",
"warnings.filterwarnings",
"sklearn.model_selection.train_test_split",
"random.choice",
"numpy.mean",
"random.seed"
] | [((76, 109), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (99, 109), False, 'import warnings\n'), ((2513, 2528), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2526, 2528), False, 'import unittest\n'), ((652, 667), 'random.seed', 'random.seed', (['(42)'], {}), '(42... |
"""
This example demonstrates how to schedule updates to the application model in
the web version.
"""
#### Imports ####
from __future__ import print_function
import datetime
from jigna.web_app import WebApp
from jigna.template import Template
from tornado.ioloop import IOLoop
from traits.api import HasTraits, Str
#... | [
"jigna.web_app.WebApp",
"datetime.timedelta",
"tornado.ioloop.IOLoop.instance",
"jigna.template.Template"
] | [((572, 601), 'jigna.template.Template', 'Template', ([], {'body_html': 'body_html'}), '(body_html=body_html)\n', (580, 601), False, 'from jigna.template import Template\n'), ((690, 707), 'tornado.ioloop.IOLoop.instance', 'IOLoop.instance', ([], {}), '()\n', (705, 707), False, 'from tornado.ioloop import IOLoop\n'), ((... |
"""
Imports
"""
import torch as nn
import torch.nn.functional as F
from tqdm import trange
import sys
import os
WORKING_PATH = os.getcwd()
PATH = os.path.abspath( os.path.dirname(os.path.abspath(__file__)) )
os.chdir(PATH)
os.chdir("../")
REPO_PATH = os.path.abspath( os.getcwd() )
os.chdir( WORKING_PATH )
sy... | [
"sys.path.append",
"base_model.Train_Net_MNIST",
"os.path.abspath",
"matplotlib.pyplot.show",
"tqdm.trange",
"os.getcwd",
"torch.nn.functional.softmax",
"torch.randperm",
"torch.zeros",
"torch.no_grad",
"os.chdir",
"base_model.Net"
] | [((135, 146), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (144, 146), False, 'import os\n'), ((217, 231), 'os.chdir', 'os.chdir', (['PATH'], {}), '(PATH)\n', (225, 231), False, 'import os\n'), ((232, 247), 'os.chdir', 'os.chdir', (['"""../"""'], {}), "('../')\n", (240, 247), False, 'import os\n'), ((292, 314), 'os.chdi... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 22, 2019 09:43:46 AM
@author: eapetcho
"""
import argparse
import os
def read_cmdline():
"""Read the command line.
Returns
-------
args: dict, argparse.Namespace object
Encapsulate the argument entered on the commandline by... | [
"os.system",
"argparse.ArgumentParser"
] | [((423, 495), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Exctract a clip from a video file"""'}), "(description='Exctract a clip from a video file')\n", (446, 495), False, 'import argparse\n'), ((1186, 1212), 'os.system', 'os.system', (['"""rm -f tmp.txt"""'], {}), "('rm -f tmp.txt')... |
import logging
import uuid
from io import BytesIO
from os.path import join
from typing import Optional, Dict, Any, BinaryIO
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.files.storage import default_storage
from django.db import transaction
from django.utils import ti... | [
"io.BytesIO",
"django.core.files.storage.default_storage.open",
"uuid.uuid4",
"django.utils.timezone.now",
"django.contrib.auth.get_user_model",
"baserow.contrib.database.views.registries.view_type_registry.get_by_model",
"baserow.contrib.database.export.tasks.run_export_job.delay",
"baserow.contrib.d... | [((1162, 1189), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1179, 1189), False, 'import logging\n'), ((1198, 1214), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (1212, 1214), False, 'from django.contrib.auth import get_user_model\n'), ((7753, 7789), 'baser... |
import torch
import numpy as np
import data
import matplotlib.pyplot as plt
import copy
class PTDeep(torch.nn.Module):
def __init__(self, conf, activation_f, param_lambda=1e-4):
"""Arguments:
:param conf: network architecture - nr_neurons in each layer
"""
self.conf = conf
... | [
"data.graph_surface",
"numpy.random.seed",
"numpy.argmax",
"torch.mm",
"torch.randn",
"data.sample_gmm_2d",
"data.sample_gauss_2d",
"numpy.random.randint",
"numpy.max",
"torch.Tensor",
"torch.optim.lr_scheduler.ExponentialLR",
"torch.nn.ParameterList",
"torch.zeros",
"torch.log",
"matplo... | [((7247, 7314), 'torch.optim.lr_scheduler.ExponentialLR', 'torch.optim.lr_scheduler.ExponentialLR', (['optimizer'], {'gamma': '(1 - 0.0001)'}), '(optimizer, gamma=1 - 0.0001)\n', (7285, 7314), False, 'import torch\n'), ((8145, 8160), 'torch.Tensor', 'torch.Tensor', (['X'], {}), '(X)\n', (8157, 8160), False, 'import tor... |
from flask import Flask,redirect, render_template,url_for
import os
app = Flask(__name__, template_folder='static/templates')
@app.route('/')
def home():
return render_template("index.html")
if __name__ == '__main__':
app.static_folder = 'static' # Allows absolute paths to folders inside static
env_port =... | [
"os.environ.get",
"flask.Flask",
"flask.render_template"
] | [((74, 125), 'flask.Flask', 'Flask', (['__name__'], {'template_folder': '"""static/templates"""'}), "(__name__, template_folder='static/templates')\n", (79, 125), False, 'from flask import Flask, redirect, render_template, url_for\n'), ((166, 195), 'flask.render_template', 'render_template', (['"""index.html"""'], {}),... |
import os
import shutil
path = '/Users/haoye.tian/Documents/University/data/PatchCollectingV1/DynaMoth/'
for root, dirs, files in os.walk(path):
for file in files:
if file.endswith('.patch'):
name = file.split('.')[0]
buggy = name + '-s.java'
fixed = name + '-t.java'
... | [
"os.walk",
"os.path.join",
"os.makedirs",
"os.path.exists"
] | [((132, 145), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (139, 145), False, 'import os\n'), ((430, 452), 'os.path.join', 'os.path.join', (['root', 'id'], {}), '(root, id)\n', (442, 452), False, 'import os\n'), ((472, 496), 'os.path.exists', 'os.path.exists', (['new_root'], {}), '(new_root)\n', (486, 496), False,... |
# Databricks notebook source
# MAGIC %run ./functions
# COMMAND ----------
import traceback
from uuid import uuid4
import warnings
# COMMAND ----------
INT_TEST_DEFAULT_SOURCE_DATASET = 'source_a'
INT_TEST_SOURCE_DATASETS = {INT_TEST_DEFAULT_SOURCE_DATASET, 'source_b'}
INT_TEST_UPLIFT_NOTEBOOK = "./notebooks/uplif... | [
"warnings.warn",
"uuid.uuid4",
"traceback.print_exception"
] | [((1855, 1905), 'traceback.print_exception', 'traceback.print_exception', (['exc_type', 'exc_value', 'tb'], {}), '(exc_type, exc_value, tb)\n', (1880, 1905), False, 'import traceback\n'), ((3086, 3198), 'warnings.warn', 'warnings.warn', (['f"""At least one table does not exist. It (They) must have been dropped during t... |
"""@desc
Constants
@author
<NAME>
Artificial Intelligence Enthusiast & Software Engineer.
Email: <EMAIL>
Github: https://github.com/deven96
GitLab: https://gitlab.com/Deven96
@project
@create date 2018-12-31 03:34:05
@modify date 2018-12-31 03:34:05
@license
MIT License
Copyright (c... | [
"os.path.abspath",
"os.path.join",
"types.SimpleNamespace"
] | [((476, 510), 'os.path.join', 'os.path.join', (['CURRENT_DIR', '"""cache"""'], {}), "(CURRENT_DIR, 'cache')\n", (488, 510), False, 'import os\n'), ((527, 565), 'os.path.join', 'os.path.join', (['CURRENT_DIR', '"""templates"""'], {}), "(CURRENT_DIR, 'templates')\n", (539, 565), False, 'import os\n'), ((872, 902), 'types... |
#!/usr/bin/env python
from __future__ import print_function
import logging
import click
from cargoport.utils import yield_packages, get_url
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger()
@click.command()
@click.argument('galaxy_package_file')
@click.argument('id')
@click.option('--version')
def ma... | [
"cargoport.utils.yield_packages",
"click.argument",
"logging.basicConfig",
"cargoport.utils.get_url",
"click.option",
"click.command",
"logging.getLogger"
] | [((140, 180), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (159, 180), False, 'import logging\n'), ((187, 206), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (204, 206), False, 'import logging\n'), ((210, 225), 'click.command', 'click.command',... |
from materials import ColourImage,GreyScaleImage,BinaryImage
class GUI(object):
def __init__(self,threshold,anotherlist):
self.threshold=threshold
self.anotherlist=anotherlist
def processes(self):
if len(self.anotherlist[1]) == 5:
appendlists=[]
avgthr... | [
"materials.ColourImage.ColourImage",
"materials.GreyScaleImage.GreyScaleImage",
"materials.BinaryImage.BinaryImage"
] | [((605, 652), 'materials.ColourImage.ColourImage', 'ColourImage.ColourImage', (['self.r', 'self.g', 'self.b'], {}), '(self.r, self.g, self.b)\n', (628, 652), False, 'from materials import ColourImage, GreyScaleImage, BinaryImage\n'), ((971, 1002), 'materials.BinaryImage.BinaryImage', 'BinaryImage.BinaryImage', (['outpu... |
from src.model.Music import Music
from src.util.Jsons import Jsons
class MusicList:
"""歌单"""
# 默认歌单(即本地歌单)ID
DEFAULT_ID = 0
def __init__(self):
# 歌单id
self.id = None
# 歌单名
self.name = None
# 创建日期(秒级时间戳)
self.created = None
self.created_label ... | [
"src.util.Jsons.Jsons.dumps"
] | [((610, 626), 'src.util.Jsons.Jsons.dumps', 'Jsons.dumps', (['obj'], {}), '(obj)\n', (621, 626), False, 'from src.util.Jsons import Jsons\n')] |
from typing import Dict, List, Union
from jigu.client.lcd.api import ApiResponse, BaseApi, project
from jigu.core import AccAddress, Coin, Coins, Dec, Proposal
from jigu.core.denoms import uLuna
from jigu.util.serdes import JiguBox
__all__ = ["GovApi"]
class GovApi(BaseApi):
"""Interface for interacting with th... | [
"jigu.util.serdes.JiguBox",
"jigu.client.lcd.api.project",
"jigu.core.Coins.deserialize",
"jigu.core.Proposal.deserialize"
] | [((994, 1023), 'jigu.client.lcd.api.project', 'project', (['res', "res['proposer']"], {}), "(res, res['proposer'])\n", (1001, 1023), False, 'from jigu.client.lcd.api import ApiResponse, BaseApi, project\n'), ((1266, 1277), 'jigu.util.serdes.JiguBox', 'JiguBox', (['{}'], {}), '({})\n', (1273, 1277), False, 'from jigu.ut... |
"""Search for rooms where maximizing correlational coefficient leads to
accurate clustering
"""
import multiprocessing
import csv
import sys
from copy import deepcopy
import numpy as np
from ..data_loader import config_loader
from . import strict_ga
def _choose_random_room(total_room_count: int, target_room_count: in... | [
"numpy.random.choice",
"copy.deepcopy",
"numpy.random.seed",
"csv.writer",
"multiprocessing.Value",
"multiprocessing.Pool",
"sys.stderr.write"
] | [((432, 472), 'multiprocessing.Value', 'multiprocessing.Value', (['"""i"""', '(0)'], {'lock': '(True)'}), "('i', 0, lock=True)\n", (453, 472), False, 'import multiprocessing\n'), ((335, 408), 'numpy.random.choice', 'np.random.choice', (['total_room_count'], {'size': 'target_room_count', 'replace': '(False)'}), '(total_... |
# Designed & coded by <NAME> <https://github.com/sandramsc>
import folium
import pandas as pd
import geopandas as gpd
usgs_url = "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.csv"
data = pd.read_csv(usgs_url)
# create a map, change the basemap style
m = folium.Map(location=[10.850516, 76.271080],... | [
"pandas.read_csv",
"folium.Popup",
"folium.Map"
] | [((210, 231), 'pandas.read_csv', 'pd.read_csv', (['usgs_url'], {}), '(usgs_url)\n', (221, 231), True, 'import pandas as pd\n'), ((277, 407), 'folium.Map', 'folium.Map', ([], {'location': '[10.850516, 76.27108]', 'tiles': '"""cartodb dark_matter"""', 'zoom_start': '(3)', 'max_bounds': '(True)', 'min_zoom': '(2)', 'max_z... |
#!/usr/bin/python
import sys
import os
from urlparse import urlsplit
from singleshot.views import ItemView, ViewableObject
from singleshot.errors import return_404
from cStringIO import StringIO
import cgi
import logging
from datetime import datetime
from pysqlite2 import dbapi2 as sqlite
LOG = logging.getLogger('si... | [
"pysqlite2.dbapi2.connect",
"os.path.join",
"os.makedirs",
"os.path.exists",
"singleshot.errors.return_404",
"cStringIO.StringIO",
"datetime.datetime.now",
"logging.getLogger"
] | [((299, 330), 'logging.getLogger', 'logging.getLogger', (['"""singleshot"""'], {}), "('singleshot')\n", (316, 330), False, 'import logging\n'), ((5741, 5755), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (5753, 5755), False, 'from datetime import datetime\n'), ((7315, 7354), 'os.path.join', 'os.path.join'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @File : fib.py
# @Date : 2019-02-15
# @Author : luyang(<EMAIL>)
import numpy as np
from prettytable import PrettyTable
def fib(month, produce, young):
rabbits = np.zeros([month, 2])
# 第一个月的起始状况,1对young,0对mature
rabbits[0, 0] = young
rabbits[0, ... | [
"numpy.zeros",
"prettytable.PrettyTable"
] | [((225, 245), 'numpy.zeros', 'np.zeros', (['[month, 2]'], {}), '([month, 2])\n', (233, 245), True, 'import numpy as np\n'), ((806, 856), 'prettytable.PrettyTable', 'PrettyTable', (["['month', 'young', 'mature', 'total']"], {}), "(['month', 'young', 'mature', 'total'])\n", (817, 856), False, 'from prettytable import Pre... |
import pytest
from os.path import dirname
import sys
sys.path.append(dirname(dirname(__file__)))
from CleanData import CleanDataWiki
def test_wrong_wiki_path():
cdw = CleanDataWiki("","")
cdw.tranform() | [
"os.path.dirname",
"CleanData.CleanDataWiki"
] | [((173, 194), 'CleanData.CleanDataWiki', 'CleanDataWiki', (['""""""', '""""""'], {}), "('', '')\n", (186, 194), False, 'from CleanData import CleanDataWiki\n'), ((77, 94), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (84, 94), False, 'from os.path import dirname\n')] |