code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
import os
from sqlite3 import dbapi2 as sqlite3
from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash
# configuration
DATABASE = 'd:/code/py/server/flaskr.db'
DEBUG = True
SECRET_KEY = 'development key'
USERNAME = 'admin'
PASSWORD = '<PASSWORD>'
app = Flask(__name__)
app.conf... | [
"flask.g.db.execute",
"flask.flash",
"flask.session.pop",
"flask.Flask",
"flask.session.get",
"flask.g.db.commit",
"sqlite3.dbapi2.connect",
"flask.abort",
"flask.url_for",
"flask.render_template"
] | [((296, 311), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (301, 311), False, 'from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash\n'), ((372, 411), 'sqlite3.dbapi2.connect', 'sqlite3.connect', (["app.config['DATABASE']"], {}), "(app.config['DATABASE'])\n", (387... |
import datetime
import requests
from bs4 import BeautifulSoup
from waste_collection_schedule import Collection # type: ignore[attr-defined]
TITLE = "Abfallkalender Würzburg"
DESCRIPTION = "Source for waste collection in the city of Würzburg, Germany."
URL = "https://www.wuerzburg.de/themen/umwelt-verkehr/vorsorge-en... | [
"datetime.datetime.fromisoformat",
"datetime.timedelta",
"requests.get",
"bs4.BeautifulSoup",
"datetime.datetime.now"
] | [((1218, 1235), 'requests.get', 'requests.get', (['URL'], {}), '(URL)\n', (1230, 1235), False, 'import requests\n'), ((2563, 2586), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (2584, 2586), False, 'import datetime\n'), ((1283, 1322), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r.content', '"""html.... |
# Lint as: python3
# Copyright 2019 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | [
"mock.patch.object",
"glazier.lib.winpe.check_winpe.cache_clear",
"glazier.lib.winpe.check_winpe",
"absl.testing.absltest.main"
] | [((878, 939), 'mock.patch.object', 'mock.patch.object', (['winpe.registry', '"""get_value"""'], {'autospec': '(True)'}), "(winpe.registry, 'get_value', autospec=True)\n", (895, 939), False, 'import mock\n'), ((1101, 1162), 'mock.patch.object', 'mock.patch.object', (['winpe.registry', '"""get_value"""'], {'autospec': '(... |
import unittest
import sallyReformer
class SallyUtilTest(unittest.TestCase):
def test_tfile_equalsFirstname(self):
t = sallyReformer.TFile( '/srv/workspace', 'AAA.BBB.CCC')
result = t.equalsFirstname('AAA')
self.assertTrue(result)
if __name__ == '__main__':
unittest.main() | [
"unittest.main",
"sallyReformer.TFile"
] | [((295, 310), 'unittest.main', 'unittest.main', ([], {}), '()\n', (308, 310), False, 'import unittest\n'), ((133, 185), 'sallyReformer.TFile', 'sallyReformer.TFile', (['"""/srv/workspace"""', '"""AAA.BBB.CCC"""'], {}), "('/srv/workspace', 'AAA.BBB.CCC')\n", (152, 185), False, 'import sallyReformer\n')] |
"""
Converts a tile set from bmp to png for use with the Mac OS X frontend.
Usage
python osx_bmp2png.py input_file output_file [options]
Options
--tcoord hcoord vcoord
Reads the color to be treated as transparent for non-terrain tiles
from the position (hcoord, vcoord) in the tile set. Both coordinates
... | [
"argparse.ArgumentParser",
"numpy.logical_and",
"numpy.empty",
"numpy.dtype",
"numpy.zeros",
"numpy.ones",
"numpy.array",
"numpy.logical_or",
"numpy.linspace"
] | [((1927, 1995), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Converts bmp tile set to png."""'}), "(description='Converts bmp tile set to png.')\n", (1950, 1995), False, 'import argparse\n'), ((4371, 4387), 'numpy.array', 'numpy.array', (['tin'], {}), '(tin)\n', (4382, 4387), False, 'i... |
#formula of a straight line, y = mx + b
#regression find out what m and b is
#stock prices program
import pandas as pd
import quandl, math
import numpy as np
from sklearn import preprocessing, svm
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
quandl.ApiConfig.ap... | [
"sklearn.preprocessing.scale",
"sklearn.model_selection.train_test_split",
"sklearn.linear_model.LinearRegression",
"numpy.array",
"quandl.get_table"
] | [((357, 388), 'quandl.get_table', 'quandl.get_table', (['"""WIKI/PRICES"""'], {}), "('WIKI/PRICES')\n", (373, 388), False, 'import quandl, math\n'), ((901, 923), 'sklearn.preprocessing.scale', 'preprocessing.scale', (['x'], {}), '(x)\n', (920, 923), False, 'from sklearn import preprocessing, svm\n'), ((952, 973), 'nump... |
from pandas import DataFrame
import pytest
from avionix import ChartBuilder, ObjectMeta
from avionix.kube.core import EndpointPort
from avionix.kube.discovery import Endpoint, EndpointConditions, EndpointSlice
from avionix.testing.helpers import kubectl_get
from avionix.testing.installation_context import ChartInstall... | [
"avionix.testing.installation_context.ChartInstallationContext",
"avionix.kube.discovery.Endpoint",
"avionix.ObjectMeta",
"avionix.testing.helpers.kubectl_get",
"avionix.kube.discovery.EndpointConditions",
"avionix.ChartBuilder",
"avionix.kube.core.EndpointPort"
] | [((1429, 1471), 'avionix.ChartBuilder', 'ChartBuilder', (['chart_info', '[endpoint_slice]'], {}), '(chart_info, [endpoint_slice])\n', (1441, 1471), False, 'from avionix import ChartBuilder, ObjectMeta\n'), ((1482, 1515), 'avionix.testing.installation_context.ChartInstallationContext', 'ChartInstallationContext', (['bui... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: vtctlservice.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor_pb2.FileOptions",
"google.protobuf.descriptor.MethodDescriptor"
] | [((485, 511), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (509, 511), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((1139, 1167), 'google.protobuf.descriptor_pb2.FileOptions', 'descriptor_pb2.FileOptions', ([], {}), '()\n', (1165, 1167), False,... |
# Copyright (c) 2017, Vienna University of Technology (TU Wien), Department
# of Geodesy and Geoinformation (GEO).
# All rights reserved.
#
# All information contained herein is, and remains the property of Vienna
# University of Technology (TU Wien), Department of Geodesy and Geoinformation
# (GEO). The intellectual a... | [
"unittest.main",
"veranda.timestack.NcRasterTimeStack",
"os.path.abspath",
"pandas.date_range",
"os.makedirs",
"numpy.random.randn",
"os.path.isdir",
"veranda.timestack.GeoTiffRasterTimeStack",
"xarray.Dataset",
"tempfile.mkdtemp",
"numpy.testing.assert_equal",
"shutil.rmtree"
] | [((7477, 7492), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7490, 7492), False, 'import unittest\n'), ((1634, 1674), 'numpy.random.randn', 'np.random.randn', (['num_files', 'xsize', 'ysize'], {}), '(num_files, xsize, ysize)\n', (1649, 1674), True, 'import numpy as np\n'), ((1688, 1737), 'xarray.Dataset', 'xr.D... |
import numpy as np
import os.path as op
import dipy.core.gradients as dpg
import nibabel as nib
import sys, time
import botocore.session
import boto3
from dipy.segment.mask import median_otsu
data_files = {'./bvals':'.../bvals',
'./bvecs':'.../bvecs',
'./data.nii.gz':'.../data.nii.gz'}
... | [
"dipy.core.gradients.gradient_table",
"nibabel.Nifti1Image",
"dipy.reconst.dti.TensorModel",
"nibabel.load",
"boto3.setup_default_session",
"os.path.exists",
"numpy.mean",
"boto3.resource",
"numpy.where",
"dipy.denoise.noise_estimate.estimate_sigma",
"dipy.denoise.nlmeans.nlmeans"
] | [((322, 369), 'boto3.setup_default_session', 'boto3.setup_default_session', ([], {'profile_name': '"""hcp"""'}), "(profile_name='hcp')\n", (349, 369), False, 'import boto3\n'), ((375, 395), 'boto3.resource', 'boto3.resource', (['"""s3"""'], {}), "('s3')\n", (389, 395), False, 'import boto3\n'), ((544, 569), 'nibabel.lo... |
import sys,os
from numpy.core.fromnumeric import shape
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import os
import trimesh
import numpy as np
import json
import open3d as o3d
import torch
from tqdm import tqdm
from timeit import default_timer as timer
import utils.deepsdf_utils as... | [
"open3d.io.read_pinhole_camera_parameters",
"torch.cat",
"matplotlib.pyplot.imsave",
"utils.parsing_utils.get_dataset_type_from_dataset_name",
"torch.no_grad",
"os.path.join",
"utils.nnutils.load_checkpoint",
"models.pose_decoder.PoseDecoderSE3",
"torch.ones",
"os.path.dirname",
"utils.nnutils.p... | [((15535, 15583), 'utils.parsing_utils.get_dataset_type_from_dataset_name', 'get_dataset_type_from_dataset_name', (['dataset_name'], {}), '(dataset_name)\n', (15569, 15583), False, 'from utils.parsing_utils import get_dataset_type_from_dataset_name\n'), ((15661, 15724), 'os.path.join', 'os.path.join', (['data_dir', 'sp... |
import gym
import simple_discrete_game
import matplotlib.pyplot as plt
from array2gif import write_gif
import torch
import torch.nn as nn
import numpy as np
from models.mlp_agent import mlp_policy_net, mlp_value_net
def preprocess_obs(obs):
# convert to grayscale by averaging channels
obs = np.mean(obs, axi... | [
"gym.make",
"torch.load",
"numpy.mean",
"models.mlp_agent.mlp_policy_net",
"torch.from_numpy"
] | [((416, 439), 'gym.make', 'gym.make', (['"""GoalGrid-v0"""'], {}), "('GoalGrid-v0')\n", (424, 439), False, 'import gym\n'), ((503, 544), 'models.mlp_agent.mlp_policy_net', 'mlp_policy_net', (['state_size', '(32)', 'n_actions'], {}), '(state_size, 32, n_actions)\n', (517, 544), False, 'from models.mlp_agent import mlp_p... |
import math
import numpy as np
import chainer
from chainer import cuda
from chainer.functions.connection import linear
from chainer import initializers
from chainer import link
from chainer.links.connection.linear import Linear
from chainer.functions.array.broadcast import broadcast_to
import common.sn.max_sv as max_sv... | [
"chainer.Parameter",
"chainer.functions.array.broadcast.broadcast_to",
"common.sn.max_sv.max_singular_value",
"chainer.functions.connection.linear.linear",
"numpy.linalg.svd"
] | [((2420, 2470), 'common.sn.max_sv.max_singular_value', 'max_sv.max_singular_value', (['self.W', 'self.u', 'self.Ip'], {}), '(self.W, self.u, self.Ip)\n', (2445, 2470), True, 'import common.sn.max_sv as max_sv\n'), ((3533, 3569), 'chainer.functions.connection.linear.linear', 'linear.linear', (['x', 'self.W_bar', 'self.b... |
import os
import codecs
from setuptools import find_packages, setup
try:
import builtins
except ImportError:
# Python 2 compat: just to be able to declare that Python >=3.7 is needed.
import __builtin__ as builtins
# This is a bit (!) hackish: we are setting a global variable so that the
# main mlresearch... | [
"mlresearch._min_dependencies.tag_to_packages.items",
"os.path.join",
"codecs.open",
"setuptools.find_packages"
] | [((720, 761), 'os.path.join', 'os.path.join', (['"""mlresearch"""', '"""_version.py"""'], {}), "('mlresearch', '_version.py')\n", (732, 761), False, 'import os\n'), ((1042, 1089), 'codecs.open', 'codecs.open', (['"""README.rst"""'], {'encoding': '"""utf-8-sig"""'}), "('README.rst', encoding='utf-8-sig')\n", (1053, 1089... |
import dAbot
if __name__ == '__main__':
dAbot.main()
| [
"dAbot.main"
] | [((45, 57), 'dAbot.main', 'dAbot.main', ([], {}), '()\n', (55, 57), False, 'import dAbot\n')] |
# Copyright 2019 DeepMind Technologies Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | [
"jax.tree_flatten",
"jax.named_call",
"haiku._src.base.assert_no_new_parameters",
"haiku._src.base.params_frozen",
"haiku._src.base.assert_state_unchanged",
"jax.numpy.expand_dims",
"inspect.signature",
"typing.TypeVar",
"functools.partial",
"jax.vmap",
"jax.lax.scan",
"jax.numpy.concatenate",... | [((987, 1046), 'collections.namedtuple', 'collections.namedtuple', (['"""InternalState"""', '"""params,state,rng"""'], {}), "('InternalState', 'params,state,rng')\n", (1009, 1046), False, 'import collections\n'), ((1092, 1104), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (1099, 1104), False, 'from typing... |
#! python
"""
===========
Simple Path
===========
Draw a graph with matplotlib.
"""
import matplotlib.pyplot as plt
import networkx as nx
G = nx.path_graph(8)
nx.draw(G)
plt.show()
| [
"networkx.path_graph",
"networkx.draw",
"matplotlib.pyplot.show"
] | [((144, 160), 'networkx.path_graph', 'nx.path_graph', (['(8)'], {}), '(8)\n', (157, 160), True, 'import networkx as nx\n'), ((161, 171), 'networkx.draw', 'nx.draw', (['G'], {}), '(G)\n', (168, 171), True, 'import networkx as nx\n'), ((172, 182), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (180, 182), True, ... |
# encoding: utf-8
'''zone_reload
A wrapper around 'rndc' for requesting zone reloads from named.
Example::
>>> from dnszone.zone_reload import ZoneReload
>>> r = ZoneReload()
>>> r.reload('example.com')
zone reload up-to-date
>>> r.reload('foo.com')
rndc: 'reload' failed: not found
Trace... | [
"subprocess.call"
] | [((1539, 1559), 'subprocess.call', 'subprocess.call', (['cmd'], {}), '(cmd)\n', (1554, 1559), False, 'import subprocess\n')] |
# nombre historico:
# conteo_go.py
from __future__ import division
from collections import Counter
import numpy as np
import glob
import os
def file_len(fname):
with open(fname) as f:
for i, l in enumerate(f):
pass
return i + 1
def ldata(archive):
f=open(archive)
data=[]
f... | [
"collections.Counter",
"numpy.loadtxt",
"os.stat",
"glob.glob"
] | [((553, 623), 'glob.glob', 'glob.glob', (["(path_input + '*community_' + numero_de_comunidad + '_*.txt')"], {}), "(path_input + '*community_' + numero_de_comunidad + '_*.txt')\n", (562, 623), False, 'import glob\n'), ((1572, 1614), 'numpy.loadtxt', 'np.loadtxt', (['f'], {'dtype': '"""str"""', 'delimiter': '"""\n"""'}),... |
# -*- coding: utf-8 -*-
# ------------------------------------
# python modules
# ------------------------------------
import os
import glob
import os.path
import csv
import pandas as pd
from PIL import Image
# ------------------------------------
# own python modules
# ------------------------------------
import i2v
#... | [
"pandas.DataFrame",
"csv.writer",
"os.path.basename",
"i2v.make_i2v_with_chainer",
"PIL.Image.open",
"os.path.isfile",
"os.path.split",
"os.listdir"
] | [((1738, 1757), 'os.listdir', 'os.listdir', (['src_dir'], {}), '(src_dir)\n', (1748, 1757), False, 'import os\n'), ((929, 1007), 'i2v.make_i2v_with_chainer', 'i2v.make_i2v_with_chainer', (['"""illust2vec_tag_ver200.caffemodel"""', '"""tag_list.json"""'], {}), "('illust2vec_tag_ver200.caffemodel', 'tag_list.json')\n", (... |
# %%
import numpy as np
from os.path import join as ospj
import pandas as pd
import sys
import json
import matplotlib.pyplot as plt
from sklearn.preprocessing import normalize
sys.path.append('tools')
from movmean import movmean
from pull_sz_starts import pull_sz_starts
from plot_spectrogram import plot_spectrogram
... | [
"sys.path.append",
"json.load",
"movmean.movmean",
"plot_spectrogram.plot_spectrogram",
"matplotlib.pyplot.close",
"matplotlib.pyplot.subplots",
"numpy.arange",
"sklearn.preprocessing.normalize",
"numpy.squeeze",
"os.path.join"
] | [((177, 201), 'sys.path.append', 'sys.path.append', (['"""tools"""'], {}), "('tools')\n", (192, 201), False, 'import sys\n'), ((645, 668), 'os.path.join', 'ospj', (['repo_path', '"""data"""'], {}), "(repo_path, 'data')\n", (649, 668), True, 'from os.path import join as ospj\n'), ((683, 709), 'os.path.join', 'ospj', (['... |
# -*- coding: utf-8 -*-
"""
Test cases related to RelaxNG parsing and validation
"""
import unittest, sys, os.path
this_dir = os.path.dirname(__file__)
if this_dir not in sys.path:
sys.path.insert(0, this_dir) # needed for Py3
from common_imports import etree, BytesIO, _bytes, HelperTestCase, fileInTestDir
from... | [
"common_imports.etree.ElementTree",
"common_imports.etree.RelaxNG",
"unittest.TestSuite",
"common_imports.BytesIO",
"common_imports.fileInTestDir",
"unittest.makeSuite",
"sys.path.insert",
"common_imports._bytes",
"common_imports.make_doctest"
] | [((188, 216), 'sys.path.insert', 'sys.path.insert', (['(0)', 'this_dir'], {}), '(0, this_dir)\n', (203, 216), False, 'import unittest, sys, os.path\n'), ((5485, 5505), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (5503, 5505), False, 'import unittest, sys, os.path\n'), ((756, 777), 'common_imports.etre... |
import os
from mastodon import Mastodon
class Tooter(object):
@staticmethod
def toot_by_id(mastodon_id, toot_text, media_list) -> (bool, dict):
return Tooter.toot(toot_text,
media_list,
mastodon_id['server'],
mastodon_id... | [
"os.path.isfile",
"mastodon.Mastodon",
"os.remove"
] | [((1815, 1907), 'mastodon.Mastodon', 'Mastodon', ([], {'client_id': 'client_info_path', 'access_token': 'access_token', 'api_base_url': 'server_url'}), '(client_id=client_info_path, access_token=access_token,\n api_base_url=server_url)\n', (1823, 1907), False, 'from mastodon import Mastodon\n'), ((2250, 2282), 'os.p... |
# Copyright (C) 2021 <FacuFalcone - CaidevOficial>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is... | [
"random.randint"
] | [((2007, 2025), 'random.randint', 'rd.randint', (['(0)', '(100)'], {}), '(0, 100)\n', (2017, 2025), True, 'import random as rd\n')] |
import http.client
import yaml
import json
import sys
file = sys.argv[1]
host = sys.argv[2]
apitoken = sys.argv[3]
index = sys.argv[4]
project = sys.argv[5]
with open(file, 'r') as yaml_in:
yaml_object = yaml.safe_load(yaml_in) # yaml_object will be a list or a dict
json_payload = json.dumps(yaml_object)... | [
"yaml.safe_load",
"json.dumps"
] | [((215, 238), 'yaml.safe_load', 'yaml.safe_load', (['yaml_in'], {}), '(yaml_in)\n', (229, 238), False, 'import yaml\n'), ((297, 320), 'json.dumps', 'json.dumps', (['yaml_object'], {}), '(yaml_object)\n', (307, 320), False, 'import json\n')] |
# -*- coding: utf-8 -*-
from collections import OrderedDict
from itertools import groupby
from django.db.models import Count
from django.db.models.functions import Trunc
from django.utils.translation import ugettext_lazy as _
from rest_social_auth.serializers import JWTSerializer
from rest_framework_expandable import ... | [
"rest_framework.serializers.HyperlinkedIdentityField",
"rest_framework.serializers.SerializerMethodField",
"rest_framework.serializers.IntegerField",
"rest_framework.reverse.reverse",
"rest_framework.serializers.CharField",
"django.db.models.Count",
"django.utils.translation.ugettext_lazy",
"rest_fram... | [((2228, 2263), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', ([], {}), '()\n', (2261, 2263), False, 'from rest_framework import serializers\n'), ((2276, 2302), 'rest_framework.serializers.IntegerField', 'serializers.IntegerField', ([], {}), '()\n', (2300, 2302), False, 'from ... |
# Generated by Django 3.1.13 on 2022-02-20 09:52
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='InfoContent',
fields=[
('id', models.AutoF... | [
"django.db.models.CharField",
"django.db.models.TextField",
"django.db.models.DateTimeField",
"django.db.models.AutoField"
] | [((308, 401), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (324, 401), False, 'from django.db import migrations, models\... |
from django.db import models
from django.utils.html import mark_safe, format_html_join
from django.utils.functional import cached_property
import json
from jsonfield.fields import JSONField
from cms.models import CMSPlugin
from cms.plugin_pool import plugin_pool
from cms.utils.placeholder import get_placeholder_conf
... | [
"django.db.models.OneToOneField",
"cms.plugin_pool.plugin_pool.get_all_plugins",
"json.loads",
"jsonfield.fields.JSONField",
"django.utils.html.mark_safe",
"cms.utils.placeholder.get_placeholder_conf"
] | [((488, 585), 'django.db.models.OneToOneField', 'models.OneToOneField', (['CMSPlugin'], {'related_name': '"""+"""', 'on_delete': 'models.CASCADE', 'parent_link': '(True)'}), "(CMSPlugin, related_name='+', on_delete=models.CASCADE,\n parent_link=True)\n", (508, 585), False, 'from django.db import models\n'), ((637, 6... |
import os
from flask import Flask
from flask_cors import CORS
# import app endpoints
from src.parrocchie_valmalenco_be.endpoints.mic_config.config_handler import configMic_blueprint
# create the Flask application and enable CORS
app = Flask(__name__)
CORS(app)
# Blueprints registration
app.register_blueprint(config... | [
"flask_cors.CORS",
"flask.Flask"
] | [((238, 253), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (243, 253), False, 'from flask import Flask\n'), ((254, 263), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (258, 263), False, 'from flask_cors import CORS\n')] |
import json
import os, json
dicts = {}
path_to_json = "src/dictionaries"
json_files = [
pos_json for pos_json in os.listdir(path_to_json) if pos_json.endswith(".json")
]
for json_file in json_files:
keyword = json_file.split(".")[0]
with open(f"src/dictionaries/{keyword}.json") as f:
dicts[keywor... | [
"os.listdir"
] | [((119, 143), 'os.listdir', 'os.listdir', (['path_to_json'], {}), '(path_to_json)\n', (129, 143), False, 'import os, json\n')] |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'createExperimentDialogUi.ui'
#
# Created by: PyQt5 UI code generator 5.12.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_CreateExperimentDialog(object):
def setupUi(self... | [
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QGridLayout",
"PyQt5.QtWidgets.QLineEdit",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWidgets.QGroupBox",
"PyQt5.QtWidgets.QSpacerItem",
"PyQt5.QtWidgets.QScrollArea",
"PyQt5.Q... | [((566, 611), 'PyQt5.QtWidgets.QGridLayout', 'QtWidgets.QGridLayout', (['CreateExperimentDialog'], {}), '(CreateExperimentDialog)\n', (587, 611), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((694, 739), 'PyQt5.QtWidgets.QScrollArea', 'QtWidgets.QScrollArea', (['CreateExperimentDialog'], {}), '(CreateExperim... |
"""
A script for reading E-PRTR data from MS Access DB.
E-PRTR data is available for download at
https://industry.eea.europa.eu/download
Requires installation of driver MS for Access DB: "Microsoft Access Database
Engine 2016 Redistributable" (or newer)
(https://www.microsoft.com/en-us/download/details.aspx?id=54920)... | [
"data_import.utils.clean_names",
"data_import.log.log",
"data_import.utils.print_unique_values_as_enum",
"os.makedirs",
"pyodbc.drivers",
"data_import.utils.clear_location_data_for_main_activity_7",
"data_import.utils.ensure_no_unlinked_releases_or_transfers",
"os.path.exists",
"data_import.utils.cl... | [((1439, 1513), 'pyodbc.connect', 'pyodbc.connect', (['f"""Driver={{{accdb_driver}}};DBQ={conf.prtr_db_file_path};"""'], {}), "(f'Driver={{{accdb_driver}}};DBQ={conf.prtr_db_file_path};')\n", (1453, 1513), False, 'import pyodbc\n'), ((1545, 1592), 'pandas.read_sql_query', 'pd.read_sql_query', (['queries.sql_facilities'... |
import os
from flask import Flask
from flask_appconfig import HerokuConfig
from .frontend import frontend
def create_app(configfile=None):
app = Flask(__name__)
HerokuConfig(app, configfile)
app.register_blueprint(frontend)
env_variables = ['SECRET_KEY', 'TWITTER_USERNAME', 'TWITTER_CONSUMER_KEY... | [
"os.environ.get",
"flask.Flask",
"flask_appconfig.HerokuConfig"
] | [((154, 169), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (159, 169), False, 'from flask import Flask\n'), ((175, 204), 'flask_appconfig.HerokuConfig', 'HerokuConfig', (['app', 'configfile'], {}), '(app, configfile)\n', (187, 204), False, 'from flask_appconfig import HerokuConfig\n'), ((799, 827), 'os.e... |
import numpy as np
from scipy.constants import mu_0, epsilon_0
# useful params
def omega(freq):
"""Angular frequency, omega"""
return 2.*np.pi*freq
def k(freq, sigma, mu=mu_0, eps=epsilon_0):
""" Eq 1.47 - 1.49 in Ward and Hohmann """
w = omega(freq)
alp = w * np.sqrt( mu*eps/2 * ( np.sqrt(1. + (... | [
"numpy.sqrt"
] | [((306, 345), 'numpy.sqrt', 'np.sqrt', (['(1.0 + (sigma / (eps * w)) ** 2)'], {}), '(1.0 + (sigma / (eps * w)) ** 2)\n', (313, 345), True, 'import numpy as np\n'), ((387, 426), 'numpy.sqrt', 'np.sqrt', (['(1.0 + (sigma / (eps * w)) ** 2)'], {}), '(1.0 + (sigma / (eps * w)) ** 2)\n', (394, 426), True, 'import numpy as n... |
import os
from blackswan import analogs as anlg
from blackswan import config
from os.path import basename
from blackswan.utils import rename_complexinputs
from pywps import Process
from pywps import LiteralInput, LiteralOutput
from pywps import ComplexInput, ComplexOutput
from pywps import Format, FORMATS
from pywps.... | [
"blackswan.utils.rename_complexinputs",
"blackswan.analogs.render_viewer",
"blackswan.analogs.reformat_analogs",
"pywps.app.Common.Metadata",
"pywps.Format",
"blackswan.log.init_process_logger",
"logging.getLogger"
] | [((418, 444), 'logging.getLogger', 'logging.getLogger', (['"""PYWPS"""'], {}), "('PYWPS')\n", (435, 444), False, 'import logging\n'), ((2471, 2501), 'blackswan.log.init_process_logger', 'init_process_logger', (['"""log.txt"""'], {}), "('log.txt')\n", (2490, 2501), False, 'from blackswan.log import init_process_logger\n... |
from __future__ import print_function
import math
import time
import os
import json
try:
import commands
except:
# python3 compatibility
import subprocess as commands
try:
import htcondor
_ = htcondor.Schedd()
have_python_htcondor_bindings = True
... | [
"logging.Formatter.__init__",
"fcntl.flock",
"logging.Formatter",
"subprocess.getstatusoutput",
"os.path.abspath",
"logging.FileHandler",
"json.loads",
"os.path.exists",
"UserTarball.UserTarball",
"datetime.timedelta",
"os.path.normpath",
"collections.Counter",
"datetime.datetime.now",
"lo... | [((261, 278), 'htcondor.Schedd', 'htcondor.Schedd', ([], {}), '()\n', (276, 278), False, 'import htcondor\n'), ((6983, 7013), 'logging.getLogger', 'logging.getLogger', (['logger_name'], {}), '(logger_name)\n', (7000, 7013), False, 'import logging\n'), ((7310, 7351), 'logging.FileHandler', 'logging.FileHandler', (["(log... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
Graph-bot
Creates graphs, stores them in the data folder,
then removes them once uploaded
This will probably eat up 100MB of memory
"""
from botinfo import *
import matplotlib
matplotlib.use('Agg') # only way to render without an Xserver running
import matplotlib.pyl... | [
"matplotlib.pylab.colorbar",
"numpy.matrix",
"os.remove",
"matplotlib.pylab.savefig",
"matplotlib.pylab.imshow",
"sympy.sympify",
"matplotlib.use",
"sympy.plotting.plot",
"ast.literal_eval",
"mpmath.cplot",
"matplotlib.pylab.figure"
] | [((229, 250), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (243, 250), False, 'import matplotlib\n'), ((1255, 1401), 'sympy.plotting.plot', 'plot', (['expr', "(var1, s['xmin'], s['xmax'])"], {'xlim': "(s['xmin'], s['xmax'])", 'ylim': "(s['ymin'], s['ymax'])", 'legend': '(True)', 'show': '(False... |
import unittest
from hundo import parse_from_json as parser
class TestParsingFromJson(unittest.TestCase):
def test_smoke(self):
strings = (
'РЭУ, Факультет маркетинга, Менеджмент (38.03.02), ОП [Б], №: 3, №*: 1, №**: 2',
'ВШЭ, ФСН, Политология (41.03.04), ОП [БК], №: 3, №*: 1, №**:... | [
"hundo.parse_from_json"
] | [((1223, 1234), 'hundo.parse_from_json', 'parser', (['arg'], {}), '(arg)\n', (1229, 1234), True, 'from hundo import parse_from_json as parser\n'), ((1695, 1706), 'hundo.parse_from_json', 'parser', (['arg'], {}), '(arg)\n', (1701, 1706), True, 'from hundo import parse_from_json as parser\n')] |
from django.db.models import CharField
from django.utils.translation import ugettext_lazy as _
from .forms import MKIdentityCardNumberField as MKIdentityCardNumberFormField
from .forms import UMCNField as UMCNFormField
from .mk_choices import MK_MUNICIPALITIES
class MKIdentityCardNumberField(CharField):
"""
... | [
"django.utils.translation.ugettext_lazy"
] | [((478, 514), 'django.utils.translation.ugettext_lazy', '_', (['"""Macedonian identity card number"""'], {}), "('Macedonian identity card number')\n", (479, 514), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((1082, 1131), 'django.utils.translation.ugettext_lazy', '_', (['"""A Macedonian municipa... |
import asyncio
from ruia import Item, TextField, AttrField
class PythonDocumentationItem(Item):
title = TextField(css_select='title')
tutorial_link = AttrField(xpath_select="//a[text()='Tutorial']", attr='href')
async def main():
url = 'https://docs.python.org/3/'
item = await PythonDocumentationIte... | [
"ruia.TextField",
"ruia.AttrField"
] | [((110, 139), 'ruia.TextField', 'TextField', ([], {'css_select': '"""title"""'}), "(css_select='title')\n", (119, 139), False, 'from ruia import Item, TextField, AttrField\n'), ((160, 221), 'ruia.AttrField', 'AttrField', ([], {'xpath_select': '"""//a[text()=\'Tutorial\']"""', 'attr': '"""href"""'}), '(xpath_select="//a... |
"""
Copyright (c) 2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writin... | [
"nncf.pruning.pruning_node_selector.PruningNodeSelector",
"nncf.dynamic_graph.context.Scope.from_str",
"nncf.dynamic_graph.graph_builder.ModelInputInfo",
"tests.helpers.create_compressed_model_and_algo_for_test",
"pytest.fixture",
"nncf.pruning.model_analysis.Clusterization",
"nncf.pruning.export_helper... | [((7207, 7299), 'pytest.fixture', 'pytest.fixture', ([], {'params': 'GROUP_PRUNING_MODULES_TEST_CASES', 'name': '"""test_input_info_struct_"""'}), "(params=GROUP_PRUNING_MODULES_TEST_CASES, name=\n 'test_input_info_struct_')\n", (7221, 7299), False, 'import pytest\n'), ((11646, 11738), 'pytest.fixture', 'pytest.fixt... |
# BEGIN_COPYRIGHT
#
# Copyright 2009-2014 CRS4.
#
# 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 agree... | [
"argparse.ArgumentParser",
"importlib.import_module"
] | [((774, 897), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Pydoop command line tool"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Pydoop command line tool',\n formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n", (797, 897), False, 'import ... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | [
"aiida.orm.Log.collection.get_logs_for"
] | [((1791, 1827), 'aiida.orm.Log.collection.get_logs_for', 'Log.collection.get_logs_for', (['process'], {}), '(process)\n', (1818, 1827), False, 'from aiida.orm import Log\n')] |
import json
import urllib
from os import curdir, sep
from urlparse import parse_qs
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify'
SITE_SECRET = '<KEY>'
RECAPTCHA_RESPONSE_PARAM = 'g-recaptcha-response'
class Handler(BaseHTTPRequestHand... | [
"BaseHTTPServer.HTTPServer",
"json.loads",
"urllib.urlencode"
] | [((1246, 1277), 'BaseHTTPServer.HTTPServer', 'HTTPServer', (["('', 8080)", 'Handler'], {}), "(('', 8080), Handler)\n", (1256, 1277), False, 'from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer\n'), ((968, 984), 'json.loads', 'json.loads', (['resp'], {}), '(resp)\n', (978, 984), False, 'import json\n'), ((869,... |
import numpy as np
from bicks.mathtool import find_n_roots, find_real_roots
from bicks.mathtool import find_n_roots_for_small_and_big_q
from bicks.mathtool import find_real_roots_for_small_and_big_q
def find_band_projection(phcs, num, Nq=100, mode="E"):
"""
find the area where we can use dichotomy to find root... | [
"bicks.mathtool.find_real_roots_for_small_and_big_q",
"bicks.mathtool.find_n_roots_for_small_and_big_q",
"bicks.mathtool.find_n_roots",
"numpy.min",
"numpy.max",
"numpy.array",
"numpy.arange",
"numpy.cos",
"numpy.sin",
"bicks.mathtool.find_real_roots",
"numpy.concatenate",
"numpy.sqrt"
] | [((2645, 2660), 'numpy.array', 'np.array', (['dataq'], {}), '(dataq)\n', (2653, 2660), True, 'import numpy as np\n'), ((2676, 2694), 'numpy.array', 'np.array', (['k0_floor'], {}), '(k0_floor)\n', (2684, 2694), True, 'import numpy as np\n'), ((2712, 2732), 'numpy.array', 'np.array', (['k0_ceiling'], {}), '(k0_ceiling)\n... |
import os, sys, re
VERSION_REGEX = r'v?[0-9]+\.[0-9]+\.[0-9]+'
def isValidTag(tag):
if tag is None:
return False
if tag == '':
return False
regex = re.compile(VERSION_REGEX)
if regex.match(tag):
return True
print('WARNING: Ignoring invalid tag: {}'.format(tag))
return False
def version... | [
"re.finditer",
"os.popen",
"re.compile"
] | [((168, 193), 're.compile', 're.compile', (['VERSION_REGEX'], {}), '(VERSION_REGEX)\n', (178, 193), False, 'import os, sys, re\n'), ((991, 1031), 're.finditer', 're.finditer', (['log_tag_version_regex', 'line'], {}), '(log_tag_version_regex, line)\n', (1002, 1031), False, 'import os, sys, re\n'), ((793, 840), 'os.popen... |
#! /usr/bin/env python
"""Transform gprof(1) output into useful HTML."""
import re, os, sys, cgi, webbrowser
header = """\
<html>
<head>
<title>gprof output (%s)</title>
</head>
<body>
<pre>
"""
trailer = """\
</pre>
</body>
</html>
"""
def add_escapes(input):
for line in input:
... | [
"os.path.abspath",
"re.findall",
"re.match",
"cgi.escape"
] | [((764, 797), 're.match', 're.match', (['"""(.* )(\\\\w+)\\\\n"""', 'line'], {}), "('(.* )(\\\\w+)\\\\n', line)\n", (772, 797), False, 'import re, os, sys, cgi, webbrowser\n'), ((1212, 1277), 're.match', 're.match', (['"""(.* )(\\\\w+)(( <cycle.*>)? \\\\[\\\\d+\\\\])\\\\n"""', 'line'], {}), "('(.* )(\\\\w+)((... |
import json
class ApiMethods(object):
# Attachments
def get_attachment(self, attachmentId):
"""Gets and returns an attachment based on given attachment ID. Both attachment metadata (application/json) and
the file itself will be returned. Content-type for the r is multipart/mixed.
:pa... | [
"json.dumps"
] | [((1732, 1748), 'json.dumps', 'json.dumps', (['meta'], {}), '(meta)\n', (1742, 1748), False, 'import json\n')] |
import torch
import torch.nn.functional as F
batch_size = 5
num_classes = 6
torch.manual_seed(123)
data = torch.rand(batch_size, num_classes)
index = [
[1, 3, 4],
[4, 5, 1],
[2, 4,-1],
[1,-1,-1],
[3,-1,-1],
]
index = torch.tensor(index)
print("1 ok.")
print("data:", data.size())
print("index:", ind... | [
"torch.gather",
"torch.manual_seed",
"torch.cat",
"torch.nn.functional.cross_entropy",
"torch.arange",
"torch.rand",
"torch.tensor"
] | [((77, 99), 'torch.manual_seed', 'torch.manual_seed', (['(123)'], {}), '(123)\n', (94, 99), False, 'import torch\n'), ((107, 142), 'torch.rand', 'torch.rand', (['batch_size', 'num_classes'], {}), '(batch_size, num_classes)\n', (117, 142), False, 'import torch\n'), ((238, 257), 'torch.tensor', 'torch.tensor', (['index']... |
import numpy as np
import re
import os
def convertatomicnumber(X):
X = int(X)
if X == 1:
return 'H'
elif X == 6:
return 'C'
elif X == 7:
return 'N'
elif X == 8:
return 'O'
def read_charge (file, type='mulliken'):
fd = open(file, 'r').read()
if type == 'mul... | [
"numpy.concatenate",
"numpy.asarray",
"os.popen",
"numpy.array",
"numpy.vstack",
"re.compile"
] | [((564, 627), 're.compile', 're.compile', (['""" +?\\\\d+? +?([A-Z][a-z]?) +?([+-]?\\\\d+?\\\\.\\\\S+?)\n"""'], {}), "(' +?\\\\d+? +?([A-Z][a-z]?) +?([+-]?\\\\d+?\\\\.\\\\S+?)\\n')\n", (574, 627), False, 'import re\n'), ((954, 1092), 're.compile', 're.compile', (['"""Corrected End Point Energy =\\\\s+?([+-]?\\\\d+?\\\\... |
from rest_framework.test import APITestCase, APIClient
class ViewTestCase(APITestCase):
fixtures = ['authentication_testdata.json']
def setUp(self):
self.client = APIClient()
def test_accounts_view(self):
# Issue a GET request.
response = self.client.get('/app/api/v1/accounts/', fo... | [
"rest_framework.test.APIClient"
] | [((180, 191), 'rest_framework.test.APIClient', 'APIClient', ([], {}), '()\n', (189, 191), False, 'from rest_framework.test import APITestCase, APIClient\n')] |
import os
import shutil
from math import ceil
from sklearn.model_selection import train_test_split
from glob import glob
import pandas as pd
from pandas.errors import EmptyDataError
import sys
import csv
import re
import codecs
# Utility function : copy and apply a function to the train, test, and dev subsets
def pro... | [
"pandas.DataFrame",
"os.path.expanduser",
"os.makedirs",
"os.path.basename",
"pandas.read_csv",
"math.ceil",
"sklearn.model_selection.train_test_split",
"os.getcwd",
"os.path.exists",
"shutil.copy2",
"os.fsdecode",
"os.chdir",
"shutil.move",
"shutil.rmtree",
"os.path.join",
"os.listdir... | [((413, 439), 'os.path.exists', 'os.path.exists', (['output_dir'], {}), '(output_dir)\n', (427, 439), False, 'import os\n'), ((3049, 3066), 're.compile', 're.compile', (['"""\\\\s"""'], {}), "('\\\\s')\n", (3059, 3066), False, 'import re\n'), ((449, 474), 'shutil.rmtree', 'shutil.rmtree', (['output_dir'], {}), '(output... |
# -*- coding: utf-8 -*-
"""
=====================================================================
Fixed Domains Example for Statistical Shape Modeling using ShapeWorks
=====================================================================
In this example we work with a dataset of axis aligned ellipsoids.
This example... | [
"shapeworks.data.download_and_unzip_dataset",
"shapeworks.utils.save_images",
"os.makedirs",
"AnalyzeUtils.create_analyze_xml",
"os.path.exists",
"AnalyzeUtils.check_results",
"OptimizeUtils.runShapeWorksOptimize_FixedDomains",
"glob.glob",
"AnalyzeUtils.launch_shapeworks_studio",
"shapeworks.Imag... | [((1069, 1135), 'shapeworks.data.download_and_unzip_dataset', 'sw.data.download_and_unzip_dataset', (['dataset_name', 'output_directory'], {}), '(dataset_name, output_directory)\n', (1103, 1135), True, 'import shapeworks as sw\n'), ((3191, 3322), 'shapeworks.utils.save_images', 'sw.utils.save_images', (["(groom_dir + '... |
# Generated by Django 2.2.16 on 2020-10-28 16:47
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('discovery', '0007_auto_20200811_1319'),
]
operations = [
migrations.RemoveField(
model_name='discoveryitem',
name='recommen... | [
"django.db.migrations.RemoveField"
] | [((230, 302), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""discoveryitem"""', 'name': '"""recommendable"""'}), "(model_name='discoveryitem', name='recommendable')\n", (252, 302), False, 'from django.db import migrations\n')] |
"""Module for checking for new releases on GitHub."""
import attr
import pandas as pd
import requests
from typing import List, Dict, Optional
REPO_ID = "murthylab/sleap"
@attr.s(auto_attribs=True)
class Release:
title: str = attr.ib(order=False)
version: str = attr.ib(order=False)
prerelease: bool = a... | [
"attr.s",
"attr.ib",
"pandas.to_datetime",
"requests.get"
] | [((177, 202), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)'}), '(auto_attribs=True)\n', (183, 202), False, 'import attr\n'), ((1410, 1435), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)'}), '(auto_attribs=True)\n', (1416, 1435), False, 'import attr\n'), ((235, 255), 'attr.ib', 'attr.ib', ([], {'order': '(False... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 <NAME>
# Copyright (C) 2014-2021 <NAME>
#
# This software is released under the terms of the BSD license.
# For more information see the COPYING.txt file in this directory.
from setuptools import setup, Extension
import sys
import platform
extra_compile_args = []
extra_l... | [
"setuptools.Extension",
"platform.machine",
"setuptools.setup"
] | [((479, 666), 'setuptools.Extension', 'Extension', (['"""lzhlib"""'], {'extra_compile_args': 'extra_compile_args', 'extra_link_args': 'extra_link_args', 'define_macros': "[('MAJOR_VERSION', '0'), ('MINOR_VERSION', '2')]", 'sources': "['lzhlib.c']"}), "('lzhlib', extra_compile_args=extra_compile_args, extra_link_args=\n... |
import numpy as np
import matplotlib.pyplot as plt
from mpl_finance import candlestick_ohlc
class Visualizer:
def __init__(self):
self.fig = None # 캔버스 같은 역할을 하는 Matplotlib의 Figure 클래스 객체
self.axes = None # 차트를 그리기 위한 Matplotlib의 Axes 클래스 객체
def prepare(self, chart_data):
# 캔버스를 초기... | [
"matplotlib.pyplot.subplots",
"numpy.array",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.savefig",
"mpl_finance.candlestick_ohlc"
] | [((398, 456), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(4)', 'ncols': '(1)', 'facecolor': '"""w"""', 'sharex': '(True)'}), "(nrows=4, ncols=1, facecolor='w', sharex=True)\n", (410, 456), True, 'import matplotlib.pyplot as plt\n'), ((1146, 1200), 'mpl_finance.candlestick_ohlc', 'candlestick_ohlc', (... |
import os
import sys
from dolfin import MPI, timings, TimingClear, TimingType, File, dump_timings_to_xml
from subprocess import check_output, CalledProcessError
from distutils.util import strtobool
import json
import time
import mpi4py
# Colored printing functions for strings that use universal ANSI escape sequences.
... | [
"json.dump",
"dolfin.MPI.sum",
"dolfin.MPI.rank",
"subprocess.check_output",
"dolfin.timings",
"time.time",
"dolfin.MPI.avg",
"os.path.join"
] | [((2825, 2869), 'dolfin.timings', 'timings', (['TimingClear.keep', '[TimingType.wall]'], {}), '(TimingClear.keep, [TimingType.wall])\n', (2832, 2869), False, 'from dolfin import MPI, timings, TimingClear, TimingType, File, dump_timings_to_xml\n'), ((2917, 2943), 'dolfin.MPI.sum', 'MPI.sum', (['MPI.comm_world', 't'], {}... |
"""2021 - Day 11 Part 2: Dumbo Octopus."""
from src.year2021.day11a import Data
from src.year2021.day11a import make_step
def solve(task: str) -> int:
data = Data.from_task(task)
step = 0
while True:
step += 1
make_step(data)
if data.all_zeros:
return step
| [
"src.year2021.day11a.make_step",
"src.year2021.day11a.Data.from_task"
] | [((164, 184), 'src.year2021.day11a.Data.from_task', 'Data.from_task', (['task'], {}), '(task)\n', (178, 184), False, 'from src.year2021.day11a import Data\n'), ((241, 256), 'src.year2021.day11a.make_step', 'make_step', (['data'], {}), '(data)\n', (250, 256), False, 'from src.year2021.day11a import make_step\n')] |
"""
Credit: <NAME>
"""
import argparse
import os
import pybullet as pb
import trimesh
import yaml
from igibson.objects.articulated_object import ArticulatedObject
from igibson.scenes.empty_scene import EmptyScene
from igibson.simulator import Simulator
"""
Analyzes a model for heights of surfaces within it.
Assume... | [
"trimesh.load",
"pybullet.createMultiBody",
"argparse.ArgumentParser",
"os.path.join",
"pybullet.createVisualShape",
"os.path.dirname",
"pybullet.getBasePositionAndOrientation",
"yaml.dump",
"igibson.simulator.Simulator",
"igibson.objects.articulated_object.ArticulatedObject",
"pybullet.resetBas... | [((502, 546), 'igibson.simulator.Simulator', 'Simulator', ([], {'image_width': '(640)', 'image_height': '(640)'}), '(image_width=640, image_height=640)\n', (511, 546), False, 'from igibson.simulator import Simulator\n'), ((559, 571), 'igibson.scenes.empty_scene.EmptyScene', 'EmptyScene', ([], {}), '()\n', (569, 571), F... |
import sys
import matplotlib.pyplot as plt
import matplotlib.colors as mplt_col
import os
import numpy as np
from PIL import Image
import glob
from pathlib import Path
import pandas as pd
from mpl_toolkits.axes_grid1 import ImageGrid
sys.path.append("/home/fionnlagh/forked_amrvac/amrvac/tools/python")
import amrvac_p... | [
"mpl_toolkits.axes_grid1.ImageGrid",
"matplotlib.offsetbox.AnchoredText",
"numpy.shape",
"matplotlib.pyplot.figure",
"numpy.rot90",
"pathlib.Path",
"matplotlib.pyplot.gca",
"os.path.join",
"numpy.round",
"sys.path.append",
"matplotlib.colors.Normalize",
"amrvac_pytools.load_datfile",
"matplo... | [((236, 304), 'sys.path.append', 'sys.path.append', (['"""/home/fionnlagh/forked_amrvac/amrvac/tools/python"""'], {}), "('/home/fionnlagh/forked_amrvac/amrvac/tools/python')\n", (251, 304), False, 'import sys\n'), ((954, 985), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'size': 'SMALL_SIZE'}), "('font', size=SM... |
from datetime import date
from referral.test_models import PrsTestCase
from referral.models import Referral, ReferralType, Organisation
class AuditTestCase(PrsTestCase):
def test_save(self):
"""Test that the save() method sets a creator and modifier outside of a HTTP request
"""
r = Refer... | [
"referral.models.ReferralType.objects.first",
"referral.models.Organisation.objects.first",
"datetime.date.today"
] | [((357, 385), 'referral.models.ReferralType.objects.first', 'ReferralType.objects.first', ([], {}), '()\n', (383, 385), False, 'from referral.models import Referral, ReferralType, Organisation\n'), ((401, 429), 'referral.models.Organisation.objects.first', 'Organisation.objects.first', ([], {}), '()\n', (427, 429), Fal... |
import json
from ..openapi.tator_openapi.models import CreateResponse
from ..util.get_api import get_api
from ..util.get_parser import get_parser
def parse_args():
parser = get_parser()
parser.add_argument('--project', type=int, help="Unique integer identifying a project.")
parser.add_argument('--media_ty... | [
"json.loads"
] | [((1668, 1690), 'json.loads', 'json.loads', (['attributes'], {}), '(attributes)\n', (1678, 1690), False, 'import json\n')] |
# -*- coding: utf-8 -*-
# StreamOnDemand Community Edition - Kodi Addon
# ------------------------------------------------------------
# streamondemand.- XBMC Plugin
# Canale cineblog01
# http://www.mimediacenter.info/foro/viewforum.php?f=36
# Version: 201706200900
# ----------------------------------------------------... | [
"core.scrapertools.printMatches",
"core.config.get_library_support",
"core.item.Item",
"core.scrapertools.find_single_match",
"platformcode.logger.error",
"platformcode.logger.debug",
"core.httptools.downloadpage",
"urlparse.urljoin",
"platformcode.logger.info",
"core.scrapertools.htmlclean",
"c... | [((650, 689), 'platformcode.logger.info', 'logger.info', (['"""[cineblog01.py] mainlist"""'], {}), "('[cineblog01.py] mainlist')\n", (661, 689), False, 'from platformcode import logger\n'), ((3967, 4007), 'platformcode.logger.info', 'logger.info', (['"""[cineblog01.py] peliculas"""'], {}), "('[cineblog01.py] peliculas'... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import matplotlib.pyplot as plt
import cv2
from scipy import fftpack
import skimage.measure
import scipy.signal
# In[2]:
import src.psf as psf
import src.image_helper as image_helper
import src.hyperparams as hyperparams
import src.kernel_estimato... | [
"src.kernel_estimator.KernelEsimator",
"src.image_helper.plot_psf",
"src.image_helper.plot_image",
"cv2.imread",
"src.psf.PSFManager",
"src.hyperparams.sinc_hp",
"src.deblur.DeblurFactory",
"src.hyperparams.esimator_hp",
"cv2.resize"
] | [((646, 690), 'cv2.imread', 'cv2.imread', (['IMAGE_PATH', 'cv2.IMREAD_GRAYSCALE'], {}), '(IMAGE_PATH, cv2.IMREAD_GRAYSCALE)\n', (656, 690), False, 'import cv2\n'), ((818, 849), 'cv2.resize', 'cv2.resize', (['image', '(SIZE, SIZE)'], {}), '(image, (SIZE, SIZE))\n', (828, 849), False, 'import cv2\n'), ((850, 897), 'src.i... |
from typing import List
import cli_ui as ui
from tsrc.errors import Error
from tsrc.executor import (
Outcome,
Task,
process_items,
process_items_parallel,
process_items_sequence,
)
class Kaboom(Error):
def __init__(self) -> None:
self.message = "Kaboom"
class FakeTask(Task[str]):
... | [
"tsrc.executor.Outcome.empty",
"tsrc.executor.process_items_parallel",
"tsrc.executor.process_items_sequence",
"cli_ui.info",
"tsrc.executor.process_items"
] | [((1076, 1111), 'tsrc.executor.process_items_sequence', 'process_items_sequence', (['items', 'task'], {}), '(items, task)\n', (1098, 1111), False, 'from tsrc.executor import Outcome, Task, process_items, process_items_parallel, process_items_sequence\n'), ((1206, 1250), 'tsrc.executor.process_items_sequence', 'process_... |
import numpy as np
def poly_feat(s, n):
if isinstance(s, float):
return np.array([s ** i for i in range(n + 1)])
# code below untested
k = s.shape[0]
n_feat = (n + 1) ** k
x_s = np.ones(n_feat)
pow_l = np.zeros(k)
s_pow = [[s[i] ** j for j in range(n + 1)] for i in range(k)]
idx = 0
while idx < ... | [
"numpy.dot",
"numpy.zeros",
"numpy.ones",
"numpy.cos"
] | [((194, 209), 'numpy.ones', 'np.ones', (['n_feat'], {}), '(n_feat)\n', (201, 209), True, 'import numpy as np\n'), ((220, 231), 'numpy.zeros', 'np.zeros', (['k'], {}), '(k)\n', (228, 231), True, 'import numpy as np\n'), ((740, 755), 'numpy.ones', 'np.ones', (['n_feat'], {}), '(n_feat)\n', (747, 755), True, 'import numpy... |
# Copyright (C) 2018 <NAME>
#
# SPDX-License-Identifier: MIT
"""This module contains a collection of functions related to
geographical data.
"""
from floodsystem.utils import sorted_by_key # noqa
import math
"""find the distance between the two points using the haversine formula"""
def haversine(lat1, lon1, lat2,... | [
"math.sqrt",
"math.cos",
"math.sin"
] | [((643, 661), 'math.sin', 'math.sin', (['(dlat / 2)'], {}), '(dlat / 2)\n', (651, 661), False, 'import math\n'), ((750, 762), 'math.sqrt', 'math.sqrt', (['a'], {}), '(a)\n', (759, 762), False, 'import math\n'), ((764, 780), 'math.sqrt', 'math.sqrt', (['(1 - a)'], {}), '(1 - a)\n', (773, 780), False, 'import math\n'), (... |
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
data = np.array([
[1, 21.1],
[2, 22.0],
[3, 22.4],
[4, 22.2],
[5, 22.2],
[6, 22.1],
[7, 22.0],
[8, 21.7],
[9, 21.6],
[10, 21.6],
[11, 21.7],
[12, 21.7],
[13, 21.6],
[14, 21.6],
[15, 21... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.plot",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig"
] | [((83, 273), 'numpy.array', 'np.array', (['[[1, 21.1], [2, 22.0], [3, 22.4], [4, 22.2], [5, 22.2], [6, 22.1], [7, 22.0\n ], [8, 21.7], [9, 21.6], [10, 21.6], [11, 21.7], [12, 21.7], [13, 21.6],\n [14, 21.6], [15, 21.6]]'], {}), '([[1, 21.1], [2, 22.0], [3, 22.4], [4, 22.2], [5, 22.2], [6, 22.1],\n [7, 22.0], [... |
from imgurpython import ImgurClient
CLIENT_ID = '3fa744e80ad2ae7'
CLIENT_SECRET = '<KEY>'
images = ["../c++/progress_sorting.png", "../c++/relative_plot.png", "../c++/progress_points.png", "../c++/relative_plot_points.png"]
client = ImgurClient(CLIENT_ID, CLIENT_SECRET)
for image in images:
response = client.uploa... | [
"imgurpython.ImgurClient"
] | [((236, 273), 'imgurpython.ImgurClient', 'ImgurClient', (['CLIENT_ID', 'CLIENT_SECRET'], {}), '(CLIENT_ID, CLIENT_SECRET)\n', (247, 273), False, 'from imgurpython import ImgurClient\n')] |
from setuptools import setup
setup(
name="my plugin name",
entry_points={"bgmi3.extensions.source": ["my-plugin-id = my_source:MySource"]},
)
| [
"setuptools.setup"
] | [((30, 144), 'setuptools.setup', 'setup', ([], {'name': '"""my plugin name"""', 'entry_points': "{'bgmi3.extensions.source': ['my-plugin-id = my_source:MySource']}"}), "(name='my plugin name', entry_points={'bgmi3.extensions.source': [\n 'my-plugin-id = my_source:MySource']})\n", (35, 144), False, 'from setuptools i... |
"""
Copyright 2021 <NAME> - <EMAIL>
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted,
provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES... | [
"oc_ocdm.Storer",
"oc_ocdm.support.create_date",
"oc_ocdm.graph.GraphSet"
] | [((3883, 3914), 'oc_ocdm.graph.GraphSet', 'GraphSet', (['"""http://example.com/"""'], {}), "('http://example.com/')\n", (3891, 3914), False, 'from oc_ocdm.graph import GraphSet\n'), ((4219, 4251), 'oc_ocdm.Storer', 'Storer', (['gs'], {'output_format': '"""nt11"""'}), "(gs, output_format='nt11')\n", (4225, 4251), False,... |
import pytest
driver = ""
server = "test"
db = "test"
user = ""
pwd = ""
class TestDbConnect:
@pytest.mark.skip(reason="not currently implemented with sqlite")
def test_init_from_conn_info(self):
from medspacy.io.db_connect import DbConnect
db_conn = DbConnect(driver, server, db, user, pwd)
... | [
"medspacy.io.db_connect.DbConnect",
"pytest.mark.skip",
"sqlite3.connect"
] | [((102, 166), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""not currently implemented with sqlite"""'}), "(reason='not currently implemented with sqlite')\n", (118, 166), False, 'import pytest\n'), ((278, 318), 'medspacy.io.db_connect.DbConnect', 'DbConnect', (['driver', 'server', 'db', 'user', 'pwd'], {}... |
# mge - Modern Game Engine
# Copyright (c) 2021 by <NAME>
# All rights reserved.
import os
import sys
import subprocess
import shutil
# parameters
# -- version increment each time config changes
# -- vcpkg_githash git hash of vcpkg to check out
# -- vcpkg_packages array of package names to install... | [
"subprocess.run",
"os.path.isdir",
"os.path.exists",
"shutil.rmtree",
"sys.exit"
] | [((2660, 2671), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (2668, 2671), False, 'import sys\n'), ((659, 734), 'subprocess.run', 'subprocess.run', (["['git', 'clone', 'https://github.com/mge-engine/vcpkg.git']"], {}), "(['git', 'clone', 'https://github.com/mge-engine/vcpkg.git'])\n", (673, 734), False, 'import subp... |
# -*- coding: utf-8 -*-
"""
molvs.normalize
~~~~~~~~~~~~~~~
This module contains tools for normalizing molecules using reaction SMARTS patterns.
:copyright: Copyright 2016 by <NAME>.
:license: MIT, see LICENSE file for more details.
"""
import logging
from rdkit import Chem
from rdkit.Chem import AllChem
from .ut... | [
"rdkit.Chem.GetMolFrags",
"rdkit.Chem.SanitizeMol",
"rdkit.Chem.MolToSmiles",
"rdkit.Chem.CombineMols",
"logging.getLogger"
] | [((357, 384), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (374, 384), False, 'import logging\n'), ((7374, 7408), 'rdkit.Chem.GetMolFrags', 'Chem.GetMolFrags', (['mol'], {'asMols': '(True)'}), '(mol, asMols=True)\n', (7390, 7408), False, 'from rdkit import Chem\n'), ((7638, 7672), 'rdki... |
import torch
class Trainer():
def __init__(self, model, device=torch.device('cpu')):
self.model = model
self.device = device
def generate_batch(self, episodes, mode):
raise NotImplementedError
def train(self, episodes):
raise NotImplementedError
def log_results(self, ... | [
"torch.device"
] | [((68, 87), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (80, 87), False, 'import torch\n')] |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Presubmit for Chromium HTML/CSS/JS resources. See chrome/browser/PRESUBMIT.py.
"""
import regex_check
class ResourceChecker(object):
def __init__(se... | [
"regex_check.RegexCheck"
] | [((535, 651), 'regex_check.RegexCheck', 'regex_check.RegexCheck', (['self.input_api.re', 'line_number', 'line', '"""^\\\\s*(?:\\\\/[\\\\*\\\\/])?\\\\s*(<include)\\\\s*src="""', 'msg'], {}), "(self.input_api.re, line_number, line,\n '^\\\\s*(?:\\\\/[\\\\*\\\\/])?\\\\s*(<include)\\\\s*src=', msg)\n", (557, 651), False... |
from typing import Text, Dict, Any, List, Optional, TYPE_CHECKING
from rasa.shared.constants import DOCS_URL_SLOTS, IGNORED_INTENTS
import rasa.shared.utils.io
from rasa.shared.nlu.constants import (
ENTITY_ATTRIBUTE_TYPE,
ENTITY_ATTRIBUTE_ROLE,
ENTITY_ATTRIBUTE_GROUP,
INTENT,
NOT_INTENT,
INTEN... | [
"rasa.shared.core.domain.InvalidDomain"
] | [((1158, 1337), 'rasa.shared.core.domain.InvalidDomain', 'InvalidDomain', (['f"""Please make sure that the slot mappings for slot \'{slot_name}\' in your domain are valid dictionaries. Please see {DOCS_URL_SLOTS} for more information."""'], {}), '(\n f"Please make sure that the slot mappings for slot \'{slot_name}\'... |
from qiskit import QuantumCircuit, execute, Aer
from qiskit.visualization import plot_histogram,display
circuit=QuantumCircuit(1,1)
circuit.x(2)
circuit.h(0)
circuit.cx(0,1)
circuit.measure(0,1)
s=1024
backend=Aer.get_backend('qasm_simulator')
job=execute(circuit, backend, shots=s)
result=job.result()
counts... | [
"qiskit.visualization.plot_histogram",
"qiskit.QuantumCircuit",
"qiskit.visualization.display",
"qiskit.execute",
"qiskit.Aer.get_backend"
] | [((114, 134), 'qiskit.QuantumCircuit', 'QuantumCircuit', (['(1)', '(1)'], {}), '(1, 1)\n', (128, 134), False, 'from qiskit import QuantumCircuit, execute, Aer\n'), ((218, 251), 'qiskit.Aer.get_backend', 'Aer.get_backend', (['"""qasm_simulator"""'], {}), "('qasm_simulator')\n", (233, 251), False, 'from qiskit import Qua... |
"""
OIDC specification of authentication request parameter ``prompt``:
OPTIONAL. Space delimited, case sensitive list of ASCII string values that
specifies whether the Authorization Server prompts the End-User for
reauthentication and consent. The defined values are:
none
The Authorizat... | [
"pytest.fixture",
"mock.patch",
"urlparse.urlparse",
"pytest.mark.parametrize",
"pytest.mark.skip"
] | [((3193, 3225), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (3207, 3225), False, 'import pytest\n'), ((3453, 3485), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (3467, 3485), False, 'import pytest\n'), ((4288, 4337), 'p... |
# The functions in this module are used to connect callback properties to Qt
# widgets.
import math
from qtpy import QtGui, QtWidgets
from qtpy.QtCore import Qt
import numpy as np
from ..core import add_callback, remove_callback
from ..selection import SelectionCallbackProperty, ChoiceSeparator
__all__ = ['connect... | [
"numpy.datetime64",
"math.log10",
"qtpy.QtWidgets.QListWidgetItem"
] | [((10623, 10640), 'math.log10', 'math.log10', (['value'], {}), '(value)\n', (10633, 10640), False, 'import math\n'), ((17779, 17811), 'qtpy.QtWidgets.QListWidgetItem', 'QtWidgets.QListWidgetItem', (['label'], {}), '(label)\n', (17804, 17811), False, 'from qtpy import QtGui, QtWidgets\n'), ((7948, 7968), 'numpy.datetime... |
# -*- coding:utf-8 -*-
__author__ = 'zhangzhibo'
__date__ = '202018/5/18 9:52'
from flask_wtf import FlaskForm
from wtforms.fields import StringField, PasswordField, SubmitField
from wtforms.validators import DataRequired, ValidationError, EqualTo, Email, Regexp
from app.models import Admin
class AdminLoginForm(Fl... | [
"wtforms.fields.SubmitField",
"wtforms.validators.ValidationError",
"wtforms.validators.EqualTo",
"wtforms.validators.DataRequired",
"app.models.Admin.query.filter_by"
] | [((750, 826), 'wtforms.fields.SubmitField', 'SubmitField', (['"""登录"""'], {'render_kw': "{'class': 'btn btn-primary btn-block btn-flat'}"}), "('登录', render_kw={'class': 'btn btn-primary btn-block btn-flat'})\n", (761, 826), False, 'from wtforms.fields import StringField, PasswordField, SubmitField\n'), ((1696, 1775), '... |
"""
Tendrás que crear un programa que simule la tirada de dados.
Cada vez que ejecutamos el programa, este elegirá dos números aleatorios entre
el 1 y el 6. El programa deberá imprimirlos en pantalla, imprimir su suma y
preguntarle al usuario si quiere tirar los dados otra vez.
"""
import random
import time
tirar_dev... | [
"random.choices",
"time.sleep"
] | [((384, 423), 'random.choices', 'random.choices', (['[1, 2, 3, 4, 5, 6]'], {'k': '(2)'}), '([1, 2, 3, 4, 5, 6], k=2)\n', (398, 423), False, 'import random\n'), ((547, 562), 'time.sleep', 'time.sleep', (['(2.5)'], {}), '(2.5)\n', (557, 562), False, 'import time\n')] |
from rest_framework import viewsets, authentication, permissions, status
from rest_framework.response import Response
from rest_framework.decorators import action
from ..models import Recipe
from ..serializers import (
RecipeSerializer,
RecipeDetailSerializer,
RecipeImageSerializer)
class ManageRecipe(vie... | [
"rest_framework.response.Response",
"rest_framework.decorators.action"
] | [((1260, 1322), 'rest_framework.decorators.action', 'action', ([], {'methods': "['POST']", 'detail': '(True)', 'url_path': '"""image-upload"""'}), "(methods=['POST'], detail=True, url_path='image-upload')\n", (1266, 1322), False, 'from rest_framework.decorators import action\n'), ((1705, 1761), 'rest_framework.response... |
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from dal import autocomplete
from TWLight.applications import views
from TWLight.users.models import Editor
from TWLight.resources.models import Partner
urlpatterns = [
url(
r"^editor/autocomplete/$",
views.... | [
"TWLight.applications.views.SubmitSingleApplicationView.as_view",
"TWLight.applications.views.ListApprovedApplicationsView.as_view",
"TWLight.applications.views.SubmitApplicationView.as_view",
"TWLight.applications.views.ListRenewalApplicationsView.as_view",
"TWLight.applications.views.BatchEditView.as_view... | [((314, 364), 'TWLight.applications.views.EditorAutocompleteView.as_view', 'views.EditorAutocompleteView.as_view', ([], {'model': 'Editor'}), '(model=Editor)\n', (350, 364), False, 'from TWLight.applications import views\n'), ((462, 514), 'TWLight.applications.views.PartnerAutocompleteView.as_view', 'views.PartnerAutoc... |
import sys, os
import psycopg2
import postgresql
import random
import time
def strTimeProp(start, end, format, prop):
stime = time.mktime(time.strptime(start, format))
etime = time.mktime(time.strptime(end, format))
ptime = stime + prop * (etime - stime)
return time.strftime(format, time.localtime(pti... | [
"random.randint",
"random.choice",
"random.random",
"time.strptime",
"time.localtime",
"psycopg2.connect"
] | [((144, 172), 'time.strptime', 'time.strptime', (['start', 'format'], {}), '(start, format)\n', (157, 172), False, 'import time\n'), ((198, 224), 'time.strptime', 'time.strptime', (['end', 'format'], {}), '(end, format)\n', (211, 224), False, 'import time\n'), ((302, 323), 'time.localtime', 'time.localtime', (['ptime']... |
# Copyright (C) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | [
"webkitpy.layout_tests.controllers.repaint_overlay.generate_repaint_overlay_html",
"logging.getLogger"
] | [((1673, 1700), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1690, 1700), False, 'import logging\n'), ((11077, 11171), 'webkitpy.layout_tests.controllers.repaint_overlay.generate_repaint_overlay_html', 'repaint_overlay.generate_repaint_overlay_html', (['self._test_name', 'actual_text',... |
import unittest
import spikeextractors as se
class SorterCommonTestSuite:
"""
This class run some basic for a sorter class.
This is the minimal test suite for each sorter class:
* run once
* run with several groups
* run with several groups in thread
"""
SorterClass = None
d... | [
"spikeextractors.BinDatRecordingExtractor",
"spikeextractors.example_datasets.toy_example"
] | [((375, 443), 'spikeextractors.example_datasets.toy_example', 'se.example_datasets.toy_example', ([], {'num_channels': '(4)', 'duration': '(60)', 'seed': '(0)'}), '(num_channels=4, duration=60, seed=0)\n', (406, 443), True, 'import spikeextractors as se\n'), ((1039, 1107), 'spikeextractors.example_datasets.toy_example'... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-10-22 12:51
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('helpdesk', '0011_useractionhistory'),
]
operations = [
migrations.RemoveField(
... | [
"django.db.migrations.RemoveField"
] | [((289, 342), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""issue"""', 'name': '"""kb"""'}), "(model_name='issue', name='kb')\n", (311, 342), False, 'from django.db import migrations\n')] |
from flask import Flask, flash, redirect, render_template, url_for, request
from flask_cors import CORS
import ibm_watson
from gtts import gTTS
import os
import re
import webbrowser
import smtplib
import requests,json
import urllib
import boto3
import os
import subprocess
import cv2
import googlemaps
from datetime impo... | [
"os.remove",
"boto3.client",
"flask_cors.CORS",
"json.dumps",
"nexmo.Client",
"boto3.resource",
"pprint.pprint",
"flask.request.get_json",
"json.loads",
"gtts.gTTS",
"cv2.imwrite",
"urllib.request.urlopen",
"flask.render_template",
"requests.get",
"datetime.datetime.now",
"analyze.enti... | [((471, 486), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (476, 486), False, 'from flask import Flask, flash, redirect, render_template, url_for, request\n'), ((488, 497), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (492, 497), False, 'from flask_cors import CORS\n'), ((606, 635), 'flask.render... |
from unittest import TestCase
from json import dumps
import requests
class ContextClass(object):
def __init__(self, requests, endpoint_params, method_params, header_params, body_params):
self.list_of_requests = []
for req_idx in range(len(requests)):
request = self.requestClass(request... | [
"requests.request"
] | [((59099, 59164), 'requests.request', 'requests.request', (['call[1]', 'call[0]'], {'headers': 'call[2]', 'data': 'payload'}), '(call[1], call[0], headers=call[2], data=payload)\n', (59115, 59164), False, 'import requests\n'), ((59375, 59440), 'requests.request', 'requests.request', (['call[1]', 'call[0]'], {'headers':... |
from torch.nn import L1Loss
from .model import Net
from models.abstract_cnn_solver import AbstractCnnSolver
class Solver(AbstractCnnSolver):
def __init__(self, cfg=None, mode="train"):
super().__init__(cfg, mode)
if mode == "train":
self.loss = L1Loss()
self.pixel_loss_p... | [
"torch.nn.L1Loss"
] | [((282, 290), 'torch.nn.L1Loss', 'L1Loss', ([], {}), '()\n', (288, 290), False, 'from torch.nn import L1Loss\n')] |
"""
Example code of a simple RNN, GRU, LSTM on the MNIST dataset.
Programmed by <NAME> <<EMAIL>.<EMAIL> at hotmail dot com>
* 2020-05-09 Initial coding
"""
# Imports
import torch
import torchvision
import torch.nn as nn # All neural network modules, nn.Linear, nn.Conv2d, BatchNorm, Loss functions
import torch.op... | [
"torch.nn.GRU",
"torch.utils.data.DataLoader",
"torch.nn.CrossEntropyLoss",
"torch.cuda.is_available",
"torch.nn.RNN",
"torch.nn.Linear",
"torch.nn.LSTM",
"torch.no_grad",
"torchvision.transforms.ToTensor"
] | [((3788, 3858), 'torch.utils.data.DataLoader', 'DataLoader', ([], {'dataset': 'train_dataset', 'batch_size': 'batch_size', 'shuffle': '(True)'}), '(dataset=train_dataset, batch_size=batch_size, shuffle=True)\n', (3798, 3858), False, 'from torch.utils.data import DataLoader\n'), ((3873, 3942), 'torch.utils.data.DataLoad... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import requests
from .base import BaseChannel
from ..exceptions import HttpError
class YoChannel(BaseChannel):
url = "https://api.justyo.co/yo/"
def __init__(self, api_token, username=None, *args, **kwargs):
self.api_token = api_token
... | [
"requests.post"
] | [((826, 863), 'requests.post', 'requests.post', (['self.url'], {'data': 'payload'}), '(self.url, data=payload)\n', (839, 863), False, 'import requests\n')] |
#!/usr/bin/env python
import io
import os
from setuptools import setup, find_packages
def read(fname, encoding='utf-8'):
path = os.path.join(os.path.dirname(__file__), fname)
with io.open(path, encoding=encoding) as f:
return f.read()
setup(
name='django-u2f',
version='0.3.1.dev0',
desc... | [
"os.path.dirname",
"setuptools.find_packages",
"io.open"
] | [((148, 173), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (163, 173), False, 'import os\n'), ((191, 223), 'io.open', 'io.open', (['path'], {'encoding': 'encoding'}), '(path, encoding=encoding)\n', (198, 223), False, 'import io\n'), ((480, 515), 'setuptools.find_packages', 'find_packages', ... |
#!/usr/bin/env python
"""
This will generate an API file for formula in dir/statsmodels/formula/api.py
It first builds statsmodels in place, then generates the file. It's to be run
by developers to add files to the formula API without having to maintain this
by hand.
usage
generate_formula_api /home/skipper/statsmod... | [
"os.path.dirname",
"os.path.join",
"os.chdir"
] | [((1853, 1912), 'os.path.join', 'os.path.join', (['directory', '"""statsmodels"""', '"""formula"""', '"""api.py"""'], {}), "(directory, 'statsmodels', 'formula', 'api.py')\n", (1865, 1912), False, 'import os\n'), ((2508, 2533), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (2523, 2533), Fals... |
import hashlib
import logging
import re
import string
import time
from datetime import timedelta
from io import StringIO
from pathlib import Path
from tempfile import gettempdir
from typing import Callable, Dict, Iterable, List, Optional, Tuple, Union, cast
import paramiko
from tqdm.autonotebook import tqdm
import pa... | [
"io.StringIO",
"paramiko.SSHClient",
"typing.cast",
"pandas.read_csv",
"re.finditer",
"tempfile.gettempdir",
"re.match",
"time.sleep",
"paramiko.AutoAddPolicy",
"logging.info",
"paramiko.ProxyCommand",
"datetime.timedelta",
"pandas.to_datetime",
"re.search",
"pandas.concat",
"re.sub"
] | [((6908, 6928), 'paramiko.SSHClient', 'paramiko.SSHClient', ([], {}), '()\n', (6926, 6928), False, 'import paramiko\n'), ((11901, 11919), 'datetime.timedelta', 'timedelta', ([], {'hours': '(1)'}), '(hours=1)\n', (11910, 11919), False, 'from datetime import timedelta\n'), ((13597, 13646), 'typing.cast', 'cast', (['Calla... |
from __future__ import with_statement
import random
import Pyro4
# We need to set either a socket communication timeout,
# or use the select based server. Otherwise the daemon requestLoop
# will block indefinitely and is never able to evaluate the loopCondition.
Pyro4.config.COMMTIMEOUT=0.5
NUM_WORKERS=5
... | [
"Pyro4.core.Proxy",
"Pyro4.core.Daemon",
"random.randint"
] | [((510, 529), 'Pyro4.core.Daemon', 'Pyro4.core.Daemon', ([], {}), '()\n', (527, 529), False, 'import Pyro4\n'), ((740, 785), 'Pyro4.core.Proxy', 'Pyro4.core.Proxy', (['"""PYRONAME:example.callback"""'], {}), "('PYRONAME:example.callback')\n", (756, 785), False, 'import Pyro4\n'), ((1028, 1048), 'random.randint', 'rando... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 14 09:58:27 2019
@author: chengxue
"""
import sys
sys.path.append('..')
sys.path.append('./src')
import numpy as np
# import os
from StateReader.game_object import GameObject, GameObjectType
from StateReader.cv_utils import Rectangle
from Utils.NDS... | [
"sys.path.append",
"numpy.zeros",
"StateReader.cv_utils.Rectangle",
"numpy.array",
"numpy.linspace",
"Utils.NDSparseMatrix.NDSparseMatrix",
"StateReader.game_object.GameObjectType"
] | [((122, 143), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (137, 143), False, 'import sys\n'), ((144, 168), 'sys.path.append', 'sys.path.append', (['"""./src"""'], {}), "('./src')\n", (159, 168), False, 'import sys\n'), ((2287, 2317), 'Utils.NDSparseMatrix.NDSparseMatrix', 'NDSparseMatrix', ([]... |
from datetime import timedelta
from decimal import Decimal
import graphene
import pytest
from django.utils import timezone
from django_countries import countries
from saleor.discount import DiscountValueType, VoucherType
from saleor.discount.error_codes import DiscountErrorCode
from saleor.discount.models import Sale... | [
"tests.api.utils.get_graphql_content",
"saleor.discount.models.Sale",
"saleor.discount.DiscountValueType.FIXED.upper",
"decimal.Decimal",
"graphene.Node.to_global_id",
"django.utils.timezone.now",
"pytest.raises",
"saleor.discount.models.Voucher.objects.create",
"datetime.timedelta",
"saleor.disco... | [((26462, 26627), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""voucher_filter, count"""', "[({'timesUsed': {'gte': 1, 'lte': 5}}, 1), ({'timesUsed': {'lte': 3}}, 2),\n ({'timesUsed': {'gte': 2}}, 1)]"], {}), "('voucher_filter, count', [({'timesUsed': {'gte': 1,\n 'lte': 5}}, 1), ({'timesUsed': {'lt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.