repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
Hacky-DH/pytorch | test/jit/test_backend_nnapi.py | 80dc4be615854570aa39a7e36495897d8a040ecc | import os
import sys
import unittest
import torch
import torch._C
from pathlib import Path
from test_nnapi import TestNNAPI
from torch.testing._internal.common_utils import TEST_WITH_ASAN
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.pa... | [((314, 347), 'sys.path.append', 'sys.path.append', (['pytorch_test_dir'], {}), '(pytorch_test_dir)\n', (329, 347), False, 'import sys\n'), ((1117, 1176), 'unittest.skipIf', 'unittest.skipIf', (['TEST_WITH_ASAN', '"""Unresolved bug with ASAN"""'], {}), "(TEST_WITH_ASAN, 'Unresolved bug with ASAN')\n", (1132, 1176), Fal... |
syxu828/Graph2Seq-0.1 | main/configure.py | 36e38f755c0ee390735e49121259151da54bcc1c | train_data_path = "../data/no_cycle/train.data"
dev_data_path = "../data/no_cycle/dev.data"
test_data_path = "../data/no_cycle/test.data"
word_idx_file_path = "../data/word.idx"
word_embedding_dim = 100
train_batch_size = 32
dev_batch_size = 500
test_batch_size = 500
l2_lambda = 0.000001
learning_rate = 0.001
epoch... | [] |
andreasbayer/AEGUIFit | dataControlWidget.py | 6a1e31091b74d648d007c75c9fef6efae4086860 | from PyQt5.QtWidgets import QLabel, QWidget, QGridLayout, QCheckBox, QGroupBox
from InftyDoubleSpinBox import InftyDoubleSpinBox
from PyQt5.QtCore import pyqtSignal, Qt
import helplib as hl
import numpy as np
class dataControlWidget(QGroupBox):
showErrorBars_changed = pyqtSignal(bool)
ignoreFirstPoint_changed ... | [((274, 290), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', (['bool'], {}), '(bool)\n', (284, 290), False, 'from PyQt5.QtCore import pyqtSignal, Qt\n'), ((322, 338), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', (['bool'], {}), '(bool)\n', (332, 338), False, 'from PyQt5.QtCore import pyqtSignal, Qt\n'), ((358, 380), 'PyQt5.QtCor... |
strawlab/flyvr | src/freemovr_engine/calib/acquire.py | 335892cae740e53e82e07b526e1ba53fbd34b0ce | import roslib
roslib.load_manifest('sensor_msgs')
roslib.load_manifest('dynamic_reconfigure')
import rospy
import sensor_msgs.msg
import dynamic_reconfigure.srv
import dynamic_reconfigure.encoding
import numpy as np
import time
import os.path
import queue
class CameraHandler(object):
def __init__(self,topic_pref... | [((14, 49), 'roslib.load_manifest', 'roslib.load_manifest', (['"""sensor_msgs"""'], {}), "('sensor_msgs')\n", (34, 49), False, 'import roslib\n'), ((50, 93), 'roslib.load_manifest', 'roslib.load_manifest', (['"""dynamic_reconfigure"""'], {}), "('dynamic_reconfigure')\n", (70, 93), False, 'import roslib\n'), ((447, 551)... |
nixli/hfta | examples/hfht/pointnet_classification.py | 76274b5ee0e32732da20b153a3cc6550510d8a78 | import argparse
import logging
import numpy as np
import os
import pandas as pd
import random
import subprocess
from pathlib import Path
from hyperopt import hp
from hyperopt.pyll.stochastic import sample
from hfta.hfht import (tune_hyperparameters, attach_common_args,
rearrange_algorithm_kwarg... | [((527, 549), 'random.seed', 'random.seed', (['args.seed'], {}), '(args.seed)\n', (538, 549), False, 'import random\n'), ((552, 577), 'numpy.random.seed', 'np.random.seed', (['args.seed'], {}), '(args.seed)\n', (566, 577), True, 'import numpy as np\n'), ((592, 629), 'numpy.random.RandomState', 'np.random.RandomState', ... |
invinst/CPDBv2_backend | cpdb/trr/migrations/0002_alter_trr_subject_id_type.py | b4e96d620ff7a437500f525f7e911651e4a18ef9 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-03-06 04:00
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('trr', '0001_initial'),
]
operations = [
migrations.AlterField(
... | [((387, 425), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'null': '(True)'}), '(null=True)\n', (414, 425), False, 'from django.db import migrations, models\n')] |
Ostrokrzew/standalone-linux-io-tracer | tests/utils/dut.py | 5fcbe7f0c7b027d9e5fdfb4c6e9d553c6fa617b6 | #
# Copyright(c) 2020 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
from core.test_run_utils import TestRun
from utils.installer import install_iotrace, check_if_installed
from utils.iotrace import IotracePlugin
from utils.misc import kill_all_io
from test_tools.fio.fio import Fio
def dut_prepare... | [((667, 672), 'test_tools.fio.fio.Fio', 'Fio', ([], {}), '()\n', (670, 672), False, 'from test_tools.fio.fio import Fio\n'), ((777, 814), 'core.test_run_utils.TestRun.LOGGER.info', 'TestRun.LOGGER.info', (['"""Killing all IO"""'], {}), "('Killing all IO')\n", (796, 814), False, 'from core.test_run_utils import TestRun\... |
Drew8521/MusiQ | game_service.py | e52671c7dcc4f54f6cbb829486a733a9179575b1 | from models import Song
from random import choice
def random_song(genre):
results = Song.query().filter(Song.genre==genre).fetch()
print(results)
songs = choice(results)
random_song = {
"title": songs.song,
"album": songs.album,
"artist": songs.artist.lower(),
"genre": g... | [((167, 182), 'random.choice', 'choice', (['results'], {}), '(results)\n', (173, 182), False, 'from random import choice\n'), ((89, 101), 'models.Song.query', 'Song.query', ([], {}), '()\n', (99, 101), False, 'from models import Song\n')] |
janbodnar/Python-Course | stdlib/csv/custom_dialect.py | 51705ab5a2adef52bcdb99a800e94c0d67144a38 | #!/usr/bin/python
# custom_dialect.py
import csv
csv.register_dialect("hashes", delimiter="#")
f = open('items3.csv', 'w')
with f:
writer = csv.writer(f, dialect="hashes")
writer.writerow(("pencils", 2))
writer.writerow(("plates", 1))
writer.writerow(("books", 4))
| [((52, 97), 'csv.register_dialect', 'csv.register_dialect', (['"""hashes"""'], {'delimiter': '"""#"""'}), "('hashes', delimiter='#')\n", (72, 97), False, 'import csv\n'), ((150, 181), 'csv.writer', 'csv.writer', (['f'], {'dialect': '"""hashes"""'}), "(f, dialect='hashes')\n", (160, 181), False, 'import csv\n')] |
zorache/ServiceX_App | servicex/web/forms.py | 4479afa0f019bbdcd35812691e78abba442c9d37 | from typing import Optional
from flask_wtf import FlaskForm
from wtforms import StringField, SelectField, SubmitField
from wtforms.validators import DataRequired, Length, Email
from servicex.models import UserModel
class ProfileForm(FlaskForm):
name = StringField('Full Name', validators=[DataRequired(), Length(... | [((681, 708), 'wtforms.SubmitField', 'SubmitField', (['"""Save Profile"""'], {}), "('Save Profile')\n", (692, 708), False, 'from wtforms import StringField, SelectField, SubmitField\n'), ((297, 311), 'wtforms.validators.DataRequired', 'DataRequired', ([], {}), '()\n', (309, 311), False, 'from wtforms.validators import ... |
vijaykumawat256/Prompt-Summarization | data/studio21_generated/interview/1657/starter_code.py | 614f5911e2acd2933440d909de2b4f86653dc214 | def string_func(s, n):
| [] |
linye931025/FPN_Tensorflow-master | libs/export_pbs/exportPb.py | e972496a798e9d77a74ddc6062d46b152d072ce7 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
import os, sys
import tensorflow as tf
import tf_slim as slim
from tensorflow.python.tools import freeze_graph
sys.path.append('../../')
from data.io.image_preprocess import short_side_resize_for_inference_data
from libs.configs... | [((203, 228), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (218, 228), False, 'import os, sys\n'), ((646, 717), 'tensorflow.placeholder', 'tf.placeholder', ([], {'dtype': 'tf.uint8', 'shape': '[None, None, 3]', 'name': '"""input_img"""'}), "(dtype=tf.uint8, shape=[None, None, 3], name='... |
smilefreak/NaDNAP | ngadnap/command_templates/adapter_removal.py | 18354778dd896bc0ab3456ca7dbb9d194c1ebf4d | """
Adapter Removal templates
"""
# AdapterRemoval
#
# {0}: executable
# {1}: fastq1 abs
# {2}: fastq2 abs
# {3}: fastq1
# {4}: fastq2
# {5}: minimum length
# {6}: mismatch_rate
# {7}: min base uality
# {8}: min merge_length
__ADAPTER_REMOVAL__="""
{0} --collapse --file1 {1} --file2 {2} --outputstats {3}.... | [((613, 633), 'os.path.abspath', 'os.path.abspath', (['fq1'], {}), '(fq1)\n', (628, 633), False, 'import os\n'), ((645, 665), 'os.path.abspath', 'os.path.abspath', (['fq2'], {}), '(fq2)\n', (660, 665), False, 'import os\n'), ((931, 982), 'ngadnap.dependency_graph.graph.CommandNode', 'CommandNode', (['cmd', 'job_id', 'N... |
AllenJSebastian/tripleo-common | undercloud_heat_plugins/immutable_resources.py | d510a30266e002e90c358e69cb720bfdfa736134 | #
# 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
# ... | [((816, 837), 'copy.deepcopy', 'copy.deepcopy', (['schema'], {}), '(schema)\n', (829, 837), False, 'import copy\n'), ((1094, 1127), 'heat.engine.resources.openstack.neutron.net.Net.properties_schema.items', 'net.Net.properties_schema.items', ([], {}), '()\n', (1125, 1127), False, 'from heat.engine.resources.openstack.n... |
jmcph4/lm5 | lm5/input.py | cd6f480ad70a3769090eab6ac3f3d47378a965de | class Input(object):
def __init__(self, type, data):
self.__type = type
self.__data = deepcopy(data)
def __repr__(self):
return repr(self.__data)
def __str__(self):
return str(self.__type) + str(self.__data)
| [] |
DataKnower/dk-portia | slybot/setup.py | 24579c0160167af2442117975bf7d6a714b4d7d5 | from os.path import join, abspath, dirname, exists
from slybot import __version__
from setuptools import setup, find_packages
from setuptools.command.bdist_egg import bdist_egg
from setuptools.command.sdist import sdist
def build_js():
root = abspath(dirname(__file__))
base_path = abspath(join(root, '..', 'sp... | [((257, 274), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (264, 274), False, 'from os.path import join, abspath, dirname, exists\n'), ((300, 332), 'os.path.join', 'join', (['root', '""".."""', '"""splash_utils"""'], {}), "(root, '..', 'splash_utils')\n", (304, 332), False, 'from os.path import joi... |
huhuhang/yolov3 | yolov3.py | 6c254b3f453c394046381e1c00cb0908b8f97b3a | import torch
import torch.nn as nn
from .yolo_layer import *
from .yolov3_base import *
class Yolov3(Yolov3Base):
def __init__(self, num_classes=80):
super().__init__()
self.backbone = Darknet([1,2,8,8,4])
anchors_per_region = 3
self.yolo_0_pre = Yolov3UpsamplePrep([512, 1... | [((1273, 1298), 'torch.cat', 'torch.cat', (['[x, xb[-2]]', '(1)'], {}), '([x, xb[-2]], 1)\n', (1282, 1298), False, 'import torch\n'), ((1436, 1461), 'torch.cat', 'torch.cat', (['[x, xb[-3]]', '(1)'], {}), '([x, xb[-3]], 1)\n', (1445, 1461), False, 'import torch\n'), ((2705, 2727), 'torch.nn.Sequential', 'nn.Sequential'... |
CyrilLeMat/modelkit | tests/assets/test_driver_errors.py | 2150ffe78ebb00e3302dac36ccb09e66becd5130 | import os
import pytest
from modelkit.assets import errors
from tests.conftest import skip_unless
def _perform_driver_error_object_not_found(driver):
with pytest.raises(errors.ObjectDoesNotExistError):
driver.download_object("someasset", "somedestination")
assert not os.path.isfile("somedestination"... | [((494, 532), 'tests.conftest.skip_unless', 'skip_unless', (['"""ENABLE_GCS_TEST"""', '"""True"""'], {}), "('ENABLE_GCS_TEST', 'True')\n", (505, 532), False, 'from tests.conftest import skip_unless\n'), ((693, 730), 'tests.conftest.skip_unless', 'skip_unless', (['"""ENABLE_S3_TEST"""', '"""True"""'], {}), "('ENABLE_S3_... |
Jarquevious/makewiki | wiki/tests.py | a945da5ab7704042ef9d740987e23da19ec87267 | from django.test import TestCase
from django.contrib.auth.models import User
from wiki.models import Page
# Create your tests here.
def test_detail_page(self):
""" Test to see if slug generated when saving a Page."""
# Create a user and save to the database
user = User.objects.create()
user.save()
... | [((280, 301), 'django.contrib.auth.models.User.objects.create', 'User.objects.create', ([], {}), '()\n', (299, 301), False, 'from django.contrib.auth.models import User\n'), ((379, 449), 'wiki.models.Page', 'Page', ([], {'title': '"""My Detail Test Page"""', 'content': '"""details_test"""', 'author': 'user'}), "(title=... |
AJB0211/BanditSim | BanditSim/__init__.py | 5426486b40c35492049b09f9b57eb18ad5d6ce63 | from .multiarmedbandit import MultiArmedBandit
from .eps_greedy_constant_stepsize import EpsilonGreedyConstantStepsize
from .greedy_constant_stepsize import GreedyConstantStepsize
from .epsilon_greedy_average_step import EpsilonGreedyAverageStep
from .greedy_average_step import GreedyAverageStep
from .greedy_bayes_upd... | [] |
txf626/django | tests/queries/test_query.py | 95bda03f2da15172cf342f13ba8a77c007b63fbb | from datetime import datetime
from django.core.exceptions import FieldError
from django.db.models import CharField, F, Q
from django.db.models.expressions import SimpleCol
from django.db.models.fields.related_lookups import RelatedIsNull
from django.db.models.functions import Lower
from django.db.models.lookups import... | [((654, 667), 'django.db.models.sql.query.Query', 'Query', (['Author'], {}), '(Author)\n', (659, 667), False, 'from django.db.models.sql.query import Query\n'), ((968, 981), 'django.db.models.sql.query.Query', 'Query', (['Author'], {}), '(Author)\n', (973, 981), False, 'from django.db.models.sql.query import Query\n'),... |
ewanlee/mackrl | src/matrix_game/matrix_game.py | 6dd505aa09830f16c35a022f67e255db935c807e | # This notebook implements a proof-of-principle for
# Multi-Agent Common Knowledge Reinforcement Learning (MACKRL)
# The entire notebook can be executed online, no need to download anything
# http://pytorch.org/
from itertools import chain
import torch
import torch.nn.functional as F
from torch.multiprocessing import... | [((370, 395), 'torch.multiprocessing.set_start_method', 'set_start_method', (['"""spawn"""'], {}), "('spawn')\n", (386, 395), False, 'from torch.multiprocessing import Pool, set_start_method, freeze_support\n'), ((2125, 2156), 'torch.ger', 'torch.ger', (['pi_dec[0]', 'pi_dec[1]'], {}), '(pi_dec[0], pi_dec[1])\n', (2134... |
wilsonsuen/av-testing | testcases/school_bus.py | a6967b4cb4e4ad6b10d041ffd3dc62188fccad81 | import sys
import os
import glob
import json
from robot import rebot
from robot.api import TestSuite
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
if __name__ == "__main__":
main_suite = TestSuite('School Bus Scenario')
main_suite.resource.imports.library('lib/simulation.py')
testcas... | [((214, 246), 'robot.api.TestSuite', 'TestSuite', (['"""School Bus Scenario"""'], {}), "('School Bus Scenario')\n", (223, 246), False, 'from robot.api import TestSuite\n'), ((330, 377), 'glob.glob', 'glob.glob', (['"""data/testdata/04_school_bus/*.json"""'], {}), "('data/testdata/04_school_bus/*.json')\n", (339, 377), ... |
adrn/astropy-tools | pr_consistency/2.find_pr_branches.py | c26a5e4cdf8735976375dd2b77de797a7723bcd9 | # The purpose of this script is to check all the maintenance branches of the
# given repository, and find which pull requests are included in which
# branches. The output is a JSON file that contains for each pull request the
# list of all branches in which it is included. We look specifically for the
# message "Merge ... | [((883, 916), 'os.path.basename', 'os.path.basename', (['REPOSITORY_NAME'], {}), '(REPOSITORY_NAME)\n', (899, 916), False, 'import os\n'), ((933, 951), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (949, 951), False, 'import tempfile\n'), ((1129, 1149), 'os.path.abspath', 'os.path.abspath', (['"""."""'], {}... |
pedMatias/matias_hfo | agents/solo_q_agents/q_agent_test/aux.py | 6d88e1043a1455f5c1f6cc11b9380869772f4176 | from datetime import datetime as dt
import os
import numpy as np
import settings
def mkdir():
now = dt.now().replace(second=0, microsecond=0)
name_dir = "q_agent_train_" + now.strftime("%Y-%m-%d_%H:%M:%S")
path = os.path.join(settings.MODELS_DIR, name_dir)
try:
os.mkdir(path)
except File... | [((229, 272), 'os.path.join', 'os.path.join', (['settings.MODELS_DIR', 'name_dir'], {}), '(settings.MODELS_DIR, name_dir)\n', (241, 272), False, 'import os\n'), ((536, 570), 'os.path.join', 'os.path.join', (['directory', 'file_name'], {}), '(directory, file_name)\n', (548, 570), False, 'import os\n'), ((575, 602), 'num... |
AXFS-H/Windows10Debloater | Python38/Lib/site-packages/PyInstaller/hooks/hook-PyQt4.py | ab5f8a8a8fb065bb40b7ddbd1df75563d8b8d13e | #-----------------------------------------------------------------------------
# Copyright (c) 2013-2020, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt... | [((985, 1009), 'os.path.join', 'os.path.join', (['x', '"""PyQt4"""'], {}), "(x, 'PyQt4')\n", (997, 1009), False, 'import os\n'), ((1268, 1292), 'PyInstaller.utils.hooks.qt_menu_nib_dir', 'qt_menu_nib_dir', (['"""PyQt4"""'], {}), "('PyQt4')\n", (1283, 1292), False, 'from PyInstaller.utils.hooks import qt_menu_nib_dir\n'... |
ig248/timeserio | timeserio/utils/functools.py | afc2a953a83e763418d417059493ef13a17d349c | import inspect
def get_default_args(func):
"""Get default arguments of a function.
"""
signature = inspect.signature(func)
return {
k: v.default
for k, v in signature.parameters.items()
if v.default is not inspect.Parameter.empty
}
| [((113, 136), 'inspect.signature', 'inspect.signature', (['func'], {}), '(func)\n', (130, 136), False, 'import inspect\n')] |
PauloAlexSilva/Python | Sec_10_expr_lambdas_fun_integradas/a_lambdas.py | 690913cdcfd8bde52d9ddd15e3c838e6aef27730 | """
Utilizando Lambdas
Conhecidas por Expressões Lambdas, ou simplesmente Lambdas, são funções sem nome, ou seja,
funções anónimas.
# Função em Python
def funcao(x):
return 3 * x + 1
print(funcao(4))
print(funcao(7))
# Expressão Lambda
lambda x: 3 * x + 1
# Como utlizar a expressão lambda?
calc = lambda x... | [] |
EduotavioFonseca/ProgramasPython | ex085.py | 8e0ef5f6f4239d1fe52321f8795b6573f6ff5130 | # Lista dentro de dicionário
campeonato = dict()
gol = []
aux = 0
campeonato['Jogador'] = str(input('Digite o nome do jogador: '))
print()
partidas = int(input('Quantas partidas ele jogou? '))
print()
for i in range(0, partidas):
aux = int(input(f'Quantos gols na partida {i + 1}? '))
gol.append(aux)
... | [] |
kjetil-lye/ismo_heat | heat/initial_data.py | 09776b740a0543e270417af653d2a047c94f1b50 | import numpy
class InitialDataControlSine:
def __init__(self, coefficients):
self.coefficients = coefficients
def __call__(self, x):
u = numpy.zeros_like(x)
for k, coefficient in enumerate(self.coefficients):
u += coefficient * numpy.sin(k * numpy.pi * x)
return... | [((164, 183), 'numpy.zeros_like', 'numpy.zeros_like', (['x'], {}), '(x)\n', (180, 183), False, 'import numpy\n'), ((277, 304), 'numpy.sin', 'numpy.sin', (['(k * numpy.pi * x)'], {}), '(k * numpy.pi * x)\n', (286, 304), False, 'import numpy\n'), ((440, 467), 'numpy.sin', 'numpy.sin', (['(k * numpy.pi * x)'], {}), '(k * ... |
john18/uccross.github.io | explore/scripts/get_repos_creationhistory.py | 72cd88c7310ab1503467fba27add2338cf57d8f7 | import helpers
import json
import re
datfilepath = "../github-data/labRepos_CreationHistory.json"
allData = {}
# Check for and read existing data file
allData = helpers.read_existing(datfilepath)
# Read repo info data file (to use as repo list)
dataObj = helpers.read_json("../github-data/labReposInfo.json")
# Popul... | [((163, 197), 'helpers.read_existing', 'helpers.read_existing', (['datfilepath'], {}), '(datfilepath)\n', (184, 197), False, 'import helpers\n'), ((258, 311), 'helpers.read_json', 'helpers.read_json', (['"""../github-data/labReposInfo.json"""'], {}), "('../github-data/labReposInfo.json')\n", (275, 311), False, 'import ... |
tomaszjonak/PBL | examples/test/runMe.py | 738b95da52cd59dcacb0b9dc244ca1713b0264ac | #! /usr/bin/env python2.7
from __future__ import print_function
import sys
sys.path.append("../../include")
import PyBool_public_interface as Bool
if __name__ == "__main__":
expr = Bool.parse_std("input.txt")
expr = expr["main_expr"]
expr = Bool.simplify(expr)
expr = Bool.nne(expr)
print(Bo... | [((78, 110), 'sys.path.append', 'sys.path.append', (['"""../../include"""'], {}), "('../../include')\n", (93, 110), False, 'import sys\n'), ((191, 218), 'PyBool_public_interface.parse_std', 'Bool.parse_std', (['"""input.txt"""'], {}), "('input.txt')\n", (205, 218), True, 'import PyBool_public_interface as Bool\n'), ((2... |
rupen4678/botique_management_system | calculator.py | 9b7807cc28bb15e024093d6161a8fef96ce7e291 | from tkinter import *
import random
import time
from PIL import Image
from datetime import datetime
from tinydb import *
import os
import pickle
#from database1 import *
from random import randint
root = Tk()
root.geometry("1600x800+0+0")
root.title("Suman_dai_ko_DHOKAN")
root.configure(bg="goldenrod4")
text_Input =... | [((1675, 1689), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1687, 1689), False, 'from datetime import datetime\n'), ((2195, 2220), 'os.path.isfile', 'os.path.isfile', (['file_name'], {}), '(file_name)\n', (2209, 2220), False, 'import os\n'), ((891, 902), 'time.time', 'time.time', ([], {}), '()\n', (900,... |
Lanselott/mmdetection | mmdet/models/anchor_heads/embedding_nnms_head_v2_limited.py | 03ce0a87f4d52f4adf4f78fd39ad30b2da394376 | import torch
import torch.nn as nn
from mmcv.cnn import normal_init
from mmdet.core import distance2bbox, force_fp32, multi_apply, multiclass_nms, bbox_overlaps
from ..builder import build_loss
from ..registry import HEADS
from ..utils import ConvModule, Scale, bias_init_with_prob
from IPython import embed
INF = 1e8
... | [((5325, 5374), 'mmdet.core.force_fp32', 'force_fp32', ([], {'apply_to': "('cls_scores', 'bbox_preds')"}), "(apply_to=('cls_scores', 'bbox_preds'))\n", (5335, 5374), False, 'from mmdet.core import distance2bbox, force_fp32, multi_apply, multiclass_nms, bbox_overlaps\n'), ((11008, 11057), 'mmdet.core.force_fp32', 'force... |
Haehnchen/trivago-firefly | firefly_flask/app/models.py | ee92450fda42059f1865971849dc234a42dc9027 | from . import db
from sqlalchemy.dialects.mysql import LONGTEXT
class Search(db.Model):
__tablename__ = 'spots'
id = db.Column(db.Integer, primary_key=True)
search_string = db.Column(db.Text)
lat = db.Column(db.Float)
lon = db.Column(db.Float)
location_name = db.Column(db.Text)
json_result ... | [] |
HarishOsthe/Plotly_Dash_Practice_Codes | plotly_basic_plots/line_chart2.py | ca709509d27803a4d727b3986d4473cdd71a41a6 | import pandas as pd
import numpy as np
import plotly.offline as pyo
import plotly.graph_objs as go
df= pd.read_csv("Data/nst-est2017-alldata.csv")
df2=df[df["DIVISION"] == '1']
df2.set_index("NAME",inplace=True)
list_of_pop_col=[col for col in df2.columns if col.startswith('POP')]
df2=df2[list_of_pop_col]
data=[go.... | [((105, 148), 'pandas.read_csv', 'pd.read_csv', (['"""Data/nst-est2017-alldata.csv"""'], {}), "('Data/nst-est2017-alldata.csv')\n", (116, 148), True, 'import pandas as pd\n'), ((457, 471), 'plotly.offline.plot', 'pyo.plot', (['data'], {}), '(data)\n', (465, 471), True, 'import plotly.offline as pyo\n'), ((317, 384), 'p... |
samdoran/sphinx | tests/test_markup.py | 4c91c038b220d07bbdfe0c1680af42fe897f342c | """
test_markup
~~~~~~~~~~~
Test various Sphinx-specific markup extensions.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
import pytest
from docutils import frontend, nodes, utils
from docutils.parsers.rst import Parser as ... | [((4460, 10878), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""type,rst,html_expected,latex_expected"""', '[(\'verify\', \':pep:`8`\',\n \'<p><span class="target" id="index-0"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-0008"><strong>PEP 8</strong></a></p>\'\n ,... |
CrankySupertoon01/Toontown-2 | dev/tools/leveleditor/direct/showbase/ContainerLeakDetector.py | 60893d104528a8e7eb4aced5d0015f22e203466d | from pandac.PandaModules import PStatCollector
from direct.directnotify.DirectNotifyGlobal import directNotify
from direct.showbase.PythonUtil import Queue, invertDictLossless, makeFlywheelGen
from direct.showbase.PythonUtil import itype, serialNum, safeRepr, fastRepr
from direct.showbase.Job import Job
import types, w... | [] |
mzazakeith/flask-blog | virtual/lib/python3.6/site-packages/sqlalchemy/sql/default_comparator.py | 2833404cc5e96ffdbfb767f35b9caf2bdcce7997 | # sql/default_comparator.py
# Copyright (C) 2005-2018 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Default implementation of SQL comparison operations.
"""
from .. impor... | [] |
klharshini/recipe-django-api | recipes/serializers.py | 7ceb00ab26f6e0d19196519ece297d2f4d616a5d | from django.contrib.auth.validators import UnicodeUsernameValidator
from rest_framework import serializers
from django.contrib.auth.models import User
from recipes.models import Recipe, Ingredient, Step
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ("usernam... | [((1216, 1257), 'django.contrib.auth.models.User.objects.get_by_natural_key', 'User.objects.get_by_natural_key', (['username'], {}), '(username)\n', (1247, 1257), False, 'from django.contrib.auth.models import User\n'), ((1275, 1325), 'recipes.models.Recipe.objects.create', 'Recipe.objects.create', ([], {'user': 'user'... |
jcwon0/BlurHPE | tests/test_model/test_temporal_regression_head.py | c97a57e92a8a7f171b0403aee640222a32513562 | import numpy as np
import pytest
import torch
from mmpose.models import TemporalRegressionHead
def test_temporal_regression_head():
"""Test temporal head."""
head = TemporalRegressionHead(
in_channels=1024,
num_joints=17,
loss_keypoint=dict(type='MPJPELoss', use_target_wei... | [((1215, 1266), 'numpy.testing.assert_almost_equal', 'np.testing.assert_almost_equal', (["acc['p_mpjpe']", '(0.0)'], {}), "(acc['p_mpjpe'], 0.0)\n", (1245, 1266), True, 'import numpy as np\n'), ((1568, 1597), 'numpy.random.random', 'np.random.random', (['input_shape'], {}), '(input_shape)\n', (1584, 1597), True, 'impor... |
gfhuertac/coding_dojo_python | django_orm/sports_orm/leagues/migrations/0002_auto_20161031_1620.py | 4d17bb63fb2b9669216a0f60326d4a4b9055af7e | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-31 23:20
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('leagues', '0001_initial'),
]
operations = [
migrations.RenameField(
mod... | [((281, 360), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""team"""', 'old_name': '"""city"""', 'new_name': '"""location"""'}), "(model_name='team', old_name='city', new_name='location')\n", (303, 360), False, 'from django.db import migrations\n')] |
Tanych/CodeTracking | 353-Design-Snake-Game/solution.py | 86f1cb98de801f58c39d9a48ce9de12df7303d20 | class SnakeGame(object):
def __init__(self, width,height,food):
"""
Initialize your data structure here.
@param width - screen width
@param height - screen height
@param food - A list of food positions
E.g food = [[1,1], [1,0]] means the first food is positioned at ... | [] |
jessebrennan/azul | scripts/register_sam.py | 65970a0947f38fae439a3bf8fd960d351787b7a3 | from itertools import (
chain,
)
import logging
from azul import (
config,
require,
)
from azul.logging import (
configure_script_logging,
)
from azul.terra import (
TDRClient,
TDRSourceName,
)
log = logging.getLogger(__name__)
def main():
configure_script_logging(log)
tdr = TDRClien... | [((226, 253), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (243, 253), False, 'import logging\n'), ((272, 301), 'azul.logging.configure_script_logging', 'configure_script_logging', (['log'], {}), '(log)\n', (296, 301), False, 'from azul.logging import configure_script_logging\n'), ((312... |
StamKaly/altitude-mod-foundation | altitude/players.py | 403befeba7d0e2e6afe3897081cd3e01f438e3d5 | class Player:
def __init__(self, nickname, vapor_id, player_id, ip):
self.nickname = nickname
self.vapor_id = vapor_id
self.player_id = player_id
self.ip = ip
self.not_joined = True
self.loads_map = True
self.joined_after_change_map = True
class Players:
... | [] |
expressionsofchange/nerf0 | dsn/editor/construct.py | 788203619fc89c92e8c7301d62bbc4f1f4ee66e1 | """
Tools to "play notes for the editor clef", which may be thought of as "executing editor commands".
NOTE: in the below, we often connect notes together "manually", i.e. using NoteSlur(..., previous_hash). As an
alternative, we could consider `nouts_for_notes`.
"""
from s_address import node_for_s_address, s_dfs
f... | [((13392, 13446), 's_address.node_for_s_address', 'node_for_s_address', (['structure.tree', 'source_parent_path'], {}), '(structure.tree, source_parent_path)\n', (13410, 13446), False, 'from s_address import node_for_s_address, s_dfs\n'), ((13468, 13522), 's_address.node_for_s_address', 'node_for_s_address', (['structu... |
richtong/pytong | src/pytong/base.py | 6ff07a1bdf1d5e2232bfc102cce2dd74783bb111 | """Base for all Classes.
Base mainly includes the description fields
"""
import logging
from typing import Optional
from .log import Log # type: ignore
class BaseLog:
"""
Set a base logging.
Use this as the base class for all your work. This adds a logging root.
"""
def __init__(self, log_roo... | [((563, 590), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (580, 590), False, 'import logging\n')] |
GuillaumeFalourd/poc-subprocess | subprocess-10.py | 8f014a709ac2e471092d4ea1f61f1a9ff65ff571 | import subprocess
import re
programs = input('Separe the programs with a space: ').split()
secure_pattern = '[\w\d]'
for program in programs:
if not re.match(secure_pattern, program):
print("Sorry we can't check that program")
continue
process = subprocess. run(
['which', program],... | [((276, 342), 'subprocess.run', 'subprocess.run', (["['which', program]"], {'capture_output': '(True)', 'text': '(True)'}), "(['which', program], capture_output=True, text=True)\n", (290, 342), False, 'import subprocess\n'), ((157, 190), 're.match', 're.match', (['secure_pattern', 'program'], {}), '(secure_pattern, pro... |
vo0doO/pydj-persweb | authentication/socialaccount/forms.py | efcd6b7090230f7c0b9ec056008f6d1d9e876ed9 | from __future__ import absolute_import
from django import forms
from authentication.account.forms import BaseSignupForm
from . import app_settings, signals
from .adapter import get_adapter
from .models import SocialAccount
class SignupForm(BaseSignupForm):
def __init__(self, *args, **kwargs):
self.soc... | [] |
nilsbeck/pytheos | pytheos/pytheos.py | de4f3a03330ddb28e68ddcaa7b4888ea9a25e238 | #!/usr/bin/env python
""" Provides the primary interface into the library """
from __future__ import annotations
import asyncio
import logging
from typing import Callable, Optional, Union
from . import utils
from . import controllers
from .networking.connection import Connection
from .networking.types import SSDPRes... | [((467, 495), 'logging.getLogger', 'logging.getLogger', (['"""pytheos"""'], {}), "('pytheos')\n", (484, 495), False, 'import logging\n'), ((1828, 1843), 'asyncio.Queue', 'asyncio.Queue', ([], {}), '()\n', (1841, 1843), False, 'import asyncio\n'), ((8845, 8871), 'asyncio.get_running_loop', 'asyncio.get_running_loop', ([... |
FelixLuciano/DesSoft-2020.2 | source/188-Lista_celulares.py | a44063d63778329f1e1266881f20f7954ecb528b | # Lista celulares
# O departamento de marketing da sua empresa está interessado em obter apenas os números de telefone celular, separando-os dos telefones fixos. Para simplificar esta operação serão considerados números de celular apenas aqueles que, após o código de área, iniciarem com o dígito adicional 9.
# Você rec... | [] |
1goodday/Google-Dictionary-Pronunciation.ankiaddon | test_modules/language_dictionary_test.py | 35837802e41d81733aec656fbf4ad1c8e4aeec5e | import csv
_iso_639_1_codes_file = open("files/ISO-639-1_Codes.csv", mode='r')
_iso_639_1_codes_dictreader = csv.DictReader(_iso_639_1_codes_file)
_iso_639_1_codes_dict: dict = {}
for _row in _iso_639_1_codes_dictreader:
_iso_639_1_codes_dict[_row['ISO-639-1 Code']] = _row['Language']
print(str(_iso_639_1_codes_... | [((110, 147), 'csv.DictReader', 'csv.DictReader', (['_iso_639_1_codes_file'], {}), '(_iso_639_1_codes_file)\n', (124, 147), False, 'import csv\n')] |
DZ9/tianshou | tianshou/data/collector.py | 04208e6cce722b7a2353d9a5f4d6f0fc05797d67 | import time
import torch
import warnings
import numpy as np
from tianshou.env import BaseVectorEnv
from tianshou.data import Batch, ReplayBuffer,\
ListReplayBuffer
from tianshou.utils import MovAvg
class Collector(object):
"""docstring for Collector"""
def __init__(self, policy, env, buffer=None, stat_si... | [((1660, 1677), 'tianshou.utils.MovAvg', 'MovAvg', (['stat_size'], {}), '(stat_size)\n', (1666, 1677), False, 'from tianshou.utils import MovAvg\n'), ((1707, 1724), 'tianshou.utils.MovAvg', 'MovAvg', (['stat_size'], {}), '(stat_size)\n', (1713, 1724), False, 'from tianshou.utils import MovAvg\n'), ((2961, 2972), 'time.... |
henriquebraga/drink-partners | drink_partners/partners/tests/views/test_search_partner_view.py | 4702263ae3e43ea9403cff5a72b68245d61880c7 | from drink_partners.contrib.samples import partner_bar_legal
class TestSearchPartner:
async def test_should_return_bad_request_for_str_coordinates(
self,
client,
partner_search_with_str_coordinates_url
):
async with client.get(partner_search_with_str_coordinates_url) as respon... | [((995, 1014), 'drink_partners.contrib.samples.partner_bar_legal', 'partner_bar_legal', ([], {}), '()\n', (1012, 1014), False, 'from drink_partners.contrib.samples import partner_bar_legal\n')] |
ysh329/Titanic-Machine-Learning-from-Disaster | Titanic/class_create_model_of_logistic_regression.py | d2ba330625e40b648b2946a8ca221198af148368 | # -*- coding: utf-8 -*-
# !/usr/bin/python
################################### PART0 DESCRIPTION #################################
# Filename: class_create_model_of_logistic_regression.py
# Description:
#
# Author: Shuai Yuan
# E-mail: ysh329@sina.com
# Create: 2016-01-23 23:32:49
# Last:
__author__ = 'yuens'
######... | [] |
mje-nz/mjecv | mjecv/io/base.py | 9a02c005a0abc7d21594f65c348cfe5185c90184 | import multiprocessing
from typing import List, Optional
import numpy as np
from ..util import dill_for_apply
class ImageSequenceWriter:
def __init__(self, pattern, writer, *, max_index=None):
if type(pattern) is not str:
raise ValueError("Pattern must be string")
if pattern.format(1... | [((1543, 1579), 'multiprocessing.get_context', 'multiprocessing.get_context', (['"""spawn"""'], {}), "('spawn')\n", (1570, 1579), False, 'import multiprocessing\n'), ((1497, 1524), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (1522, 1524), False, 'import multiprocessing\n')] |
gengwg/leetcode | 377_combination_sum_iv.py | 0af5256ec98149ef5863f3bba78ed1e749650f6e | # 377 Combination Sum IV
# Given an integer array with all positive numbers and no duplicates,
# find the number of possible combinations that add up to a positive integer target.
#
# Example:
#
# nums = [1, 2, 3]
# target = 4
#
# The possible combination ways are:
# (1, 1, 1, 1)
# (1, 1, 2)
# (1, 2, 1)
# (1, 3)
# (2,... | [] |
koeleck/conan-packages | nvidia-texture-tools/conanfile.py | da43e82c2444e934e69a38e524998d028f8edcc3 | from conans import ConanFile, CMake, tools
import os
STATIC_LIBS = ["nvtt", "squish", "rg_etc1", "nvimage", "bc6h", "posh",
"bc7", "nvmath", "nvthread", "nvcore"]
SHARED_LIBS = ["nvtt", "nvimage", "nvthread", "nvmath", "nvcore"]
class NvidiatexturetoolsConan(ConanFile):
name = "nvidia-texture-tools... | [((1255, 1269), 'conans.tools.get', 'tools.get', (['url'], {}), '(url)\n', (1264, 1269), False, 'from conans import ConanFile, CMake, tools\n'), ((1616, 1627), 'conans.CMake', 'CMake', (['self'], {}), '(self)\n', (1621, 1627), False, 'from conans import ConanFile, CMake, tools\n'), ((2993, 3017), 'conans.tools.collect_... |
MyWay/Create-Your-Own-Image-Classifier | train_args.py | 70e5744084435af8a74b2cfe2098c25b0745c9af | #!/usr/bin/env python3
""" train_args.py
train_args.py command-line args.
"""
import argparse
def get_args():
"""
"""
parser = argparse.ArgumentParser(
description="This script lets you train and save your model.",
usage="python3 train.py flowers/train --gpu --learning_rate 0.001 --epochs... | [((142, 404), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""This script lets you train and save your model."""', 'usage': '"""python3 train.py flowers/train --gpu --learning_rate 0.001 --epochs 11 --gpu --hidden_units 500"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}... |
canadiyaman/thetask | apps/payment/views.py | 0f1cea1d8eea4966138ef0bdc303a53e3511e57d | from django.http import HttpResponseRedirect
from django.conf import settings
from django.views.generic import TemplateView
from apps.payment.models import PaymentLog
from apps.payment.stripe import get_token, get_payment_charge
from apps.subscription.views import start_subscription
class ChargeView(TemplateView):
... | [((1435, 1482), 'apps.payment.models.PaymentLog.objects.create', 'PaymentLog.objects.create', ([], {'user': 'user', 'data': 'data'}), '(user=user, data=data)\n', (1460, 1482), False, 'from apps.payment.models import PaymentLog\n'), ((1111, 1126), 'apps.payment.stripe.get_token', 'get_token', (['card'], {}), '(card)\n',... |
srinidhibhat/booknotes | users/apps.py | 666f92fac309b97c13b79e91f5493220f934cab3 | from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'users'
# below piece of code is needed for automatic profile creation for user
def ready(self):
import users.signals
| [] |
HumanBrainProject/secure-data-store | secure_data_store/cli.py | 69b615cf979fc08f4ae8474ca9cd3e6d2f04b7f0 | # -*- coding: utf-8 -*-
"""Console script for secure_data_store."""
import click
from . import secure_data_store as sds
CONFIG='~/.sdsrc'
@click.group()
def main():
"""Wrapper for GoCryptFS"""
@main.command()
@click.argument('name')
@click.option('--config', help='Path to config file', default='~/.sdsrc')
def cr... | [((141, 154), 'click.group', 'click.group', ([], {}), '()\n', (152, 154), False, 'import click\n'), ((217, 239), 'click.argument', 'click.argument', (['"""name"""'], {}), "('name')\n", (231, 239), False, 'import click\n'), ((241, 313), 'click.option', 'click.option', (['"""--config"""'], {'help': '"""Path to config fil... |
marient/PelePhysics | Support/Fuego/Pythia/pythia-0.4/packages/pyre/pyre/graph/Node.py | e6ad1839d77b194e09ab44ff850c9489652e5d81 | #!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Michael A.G. Aivazis
# California Institute of Technology
# (C) 1998-2003 All Rights Reserved
#
# <LicenseText>
#
# ~~~~~~~~~~~~~~~~~... | [((632, 655), 'Drawable.Drawable.__init__', 'Drawable.__init__', (['self'], {}), '(self)\n', (649, 655), False, 'from Drawable import Drawable\n')] |
RachelLar/cairis_update | cairis/gui/RiskScatterPanel.py | 0b1d6d17ce49bc74887d1684e28c53c1b06e2fa2 | # 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 under the Apache License, Version 2.0 (the
# "License"); you may... | [((932, 955), 'matplotlib.use', 'matplotlib.use', (['"""WXAgg"""'], {}), "('WXAgg')\n", (946, 955), False, 'import matplotlib\n'), ((1619, 1666), 'wx.Panel.__init__', 'wx.Panel.__init__', (['self', 'parent', 'RISKSCATTER_ID'], {}), '(self, parent, RISKSCATTER_ID)\n', (1636, 1666), False, 'import wx\n'), ((1673, 1679), ... |
aangelisc/pulumi-azure | sdk/python/pulumi_azure/containerservice/get_registry.py | 71dd9c75403146e16f7480e5a60b08bc0329660e | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | [((2853, 2887), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""adminEnabled"""'}), "(name='adminEnabled')\n", (2866, 2887), False, 'import pulumi\n'), ((3092, 3127), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""adminPassword"""'}), "(name='adminPassword')\n", (3105, 3127), False, 'import pulumi\n'), ((3368,... |
TimWhalen/graphite-web | contrib/memcache_whisper.py | e150af45e01d01141a8767ec0597e218105b9914 | #!/usr/bin/env python
# Copyright 2008 Orbitz WorldWide
#
# 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 ... | [((1279, 1306), 'struct.calcsize', 'struct.calcsize', (['longFormat'], {}), '(longFormat)\n', (1294, 1306), False, 'import os, struct, time\n'), ((1338, 1366), 'struct.calcsize', 'struct.calcsize', (['floatFormat'], {}), '(floatFormat)\n', (1353, 1366), False, 'import os, struct, time\n'), ((1406, 1438), 'struct.calcsi... |
showtimesynergy/mojify | main.py | 8c012730b9f56d6e7e2003e8db99669516f4e027 | from PIL import Image
import csv
from ast import literal_eval as make_tuple
from math import sqrt
import argparse
import os.path
def load_img(image):
# load an image as a PIL object
im = Image.open(image).convert('RGBA')
return im
def color_distance(c_tuple1, c_tuple2):
# calculate the color distanc... | [((653, 664), 'math.sqrt', 'sqrt', (['delta'], {}), '(delta)\n', (657, 664), False, 'from math import sqrt\n'), ((1960, 2029), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Represent an image using emoji"""'}), "(description='Represent an image using emoji')\n", (1983, 2029), False, 'im... |
umr-bot/sliding-puzzle-solver-bot | venv/lib/python3.7/site-packages/Xlib/ext/xinput.py | 826532a426f343bcc66034b241a42b3bd864e07c | # Xlib.ext.xinput -- XInput extension module
#
# Copyright (C) 2012 Outpost Embedded, LLC
# Forest Bond <forest.bond@rapidrollout.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software... | [((5964, 5986), 'Xlib.protocol.rq.LengthOf', 'rq.LengthOf', (['"""mask"""', '(2)'], {}), "('mask', 2)\n", (5975, 5986), False, 'from Xlib.protocol import rq\n'), ((6813, 6830), 'Xlib.protocol.rq.Card16', 'rq.Card16', (['"""type"""'], {}), "('type')\n", (6822, 6830), False, 'from Xlib.protocol import rq\n'), ((6837, 685... |
tigerwlin/vel | vel/notebook/__init__.py | 00e4fbb7b612e888e2cbb5d8455146664638cd0b | from .loader import load | [] |
rayhanrock/django-yourjobaid-api | YourJobAidApi/migrations/0019_remove_category_count_post.py | 17751dac5a298998aeecf7a70b79792f8311b9b2 | # Generated by Django 3.0.4 on 2020-04-16 23:10
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('YourJobAidApi', '0018_category_count_post'),
]
operations = [
migrations.RemoveField(
model_name='category',
name='count_post... | [((233, 297), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""category"""', 'name': '"""count_post"""'}), "(model_name='category', name='count_post')\n", (255, 297), False, 'from django.db import migrations\n')] |
CharlieZhao95/easy-quant | easyquant/login/__init__.py | 9df126433e27d92eced9b087e581b5fd66c5a400 | # @Time : 2022/1/26 23:07
# @Author : zhaoyu
# @Site :
# @File : __init__.py.py
# @Software: PyCharm
# @Note : xx | [] |
DowneyTung/saleor | tests/api/test_attributes.py | 50f299d8e276b594753ee439d9e1a212f85a91b1 | from typing import Union
from unittest import mock
import graphene
import pytest
from django.core.exceptions import ValidationError
from django.db.models import Q
from django.template.defaultfilters import slugify
from graphene.utils.str_converters import to_camel_case
from saleor.core.taxes import zero_money
from sa... | [((5264, 5314), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""is_staff"""', '(False, True)'], {}), "('is_staff', (False, True))\n", (5287, 5314), False, 'import pytest\n'), ((11645, 11709), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""test_deprecated_filter"""', '[True, False]'], {}), "('te... |
rafacm/aws-serverless-workshop-innovator-island | 3-photos/1-chromakey/app.py | 3f982ef6f70d28dfdc4e1d19103c181609b06b08 | import os
import json
import cv2
import logging
import boto3
import botocore
s3 = boto3.client('s3')
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def upload_file(file_name, bucket, object_name=None):
"""Upload a file to an S3 bucket
:param file_name: File to upload
:param bucket: Bucket to ... | [((83, 101), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (95, 101), False, 'import boto3\n'), ((111, 130), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (128, 130), False, 'import logging\n'), ((2619, 2652), 'cv2.imread', 'cv2.imread', (['local_input_temp_file'], {}), '(local_input_tem... |
DEKHTIARJonathan/pyinstrument | metrics/overflow.py | cc4f3f6fc1b493d7cd058ecf41ad012e0030a512 | from pyinstrument import Profiler
p = Profiler(use_signal=False)
p.start()
def func(num):
if num == 0:
return
b = 0
for x in range(1,100000):
b += x
return func(num - 1)
func(900)
p.stop()
print(p.output_text())
with open('overflow_out.html', 'w') as f:
f.write(p.output_html(... | [((39, 65), 'pyinstrument.Profiler', 'Profiler', ([], {'use_signal': '(False)'}), '(use_signal=False)\n', (47, 65), False, 'from pyinstrument import Profiler\n')] |
wawang621/optee_os | scripts/gen_tee_bin.py | bf7298044beca7a4501ece95c6146b5987cecaa4 | #!/usr/bin/env python3
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2019, Linaro Limited
#
from __future__ import print_function
from __future__ import division
import argparse
import sys
import struct
import re
import hashlib
try:
from elftools.elf.elffile import ELFFile
from elftools.elf.consta... | [((1428, 1439), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1436, 1439), False, 'import sys\n'), ((11109, 11134), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (11132, 11134), False, 'import argparse\n'), ((12419, 12438), 'elftools.elf.elffile.ELFFile', 'ELFFile', (['args.input'], {}), '(... |
gamblor21/Adafruit_Learning_System_Guides | CircuitPython_JEplayer_mp3/repeat.py | f5dab4a758bc82d0bfc3c299683fe89dc093912a | # The MIT License (MIT)
#
# Copyright (c) 2020 Jeff Epler for Adafruit Industries LLC
#
# 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 r... | [((1718, 1737), 'time.monotonic_ns', 'time.monotonic_ns', ([], {}), '()\n', (1735, 1737), False, 'import time\n')] |
Geralonx/Classes_Tutorial | Kapitel_1/_1_public_private.py | 9499db8159efce1e3c38975b66a9c649631c6727 | # --- Klassendeklaration mit Konstruktor --- #
class PC:
def __init__(self, cpu, gpu, ram):
self.cpu = cpu
self.gpu = gpu
self.__ram = ram
# --- Instanziierung einer Klasse ---#
# --- Ich bevorzuge die Initialisierung mit den Keywords --- #
pc_instanz = PC(cpu='Ryzen 7', gpu='RTX2070Super'... | [] |
delaanthonio/hackerrank | algorithm/dynamic_programming/coin_change/solution.py | b1f2e1e93b3260be90eb3b8cb8e86e9a700acf27 | #!/usr/bin/env python3
"""
The Coin Change Problem
:author: Dela Anthonio
:hackerrank: https://hackerrank.com/delaanthonio
:problem: https://www.hackerrank.com/challenges/coin-change/problem
"""
from typing import List
def count_ways(amount: int, coins: List[int]) -> int:
"""Return the number of ways we can cou... | [] |
javawolfpack/ClimbProject | climbproject/climbapp/admin.py | 508cf822a1eb0b78f7120a3d469ceb65e3b423f7 | from django.contrib import admin
#from .models import *
from . import models
# Register your models here.
admin.site.register(models.ClimbModel)
| [((108, 146), 'django.contrib.admin.site.register', 'admin.site.register', (['models.ClimbModel'], {}), '(models.ClimbModel)\n', (127, 146), False, 'from django.contrib import admin\n')] |
TheMagicNacho/artemis-nozzle | setup.py | 5c02672feb7b437a4ff0ccc45394de3010bcd5ab | # coding: utf-8
from runpy import run_path
from setuptools import setup
# Get the version from the relevant file
d = run_path('skaero/version.py')
__version__ = d['__version__']
setup(
name="scikit-aero",
version=__version__,
description="Aeronautical engineering calculations in Python.",
author="Juan... | [((118, 147), 'runpy.run_path', 'run_path', (['"""skaero/version.py"""'], {}), "('skaero/version.py')\n", (126, 147), False, 'from runpy import run_path\n')] |
royqh1979/programming_with_python | appendix/AI.by.Search/backtracking.search/3-1.eight.queens.py | 7e1e8f88381151b803b6ae6ebda9809d9cc6664a | """
8皇后问题
使用栈实现回溯法
"""
def print_board(n,count):
print(f"------解.{count}------")
print(" ",end="")
for j in range(n):
print(f"{j:<2}" ,end="")
print()
for i in range(1,n+1):
print(f"{i:<2}",end="")
for j in range(1,n+1):
if queens[i] == j:
print("Q ",end="")
else:
print(" ",end="")
print... | [] |
amzn/multimodal-affinities | multimodal_affinities/evaluation/analysis/plots_producer.py | 23045eb6a9387ce0c9c6f5a15227cf1cc4282626 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: CC-BY-4.0
import os
import cv2
from collections import namedtuple
import imageio
from PIL import Image
from random import randrange
import numpy as np
from sklearn.decomposition import PCA
from scipy.spatial.distance import... | [((370, 391), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (384, 391), False, 'import matplotlib\n'), ((939, 966), 'matplotlib.pyplot.imread', 'plt.imread', (['self.image_path'], {}), '(self.image_path)\n', (949, 966), True, 'import matplotlib.pyplot as plt\n'), ((993, 1020), 'cv2.imread', 'cv2... |
Jgorsick/Advocacy_Angular | openstates/openstates-master/openstates/de/legislators.py | 8906af3ba729b2303880f319d52bce0d6595764c | import re
import lxml.html
from openstates.utils import LXMLMixin
from billy.scrape.legislators import LegislatorScraper, Legislator
class DELegislatorScraper(LegislatorScraper,LXMLMixin):
jurisdiction = 'de'
def scrape(self, chamber, term):
url = {
'upper': 'http://legis.delaware.gov/l... | [((2963, 3017), 'billy.scrape.legislators.Legislator', 'Legislator', (['term', 'chamber', 'district', 'name'], {'party': 'party'}), '(term, chamber, district, name, party=party)\n', (2973, 3017), False, 'from billy.scrape.legislators import LegislatorScraper, Legislator\n'), ((1858, 1880), 're.compile', 're.compile', (... |
gmftbyGMFTBY/SimpleReDial-v1 | simpleredial/dataloader/fine_grained_test_dataloader.py | f45b8eb23d1499ec617b4cc4f417d83d8f2b6bde | from header import *
from .utils import *
from .util_func import *
'''Only for Testing'''
class FineGrainedTestDataset(Dataset):
def __init__(self, vocab, path, **args):
self.args = args
self.vocab = vocab
self.vocab.add_tokens(['[EOS]'])
self.pad = self.vocab.convert_tokens_... | [] |
SvajkaJ/dabing | dabing/DABING-MIB.py | 8ddd8c1056b182b52f76028e23cd2ba8418a0dec | #
# PySNMP MIB module DABING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file://..\DABING-MIB.mib
# Produced by pysmi-0.3.4 at Tue Mar 22 12:53:47 2022
# On host ? platform ? version ? by user ?
# Using Python version 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (Intel)]
#
OctetString, Objec... | [] |
kharris/allen-voxel-network | parameter_setup/run_setup_extra_vis.py | 3c39cf7e7400c09f78ebe9d1d9f8a6d7b9ef6d7b | import os
import numpy as np
save_stem='extra_vis_friday_harbor'
data_dir='../../data/sdk_new_100'
resolution=100
cre=False
source_acronyms=['VISal','VISam','VISl','VISp','VISpl','VISpm',
'VISli','VISpor','VISrl','VISa']
lambda_list = np.logspace(3,12,10)
scale_lambda=True
min_vox=0
# save_file_name='... | [((253, 275), 'numpy.logspace', 'np.logspace', (['(3)', '(12)', '(10)'], {}), '(3, 12, 10)\n', (264, 275), True, 'import numpy as np\n'), ((428, 480), 'os.path.join', 'os.path.join', (['"""../../data/connectivities"""', 'save_stem'], {}), "('../../data/connectivities', save_stem)\n", (440, 480), False, 'import os\n'), ... |
GNiklas/MOSSEPy | examples/runall.py | fbae1294beefe48f321bc5dbbc70e6c72d3ffe1f | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 20 09:42:39 2020
@author: niklas
"""
from mossepy.mosse_tracker import MOSSE
# choose position of object in first frame
# that should be done by mouse click
objPos = [256, 256]
# choose tracker type
tracker = MOSSE()
# initialize object position ... | [((283, 290), 'mossepy.mosse_tracker.MOSSE', 'MOSSE', ([], {}), '()\n', (288, 290), False, 'from mossepy.mosse_tracker import MOSSE\n')] |
mike006322/PolynomialCalculator | core/formulas.py | bf56b0e773a3461ab2aa958d0d90e08f80a4d201 | def solve(polynomial):
"""
input is polynomial
if more than one variable, returns 'too many variables'
looks for formula to apply to coefficients
returns solution or 'I cannot solve yet...'
"""
if len(polynomial.term_matrix[0]) > 2:
return 'too many variables'
elif len(polynomial... | [] |
5Points7Edges/manim | manim/mobject/svg/style_utils.py | 1c2a5099133dbf0abdd5517b2ac93cfc8275b842 | """Utility functions for parsing SVG styles."""
__all__ = ["cascade_element_style", "parse_style", "parse_color_string"]
from xml.dom.minidom import Element as MinidomElement
from colour import web2hex
from ...utils.color import rgb_to_hex
from typing import Dict, List
CASCADING_STYLING_ATTRIBUTES: List[str] = [
... | [((3638, 3674), 'colour.web2hex', 'web2hex', (['color_spec'], {'force_long': '(True)'}), '(color_spec, force_long=True)\n', (3645, 3674), False, 'from colour import web2hex\n')] |
mm011106/iotrigger | iotrigger.py | 643ced0440a8c4fb95ade56399f813c88ac8ddd6 | #!/usr/bin/env python
#coding:utf-8
import os
import RPi.GPIO as GPIO #
import json
from time import sleep #
from twython import Twython
f=open("tw_config.json",'r')
config=json.load(f)
f.close()
CONSUMER_KEY =config['consumer_key']
CONSUMER_SECRET =config['consumer_secret']
ACCESS_TOKEN =config['access_token']
ACCE... | [((175, 187), 'json.load', 'json.load', (['f'], {}), '(f)\n', (184, 187), False, 'import json\n'), ((954, 1021), 'twython.Twython', 'Twython', (['CONSUMER_KEY', 'CONSUMER_SECRET', 'ACCESS_TOKEN', 'ACCESS_SECRET'], {}), '(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_SECRET)\n', (961, 1021), False, 'from twython i... |
nxsofsys/wheezy.template | src/wheezy/template/tests/test_utils.py | b65b70b2927974790ff2413843ec752dd9c6c609 |
""" Unit tests for ``wheezy.templates.utils``.
"""
import unittest
class FindAllBalancedTestCase(unittest.TestCase):
""" Test the ``find_all_balanced``.
"""
def test_start_out(self):
""" The start index is out of range.
"""
from wheezy.template.utils import find_all_balanced
... | [((338, 367), 'wheezy.template.utils.find_all_balanced', 'find_all_balanced', (['"""test"""', '(10)'], {}), "('test', 10)\n", (355, 367), False, 'from wheezy.template.utils import find_all_balanced\n'), ((551, 581), 'wheezy.template.utils.find_all_balanced', 'find_all_balanced', (['"""test(["""', '(0)'], {}), "('test([... |
peterrosetu/akshare | akshare/economic/macro_constitute.py | 9eac9ccb531b6e07d39140830d65349ea9441dc3 | # -*- coding:utf-8 -*-
# /usr/bin/env python
"""
Date: 2019/10/21 12:08
Desc: 获取金十数据-数据中心-主要机构-宏观经济
"""
import json
import time
import pandas as pd
import requests
from tqdm import tqdm
from akshare.economic.cons import (
JS_CONS_GOLD_ETF_URL,
JS_CONS_SLIVER_ETF_URL,
JS_CONS_OPEC_URL,
)
def macro_cons_... | [((711, 722), 'time.time', 'time.time', ([], {}), '()\n', (720, 722), False, 'import time\n'), ((1097, 1121), 'pandas.DataFrame', 'pd.DataFrame', (['value_list'], {}), '(value_list)\n', (1109, 1121), True, 'import pandas as pd\n'), ((1185, 1210), 'pandas.to_datetime', 'pd.to_datetime', (['date_list'], {}), '(date_list)... |
ABEMBARKA/monoUI | test/testers/winforms/scrollbar/__init__.py | 5fda266ad2db8f89580a40b525973d86cd8de939 |
##############################################################################
# Written by: Cachen Chen <cachen@novell.com>
# Date: 08/06/2008
# Description: Application wrapper for scrollbar.py
# Used by the scrollbar-*.py tests
###################################################################... | [] |
iglesiasmanu/data_analysis | save_tweets.py | 61127c91ad0eb11ecdc7258e186e430e9dddb0b6 | import json
from os import path
from tweepy import OAuthHandler, Stream
from tweepy.streaming import StreamListener
from sqlalchemy.orm.exc import NoResultFound
from database import session, Tweet, Hashtag, User
consumer_key = "0qFf4T2xPWVIycLmAwk3rDQ55"
consumer_secret = "LcHpujASn4fIIrQ8sikbCTQ3oyU6T6opchFVWBBqwI... | [((475, 518), 'tweepy.OAuthHandler', 'OAuthHandler', (['consumer_key', 'consumer_secret'], {}), '(consumer_key, consumer_secret)\n', (487, 518), False, 'from tweepy import OAuthHandler, Stream\n'), ((651, 686), 'os.path.join', 'path.join', (['directory', '"""tweets.json"""'], {}), "(directory, 'tweets.json')\n", (660, ... |
chrisjws-harness/flaskSaaS | app/views/main.py | f42558c523de23f03a098044df164ead3539a4dd | from flask import render_template, jsonify
from app import app
import random
@app.route('/')
@app.route('/index')
def index():
# Feature flags init goes here!
#
# noinspection PyDictCreation
flags = {
"welcome_text": "welcome to my python FF tutorial!"
}
# Flag goes here!
#... | [((81, 95), 'app.app.route', 'app.route', (['"""/"""'], {}), "('/')\n", (90, 95), False, 'from app import app\n'), ((97, 116), 'app.app.route', 'app.route', (['"""/index"""'], {}), "('/index')\n", (106, 116), False, 'from app import app\n'), ((461, 478), 'app.app.route', 'app.route', (['"""/map"""'], {}), "('/map')\n",... |
keepangry/ai_algorithm | base_sample/numpy_mat.py | 21d8024296a2f2d2797448ed34eb383359259684 | # encoding: utf-8
'''
@author: yangsen
@license:
@contact:
@software:
@file: numpy_mat.py
@time: 18-8-25 下午9:56
@desc:
'''
import numpy as np
a = np.arange(9).reshape(3,3)
# 行
a[1]
a[[1,2]]
a[np.array([1,2])]
# 列
a[:,1]
a[:,[1,2]]
a[:,np.array([1,2])] | [((146, 158), 'numpy.arange', 'np.arange', (['(9)'], {}), '(9)\n', (155, 158), True, 'import numpy as np\n'), ((194, 210), 'numpy.array', 'np.array', (['[1, 2]'], {}), '([1, 2])\n', (202, 210), True, 'import numpy as np\n'), ((238, 254), 'numpy.array', 'np.array', (['[1, 2]'], {}), '([1, 2])\n', (246, 254), True, 'impo... |
laszukdawid/ai-traineree | ai_traineree/agents/rainbow.py | af32940eba8e11012de87b60d78f10f5a3b96c79 | import copy
from typing import Callable, Dict, List, Optional
import torch
import torch.nn as nn
import torch.optim as optim
from ai_traineree import DEVICE
from ai_traineree.agents import AgentBase
from ai_traineree.agents.agent_utils import soft_update
from ai_traineree.buffers import NStepBuffer, PERBuffer
from ai... | [((5392, 5456), 'torch.linspace', 'torch.linspace', (['v_min', 'v_max', 'self.num_atoms'], {'device': 'self.device'}), '(v_min, v_max, self.num_atoms, device=self.device)\n', (5406, 5456), False, 'import torch\n'), ((5537, 5556), 'ai_traineree.buffers.PERBuffer', 'PERBuffer', ([], {}), '(**kwargs)\n', (5546, 5556), Fal... |
uchytilc/PyCu | nvvm/core/nvvm.py | 9ba25281611bf4dbd70d37f4eba0574f817d6928 | from pycu.nvvm import (get_libdevice, ir_version, version, add_module_to_program, compile_program,
create_program, destroy_program, get_compiled_result, get_compiled_result_size,
get_program_log, get_program_log_size, lazy_add_module_to_program, verify_program)
import os
import sys
from ctypes import c... | [((714, 733), 'pycu.nvvm.get_libdevice', 'get_libdevice', (['arch'], {}), '(arch)\n', (727, 733), False, 'from pycu.nvvm import get_libdevice, ir_version, version, add_module_to_program, compile_program, create_program, destroy_program, get_compiled_result, get_compiled_result_size, get_program_log, get_program_log_siz... |
itsdaveit/fieldservice | fieldservice/fieldservice/doctype/fieldservice_settings/test_fieldservice_settings.py | 90bd813fb01f23a18df3b24fc67ec86c4d8be5a5 | # Copyright (c) 2022, itsdve GmbH and Contributors
# See license.txt
# import frappe
import unittest
class TestFieldserviceSettings(unittest.TestCase):
pass
| [] |
BrickerP/Investment- | Codes/Data Processing.py | 8b57c0d157a7eaa38d693c8d42ce1bc7dc7bdde9 | # -*- coding: utf-8 -*-
"""
Created on Sun Nov 21 14:51:01 2021
@author: 75638
"""
import pandas as pd
import numpy as np
pd.set_option('display.max_columns', None)
pd.set_option('display.width', 10000)
def process_data(path1,path2):
'''
1.path1: file path of different factor
2.path2:file path... | [((131, 173), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', 'None'], {}), "('display.max_columns', None)\n", (144, 173), True, 'import pandas as pd\n'), ((175, 212), 'pandas.set_option', 'pd.set_option', (['"""display.width"""', '(10000)'], {}), "('display.width', 10000)\n", (188, 212), True, 'im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.