id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3253611 | from .utils import Utils | StarcoderdataPython |
1654014 | from bs4 import BeautifulSoup
from bs4 import element
from spider import Item
import traceback
# 对于指定的HTML页面进行解析,抽取出要抓取图片的url和name
# 保存在Item对象中,Item对象保存在一个“线程安全”队列中
# 生产者-消费者模型
class HtmlParser(object):
'''
每一个HtmlParser对象中保存了要解析的HTML页面
parser = HtmlParser(html, taskManager)
parser.pageUrlParser()
... | StarcoderdataPython |
21576 | #! /usr/bin/env python3.5
# vim:ts=4:sw=4:ai:et:si:sts=4
import argparse
import json
import re
import os
import uuid
import shutil
import sys
import requests
filterRe = re.compile(r'(?P<block>^%=(?P<mode>.)?\s+(?P<label>.*?)\s+(?P<value>[^\s\n$]+)(?:\s*.*?)?^(?P<section>.*?)^=%.*?$)', re.M | re.S)
subItemRe = re.com... | StarcoderdataPython |
4841362 | <gh_stars>0
"""
1. Evaluate the accuracy and speed of uniform sampling on SSD for UADetrac dataset
"""
from loaders.uadetrac_loader import UADetracLoader
from loaders.jackson_loader import JacksonLoader
from logger import Logger
from others.amdegroot.eval_uad2 import * ## we import all the functions from here and ... | StarcoderdataPython |
131586 | # coding: utf-8
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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 req... | StarcoderdataPython |
3371410 | <reponame>sergiopasra/glue
from __future__ import absolute_import, division, print_function
import os
from glue import __version__
from qtpy import QtWidgets
from qtpy.QtCore import Qt
from glue.utils import nonpartial
from glue.utils.qt import load_ui, CenteredDialog
from glue._deps import get_status_as_odict
__a... | StarcoderdataPython |
3202119 | """Mathmatical 3d plane."""
from __future__ import annotations
from typing import Tuple, Union, Any, Optional
from engine.threed.base.plane import AbstractPlane
from engine.threed.base.vector import AbstractVector
from engine.threed.base.point import AbstractPoint
from engine.threed.base.line import AbstractLine
from... | StarcoderdataPython |
176437 | <reponame>MartinKliemank/lettuce
"""
Tests for streaming operators.
"""
from lettuce import StandardStreaming
import pytest
import copy
def test_standard_streaming_x3(f_all_lattices):
"""Streaming three times on a 3^D grid gives the original distribution functions."""
f, lattice = f_all_lattices
f_old ... | StarcoderdataPython |
4806123 | from monero_glue.xmr import crypto
from monero_serialize.xmrtypes import EcdhTuple
def copy_ecdh(ecdh):
"""
Clones ECDH tuple
:param ecdh:
:return:
"""
return EcdhTuple(mask=ecdh.mask, amount=ecdh.amount)
def recode_ecdh(ecdh, encode=True):
"""
In-place ecdhtuple recoding
:param ... | StarcoderdataPython |
3357863 | from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import csv
from tkinter import *
from math import sqrt
from celluloid import Camera
#This fucntion is called after the commit button is clicked it stores the filename in the variable
def retrieve_input():
inputValue=textBox.get("... | StarcoderdataPython |
1722920 |
import unittest
import shutil
from g2p_seq2seq import g2p
from g2p_seq2seq import data_utils
class TestG2P(unittest.TestCase):
def test_train(self):
model_dir = "tests/models/train"
with g2p.tf.Graph().as_default():
g2p_model = g2p.G2PModel(model_dir)
train_path = "tests/data/toydict.train"
... | StarcoderdataPython |
1685814 | <gh_stars>0
class Variable:
def __init__(self, name, value, section=''):
self.section = section
self.name = name
self.value = value | StarcoderdataPython |
97223 | <reponame>0mars/graphx
import os
from registry.services import BootableService, Container
from falcon_swagger_ui import register_swaggerui_app
class SwaggerService(BootableService):
def boot(self, container: Container):
from graphx.configurations.app import settings
from graphx.configurations.inf... | StarcoderdataPython |
151467 | # Copyright 2018,2019,2020,2021 Sony Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | StarcoderdataPython |
119333 | <gh_stars>0
import csv
import glob
import re
import logging
from datetime import datetime
from zipfile import ZipFile
from state_fin_ingest.ingestor import RootIngestor
from state_fin_ingest.dir import INPUT_DIR, TEMP_DIR
from .contrib_ingestor import ContribIngestor
from .report_ingestor import ReportIngestor
logge... | StarcoderdataPython |
1636338 | <reponame>lucaoflaif/pyCoinMarketCapAPI<gh_stars>1-10
"""Tests for the cache mechanism"""
import time
import secrets
import os
import sys
import unittest
import coinmarketcapapi
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
class CacheTestCase(unittest.TestCase):
"""Test class... | StarcoderdataPython |
127765 | <reponame>DanielRios549/PythonExcercises
'''
Get an undefined numbers of values and put them in a list.
In the end, show all the unique values in ascendent order.
'''
values = []
while True:
number = int(input('Choose a number: '))
if number not in values:
print(f'\033[32mAdd the number {numbe... | StarcoderdataPython |
126028 | import torch
from torchvision import transforms, datasets
data_transform = transforms.Compose([
transforms.RandomSizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.2... | StarcoderdataPython |
3202566 | <filename>cogs/slash/moderation-slash.py
""""
Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk)
Description:
This is a template to create your own discord bot in python.
Version: 4.1
"""
import json
import os
import sys
import disnake
from disnake import ApplicationCommandInteraction, O... | StarcoderdataPython |
62250 | from nose.tools import assert_equals, assert_true
from wikimetrics.metrics import metric_classes
from wikimetrics.models import SumAggregateByUserReport
from wikimetrics.models.storage.wikiuser import WikiUserKey
from wikimetrics.enums import Aggregation
from ..fixtures import DatabaseTest
class SumAggregateByUserRep... | StarcoderdataPython |
3287310 | from .base import *
SECRET_KEY = <KEY>'
# Flag to determine whether the FOIA request form gets shown.
SHOW_WEBFORM = True
ANALYTICS_ID = 'MyAwesomeAnalyticsCode'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3'
}
}
| StarcoderdataPython |
78781 | """
Fit zero-mean GPCSD to baseline period of auditory LFP recordings.
Investigate power and extract phases for coupling analysis in Matlab.
Creates Figure 2 in the paper.
"""
# %% Imports
import autograd.numpy as np
from scipy import signal
import matplotlib.pyplot as plt
import scipy.io
import pickle
import os.path... | StarcoderdataPython |
4396 | """
Implements a non interactive controller to controt non-interactive visualizers.
(i.e. those that are used for converting TPP souce code into another format)
"""
from tpp.FileParser import FileParser
from tpp.controller.TPPController import TPPController
class ConversionController(TPPController):
"""
Impl... | StarcoderdataPython |
3381257 | <filename>face_processor.py
import sys
import json
import math
import os
import random
import pygame
from pygame.locals import *
import text
import poly_3d
X_ROT_SCALE = 3
AVERAGE_DISTANCE = 100
RESTING_MOUTH_WIDTH = 0.67
clock = pygame.time.Clock()
pygame.init()
pygame.display.set_caption('game... | StarcoderdataPython |
3334921 | import time
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from scipy.misc import imread,imresize,imsave
from skimage.segmentation import clear_border
from skimage.morphology import label
from skimage.measure import regionprops
class Extract_Letters:
def extractFile(self, ... | StarcoderdataPython |
29886 | """Example for Pytest-Gherkin"""
import ast
from pytest import approx
from pt_gh import step, value_options
operator = value_options("add", "subtract")
@step("I have {num1:d} and {num2:d}")
def given_numbers_i(num1, num2, context):
"""Example of parameter types converted based on annotation
and context i... | StarcoderdataPython |
4836426 | <reponame>Arka161/CleanLeetCode
class Solution:
def maxProfit(self, prices: List[int]) -> int:
min_val = 10001
max_val = -1
# [7,1,5,3,6,4]
for i in prices:
min_val = min(i, min_val)
max_temp = i - min_val
max_val = max(max_val, max_temp)
... | StarcoderdataPython |
179532 | <gh_stars>0
import os
import matplotlib.pyplot as plt
import numpy as np
import torchutils
if __name__ == "__main__":
input_dir = "release"
files = ["train.json", "valid.json", "test.json"]
nondisjoint = [
len(outfit["items"])
for fn in files
for outfit in torchutils.io.load_json(o... | StarcoderdataPython |
118510 | '''
This file contains basic utility functions that you can use.
'''
import binascii
MAX_NUM_CLIENTS = 10
TIME_OUT = 0.5 # 500ms
NUM_OF_RETRANSMISSIONS = 3
CHUNK_SIZE = 1400 # 1400 Bytes
def validate_checksum(message):
'''
Validates Checksum of a message and returns true/false
'''
try:
msg, ch... | StarcoderdataPython |
3297575 | def update_action_value(q, action, reward, alpha):
""" Compute the updated action value given the learning rate and observed
reward.
Args:
q (ndarray): an array of action values
action (int): the action taken
reward (float): the reward received for taking the action
alpha (float): the learning ra... | StarcoderdataPython |
80528 | <reponame>typemytype/RoboFontExamples<filename>UI/multiLineView.py<gh_stars>10-100
from mojo.UI import MultiLineView
from vanilla import *
class SampleMultiLineView:
def __init__(self, font):
self.w = Window((600, 400), minSize=(300, 300))
self.w.lineView = MultiLineView((0, 0, -0, -0),
... | StarcoderdataPython |
1798302 | import pytest
import numpy as np
import pandas as pd
from .context import fitgrid
from fitgrid import fake_data, defaults
from fitgrid.errors import FitGridError
from fitgrid.epochs import Epochs
def test_epochs_unequal_snapshots():
epochs_table, channels = fake_data._generate(
n_epochs=10,
n_sam... | StarcoderdataPython |
149807 | import json
import numpy
from RecomandEngine.restrictions.RestrictionConflicts import RestrictionConflict, RestrictionAlphaOrBeta
from RecomandEngine.restrictions.RestrictionDependences import RestrictionOneToOneDependency, \
RestrictionOneToManyDependency, RestrictionManyToManyDependency, RestrictionManyToManyDepe... | StarcoderdataPython |
1644233 | class SixtyToSixtyFourHelper(object):
@classmethod
def transform(cls, desired):
actual = []
counter = 0
for x in desired:
actual.append(x)
counter += 1
if counter % 60 == 0:
actual.append(x)
actual.append(x)
actual.append(x)
actual.append(x)
return a... | StarcoderdataPython |
1755542 | <gh_stars>1-10
#!/usr/bin/env python
import numpy as np
from superpose3d import Superpose3D
def test_superpose3d():
X=[[0,0,0],[0,0,1],[0,1,1],[1,1,1]]
x=[[0,0,0],[0,1,0],[0,1,-1],[1,1,-1]] # (=X after rotation around the Z axis)
Xshifted = [ [X[i][0],X[i][1]+100, X[i][2]] for i in range(0,len(X))]
... | StarcoderdataPython |
3293204 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author : 陈坤泽
# @Email : <EMAIL>
# @Date : 2020/06/03 09:52
from pyxllib.prog.pupil import check_install_package
check_install_package('bidict')
check_install_package('sqlalchemy')
check_install_package('mysqlclient')
import math
from bidict import bidict
import p... | StarcoderdataPython |
1787111 | <gh_stars>0
from .sync import run
run(prog_name='labelsync') | StarcoderdataPython |
1630398 | __version__ = '0.1.5'
default_app_config = 'connected_accounts.apps.ConnectedAccountsConfig'
| StarcoderdataPython |
86300 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
print json.dumps({
"_meta": {
"hostvars": {
"test0.na.example.net": {
"region": "NA",
"data_center": "FDC",
"environment": "LAB",
"baseline": "2019q3",
"owni... | StarcoderdataPython |
1732037 | # 19 continued. gt/pt/tree
import sys, unittest, json
sys.path.append('./')
sys.path.append('../')
import webapp
from test_gt_ot_get_tree import GtTreeTester
service = webapp.get_service(5004, 'gt/pt/tree')
class TestGtPtTree(GtTreeTester):
@classmethod
def get_service(self):
return service
@cla... | StarcoderdataPython |
139258 | <reponame>hasboeuf/robotum<gh_stars>0
"""Robot brain
"""
import sys
import argparse
import os
import socket
import time
SOCKET_PATH = "/tmp/uv4l.socket"
RET_OK = 0
RET_KO = 1
class Controller:
def __init__(self):
self.socket = None
self.client = None
def exec(self):
try:
... | StarcoderdataPython |
3393688 |
import pausable_unittest
import pausable_unittest.dummypauser
import time
class SampleTest(pausable_unittest.TestCase):
def test_sample1(self):
for x in range(2):
start = time.time()
self.reboot()
end = time.time()
self.assertTrue(start + 1 < ... | StarcoderdataPython |
1714316 | <reponame>rndazurescript/Coco2CustomVision<gh_stars>0
import pytest
import os
ENV_KEY_PARAM = "STORAGE_ACCOUNT_KEY"
ENV_NAME_PARAM = "STORAGE_ACCOUNT_NAME"
ENV_CONTAINER_NAME_PARAM = "STORAGE_ACCOUNT_CONTAINER_NAME"
@pytest.fixture
def blob_container_client():
from coco2customvision.azure_blob import get_blob_co... | StarcoderdataPython |
1611756 | # -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'ui_scene_tab.ui'
##
## Created by: Qt User Interface Compiler version 6.1.3
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
##############... | StarcoderdataPython |
1700272 | # coding=utf-8
'''
Show optical flow
USAGE: python opt_flow.py [<video_source>] (Defaults to webcam if no video
source provided.
Keys:
1 - Show HSV
ESC - Exit
'''
from __future__ import print_function
import numpy as np
import cv2
import sys
def draw_flow(img, flow, step=10):
h, w = img.shape[:... | StarcoderdataPython |
130991 | #!/usr/bin/env python
import os
import shutil
import zipfile
from itertools import izip
from collections import defaultdict
from functools import partial
from biom.parse import parse_biom_table
from americangut.util import check_file
# These are the data files in the American-Gut repository that are used for
# resu... | StarcoderdataPython |
3351981 | <reponame>pakozm/DNNJ
# coding: utf-8
# This file is part of https://github.com/pakozm/DNNJ tool
# Copyright (c) 2016 <NAME>
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND N... | StarcoderdataPython |
1618644 | import torch.nn as nn
import torch.nn.functional as F
import torch
from layers import GraphConvolution
class GNN_Encoder(nn.Module):
def __init__(self, nfeat, nhid, dropout):
super(GNN_Encoder, self).__init__()
self.gc1 = GraphConvolution(nfeat, 2 * nhid)
self.gc2 = GraphConvolution(2 * n... | StarcoderdataPython |
1729834 | import math
import numpy as np
from .Bus import Bus
class Branch:
def __init__(self, data : np.ndarray = None) -> None:
if data is None :
self._fbus = None
self._tbus = None
self._r = None
self._x = None
self._b = None
self._rateA = N... | StarcoderdataPython |
1721514 | # -*- coding: utf-8 -*-
import logging
from pathlib import Path
def add_map_style(sum):
'''
Write the map style element to the HTML header
'''
logging.debug('Write the map style element to the HTML header')
sum.write('<style>\n')
sum.write(' #map {\n')
sum.write(' height: 400px;\n')
... | StarcoderdataPython |
3378567 | <gh_stars>0
import sys
#PYQT5 PyQt4’s QtGui module has been split into PyQt5’s QtGui, QtPrintSupport and QtWidgets modules
from PyQt5 import QtWidgets
#PYQT5 QSpinBox, QMessageBox, QDialog, QPushButton, QGridLayout, QLabel
from PyQt5 import QtGui, QtCore
from PyQt5.QtCore import Qt
class Table(QtWidgets.QDialog):... | StarcoderdataPython |
22776 | from z3c.saconfig.scopedsession import Session, named_scoped_session
from z3c.saconfig.utility import (
GloballyScopedSession, SiteScopedSession, EngineFactory)
__all__ = [
'Session',
'named_scoped_session',
'GloballyScopedSession',
'SiteScopedSession',
'EngineFactory',
]
| StarcoderdataPython |
167106 | <filename>4-web-apps/javascript-ajax-apis/foursquare/foursquare-explore.py
import json
import requests
url = 'https://api.foursquare.com/v2/venues/search'
params = dict(client_id='PASTE_YOUR_KEY_HERE',
client_secret='PASTE_YOUR_SECRET_HERE',
v='20180323',
ll='42.3495694,-71.0... | StarcoderdataPython |
132684 | # @Author ZhangGJ
# @Date 2021/04/09 17:08
from selenium import webdriver
from selenium.webdriver import ActionChains
driver = webdriver.Chrome()
driver.get('https://www.baidu.com')
above = driver.find_element_by_id('s-usersetting-top')
ActionChains(driver).move_to_element(above).perform()
| StarcoderdataPython |
1694711 | <gh_stars>0
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Customer(models.Model):
user = models.OneToOneField(User, null=True, blank = True ,on_delete=models.CASCADE)
name = models.CharField(max_length=200, null=True)
phone = models.CharField(max_length=20... | StarcoderdataPython |
3221941 | #!/usr/bin/env python
from setuptools import setup
entry_points = """
[pygments.lexers]
snort = hogments.hog:SnortLexer
"""
setup(
name = 'hogments',
version = '0.1',
license = 'BSD',
description = __doc__,
author = "<NAME>",
packages = ['hogments'],
entry_points = entry_points
)
| StarcoderdataPython |
3287700 | <gh_stars>0
import sys
from pathlib import Path, PurePosixPath
import holoviews as hv
import pytest
from adlfs import AzureBlobFileSystem
from fsspec.implementations.http import HTTPFileSystem
from fsspec.implementations.local import LocalFileSystem
from gcsfs import GCSFileSystem
from s3fs.core import S3FileSystem
f... | StarcoderdataPython |
1728032 | import sys
import config
from pprint import pprint
sys.path.append("..")
import eversign
client = eversign.Client(config.access_key)
businesses = client.get_businesses()
print(businesses[0].business_id)
| StarcoderdataPython |
61801 | <gh_stars>0
import functools
import gzip
import os
import re
from collections import namedtuple
# get the filename from a line: 'HDF5 "rbspa_hope_eff_2018.h5" {'
hdf5_re = re.compile(r'.*HDF5.*"([A-Za-z0-9_\./\\-]*)"')
# get the group from a line: 'GROUP "/" {',
group_re = re.compile(r'.*GROUP.*"([A-Za-z0-9_\./\\-]*)... | StarcoderdataPython |
1741680 | import os
from celery import Celery
BROKER_URL = os.getenv('BROKER_URL')
BACKEND_URL = os.getenv('BACKEND_URL')
app = Celery('celery', backend=BACKEND_URL, broker=BROKER_URL, include=['worker.tasks'])
if __name__ == '__main__':
app.start()
| StarcoderdataPython |
1708534 | #!/usr/bin/env python
#Author: <NAME>
#Purpose: Old script to get change in energy for point mutations of a structure after mutation and FastRelax.
#Instructions: Look at the input options. Set at least --pdb and --region. (python get_mutation_energy.py --pdb mypdbfile.pdb --region 1:10:B)
import pyrosetta
impor... | StarcoderdataPython |
31849 | <reponame>nicklambourne/hackerrank-solutions
#!/bin/python3
import sys
def kangaroo(x1, v1, x2, v2):
if (x1 < x2 and v1 <= v2) or (x2 < x1 and v2 <= v1):
return "NO"
if ((x2 - x1) % (v2-v1)) == 0:
return "YES"
return "NO"
x1, v1, x2, v2 = input().strip().split(' ')
x1, v1, x2, v2 = [int(x... | StarcoderdataPython |
3283455 | <gh_stars>10-100
TASKS = [
'style_transfer',
'summarization',
'dialog',
'factual_consistency'
]
ALIGNS = [
"E-bert",
"E-roberta",
"E-roberta-mnli",
"D-topical_chat",
"D-persona_chat",
"D-cnndm",
"D-xsum",
"D-yelp",
"D-mix-albert",
"R-topical_chat",
"R-persona... | StarcoderdataPython |
8349 | # Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | StarcoderdataPython |
41343 | def test():
# Here we can either check objects created in the solution code, or the
# string value of the solution, available as __solution__. A helper for
# printing formatted messages is available as __msg__. See the testTemplate
# in the meta.json for details.
# If an assertion fails, the messag... | StarcoderdataPython |
1774499 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""=================================================================
@Project : Algorithm_YuweiYin/LeetCode-All-Solution/Python3
@File : LC-1576-Replace-All-s-to-Avoid-Consecutive-Repeating-Characters.py
@Author : [YuweiYin](https://github.com/YuweiYin)
@Date : 2022-0... | StarcoderdataPython |
1627257 | <filename>src/core/difftools.py
import difflib
from django.utils.html import conditional_escape, format_html
from django.utils.safestring import mark_safe
from core.utils import html_join
def dump_replace(a, b, alo, blo, ahi, bhi): # noqa
# Based on `difflib.Differ._fancy_replace`.
# When replacing one blo... | StarcoderdataPython |
3341795 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, unicode_literals, print_function
from astropy import units as u
from astropy.utils import OrderedDict
from astropy.coordinates import BaseRepresentation
from astropy.utils.compat.numpy import broadcast_arr... | StarcoderdataPython |
3254209 | """
Dialog/UI for interacting with meshgeneratormodel.
"""
from PySide2 import QtCore, QtWidgets
from functools import partial
from mapclientplugins.meshgeneratorstep.view.ui_meshgeneratorwidget import Ui_MeshGeneratorWidget
from mapclientplugins.meshgeneratorstep.view.functionoptionsdialog import FunctionOptionsDial... | StarcoderdataPython |
4823066 | """
Latitudes and longitudes for top-1000 cities by population
Data provided by: https://simplemaps.com/data/world-cities
"""
from typing import Dict, Tuple
class CountryBase:
@classmethod
def name(cls) -> str:
return cls.__name__
@classmethod
def cities(cls) -> Dict[str, Tuple[float, float]... | StarcoderdataPython |
149537 | <reponame>yangxy16/IPPool
# /usr/bin/env python3
# -*- coding: utf-8 -*-
'''
代理测试
'''
import requests as rq
if __name__ == '__main__':
ip = '192.168.3.11'
port = '8080'
def getAvailableIP( ip, port ):
url = 'http://2017.ip138.com/ic.asp'
proxies = { 'http': 'http://' + ip + ':' +... | StarcoderdataPython |
1778354 | <gh_stars>1000+
from .tsn import *
| StarcoderdataPython |
1797921 | <reponame>xinglinsky/vmaf
import pywt
def adm_dwt2_py(a):
a, ds = pywt.dwt2(a, 'db2', 'periodization')
h, v, d = ds
return a, v, h, d
def adm_idwt2_py(a_v_h_d):
a, v, h, d = a_v_h_d
ds = (h, v, d)
a = pywt.idwt2((a, ds), 'db2', 'periodization')
return a
| StarcoderdataPython |
1664230 | <filename>RecoTracker/TrackProducer/python/TrackRefitter_cfi.py
import FWCore.ParameterSet.Config as cms
TrackRefitter = cms.EDProducer("TrackRefitter",
src = cms.InputTag("generalTracks"),
beamSpot = cms.InputTag("offlineBeamSpot"),
Fitter = cms.string('KFFittingSmootherWithOutliersRejectionAndRK'),
T... | StarcoderdataPython |
1656463 | <gh_stars>0
# -*- coding: utf-8 -*-
#Copyright (C) 2011 <NAME>
#Python imports
import logging
#Django imports
from django.contrib import admin
#App imports
from models import Feedback
logger = logging.getLogger(__name__)
class FeedbackAdmin(admin.ModelAdmin):
list_filter = ['archived']
readonly_fields = ['date',... | StarcoderdataPython |
43022 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
"""
django_twilio specific settings.
"""
from .utils import discover_twilio_credentials
TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN = discover_twilio_credentials()
| StarcoderdataPython |
3271830 | <reponame>youngqqcn/QBlockChainNotes
from django.contrib import admin
from finance.models import *
from import_export import resources
from import_export.admin import ImportExportModelAdmin, ImportExportActionModelAdmin
class ProxyResource(resources.ModelResource):
class Meta:
model = Record
# Register... | StarcoderdataPython |
1675390 | <filename>tests/zquantum/core/cost_function_test.py
from functools import partial
from unittest import mock
import numpy as np
import pytest
from openfermion import QubitOperator
from sympy import Symbol
from zquantum.core.cost_function import (
AnsatzBasedCostFunction,
get_ground_state_cost_function,
sum_... | StarcoderdataPython |
3244407 | <reponame>hasii2011/PyArcadeStarTrek
from logging import Logger
from logging import getLogger
from pytrek.model.Coordinates import Coordinates
from pytrek.settings.BaseSubSetting import BaseSubSetting
from pytrek.settings.SettingsCommon import SettingsCommon
from pytrek.settings.SettingsCommon import SettingsNameValue... | StarcoderdataPython |
1724110 | from django.urls import path
from . import views
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import url
urlpatterns = [
path('', views.pictures_index, name='pictures_index'),
url(r'^search/', views.search_results, name='search_results'),
path('<int:pk>... | StarcoderdataPython |
41502 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from nose.tools import eq_
from anytree import AnyNode
from anytree import Node
from anytree import NodeMixin
from anytree import PostOrderIter
from anytree import PreOrderIter
from anytree import SymlinkNode
def test_symlink():
root = Node("root")
s0 = Node("sub0"... | StarcoderdataPython |
3255288 | <gh_stars>1-10
import logging
class Log(object):
@staticmethod
def setup(name: str) -> logging.Logger:
formatter = logging.Formatter(fmt='%(levelname)s | %(module)s.%(funcName)s: %(message)s')
handler = logging.StreamHandler()
handler.setFormatter(fmt=formatter)
logger = loggi... | StarcoderdataPython |
50884 | <reponame>ABHISHEK-T-S/MAX-Toxic-Comment-Classifier
#
# Copyright 2018-2019 IBM Corp. 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/licens... | StarcoderdataPython |
1634666 | import json
import union
from six import text_type
#
# Abstract Base Model
#
class BaseModel(object):
def __init__(self, **attrs):
for k, v in list(attrs.items()):
self.__setattr__(k, v)
def __repr__(self):
return text_type('< union.%s(%s) >' % (type(self).__name__, self))
de... | StarcoderdataPython |
84715 | <gh_stars>1-10
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import unittest
from pymatgen.util.testing import PymatgenTest
from pymatgen.core.lattice import Lattice
from pymatgen.core.structure import Structure
from pymatgen.symmetry.kpath import KPathS... | StarcoderdataPython |
1655197 | def ping(hub):
return True
| StarcoderdataPython |
1649436 | <reponame>arthus701/algopy
import pylab
#SETUP PLOTTING PARAMETERS
fig_width_pt = 600.0 # Get this from LaTeX using \showthe\columnwidth
inches_per_pt = 1.0/72.25 # Convert pt to inches
golden_mean = (pylab.sqrt(5)-1.0)/2.0 # Aesthetic ratio
fig_width = fig_width_pt*inches_per_pt # width in inc... | StarcoderdataPython |
1791066 | <gh_stars>1-10
first, last = input(), input()
print(f"{last}, {first}" if last > "Hopper" else f"{first} {last}") | StarcoderdataPython |
1750809 | """
Saving model output.
"""
import json
import pickle
from copy import deepcopy
import os
import numpy as np
import xarray as xr
def save_to_pickle(datafield, filename):
"""
Save datafield to pickle file. Keep in mind that restoring a pickle
requires that the internal structure of the types for the pi... | StarcoderdataPython |
9377 | <filename>main/migrations/0006_labourer_allproj.py
# Generated by Django 3.1.2 on 2020-10-18 16:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0005_auto_20201018_1902'),
]
operations = [
migrations.AddField(
mode... | StarcoderdataPython |
3225430 | import unittest
from domain_scoring.domain_value_transformer import NaiveTransformer, SMALLER
from util.lists import all_pairs
class NaiveDomainValueTransformerTest(unittest.TestCase):
def setUp(self):
self.transformer = NaiveTransformer()
self.oracle = self._create_oracle(range(6))
def test... | StarcoderdataPython |
146855 | <filename>examples/0053-seeAlso.py
# https://iiif.io/api/cookbook/recipe/0053-seeAlso/
from IIIFpres import iiifpapi3
iiifpapi3.BASE_URL = "https://iiif.io/api/cookbook/recipe/0053-seeAlso/"
manifest = iiifpapi3.Manifest()
manifest.set_id(extendbase_url="manifest.json")
manifest.add_label("en","Linking to Structured Me... | StarcoderdataPython |
3258493 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os
import unittest
from bson import objectid
from pymongo import MongoClient, TEXT
import config
import errors
import server
class ApiBaseTestCase(unittest.TestCase):
def setUp(self):
"""Initialize test app"""
self.app = server.a... | StarcoderdataPython |
95623 | <gh_stars>1-10
"""Classes to help with supporting AreaDetector 33 (and the
wait_for_plugins functionality)
This is actually adding a mix of functionality from AD 2-2 to 3-3 and
all of these names may change in the future.
"""
from ophyd import Device, Component as Cpt
from ophyd.areadetector.base import (ADBase, AD... | StarcoderdataPython |
1636709 | import os
from scrubber import Scrubber
import BeautifulSoup
#import BeautifulSoup
# initialise the scrubber! all this stuff is overriding scrubber defaults so hack it to bits if you want!
scrubber = Scrubber(autolink=False)
scrubber.allowed_tags = set((
'a', 'abbr', 'acronym', 'b', 'bdo', 'big', 'blockquote', 'br... | StarcoderdataPython |
64131 | # Generated by Django 2.2.6 on 2019-10-10 19:01
from uuid import uuid4
from django.db import migrations
def apply_migration(apps, migration):
"""Apply App Token data migration"""
Group = apps.get_model('auth', 'Group')
Group.objects.create(
name='App Token'
)
def revert_migration(apps, mig... | StarcoderdataPython |
1627965 | <reponame>mobalk/raspi-skycam
#!/usr/bin/env python3
import os
from PIL import Image
import logging
import time
import config
SEC_PER_DAY = 60 * 60 * 24
logging.basicConfig(level=logging.INFO)
dryRun = False
delete = True
factor = 0.4
# Lookup config.ini, in same directory with this script.
config.init(os.path.j... | StarcoderdataPython |
4834907 | <reponame>dstftw/youtube-dl-gui
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Youtube-dlg setup file.
Note:
If you get 'TypeError: decoding Unicode is not supported' when you run
py2exe then apply the following patch:
http://sourceforge.net/p/py2exe/patches/28/
"""
import os
import sys
import shuti... | StarcoderdataPython |
3262274 | import logging
import chronicle.logger as log_helper
logger = logging.getLogger(__name__)
class StrategyBase:
def __init__(self, process_list):
self._process_list = process_list
@classmethod
def alias(cls):
raise NotImplementedError
def already_running(self, command) -> bool:
... | StarcoderdataPython |
33232 | #!/usr/bin/env python3
from setuptools import setup
setup(
name="deeplator",
version="0.0.7",
description="Wrapper for DeepL translator.",
long_description="Deeplator is a library enabling translation via the DeepL translator.",
author="uinput",
author_email="<EMAIL>",
license="MIT",
u... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.