code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pandas as pd
import warnings
def collate_columns(data, column, reset_index=True):
"""Collate specified column from different DataFrames
Parameters
----------
* data : dict, of pd.DataFrames organized as {ZoneID: {ScenarioID: result_dataframe}}
* column : str, name of column to collate into... | [
"pandas.DataFrame",
"warnings.warn",
"pandas.DateOffset",
"pandas.Series"
] | [((1313, 1350), 'pandas.DateOffset', 'pd.DateOffset', ([], {'years': '(years_offset - 1)'}), '(years=years_offset - 1)\n', (1326, 1350), True, 'import pandas as pd\n'), ((2332, 2365), 'warnings.warn', 'warnings.warn', (['msg', 'FutureWarning'], {}), '(msg, FutureWarning)\n', (2345, 2365), False, 'import warnings\n'), (... |
#!/usr/bin/env python3
"""
Author : <NAME> <<EMAIL>>
Purpose: This is something I wrote to keep track of the sanparks (i.e. https://www.sanparks.org).
website, to track spots / availability of the Otter Trail.
Anyone who knows the Otter, its incredibly difficult to get in.
"""
import os
import smtpli... | [
"smtplib.SMTP",
"email.mime.text.MIMEText",
"ssl.create_default_context",
"datetime.date.today",
"email.mime.multipart.MIMEMultipart",
"prettytable.PrettyTable",
"requests_html.HTMLSession",
"os.getenv"
] | [((597, 622), 'os.getenv', 'os.getenv', (['"""GMAILADDRESS"""'], {}), "('GMAILADDRESS')\n", (606, 622), False, 'import os\n'), ((638, 661), 'os.getenv', 'os.getenv', (['"""<PASSWORD>"""'], {}), "('<PASSWORD>')\n", (647, 661), False, 'import os\n'), ((683, 705), 'os.getenv', 'os.getenv', (['"""GMAILRCPT"""'], {}), "('GM... |
from flask import Blueprint, jsonify
# https://github.com/fighting41love/funNLP
handler_blueprint = Blueprint(
'NLP词库、工具包、学习资料',
__name__,
url_prefix='/hanlp'
)
import hanlp
import json
from flask import request
from flask import Flask
app = Flask(__name__)
## =============================... | [
"flask.Flask",
"flask.Blueprint",
"flask.request.args.get"
] | [((102, 160), 'flask.Blueprint', 'Blueprint', (['"""NLP词库、工具包、学习资料"""', '__name__'], {'url_prefix': '"""/hanlp"""'}), "('NLP词库、工具包、学习资料', __name__, url_prefix='/hanlp')\n", (111, 160), False, 'from flask import Blueprint, jsonify\n'), ((271, 286), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (276, 286), ... |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2020-2022 INRAE
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, ... | [
"osgeo.osr.CoordinateTransformation",
"numpy.transpose",
"osgeo.gdal.SetConfigOption",
"osgeo.gdal.Open",
"osgeo.osr.SpatialReference",
"osgeo.gdal.AllRegister"
] | [((1412, 1431), 'osgeo.gdal.Open', 'gdal.Open', (['filename'], {}), '(filename)\n', (1421, 1431), False, 'from osgeo import gdal, osr\n'), ((1776, 1828), 'osgeo.gdal.SetConfigOption', 'gdal.SetConfigOption', (['"""GDAL_CACHEMAX"""', 'gdal_cachemax'], {}), "('GDAL_CACHEMAX', gdal_cachemax)\n", (1796, 1828), False, 'from... |
import json
from distutils.version import StrictVersion
import click
import os
from telegram_upload.files import get_file_attributes, get_file_thumb
from telethon.version import __version__ as telethon_version
from telethon import TelegramClient
if StrictVersion(telethon_version) >= StrictVersion('1.0'):
import t... | [
"os.remove",
"telegram_upload.files.get_file_thumb",
"distutils.version.StrictVersion",
"os.path.basename",
"os.path.getsize",
"click.echo",
"telegram_upload.files.get_file_attributes"
] | [((251, 282), 'distutils.version.StrictVersion', 'StrictVersion', (['telethon_version'], {}), '(telethon_version)\n', (264, 282), False, 'from distutils.version import StrictVersion\n'), ((286, 306), 'distutils.version.StrictVersion', 'StrictVersion', (['"""1.0"""'], {}), "('1.0')\n", (299, 306), False, 'from distutils... |
import unittest
class MyTestCase(unittest.TestCase):
def test_equal(self):
result = 1 + 2
self.assertEqual(result, 3)
def test_not_equal(self):
result = 1 + 2
self.assertNotEqual(result, 10)
def test_match_string(self):
string = "Hello" + "World"
self.asse... | [
"unittest.main"
] | [((602, 617), 'unittest.main', 'unittest.main', ([], {}), '()\n', (615, 617), False, 'import unittest\n')] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
"""fujitsu_srs_facts module.
Gather facts from the node.
<NAME> (@takamitsu-iida)
"""
ANSIBLE_METADATA = {'metadata_version': '0.1', 'status': ['preview'], 'supported_by': 'community'}
DOCUMENTATION = '''
---
module: fujitsu_srs_facts
sho... | [
"ansible.module_utils.fujitsu_srs.run_commands",
"ansible.module_utils.fujitsu_srs.check_args",
"ansible.module_utils.six.iteritems",
"re.match",
"re.findall",
"ansible.module_utils.basic.AnsibleModule",
"re.search"
] | [((12830, 12898), 'ansible.module_utils.basic.AnsibleModule', 'AnsibleModule', ([], {'argument_spec': 'argument_spec', 'supports_check_mode': '(True)'}), '(argument_spec=argument_spec, supports_check_mode=True)\n', (12843, 12898), False, 'from ansible.module_utils.basic import AnsibleModule\n'), ((13978, 13994), 'ansib... |
#!/usr/bin/python3
import re
import math
with open('input.txt', 'r') as f:
alldata = f.readlines()
f.close()
version_sum = 0
def parse_literal(payload, offset):
value_bin = ''
keep_going = '1'
while keep_going == '1':
keep_going = payload[offset]
offset += 1
value_bin += ... | [
"math.prod"
] | [((1962, 1979), 'math.prod', 'math.prod', (['values'], {}), '(values)\n', (1971, 1979), False, 'import math\n')] |
#This file is part of ElectricEye.
#SPDX-License-Identifier: Apache-2.0
#Licensed to the Apache Software Foundation (ASF) under one
#or more contributor license agreements. See the NOTICE file
#distributed with this work for additional information
#regarding copyright ownership. The ASF licenses this file
#to you un... | [
"check_register.CheckRegister",
"datetime.datetime.now",
"boto3.client"
] | [((935, 950), 'check_register.CheckRegister', 'CheckRegister', ([], {}), '()\n', (948, 950), False, 'from check_register import CheckRegister\n'), ((967, 995), 'boto3.client', 'boto3.client', (['"""imagebuilder"""'], {}), "('imagebuilder')\n", (979, 995), False, 'import boto3\n'), ((1348, 1392), 'datetime.datetime.now'... |
import os
from .study_definition import StudyDefinition
from .codelistlib import (
codelist,
codelist_from_csv,
filter_codes_by_category,
combine_codelists,
)
with open(os.path.join(os.path.dirname(__file__), "VERSION")) as version_file:
__version__ = version_file.read().strip()
__all__ = [
... | [
"os.path.dirname"
] | [((201, 226), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (216, 226), False, 'import os\n')] |
# Python imports.
from collections import defaultdict
import copy
# Other imports.
from simple_rl.planning import Planner
from simple_rl.planning import ValueIteration
from simple_rl.tasks import GridWorldMDP
from simple_rl.planning.BoundedRTDPClass import BoundedRTDP
class MonotoneLowerBound(Planner):
def __init... | [
"copy.deepcopy",
"simple_rl.planning.ValueIteration",
"simple_rl.tasks.GridWorldMDP",
"simple_rl.planning.BoundedRTDPClass.BoundedRTDP",
"collections.defaultdict",
"simple_rl.planning.Planner.__init__"
] | [((1562, 1628), 'simple_rl.tasks.GridWorldMDP', 'GridWorldMDP', ([], {'width': '(6)', 'height': '(6)', 'goal_locs': '[(6, 6)]', 'slip_prob': '(0.2)'}), '(width=6, height=6, goal_locs=[(6, 6)], slip_prob=0.2)\n', (1574, 1628), False, 'from simple_rl.tasks import GridWorldMDP\n'), ((1786, 1891), 'simple_rl.planning.Bound... |
from PIL import Image
import glob
import os,sys
def convert_image(input_file):
try:
image = Image.open(input_file)
except IOError:
print("Cant load: ", input_file)
sys.exit(1)
try:
output_image = Image.new("RGB", image.size)
output_image.paste(image)
output_f... | [
"PIL.Image.new",
"os.remove",
"PIL.Image.open",
"os.path.splitext",
"glob.glob",
"sys.exit"
] | [((637, 652), 'glob.glob', 'glob.glob', (['path'], {}), '(path)\n', (646, 652), False, 'import glob\n'), ((105, 127), 'PIL.Image.open', 'Image.open', (['input_file'], {}), '(input_file)\n', (115, 127), False, 'from PIL import Image\n'), ((241, 269), 'PIL.Image.new', 'Image.new', (['"""RGB"""', 'image.size'], {}), "('RG... |
from dbnd._core.configuration.dbnd_config import config
def set_tracking_config_overide(use_dbnd_log=None):
# 1. create proper DatabandContext so we can create other objects
track_with_cache = config.getboolean("run", "tracking_with_cache")
config_for_airflow = {
"run": {
"skip_complet... | [
"dbnd._core.configuration.dbnd_config.config.set_values",
"dbnd._core.configuration.dbnd_config.config.getboolean"
] | [((203, 250), 'dbnd._core.configuration.dbnd_config.config.getboolean', 'config.getboolean', (['"""run"""', '"""tracking_with_cache"""'], {}), "('run', 'tracking_with_cache')\n", (220, 250), False, 'from dbnd._core.configuration.dbnd_config import config\n'), ((887, 989), 'dbnd._core.configuration.dbnd_config.config.se... |
# -*- coding: utf-8 -*-
"""
Process xml files from [1] into separate token and tag files.
[1] Abzianidze, Lasha, et al. "The parallel meaning bank: Towards a multilingual corpus of translations annotated with compositional meaning representations." arXiv preprint arXiv:1702.03964 (2017).
"""
import xml.etree.Element... | [
"xml.etree.ElementTree.parse",
"pathlib.Path",
"argparse.ArgumentParser"
] | [((393, 483), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Process all pmb files into token and tag files"""'}), "(description=\n 'Process all pmb files into token and tag files')\n", (416, 483), False, 'import argparse\n'), ((2548, 2563), 'pathlib.Path', 'Path', (['args.data'], {})... |
#!/usr/bin/env python3
import sys
import argparse
import yaml
import os
from PETPipeline import PETPipeline
from config import _EnvConfig, \
_MotionCorrectionConfig, \
_PartialVolumeCorrectionConfig, \
_ReconAllConfig, \
_CoregistrationConfig ... | [
"config._EnvConfig",
"yaml.load",
"config._MotionCorrectionConfig",
"argparse.ArgumentParser",
"os.getcwd",
"config._PartialVolumeCorrectionConfig",
"config._ReconAllConfig",
"PETPipeline.PETPipeline",
"config._CoregistrationConfig"
] | [((358, 383), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (381, 383), False, 'import argparse\n'), ((2208, 2403), 'PETPipeline.PETPipeline', 'PETPipeline', ([], {'env_config': 'env_config', 'motion_correction_config': 'motion_correction_config', 'coregistration_config': 'coregistration_confi... |
import argparse
import os
import pathlib
import subprocess
DEFAULT_IDE = "intellij idea"
def generate_ide_map():
ides = {
"pycharm": ("py", "pyc"),
"webstorm": ("js", "css", "html", "less", "sass", "scss"),
"goland": ("go",),
"rubymine": ("rb",),
"clion": ("c", "h", "cc", ... | [
"subprocess.run",
"argparse.ArgumentParser",
"os.walk",
"pathlib.Path",
"pathlib.Path.cwd"
] | [((883, 908), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (906, 908), False, 'import argparse\n'), ((1138, 1151), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (1145, 1151), False, 'import os\n'), ((1819, 1877), 'subprocess.run', 'subprocess.run', (['f"""open -a "{ide_name}" {path}"""'],... |
"""Validation classes for various types of data."""
from __future__ import annotations
import typing
from marshmallow.validate import Length as MaLength
from marshmallow.validate import Equal as MaEqual
from marshmallow.validate import Regexp as MaRegexp
from marshmallow.validate import Predicate as MaPredicate
from ... | [
"typing.TypeVar"
] | [((1050, 1070), 'typing.TypeVar', 'typing.TypeVar', (['"""_T"""'], {}), "('_T')\n", (1064, 1070), False, 'import typing\n')] |
#下级路由文件 上级处理后的 url 文件会匹配进入下级进行处理。
from django.urls import path
from . import views
urlpatterns = [
path('', views.blog_list, name="blog_list"),
path('<int:blog_id>', views.blog_details, name="blog_detail"),
path('type/<int:blog_type_pk>',
views.blog_with_type,
name="blog_with_type"),
p... | [
"django.urls.path"
] | [((103, 146), 'django.urls.path', 'path', (['""""""', 'views.blog_list'], {'name': '"""blog_list"""'}), "('', views.blog_list, name='blog_list')\n", (107, 146), False, 'from django.urls import path\n'), ((152, 213), 'django.urls.path', 'path', (['"""<int:blog_id>"""', 'views.blog_details'], {'name': '"""blog_detail"""'... |
import face_recognition
from deepface import DeepFace
import cv2
import numpy as np
from tensorflow.keras.preprocessing import image
import pyscreenshot as ImageGrab
model = ""
def preprocess_img(img, target_size=(224,224)):
img = cv2.resize(img, target_size)
img_pixels = image.img_to_array(img)
img_pixel... | [
"numpy.argmax",
"pyscreenshot.grab",
"tensorflow.keras.preprocessing.image.img_to_array",
"numpy.expand_dims",
"deepface.DeepFace.build_model",
"face_recognition.face_locations",
"face_recognition.load_image_file",
"cv2.resize"
] | [((237, 265), 'cv2.resize', 'cv2.resize', (['img', 'target_size'], {}), '(img, target_size)\n', (247, 265), False, 'import cv2\n'), ((283, 306), 'tensorflow.keras.preprocessing.image.img_to_array', 'image.img_to_array', (['img'], {}), '(img)\n', (301, 306), False, 'from tensorflow.keras.preprocessing import image\n'), ... |
from pyserial_uart import Uart
class Demo():
def __init__(self):
self.com = Uart(1)
def send(self, cmd, param, data):
if isinstance(cmd, str):
# cmd.replace(' ','',-1) #fromhex内部已经做个去除空格处理
cmd = bytes.fromhex(cmd)
if isinstance(param, str):
param ... | [
"pyserial_uart.Uart"
] | [((90, 97), 'pyserial_uart.Uart', 'Uart', (['(1)'], {}), '(1)\n', (94, 97), False, 'from pyserial_uart import Uart\n')] |
from django.db import models
from django.contrib.auth.models import User
from datetime import datetime
from django.utils import timezone
# Create your models here.
class Post(models.Model):
username = models.CharField(max_length=100)
title = models.CharField(max_length=100)
pub_date = models.DateField(aut... | [
"django.db.models.CharField",
"django.db.models.DateField"
] | [((207, 239), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (223, 239), False, 'from django.db import models\n'), ((252, 284), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (268, 284), False, 'from django.d... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2016, MIT Probabilistic Computing Project
#
# 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/LICENS... | [
"math.sqrt",
"bayeslite.stats.gauss_suff_stats",
"bayeslite.stats.chi2_sf",
"bayeslite.stats.t_cdf",
"pytest.raises",
"bayeslite.stats.f_sf",
"bayeslite.stats.pearsonr",
"bayeslite.stats.chi2_contingency",
"bayeslite.math_util.relerr",
"bayeslite.stats.f_oneway"
] | [((6467, 6496), 'math.sqrt', 'math.sqrt', (['(2 * small ** 2 / 3)'], {}), '(2 * small ** 2 / 3)\n', (6476, 6496), False, 'import math\n'), ((6519, 6547), 'bayeslite.stats.gauss_suff_stats', 'stats.gauss_suff_stats', (['data'], {}), '(data)\n', (6541, 6547), True, 'import bayeslite.stats as stats\n'), ((1087, 1109), 'ba... |
import json
import ast
from copy import deepcopy
from collections import OrderedDict
from panaedra.msroot.msmetrics.logic_xu.c_msmetrics_influxdbclient_bulk_xu import c_influxdbclient_bulk
class sc_msmetrics_influxdb_xu(object):
def __init__(self,cHost,iPort,cDatabase,cRetentionPolicy):
self.cHos... | [
"copy.deepcopy",
"json.load",
"panaedra.msroot.msmetrics.logic_xu.c_msmetrics_influxdbclient_bulk_xu.c_influxdbclient_bulk",
"json.dumps",
"ast.literal_eval",
"collections.OrderedDict"
] | [((2878, 2904), 'json.dumps', 'json.dumps', (['tRet'], {'indent': '(0)'}), '(tRet, indent=0)\n', (2888, 2904), False, 'import json\n'), ((548, 662), 'panaedra.msroot.msmetrics.logic_xu.c_msmetrics_influxdbclient_bulk_xu.c_influxdbclient_bulk', 'c_influxdbclient_bulk', (['self.cHost', 'self.iPort'], {'database': 'self.c... |
# Copyright (c) 2020, VMRaid Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import vmraid
def execute():
"""Set default module for standard Web Template, if none."""
vmraid.reload_doc('website', 'doctype', 'Web Template Field')
vmraid.reload_doc('webs... | [
"vmraid.get_list",
"vmraid.reload_doc",
"vmraid.get_doc"
] | [((234, 295), 'vmraid.reload_doc', 'vmraid.reload_doc', (['"""website"""', '"""doctype"""', '"""Web Template Field"""'], {}), "('website', 'doctype', 'Web Template Field')\n", (251, 295), False, 'import vmraid\n'), ((297, 352), 'vmraid.reload_doc', 'vmraid.reload_doc', (['"""website"""', '"""doctype"""', '"""web_templa... |
import allopath
import argparse
parser = argparse.ArgumentParser(epilog='Computing protein residue-cofactor node interactions ' +
'and cofactor nodefluctuations for expanded network analysis. <NAME>.')
parser = allopath.set_traj_init_parser(parser)
parser = allopath.set_CI_parser(parser)
args, kwargs = allopath.set... | [
"allopath.set_CI_parser",
"argparse.ArgumentParser",
"allopath.set_CI_args",
"allopath.set_traj_init_parser",
"allopath.CofactorInteractors"
] | [((42, 211), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'epilog': "('Computing protein residue-cofactor node interactions ' +\n 'and cofactor nodefluctuations for expanded network analysis. <NAME>.')"}), "(epilog=\n 'Computing protein residue-cofactor node interactions ' +\n 'and cofactor node... |
"""Flask Config - This File is NOT used"""
from os import environ, path
from dotenv import load_dotenv
basedir = path.abspath(path.dirname(__file__))
load_dotenv(path.join(basedir,".env"))
class Config:
"""Base Config"""
TESTING = True
DEBUG = True
FLASK_ENV = 'development'
FLASK_APP = 'wsgi.py'
... | [
"os.path.dirname",
"os.path.join"
] | [((127, 149), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (139, 149), False, 'from os import environ, path\n'), ((163, 189), 'os.path.join', 'path.join', (['basedir', '""".env"""'], {}), "(basedir, '.env')\n", (172, 189), False, 'from os import environ, path\n')] |
import logging
import re
from typing import List
from telegram.ext import CallbackQueryHandler, Filters, MessageHandler, Updater
from telegram.ext.callbackcontext import CallbackContext
from telegram.ext.dispatcher import Dispatcher
from telegram.update import Update
from transitions import Machine, State
from transit... | [
"transitions.Machine",
"telegram.ext.CallbackQueryHandler",
"transitions.State",
"re.match",
"telegram.ext.Updater",
"telegram.ext.MessageHandler",
"logging.getLogger"
] | [((396, 423), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (413, 423), False, 'import logging\n'), ((1574, 1593), 'telegram.ext.Updater', 'Updater', (['self.token'], {}), '(self.token)\n', (1581, 1593), False, 'from telegram.ext import CallbackQueryHandler, Filters, MessageHandler, Upda... |
import time
import requests
from django.conf import settings
class BaseParser():
"""
subclasses must implement most of "Not Implemented" methods!
most important:
- get_results_for_link(link):
"""
allow_same_links = False
def __init__(self, source):
self.source = source
s... | [
"time.process_time",
"requests.Session",
"time.sleep"
] | [((3324, 3342), 'requests.Session', 'requests.Session', ([], {}), '()\n', (3340, 3342), False, 'import requests\n'), ((3682, 3701), 'time.process_time', 'time.process_time', ([], {}), '()\n', (3699, 3701), False, 'import time\n'), ((4247, 4266), 'time.process_time', 'time.process_time', ([], {}), '()\n', (4264, 4266), ... |
# Question 06, Lab 05
# AB Satyaprakash - 180123062
# imports ----------------------------------------------------------------------------
from math import cos, log, sin, pi
from sympy.abc import t
import numpy as np
import pandas as pd
import sympy as sp
from scipy.integrate import quad
# global dictionaries -------... | [
"pandas.DataFrame",
"numpy.polysub",
"numpy.poly1d",
"scipy.integrate.quad",
"math.sin",
"numpy.polyint",
"numpy.linalg.inv",
"math.cos",
"numpy.polymul",
"numpy.dot"
] | [((2515, 2608), 'pandas.DataFrame', 'pd.DataFrame', (['table'], {'columns': "['N', 'Evaluated value using N+1 point Gaussian Quadrature']"}), "(table, columns=['N',\n 'Evaluated value using N+1 point Gaussian Quadrature'])\n", (2527, 2608), True, 'import pandas as pd\n'), ((2631, 2658), 'scipy.integrate.quad', 'quad... |
#!/usr/bin/env python
"""Test Cython interpolation"""
from __future__ import division, print_function
import argparse
import os
import sys
from viscid_test_common import next_plot_fname
from matplotlib import pyplot as plt
import numpy as np
import viscid
from viscid.plot import vpyplot as vlt
def run_test(fld, se... | [
"matplotlib.pyplot.title",
"argparse.ArgumentParser",
"matplotlib.pyplot.clf",
"viscid.interp",
"viscid_test_common.next_plot_fname",
"viscid.arrays2field",
"viscid.vutil.common_argparse",
"numpy.linspace",
"viscid.Volume",
"viscid.plot.vpyplot.show",
"os.path.join"
] | [((348, 357), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (355, 357), True, 'from matplotlib import pyplot as plt\n'), ((413, 428), 'matplotlib.pyplot.title', 'plt.title', (['kind'], {}), '(kind)\n', (422, 428), True, 'from matplotlib import pyplot as plt\n'), ((532, 576), 'argparse.ArgumentParser', 'argparse... |
import networkx as nx
from util import *
from heuristic import *
from bruteforce import *
from branch_and_bound import *
g = nx.Graph()
load_graph(g,"../data/20v30d.dat")
#c = [0 for x in range(g.number_of_nodes())]
#A = [0 for x in range(g.number_of_nodes())]
#c = heuristic_cover(g)
#c = brute_force(g)
size,c = br... | [
"networkx.Graph"
] | [((126, 136), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (134, 136), True, 'import networkx as nx\n')] |
# -*- coding: utf-8 -*-
'''define classes and functions related to plane wave basis setup
'''
import os
from mykit.core._control import (build_tag_map_obj, extract_from_tagdict,
parse_to_tagdict, prog_mapper, tags_mapping)
from mykit.core.log import Verbose
class PlanewaveError(Excep... | [
"os.path.dirname",
"mykit.core._control.parse_to_tagdict",
"mykit.core._control.tags_mapping",
"mykit.core._control.extract_from_tagdict",
"mykit.core._control.build_tag_map_obj"
] | [((1454, 1495), 'mykit.core._control.build_tag_map_obj', 'build_tag_map_obj', (['_meta', '"""mykit"""', '"""json"""'], {}), "(_meta, 'mykit', 'json')\n", (1471, 1495), False, 'from mykit.core._control import build_tag_map_obj, extract_from_tagdict, parse_to_tagdict, prog_mapper, tags_mapping\n'), ((1379, 1404), 'os.pat... |
import pandas as pd
from mako.template import Template
def genHTML(df):
HTML = Template("""<!DOCTYPE html><html><head>
<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name=viewport><meta charset=utf-8>
<meta name="referrer" content="no-referrer">
<link rel="styleshee... | [
"pandas.read_pickle",
"mako.template.Template"
] | [((2305, 2339), 'pandas.read_pickle', 'pd.read_pickle', (['"""douban_gohit.pkl"""'], {}), "('douban_gohit.pkl')\n", (2319, 2339), True, 'import pandas as pd\n'), ((84, 1697), 'mako.template.Template', 'Template', (['"""<!DOCTYPE html><html><head>\n <meta content="width=device-width,initial-scale=1,maximum-scale=1,us... |
# -*- coding: utf-8 -*-
import requests
import json
import jmespath
from datetime import datetime, timedelta, timezone
import re
class WikiUtil():
def __init__(self, client):
self.client = client
def get_wiki_page(self, wiki_id):
wiki_page = self.client.wiki(wiki_id)
return wiki_page
... | [
"re.search"
] | [((639, 686), 're.search', 're.search', (['"""^\\\\s?\\\\|"""', 'wiki_content_row_list[i]'], {}), "('^\\\\s?\\\\|', wiki_content_row_list[i])\n", (648, 686), False, 'import re\n')] |
from abc import ABC, abstractmethod
from random import randrange
from math import inf
class AbstractSort(ABC):
"""Abstract sort Baseclass"""
def __init__(self, to_sort, log_swaps=True):
self.to_sort = to_sort
self.length = len(to_sort)
self.log_swaps = log_swaps
self.totalswap... | [
"random.randrange"
] | [((2872, 2897), 'random.randrange', 'randrange', (['(0)', 'self.length'], {}), '(0, self.length)\n', (2881, 2897), False, 'from random import randrange\n'), ((2915, 2940), 'random.randrange', 'randrange', (['(0)', 'self.length'], {}), '(0, self.length)\n', (2924, 2940), False, 'from random import randrange\n')] |
import random
from typing import Union, Tuple, Any, Dict
import cv2
import numpy as np
from skimage.measure import label
from ...core.transforms_interface import DualTransform
from ...core.transforms_interface import to_tuple
__all__ = ["MaskDropout"]
class MaskDropout(DualTransform):
"""
Image & mask augm... | [
"random.randint",
"numpy.zeros",
"skimage.measure.label",
"cv2.inpaint",
"cv2.boundingRect"
] | [((1705, 1733), 'skimage.measure.label', 'label', (['mask'], {'return_num': '(True)'}), '(mask, return_num=True)\n', (1710, 1733), False, 'from skimage.measure import label\n'), ((1839, 1895), 'random.randint', 'random.randint', (['self.max_objects[0]', 'self.max_objects[1]'], {}), '(self.max_objects[0], self.max_objec... |
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 16 12:41:41 2021
@author: catal
"""
# whole window should have a minimum height of 800 pixels
# in frame1, not auto-resizing:
# A Button widget called btn_open for opening a file for editing
# A Button widget called btn_save for saving a file
# in frame2, auto-resizing... | [
"tkinter.filedialog.asksaveasfilename",
"tkinter.Text",
"tkinter.Button",
"tkinter.filedialog.askopenfilename",
"tkinter.Frame",
"tkinter.Tk"
] | [((1252, 1259), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (1257, 1259), True, 'import tkinter as tk\n'), ((1490, 1513), 'tkinter.Frame', 'tk.Frame', ([], {'master': 'window'}), '(master=window)\n', (1498, 1513), True, 'import tkinter as tk\n'), ((1528, 1628), 'tkinter.Button', 'tk.Button', ([], {'master': 'frame_buttons... |
#!/usr/bin/env python
import glob
import re
import os
wd = os.getcwd()
path = wd + "/FASTQ/"
forward = [s.split("/")[-1] for s in glob.glob("FASTQ/*_R1_001.fastq.gz")]
reverse = [s.replace("_R1_001","_R2_001") for s in forward]
pattern = "_16S_\d{8}"
result = re.split(pattern,forward[0])
samples = [re.split(patter... | [
"os.getcwd",
"re.split",
"glob.glob"
] | [((61, 72), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (70, 72), False, 'import os\n'), ((264, 293), 're.split', 're.split', (['pattern', 'forward[0]'], {}), '(pattern, forward[0])\n', (272, 293), False, 'import re\n'), ((133, 169), 'glob.glob', 'glob.glob', (['"""FASTQ/*_R1_001.fastq.gz"""'], {}), "('FASTQ/*_R1_001.f... |
from ebird.api import Client
import time
import datetime
api_key = 'o1rng64r9e2b'
locale = 'zh'
client = Client(api_key, locale)
start_date = datetime.date(2020,9,5)
for i in range(15):
print(start_date + datetime.timedelta(days=i))
records = client.get_visits('TW', date=start_date + datetime.timedelta(days=... | [
"datetime.date",
"ebird.api.Client",
"datetime.timedelta",
"time.sleep"
] | [((106, 129), 'ebird.api.Client', 'Client', (['api_key', 'locale'], {}), '(api_key, locale)\n', (112, 129), False, 'from ebird.api import Client\n'), ((144, 169), 'datetime.date', 'datetime.date', (['(2020)', '(9)', '(5)'], {}), '(2020, 9, 5)\n', (157, 169), False, 'import datetime\n'), ((377, 390), 'time.sleep', 'time... |
#!/usr/bin/env python
import os
import sys
# For coverage.
if __package__ is None:
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/..")
from unittest import main, TestCase
import requests
import requests_mock
from iris_sdk.client import Client
from iris_sdk.models.cities import Cities
XML_RESPO... | [
"unittest.main",
"os.path.abspath",
"iris_sdk.client.Client",
"requests_mock.Mocker",
"iris_sdk.models.cities.Cities"
] | [((1410, 1416), 'unittest.main', 'main', ([], {}), '()\n', (1414, 1416), False, 'from unittest import main, TestCase\n'), ((797, 838), 'iris_sdk.client.Client', 'Client', (['"""http://foo"""', '"""bar"""', '"""bar"""', '"""qux"""'], {}), "('http://foo', 'bar', 'bar', 'qux')\n", (803, 838), False, 'from iris_sdk.client ... |
"""__init__.py"""
import pyglet
def run_simulation(count):
"""run the simulation & bash the homework"""
from buffon_simulator.app import App
application = App(count, fullscreen=True, vsync=True)
pyglet.app.run() | [
"pyglet.app.run",
"buffon_simulator.app.App"
] | [((169, 208), 'buffon_simulator.app.App', 'App', (['count'], {'fullscreen': '(True)', 'vsync': '(True)'}), '(count, fullscreen=True, vsync=True)\n', (172, 208), False, 'from buffon_simulator.app import App\n'), ((213, 229), 'pyglet.app.run', 'pyglet.app.run', ([], {}), '()\n', (227, 229), False, 'import pyglet\n')] |
import yaml
template = """
apiVersion: v1
kind: Service
metadata:
name: {name}
labels:
purpose: coded-computation
spec:
ports:
- port: 5000
targetPort: 22
name: scp-port
- port: 57023
targetPort: 57023
name: python-port
selector:
app: {name}
"""
## \brief this function genetares ... | [
"yaml.load"
] | [((598, 622), 'yaml.load', 'yaml.load', (['specific_yaml'], {}), '(specific_yaml)\n', (607, 622), False, 'import yaml\n')] |
from json_serializable import JsonSerializable
from test.test_class import print_title, SerializableClass
import unittest
class SerializeTestCase(unittest.TestCase):
@print_title
def test_from_json(self):
target = SerializableClass()
json_str = target.to_json()
deserializer = Serializ... | [
"test.test_class.SerializableClass.load",
"test.test_class.SerializableClass"
] | [((232, 251), 'test.test_class.SerializableClass', 'SerializableClass', ([], {}), '()\n', (249, 251), False, 'from test.test_class import print_title, SerializableClass\n'), ((312, 350), 'test.test_class.SerializableClass', 'SerializableClass', ([], {'set_parameter': '(False)'}), '(set_parameter=False)\n', (329, 350), ... |
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader, random_split
import matplotlib.pyplot as plt
from torchvision import transforms
from src.models.vqvae import VQ_VAE_KPT
from src.losses.temporal_separation_loss import temporal_separation_loss
from src.losses.pixelwise_contrastive_l... | [
"src.losses.pixelwise_contrastive_loss_2.pixelwise_contrastive_loss",
"matplotlib.pyplot.savefig",
"src.data.video_dataset.VideoFrameDataset",
"torch.var",
"torch.utils.data.DataLoader",
"torchvision.transforms.RandomHorizontalFlip",
"torchvision.transforms.RandomRotation",
"src.data.video_dataset.Img... | [((816, 1154), 'src.data.video_dataset.VideoFrameDataset', 'VideoFrameDataset', ([], {'root_path': '"""/media/yannik/samsung_ssd/data/simitate_processed_128pix"""', 'annotationfile_path': '"""/media/yannik/samsung_ssd/data/simitate_processed_128pix/annotations.txt"""', 'num_segments': '(1)', 'frames_per_segment': '(8)'... |
import fastai.optimizer as opt
from functools import partial
def get_optimizer(run_params):
# Scheduling
# FixMatch is highly influenced by the Optimizer and its parameters
# TODO: Study which parameters are best for this use-case
if run_params["SSL"] == run_params["SSL_FIX_MATCH"]:
# sched = ... | [
"functools.partial"
] | [((887, 1052), 'functools.partial', 'partial', (['opt.OptimWrapper'], {'opt': 'AdaBelief', 'betas': "(run_params['OPT_MOM'], run_params['OPT_SQR_MOM'])", 'weight_decay': "run_params['OPT_WD']", 'print_change_log': '(False)'}), "(opt.OptimWrapper, opt=AdaBelief, betas=(run_params['OPT_MOM'],\n run_params['OPT_SQR_MOM... |
from django import forms
def select_form_factory(field_names):
CHOICES = (False, True)
fields = {name: forms.TypedChoiceField(choices=CHOICES, coerce=bool,
required=False, initial=False,
widget=forms.CheckboxInput, )
... | [
"django.forms.CharField",
"django.forms.TypedChoiceField"
] | [((486, 517), 'django.forms.CharField', 'forms.CharField', ([], {'required': '(False)'}), '(required=False)\n', (501, 517), False, 'from django import forms\n'), ((112, 227), 'django.forms.TypedChoiceField', 'forms.TypedChoiceField', ([], {'choices': 'CHOICES', 'coerce': 'bool', 'required': '(False)', 'initial': '(Fals... |
# -*- coding: utf-8 -*-
# @Author: Wangchuanli
# @Date: 2018-12-15 09:54:15
# @Last Modified by: Wangchuanli
# @Last Modified time: 2018-12-18 10:54:12
import os
# 从本地clone的仓库中得到文件列表
def fileListFunc(fileList,filePath,suffix):
for filename in os.listdir(filePath):
if os.path.isdir((filePath+"/"+filename... | [
"os.path.isdir",
"os.listdir"
] | [((251, 271), 'os.listdir', 'os.listdir', (['filePath'], {}), '(filePath)\n', (261, 271), False, 'import os\n'), ((284, 324), 'os.path.isdir', 'os.path.isdir', (["(filePath + '/' + filename)"], {}), "(filePath + '/' + filename)\n", (297, 324), False, 'import os\n')] |
import sys
import numpy as np
import os
import h5py
import pickle
import re
if len(sys.argv) < 2:
sys.stderr.write('Usage: %s <annotation_gtf>\n' % sys.argv[0])
sys.exit(1)
infile = sys.argv[1]
CONF = 2
def get_tags_gtf(tagline):
"""Extract tags from given tagline"""
tags = dict()
for t in tagli... | [
"sys.stdout.write",
"numpy.unique",
"numpy.argsort",
"numpy.array",
"numpy.arange",
"sys.stdout.flush",
"sys.exit",
"sys.stderr.write",
"re.sub",
"numpy.vstack"
] | [((1147, 1168), 'numpy.array', 'np.array', (['transcripts'], {}), '(transcripts)\n', (1155, 1168), True, 'import numpy as np\n'), ((1177, 1192), 'numpy.array', 'np.array', (['chrms'], {}), '(chrms)\n', (1185, 1192), True, 'import numpy as np\n'), ((1201, 1216), 'numpy.array', 'np.array', (['exons'], {}), '(exons)\n', (... |
from copy import deepcopy
from postprocessing import POST
class POST_PUCC(POST):
def __init__(self, state, mpr):
super().__init__(state)
self._cr = dict()
self._mpr = mpr
for r_i, prms_i in self._orig_pa.items():
for r_j, prms_j in self._orig_pa.items():
... | [
"copy.deepcopy"
] | [((830, 844), 'copy.deepcopy', 'deepcopy', (['role'], {}), '(role)\n', (838, 844), False, 'from copy import deepcopy\n')] |
from .. import config
import logging
logger=logging.getLogger(__name__)
import poplib, socket
ERROR_STRINGS = {
'error_proto': 'Protocol Error: %s',
}
def run(options):
ip = options['ip']
port = options['port']
username = options['username']
password = options['password']
try:
p... | [
"poplib.POP3",
"logging.getLogger"
] | [((46, 73), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (63, 73), False, 'import logging\n'), ((325, 349), 'poplib.POP3', 'poplib.POP3', (['ip', 'port', '(2)'], {}), '(ip, port, 2)\n', (336, 349), False, 'import poplib, socket\n')] |
from typing import (
TYPE_CHECKING,
Callable,
Dict,
Iterable,
List,
Mapping,
Optional,
Sequence,
Set,
Tuple,
Union,
)
from dagster import _check as check
from dagster.serdes import ConfigurableClass, ConfigurableClassData
from .base_storage import DagsterStorage
from .event... | [
"dagster._check.inst_param",
"dagster._check.opt_inst_param",
"dagster.serdes.ConfigurableClassData"
] | [((1898, 1971), 'dagster._check.inst_param', 'check.inst_param', (['event_log_storage', '"""event_log_storage"""', 'EventLogStorage'], {}), "(event_log_storage, 'event_log_storage', EventLogStorage)\n", (1914, 1971), True, 'from dagster import _check as check\n'), ((2027, 2098), 'dagster._check.inst_param', 'check.inst... |
from os.path import join
from django.db import models
from django.contrib.auth.models import User
from django.core.files.storage import FileSystemStorage
JUDGE_STORAGE_ROOT = join('..', '..', 'judge')
judge_storage = FileSystemStorage(location=JUDGE_STORAGE_ROOT)
class Problem(models.Model):
name = models.CharFie... | [
"django.db.models.FileField",
"django.core.files.storage.FileSystemStorage",
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.FloatField",
"django.db.models.PositiveSmallIntegerField",
"django.db.models.BooleanField",
"django.db.models.Date... | [((176, 201), 'os.path.join', 'join', (['""".."""', '""".."""', '"""judge"""'], {}), "('..', '..', 'judge')\n", (180, 201), False, 'from os.path import join\n'), ((218, 264), 'django.core.files.storage.FileSystemStorage', 'FileSystemStorage', ([], {'location': 'JUDGE_STORAGE_ROOT'}), '(location=JUDGE_STORAGE_ROOT)\n', ... |
import re
from django.core.exceptions import ObjectDoesNotExist
from django.db import connection, models
from django.db.models.expressions import BaseExpression, Combinable
from django.db.models.query_utils import DeferredAttribute
from django.utils import timezone
# text patterns for "routine" documents
_routine_tex... | [
"django.db.models.TextField",
"django.db.models.OneToOneField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.EmailField",
"django.db.models.IntegerField",
"django.db... | [((330, 369), 're.compile', 're.compile', (['"""Condominium claims?"""', 're.I'], {}), "('Condominium claims?', re.I)\n", (340, 369), False, 'import re\n'), ((375, 419), 're.compile', 're.compile', (['"""Congratulations extended"""', 're.I'], {}), "('Congratulations extended', re.I)\n", (385, 419), False, 'import re\n'... |
#
# (c) FFRI Security, Inc., 2021 / Author: FFRI Security, Inc.
#
import mmap
import os
from ctypes import Structure, c_uint32, c_uint64, sizeof
from typing import Iterable, Optional, cast
import typer
app = typer.Typer()
AOT_SHARED_CACHE_MAGIC = 0x6568636143746F41
def show_err(msg: str) -> None:
typer.secho(m... | [
"typer.echo",
"typer.Typer",
"ctypes.sizeof",
"typing.cast",
"os.path.exists",
"typer.secho"
] | [((210, 223), 'typer.Typer', 'typer.Typer', ([], {}), '()\n', (221, 223), False, 'import typer\n'), ((307, 354), 'typer.secho', 'typer.secho', (['msg'], {'err': '(True)', 'fg': 'typer.colors.RED'}), '(msg, err=True, fg=typer.colors.RED)\n', (318, 354), False, 'import typer\n'), ((394, 444), 'typer.secho', 'typer.secho'... |
"""This file defines a simple framework for hyper-parameter tuning.
It takes the input as a json fine which has a dictionary of hyper-parameters
to be tuned along with the list of values for that hyper-parameter.
All combinations of the hyperparameter values are run and result and checkpoints
are stored in a separate... | [
"json.load",
"os.system",
"itertools.product"
] | [((870, 882), 'json.load', 'json.load', (['f'], {}), '(f)\n', (879, 882), False, 'import json\n'), ((1768, 1794), 'os.system', 'os.system', (['execute_command'], {}), '(execute_command)\n', (1777, 1794), False, 'import os\n'), ((1135, 1161), 'itertools.product', 'itertools.product', (['*values'], {}), '(*values)\n', (1... |
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.urls import include, path
from django.views import defaults as default_views
from welcome.views import index, health
urlpatterns = [
# Examples:
# url(r'^$', 'project.views.home', name='home... | [
"django.urls.path",
"django.urls.include"
] | [((373, 401), 'django.urls.path', 'path', (['""""""', 'index'], {'name': '"""home"""'}), "('', index, name='home')\n", (377, 401), False, 'from django.urls import include, path\n'), ((407, 444), 'django.urls.path', 'path', (['"""health"""', 'health'], {'name': '"""health"""'}), "('health', health, name='health')\n", (4... |
import streamlit as st
def section_title(text):
st.markdown(f'*{text}*')
def view_data(df, checkbox_key=None):
if df is not None:
section_title('Shape')
st.write(df.shape)
section_title('Head')
st.write(df[:5])
if st.checkbox("View All", key=checkbox_key):
... | [
"streamlit.checkbox",
"streamlit.markdown",
"streamlit.error",
"streamlit.write"
] | [((53, 77), 'streamlit.markdown', 'st.markdown', (['f"""*{text}*"""'], {}), "(f'*{text}*')\n", (64, 77), True, 'import streamlit as st\n'), ((179, 197), 'streamlit.write', 'st.write', (['df.shape'], {}), '(df.shape)\n', (187, 197), True, 'import streamlit as st\n'), ((237, 253), 'streamlit.write', 'st.write', (['df[:5]... |
#!/usr/bin/env python2.7
import os
import sys
sys.path.append(os.path.realpath(__file__ + '/../../../lib'))
import udf
import unicodedata
from udf import useData
def add_uniname(data):
return [(n, unicodedata.name(unichr(n), 'U+%04X' % n))
for n in data]
class LuaExpat(udf.TestCase):
def setUp(... | [
"udf.main",
"udf.useData",
"os.path.realpath",
"udf.fixindent"
] | [((64, 108), 'os.path.realpath', 'os.path.realpath', (["(__file__ + '/../../../lib')"], {}), "(__file__ + '/../../../lib')\n", (80, 108), False, 'import os\n'), ((13937, 13950), 'udf.useData', 'useData', (['data'], {}), '(data)\n', (13944, 13950), False, 'from udf import useData\n'), ((15329, 15339), 'udf.main', 'udf.m... |
"""
The MIT License (MIT)
Copyright (c) 2018 Zuse Institute Berlin, www.zib.de
Permissions are granted as stated in the license file you have obtained
with this software. If you find the library useful for your purpose,
please refer to README.md for how to cite IPET.
@author: <NAME>
"""
import re
from ipet import mi... | [
"ipet.misc.numericExpression.search",
"re.match",
"ipet.misc.numericExpression.findall",
"re.search",
"re.sub"
] | [((1705, 1735), 're.match', 're.match', (['"""^SCIP Status"""', 'line'], {}), "('^SCIP Status', line)\n", (1713, 1735), False, 'import re\n'), ((1798, 1824), 're.match', 're.match', (['"""[a-zA-Z]"""', 'line'], {}), "('[a-zA-Z]', line)\n", (1806, 1824), False, 'import re\n'), ((1845, 1865), 're.search', 're.search', ([... |
# -*- coding: utf-8 -*-
"""
This file is for any custom Tasks you may need in your workflows. For example,
you may want to write a new VaspTask that has custom INCAR settings. These tasks
can be incorporated into our workflows (in `workflows.py`).
Below is an example of a simple VaspTask, which is used to run a singl... | [
"simmate.calculators.vasp.error_handlers.FrozenErrorHandler",
"simmate.calculators.vasp.inputs.Incar.add_keyword_modifier",
"simmate.calculators.vasp.error_handlers.NonConvergingErrorHandler",
"simmate.calculators.vasp.error_handlers.UnconvergedErrorHandler"
] | [((2899, 2959), 'simmate.calculators.vasp.inputs.Incar.add_keyword_modifier', 'Incar.add_keyword_modifier', (['keyword_modifier_multiply_nsites'], {}), '(keyword_modifier_multiply_nsites)\n', (2925, 2959), False, 'from simmate.calculators.vasp.inputs import Incar\n'), ((2381, 2406), 'simmate.calculators.vasp.error_hand... |
# coding: utf-8
# Copyright (c) 2017 Hitachi, Ltd. All Rights Reserved.
#
# Licensed under the MIT License.
# You may obtain a copy of the License at
#
# https://opensource.org/licenses/MIT
#
# This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OF ANY KIND.
from seobject import fcontextRecords
fro... | [
"FileContextMatcher.FileContextMatcher",
"SEPolicyRules.SEPolicyRules",
"seobject.fcontextRecords"
] | [((512, 581), 'SEPolicyRules.SEPolicyRules', 'SEPolicyRules', ([], {'source': 'domain', 'target': 'target', 'perms': 'perms', 'klass': 'klass'}), '(source=domain, target=target, perms=perms, klass=klass)\n', (525, 581), False, 'from SEPolicyRules import SEPolicyRules\n'), ((604, 624), 'FileContextMatcher.FileContextMat... |
import os
import pytest
import pendulum
from datetime import timedelta
from dotenv import load_dotenv
from stockdata.models import (
engine, session, Asset,
Candlestick1M, Candlestick1H, Candlestick1D
)
"""
Tests to be ran after the ETL process is triggered manually.
"""
load_dotenv()
BACK_POPULATE_MONTHS =... | [
"stockdata.models.Candlestick1D.timestamp.desc",
"stockdata.models.Candlestick1M.timestamp.desc",
"dotenv.load_dotenv",
"os.environ.get",
"pendulum.now",
"stockdata.models.session.query",
"datetime.timedelta",
"stockdata.models.Candlestick1H.timestamp.desc",
"stockdata.models.Candlestick1D.timestamp... | [((284, 297), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (295, 297), False, 'from dotenv import load_dotenv\n'), ((325, 363), 'os.environ.get', 'os.environ.get', (['"""BACK_POPULATE_MONTHS"""'], {}), "('BACK_POPULATE_MONTHS')\n", (339, 363), False, 'import os\n'), ((626, 640), 'pendulum.now', 'pendulum.now'... |
import pytest
from flask import url_for
import config
from tests.auth_test import AuthTestSuiteConfig
@pytest.mark.usefixtures('client_class')
class TestNotificationChannels:
def do_authentication(self, registration_data: dict):
assert self.client.post(url_for("apiV1.api_register"), json=registration_dat... | [
"tests.auth_test.AuthTestSuiteConfig.login_data_from_register",
"flask.url_for",
"pytest.mark.skipif",
"pytest.mark.usefixtures"
] | [((105, 144), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""client_class"""'], {}), "('client_class')\n", (128, 144), False, 'import pytest\n'), ((617, 787), 'pytest.mark.skipif', 'pytest.mark.skipif', (['config.MailConfig.check_refresh_cookie_on_validating_email'], {'reason': '"""This test only make sens... |
from rest_framework import serializers
from schedule.models import Schedule
from schedule.serialize import ScheduleSerializer
class TestSerializer(serializers.ModelSerializer):
events=ScheduleSerializer(many=True, read_only=True)
class Meta:
model=Schedule
fields= ('events') | [
"schedule.serialize.ScheduleSerializer"
] | [((190, 235), 'schedule.serialize.ScheduleSerializer', 'ScheduleSerializer', ([], {'many': '(True)', 'read_only': '(True)'}), '(many=True, read_only=True)\n', (208, 235), False, 'from schedule.serialize import ScheduleSerializer\n')] |
"""
Definition of forms.
"""
from django import forms
from django.forms.models import ModelForm
from django.forms import ModelForm
from django.contrib.auth.forms import AuthenticationForm
from django.utils.translation import ugettext_lazy as _
from app.models import *
from django.views.generic.detail import DetailView... | [
"django.forms.TextInput",
"django.utils.translation.ugettext_lazy",
"django.forms.PasswordInput"
] | [((559, 629), 'django.forms.TextInput', 'forms.TextInput', (["{'class': 'form-control', 'placeholder': 'User name'}"], {}), "({'class': 'form-control', 'placeholder': 'User name'})\n", (574, 629), False, 'from django import forms\n'), ((739, 752), 'django.utils.translation.ugettext_lazy', '_', (['"""Password"""'], {}),... |
import cv2 as cv
import os
# STEP 3 : Making Predictions using our trained model
# ____________________________________________________________________________
# Read Cascade Classifier from haar_face.xml
haar_cascade = cv.CascadeClassifier('../haar_face.xml')
# Location of Training dataset
DIR = './train'
people =... | [
"cv2.face.LBPHFaceRecognizer_create",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.rectangle",
"cv2.imread",
"cv2.CascadeClassifier",
"cv2.imshow",
"os.listdir"
] | [((223, 263), 'cv2.CascadeClassifier', 'cv.CascadeClassifier', (['"""../haar_face.xml"""'], {}), "('../haar_face.xml')\n", (243, 263), True, 'import cv2 as cv\n'), ((367, 382), 'os.listdir', 'os.listdir', (['DIR'], {}), '(DIR)\n', (377, 382), False, 'import os\n'), ((493, 528), 'cv2.face.LBPHFaceRecognizer_create', 'cv... |
from collections import defaultdict
from django.contrib.admin.views.decorators import staff_member_required
from django.shortcuts import render, redirect
from django.views.generic.dates import timezone_today
from core.models import Expense, Income
@staff_member_required
def index(request):
today = timezone_today(... | [
"core.models.Expense.objects.filter",
"django.shortcuts.redirect",
"django.views.generic.dates.timezone_today",
"collections.defaultdict",
"core.models.Income.objects.filter",
"django.shortcuts.render"
] | [((305, 321), 'django.views.generic.dates.timezone_today', 'timezone_today', ([], {}), '()\n', (319, 321), False, 'from django.views.generic.dates import timezone_today\n'), ((333, 375), 'django.shortcuts.redirect', 'redirect', (['"""month"""', 'today.year', 'today.month'], {}), "('month', today.year, today.month)\n", ... |
import cv2
import subprocess as sp
import numpy
VIDEO_URL = 'http://iphone-streaming.ustream.tv/watch/playlist.m3u8?cid=16258431&stream=live_3&appType=103&appVersion=3&conn=wifi&group=iphone'
cv2.namedWindow("GoPro",cv2.CV_WINDOW_AUTOSIZE)
pipe = sp.Popen([ 'ffmpeg.exe', "-i", VIDEO_URL,
"-loglevel", "qui... | [
"subprocess.Popen",
"cv2.waitKey",
"cv2.imshow",
"cv2.destroyAllWindows",
"numpy.fromstring",
"cv2.namedWindow"
] | [((194, 242), 'cv2.namedWindow', 'cv2.namedWindow', (['"""GoPro"""', 'cv2.CV_WINDOW_AUTOSIZE'], {}), "('GoPro', cv2.CV_WINDOW_AUTOSIZE)\n", (209, 242), False, 'import cv2\n'), ((250, 429), 'subprocess.Popen', 'sp.Popen', (["['ffmpeg.exe', '-i', VIDEO_URL, '-loglevel', 'quiet', '-an', '-f',\n 'image2pipe', '-pix_fmt'... |
from random import randrange
from numpy import log, array, ceil
from copy import deepcopy
from itertools import permutations
import spidev
import Color_Match as cm
valid_arrangements = ['linear']
valid_update_strategies = ['on-command']
class DotstarDevice:
def __init__(self, num_LEDs, arrangement, color_order, t... | [
"copy.deepcopy",
"spidev.SpiDev",
"numpy.ceil",
"numpy.log",
"Color_Match.rgb_composition",
"itertools.permutations",
"random.randrange",
"Color_Match.planck_spectrum"
] | [((11584, 11612), 'random.randrange', 'randrange', (['(0)', 'pattern_length'], {}), '(0, pattern_length)\n', (11593, 11612), False, 'from random import randrange\n'), ((12379, 12394), 'copy.deepcopy', 'deepcopy', (['state'], {}), '(state)\n', (12387, 12394), False, 'from copy import deepcopy\n'), ((1582, 1597), 'spidev... |
# Generated by Django 3.2.3 on 2021-06-02 16:58
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ingest', '0045_contributor_owners'),
('core', '0008_auto_20210526_0232'),
]
o... | [
"django.db.models.OneToOneField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.JSONField",
"django.db.models.Q",
"django.db.models.BooleanField",
"django.db.models.AutoField"
] | [((786, 818), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (802, 818), False, 'from django.db import migrations, models\n'), ((848, 869), 'django.db.models.BooleanField', 'models.BooleanField', ([], {}), '()\n', (867, 869), False, 'from django.db import migratio... |
'''
This test signal acts as a proxy to BungieSignalProcessor. It allows us
to test the functionality of the default signal processor while using a
custom processor instead, hence testing that we can plug in and use a custom
signal processor.
'''
from django.db.models import signals
from bungiesearch.signals import Bu... | [
"django.db.models.signals.pre_delete.connect",
"django.db.models.signals.post_save.connect",
"django.db.models.signals.pre_delete.disconnect",
"django.db.models.signals.post_save.disconnect"
] | [((672, 729), 'django.db.models.signals.post_save.connect', 'signals.post_save.connect', (['self.handle_save'], {'sender': 'model'}), '(self.handle_save, sender=model)\n', (697, 729), False, 'from django.db.models import signals\n'), ((738, 798), 'django.db.models.signals.pre_delete.connect', 'signals.pre_delete.connec... |
'''
Created on Jan 12, 2020
@author: ballance
'''
from enum import IntEnum, auto
class ToggleMetricT(IntEnum):
NOBINS = 1 # Toggle scope has no local bins
ENUM = auto() # UCIS:ENUM
TRANSITION = auto() # UCIS:TRANSITION
_2STOGGLE = auto() # UCIS:2STOGGLE
ZTOGGLE = aut... | [
"enum.auto"
] | [((190, 196), 'enum.auto', 'auto', ([], {}), '()\n', (194, 196), False, 'from enum import IntEnum, auto\n'), ((229, 235), 'enum.auto', 'auto', ([], {}), '()\n', (233, 235), False, 'from enum import IntEnum, auto\n'), ((274, 280), 'enum.auto', 'auto', ([], {}), '()\n', (278, 280), False, 'from enum import IntEnum, auto\... |
from generateNum import generateNum
from generateSymbol import generateSymbol
import random
from computeAns import computeAns
def generateProblem(level):
num = random.randint(2, 4)
if level == 1:
list1 = generateNum(num, False, 100)
list2 = generateSymbol(num, False)
problem = fix(list... | [
"computeAns.computeAns",
"generateSymbol.generateSymbol",
"random.randint",
"generateNum.generateNum"
] | [((166, 186), 'random.randint', 'random.randint', (['(2)', '(4)'], {}), '(2, 4)\n', (180, 186), False, 'import random\n'), ((222, 250), 'generateNum.generateNum', 'generateNum', (['num', '(False)', '(100)'], {}), '(num, False, 100)\n', (233, 250), False, 'from generateNum import generateNum\n'), ((267, 293), 'generateS... |
import h5py as h5
import pandas as pd
import numpy as np
import os
f = h5.File("human_tpm_v8.h5", 'r')
expression = f['data/expression']
fields = f["meta"]
samples = f['meta/Sample_geo_accession']
genes = f['meta/genes']
| [
"h5py.File"
] | [((72, 103), 'h5py.File', 'h5.File', (['"""human_tpm_v8.h5"""', '"""r"""'], {}), "('human_tpm_v8.h5', 'r')\n", (79, 103), True, 'import h5py as h5\n')] |
from django.contrib.contenttypes.models import ContentType
from extras.models import *
__all__ = (
'CustomFieldsMixin',
)
class CustomFieldsMixin:
"""
Extend a Form to include custom field support.
Attributes:
model: The model class
"""
model = None
def __init__(self, *args, **... | [
"django.contrib.contenttypes.models.ContentType.objects.get_for_model"
] | [((713, 758), 'django.contrib.contenttypes.models.ContentType.objects.get_for_model', 'ContentType.objects.get_for_model', (['self.model'], {}), '(self.model)\n', (746, 758), False, 'from django.contrib.contenttypes.models import ContentType\n')] |
import numpy as np
class Gene(object):
"""
creates lise of genes out of files and can display them in log
"""
def __init__(self, items_file, logger):
self.items = np.loadtxt(items_file)
self.logger = logger
self.logger.debug('list of items: %s' % self.items)
return
| [
"numpy.loadtxt"
] | [((189, 211), 'numpy.loadtxt', 'np.loadtxt', (['items_file'], {}), '(items_file)\n', (199, 211), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
from __future__ import with_statement
try:
import json
except ImportError:
import simplejson as json
import datetime
import math
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import FormRequest
from product_spiders.items import Produ... | [
"datetime.date",
"datetime.date.today",
"scrapy.http.FormRequest",
"product_spiders.items.Product",
"datetime.timedelta",
"simplejson.loads",
"scrapy.selector.HtmlXPathSelector"
] | [((2392, 2413), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (2411, 2413), False, 'import datetime\n'), ((4371, 4398), 'scrapy.selector.HtmlXPathSelector', 'HtmlXPathSelector', (['response'], {}), '(response)\n', (4388, 4398), False, 'from scrapy.selector import HtmlXPathSelector\n'), ((6371, 6396), ... |
from datetime import date
from logging import getLogger
import os
from pathlib import Path
from typing import Optional, Union
import dotenv
from pydantic import BaseSettings, ValidationError
logger = getLogger(__name__)
DOTENV_FILE = ".env"
class EnvConfig(BaseSettings):
debug: Optional[bool]
redmine_url:... | [
"dotenv.set_key",
"pathlib.Path.home",
"logging.getLogger"
] | [((203, 222), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (212, 222), False, 'from logging import getLogger\n'), ((717, 728), 'pathlib.Path.home', 'Path.home', ([], {}), '()\n', (726, 728), False, 'from pathlib import Path\n'), ((1338, 1385), 'dotenv.set_key', 'dotenv.set_key', (['DOTENV_FILE'... |
# This code is used to create Ansible files for deploying Lambda's
# all that is needed is a target Lambda, tests, and it will do the rest.
# finds associate roles and policies
# creates Ansible modules based on those policies and roles
# defines the Lambdas and creates them with tests
# finds api-gateways or other eve... | [
"sys.stdout.write",
"yaml.load",
"pathlib.Path.home",
"boto3.client",
"yaml.dump",
"os.path.isfile",
"boto3.resource",
"shutil.rmtree",
"configparser.RawConfigParser",
"os.path.exists",
"re.search",
"json.dump",
"os.path.basename",
"os.path.realpath",
"os.rename",
"os.makedirs",
"fil... | [((1138, 1165), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1155, 1165), False, 'import logging\n'), ((1101, 1127), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (1117, 1127), False, 'import os\n'), ((1182, 1193), 'pathlib.Path.home', 'Path.home', ([], {}... |
import os
from bitStream import BitStream
from huffmanTree import HuffmanTree
class Decoder:
def __init__(self):
self.tree = HuffmanTree(1)
def decodeFile(self, fileName, outFileName):
if not os.path.exists(fileName):
print('File doesnt exist.')
return
readFile... | [
"huffmanTree.HuffmanTree",
"os.path.exists",
"bitStream.BitStream"
] | [((139, 153), 'huffmanTree.HuffmanTree', 'HuffmanTree', (['(1)'], {}), '(1)\n', (150, 153), False, 'from huffmanTree import HuffmanTree\n'), ((323, 348), 'bitStream.BitStream', 'BitStream', (['fileName', '"""rb"""'], {}), "(fileName, 'rb')\n", (332, 348), False, 'from bitStream import BitStream\n'), ((219, 243), 'os.pa... |
from participants.models import Participant
from voters.models import Voter
from votes.models import Vote
def check_token(token, from_voter):
return str(token) == str(Voter.objects.get(id=from_voter).vote_key)
def check_voters(validated_data):
errors = []
vote_point = validated_data.get('point')
fr... | [
"votes.models.Vote.objects.filter",
"voters.models.Voter.objects.get",
"participants.models.Participant.objects.get"
] | [((435, 470), 'voters.models.Voter.objects.get', 'Voter.objects.get', ([], {'id': 'from_voter.id'}), '(id=from_voter.id)\n', (452, 470), False, 'from voters.models import Voter\n'), ((489, 534), 'participants.models.Participant.objects.get', 'Participant.objects.get', ([], {'id': 'to_participant.id'}), '(id=to_particip... |
import nukta.camera as cr
laser=cr.LaserTracker()
laser.run()
print("hello") | [
"nukta.camera.LaserTracker"
] | [((35, 52), 'nukta.camera.LaserTracker', 'cr.LaserTracker', ([], {}), '()\n', (50, 52), True, 'import nukta.camera as cr\n')] |
from rest_framework.permissions import IsAdminUser
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from django.contrib.auth.models import Group,Permission
from meiduo_admin.serializers.admins import AdminSerializer
from meiduo_admin.serializers.groups import GroupSerializ... | [
"rest_framework.response.Response",
"django.contrib.auth.models.Group.objects.all",
"users.models.User.objects.filter",
"meiduo_admin.serializers.groups.GroupSerializer"
] | [((530, 564), 'users.models.User.objects.filter', 'User.objects.filter', ([], {'is_staff': '(True)'}), '(is_staff=True)\n', (549, 564), False, 'from users.models import User\n'), ((656, 675), 'django.contrib.auth.models.Group.objects.all', 'Group.objects.all', ([], {}), '()\n', (673, 675), False, 'from django.contrib.a... |
from django.core.management.base import BaseCommand
from linkcheck.linkcheck_settings import EXTERNAL_RECHECK_INTERVAL, MAX_CHECKS_PER_RUN
from linkcheck.utils import check_links
class Command(BaseCommand):
help = 'Check and record internal and external link status'
def add_arguments(self, parser):
... | [
"linkcheck.utils.check_links"
] | [((1180, 1226), 'linkcheck.utils.check_links', 'check_links', ([], {'limit': 'limit', 'check_external': '(False)'}), '(limit=limit, check_external=False)\n', (1191, 1226), False, 'from linkcheck.utils import check_links\n'), ((1254, 1348), 'linkcheck.utils.check_links', 'check_links', ([], {'external_recheck_interval':... |
import json
import os
from fs.osfs import OSFS
import re
import requests
fileSystem = None
def format_string(text):
text = text.replace(" ", "").replace("-", "").replace("_", "").lower()
return str(text)
def get_all_item_urls():
page = requests.get("https://deeptownguide.com/Items")
item_urls = []
... | [
"json.dump",
"re.split",
"requests.get",
"re.sub",
"re.compile"
] | [((253, 300), 'requests.get', 'requests.get', (['"""https://deeptownguide.com/Items"""'], {}), "('https://deeptownguide.com/Items')\n", (265, 300), False, 'import requests\n'), ((920, 937), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (932, 937), False, 'import requests\n'), ((1071, 1115), 're.compile', 'r... |
#
# ktool | ktool
# structs.py
#
# This file contains a custom system for representing structures used within a mach-o header
#
# This file is part of ktool. ktool is free software that
# is made available under the MIT license. Consult the
# file "LICENSE" that is distributed together with this file
# ... | [
"collections.namedtuple"
] | [((492, 533), 'collections.namedtuple', 'namedtuple', (['"""struct"""', "['struct', 'sizes']"], {}), "('struct', ['struct', 'sizes'])\n", (502, 533), False, 'from collections import namedtuple\n'), ((552, 643), 'collections.namedtuple', 'namedtuple', (['"""symtab_entry"""', "['off', 'str_index', 'type', 'sect_index', '... |
from lite_boolean_formulae import L
def test_literal_contains():
assert ("x" in L("x"))
def test_conjunction_formula_contains():
assert ("x" in (L("x") & L("y")))
def test_disjunction_formula_contains():
assert ("x" in (L("x") | L("y")))
def test_disjunction_formula_does_not_contain():
assert no... | [
"lite_boolean_formulae.L"
] | [((86, 92), 'lite_boolean_formulae.L', 'L', (['"""x"""'], {}), "('x')\n", (87, 92), False, 'from lite_boolean_formulae import L\n'), ((157, 163), 'lite_boolean_formulae.L', 'L', (['"""x"""'], {}), "('x')\n", (158, 163), False, 'from lite_boolean_formulae import L\n'), ((166, 172), 'lite_boolean_formulae.L', 'L', (['"""... |
import csv
import os
import random
import numpy as np
import torch
import tqdm
from torch.backends import cudnn
from torch.utils import data
from torchvision import datasets
from torchvision import transforms
from nets import nn
from utils import util
random.seed(42)
np.random.seed(42)
torch.manual_seed(42)
cudnn.be... | [
"torch.cuda.synchronize",
"numpy.random.seed",
"utils.util.add_weight_decay",
"nets.nn.StepLR",
"torch.cuda.device_count",
"torch.device",
"torchvision.transforms.Normalize",
"torch.no_grad",
"os.path.join",
"utils.util.AverageMeter",
"csv.DictWriter",
"nets.nn.CrossEntropyLoss",
"utils.util... | [((255, 270), 'random.seed', 'random.seed', (['(42)'], {}), '(42)\n', (266, 270), False, 'import random\n'), ((271, 289), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (285, 289), True, 'import numpy as np\n'), ((290, 311), 'torch.manual_seed', 'torch.manual_seed', (['(42)'], {}), '(42)\n', (307, 311... |
from flask import Blueprint
bp = Blueprint('api_fittings', __name__)
| [
"flask.Blueprint"
] | [((34, 69), 'flask.Blueprint', 'Blueprint', (['"""api_fittings"""', '__name__'], {}), "('api_fittings', __name__)\n", (43, 69), False, 'from flask import Blueprint\n')] |
"""
MAMBA coil
==========
Compact example of a biplanar coil producing homogeneous field in a number of target
regions arranged in a grid. Meant to demonstrate the flexibility in target choice, inspired by the
technique "multiple-acquisition micro B(0) array" (MAMBA) technique, see https://doi.org/10.1002/mrm.10464
... | [
"trimesh.Trimesh",
"numpy.meshgrid",
"numpy.zeros_like",
"mayavi.mlab.quiver3d",
"bfieldtools.coil_optimize.optimize_streamfunctions",
"numpy.asarray",
"bfieldtools.utils.combine_meshes",
"numpy.array",
"bfieldtools.utils.load_example_mesh",
"numpy.linspace",
"bfieldtools.mesh_conductor.MeshCond... | [((734, 772), 'bfieldtools.utils.load_example_mesh', 'load_example_mesh', (['"""10x10_plane_hires"""'], {}), "('10x10_plane_hires')\n", (751, 772), False, 'from bfieldtools.utils import combine_meshes, load_example_mesh\n'), ((820, 839), 'numpy.array', 'np.array', (['[0, 0, 0]'], {}), '([0, 0, 0])\n', (828, 839), True,... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed u... | [
"numpy.zeros"
] | [((1291, 1311), 'numpy.zeros', 'np.zeros', (['max_values'], {}), '(max_values)\n', (1299, 1311), True, 'import numpy as np\n'), ((2309, 2334), 'numpy.zeros', 'np.zeros', (['self.max_values'], {}), '(self.max_values)\n', (2317, 2334), True, 'import numpy as np\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pathlib import Path
import pandas as pd
import numpy as np
import re
import click
from ...exceptions import InvalidFileExtension
def concat_command(files, output, **kwargs):
verbose = kwargs.pop("verbose", False)
# make sure the extension is csv
output... | [
"pandas.DataFrame",
"click.progressbar",
"re.split",
"pandas.read_csv",
"pathlib.Path",
"pandas.to_datetime",
"pandas.Timedelta",
"pandas.concat"
] | [((323, 335), 'pathlib.Path', 'Path', (['output'], {}), '(output)\n', (327, 335), False, 'from pathlib import Path\n'), ((1196, 1223), 'pandas.concat', 'pd.concat', (['data'], {'sort': '(False)'}), '(data, sort=False)\n', (1205, 1223), True, 'import pandas as pd\n'), ((1837, 1849), 'pathlib.Path', 'Path', (['output'], ... |
from setuptools import setup, find_packages
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name="causal-data-augmentation",
version="1.0.0",
description='Implementation of Causal Data Augmentation.',
long_description=readme,
author='',
... | [
"setuptools.find_packages"
] | [((387, 433), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "('docs', 'experiments')"}), "(exclude=('docs', 'experiments'))\n", (400, 433), False, 'from setuptools import setup, find_packages\n')] |
import random
import numpy as np
import pandas as pd
from pyeasyga import pyeasyga #pip install pyeasyga
from pyeasyga.pyeasyga import pyeasyga #!git clone https://github.com/remiomosowon/pyeasyga.git
### CONSTANTES GLOBAIS ###
# SEPARADOR CSV
SEPARADOR_CSV = ';'
# INDICES DA SOLUCAO [VALOR_FITNESS, ORDEM_GRADE]
IND... | [
"pandas.read_csv",
"random.shuffle",
"pyeasyga.pyeasyga.pyeasyga.GeneticAlgorithm"
] | [((1855, 1897), 'pandas.read_csv', 'pd.read_csv', (['url_config'], {'sep': 'SEPARADOR_CSV'}), '(url_config, sep=SEPARADOR_CSV)\n', (1866, 1897), True, 'import pandas as pd\n'), ((3075, 3100), 'random.shuffle', 'random.shuffle', (['individuo'], {}), '(individuo)\n', (3089, 3100), False, 'import random\n'), ((10912, 1118... |
# Author: <NAME>
# Project: Image/video auto-captioning using Deep Learning
# This script is executed when the user has uploaded a video to the library to be
# processed. The processing involves the following steps: converting the video to mp4
# format if it is not in that format already, extracting key frames and get... | [
"os.remove",
"numpy.argmax",
"tensorflow.keras.applications.xception.preprocess_input",
"os.path.isfile",
"glob.glob",
"shutil.rmtree",
"os.path.join",
"shutil.copy",
"os.path.exists",
"tensorflow.keras.preprocessing.image.load_img",
"tensorflow.keras.preprocessing.sequence.pad_sequences",
"te... | [((1003, 1026), 'subprocess.run', 'subprocess.run', (['command'], {}), '(command)\n', (1017, 1026), False, 'import subprocess\n'), ((2390, 2413), 'subprocess.run', 'subprocess.run', (['command'], {}), '(command)\n', (2404, 2413), False, 'import subprocess\n'), ((5547, 5620), 'tensorflow.keras.preprocessing.image.load_i... |
from interactivity import ActionHandler
from interactivity.generics import Payload
class MyAction(ActionHandler):
def execute(self):
return
class TestActionHandler:
def test_action(self, block_actions_request_data):
payload = Payload(**block_actions_request_data)
handler = MyAction(p... | [
"interactivity.generics.Payload"
] | [((254, 291), 'interactivity.generics.Payload', 'Payload', ([], {}), '(**block_actions_request_data)\n', (261, 291), False, 'from interactivity.generics import Payload\n')] |
# coding=gbk
import sys
import numpy
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {'packages': ['numpy'],'includes' :['cv2', 'numpy.core.multiarray'], 'excludes': [],"packages" : ["os"]}
base = None
if sys.platform == "... | [
"cx_Freeze.Executable"
] | [((510, 557), 'cx_Freeze.Executable', 'Executable', (['"""main.py"""'], {'base': 'base', 'icon': 'iconpath'}), "('main.py', base=base, icon=iconpath)\n", (520, 557), False, 'from cx_Freeze import setup, Executable\n')] |
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.3
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
# %% [markdown]
# # Model evaluation usi... | [
"pandas.read_csv",
"sklearn.linear_model.LogisticRegression",
"sklearn.preprocessing.StandardScaler",
"sklearn.model_selection.cross_validate"
] | [((691, 734), 'pandas.read_csv', 'pd.read_csv', (['"""../datasets/adult-census.csv"""'], {}), "('../datasets/adult-census.csv')\n", (702, 734), True, 'import pandas as pd\n'), ((3882, 3931), 'sklearn.model_selection.cross_validate', 'cross_validate', (['model', 'data_numeric', 'target'], {'cv': '(5)'}), '(model, data_n... |
TEST_APP_STATE = {
"origin": "opt-frontend.js",
"code": "x = [1,2,3]\ny = [4,5,6]\nprint x, y",
"textReferences": "false",
"cumulative": "false",
"rawInputLstJSON": "[]",
"mode": "edit",
"heapPrimitives": "nevernest",
"py": "2"
}
'''
parameters needed for python:
user_script
raw_input_... | [
"requests.get",
"json.dumps"
] | [((1704, 1899), 'json.dumps', 'json.dumps', (["{'cumulative_mode': myAppState['cumulative'] == 'true', 'heap_primitives': \n myAppState['heapPrimitives'] == 'true', 'show_only_outputs': False,\n 'origin': 'call_opt_backend.py'}"], {}), "({'cumulative_mode': myAppState['cumulative'] == 'true',\n 'heap_primitive... |
from functools import partial
import numpy as np
import pandas as pd
import chainer
from chainer import functions
from chainer import functions as F
from chainer.links import Linear
from chainer.dataset import to_device
from lib.graph import Graph
def zero_plus(x):
return F.softplus(x) - 0.6931472
class Eleme... | [
"functools.partial",
"chainer.functions.softplus",
"pandas.read_csv",
"chainer.functions.sum",
"chainer.functions.exp",
"chainer.functions.mean_absolute_error",
"chainer.functions.concat",
"chainer.functions.reshape",
"chainer.functions.expand_dims",
"numpy.linspace",
"chainer.functions.broadcas... | [((5976, 6020), 'pandas.read_csv', 'pd.read_csv', (['"""../../../input/structures.csv"""'], {}), "('../../../input/structures.csv')\n", (5987, 6020), True, 'import pandas as pd\n'), ((6084, 6123), 'pandas.read_csv', 'pd.read_csv', (['"""../../../input/bonds.csv"""'], {}), "('../../../input/bonds.csv')\n", (6095, 6123),... |