id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
8011211
self.description = "remove a package with a directory that has been replaced with a symlink" self.filesystem = [ "var/", "srv -> var/" ] lpkg = pmpkg("pkg1") lpkg.files = ["srv/"] self.addpkg2db("local", lpkg) self.args = "-R %s" % (lpkg.name) self.addrule("PACMAN_RETCODE=0") self.addrule("DIR_EXIST=var/") self.add...
StarcoderdataPython
3206105
def make_tree(seq): tree = {} for item in seq: tree = _make_tree(item, tree) return tree def _make_tree(item, tree): if not tree: tree[item] = {'left': {}, 'right': {}} else: last_key = tree.keys()[0] if item > last_key: _make_tree(item, tree[last_key]['...
StarcoderdataPython
1921037
import vmraid from vmraid.model.naming import append_number_if_name_exists from vmraid.utils.dashboard import get_dashboards_with_link def execute(): if not vmraid.db.table_exists('Dashboard Chart')\ or not vmraid.db.table_exists('Number Card')\ or not vmraid.db.table_exists('Dashboard'): return vmraid.reload...
StarcoderdataPython
3537327
#!/usr/bin/env python # Requires Python 3.x """ NSX-T SDK Sample Code Copyright 2017-2020 VMware, Inc. All rights reserved The BSD-2 license (the "License") set forth below applies to all parts of the NSX-T SDK Sample Code project. You may not use this file except in compliance with the License. BSD-2 License Redist...
StarcoderdataPython
6598709
import sys if __name__ == '__main__': filename = sys.argv[-1] with open(filename) as input_file: input_code = input_file.read() output_code = "" is_string = False is_inline_comment = False is_multiline_comment = False upper = False prev_char = "" fo...
StarcoderdataPython
1964421
from tortoise import Model, fields from tortoise.contrib.postgres.fields import TSVectorField from tortoise.contrib.postgres.indexes import ( BloomIndex, BrinIndex, GinIndex, GistIndex, HashIndex, PostgreSQLIndex, SpGistIndex, ) class Index(Model): bloom = fields.CharField(max_length=2...
StarcoderdataPython
1916201
import os import logging import urlparse import simplejson as json import itertools from os.path import join from uuid import uuid4 from zipfile import ZipFile from datetime import datetime from lxml import etree from shutil import rmtree from django.utils.functional import cached_property from .config import DATETI...
StarcoderdataPython
9734434
#!/usr/bin/env python import unittest import logging from BaseTest import parse_commandline, BasicTestSetup import afs class TestLookupUtilMethods(unittest.TestCase, BasicTestSetup): """ Tests LookupUtil Methods """ def setUp(self): """ setup """ BasicTestSetup._...
StarcoderdataPython
11271968
<reponame>Muhammadislom/TuitOpenSource class RSAMethod: def pq(self, p, q): return str(p * q)
StarcoderdataPython
5009016
<gh_stars>1-10 import sys from csv import DictReader import os argv=sys.argv CLASSES=["CT_plus","CT_minus","PR_plus","PR_minus","PS_plus","PS_minus","Uu"] csv_filename=argv[1] MODE=argv[-1] if MODE == "bow": factbank_path=r"/Users/pushpendrerastogi/Dropbox/evsem_data/factbank/data" sentence_file_path = os.path...
StarcoderdataPython
3464328
''' Classes/functions to read and featurize data ''' import argparse import logging import time import os import pandas as pd from sklearn import preprocessing import torch from transformers import BertTokenizer, BertModel import numpy as np from tqdm import tqdm import pickle from utils import get_appendix from glob i...
StarcoderdataPython
8065495
# -*- coding: utf-8 -*- # Copyright (C) 2018 by # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # All rights reserved. # BSD license. # # Authors: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> from __future__ im...
StarcoderdataPython
9668973
class build: def __init__(self): # 安装插件 import os os.system("pip install pyinstaller") os.system("pip install requests") # 下载压缩工具 import requests url1 = "https://www.hestudio.xyz/nonsense-literature/7z.dll" url2 = "https://www.hestudio.xyz/nonsense-lit...
StarcoderdataPython
11345842
<gh_stars>0 class Port: def __init__(self, gear, index, basename, producer=None, consumer=None): self.gear = gear self.index = index self.producer = producer self.consumer = consumer self.basename = basename @property def dtype(self): if self.producer is not ...
StarcoderdataPython
31823
# -------------------------------------------------------------------------- # # OpenSim Muscollo: plot_inverse_dynamics.py # # -------------------------------------------------------------------------- # # Copyright (c) 2017 Stanford University and the Authors # # ...
StarcoderdataPython
8083210
<reponame>jamboree/mrustc import argparse import sys def main(): argp = argparse.ArgumentParser() argp.add_argument("-o", "--output", type=lambda v: open(v, 'w'), default=sys.stdout) argp.add_argument("logfile", type=open) argp.add_argument("fcn_name", type=str, nargs='?') args = argp.parse_args() ...
StarcoderdataPython
5053640
<reponame>luoy2/polyhymnia from flask import Blueprint, abort from polyhymnia.decorators.json import * import logging from polyhymnia.serializers import NpEncoder import importlib from pprint import pformat simbert_bp = Blueprint('simbert', __name__) logger = logging.getLogger(__name__) gunicorn_logger = logging.getLo...
StarcoderdataPython
6507249
<reponame>tushar-agarwal2909/MoPulseGen # -*- coding: utf-8 -*- """ Created on Tue Jan 28 16:35:59 2020 @author: agarwal.270a """ from __future__ import absolute_import, division, print_function, unicode_literals import tensorflow as tf import tensorflow.keras.layers as layers #import modules.custom_layers ...
StarcoderdataPython
96726
from .utility import get_automation_runas_credential from .utility import get_automation_runas_token from .utility import import_child_runbook from .utility import load_webhook_body
StarcoderdataPython
5045384
import pytest from fbmessenger import attachments from fbmessenger import elements from fbmessenger import templates from fbmessenger import quick_replies class TestTemplates: def test_button_template_with_single_button(self): btn = elements.Button( button_type="web_url", title="Web button", ...
StarcoderdataPython
1824690
# -*- coding: utf-8 -*- # @Time : 2020/10/7 00:03 # @Author : ooooo from typing import * class Solution: def sortColors(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ count_0, count_1, count_2 = 0, 0, 0 for x in nums: ...
StarcoderdataPython
40838
# -*- coding: utf-8 -*- """ ====== Slider ====== A slideshow component which may be similar to Album but with difference that a slide item can have HTML content. Slide items are ordered from their ``order`` field value. Items with a zero value for their order will be ordered in an almost arbitrary order (mostly depen...
StarcoderdataPython
11306057
<filename>from_3b1b/active/diffyq/part2/fourier_series.py for i in range(0,1000000000): print(i)
StarcoderdataPython
6554538
""" matrix-api v0.1 @author <NAME> @created on 04/14/2016 multiply.py Route handler for the subtraction endpoint. POST /v1/add """ from flask import Flask, Blueprint, abort, request, jsonify from app.matrix import Matrix from app.decorators import validate import app.schema sub = Blueprint('sub', __name__) @sub.bef...
StarcoderdataPython
4808081
import pathmagic # noqa isort:skip import datetime import os import unittest from database import Database class TestDB(unittest.TestCase): def test_run(self): TEST_DIR = os.path.dirname(os.path.abspath(__file__)) self.db = Database() EVENT_COUNT = 4 ARTIST_COUNT = 3 ...
StarcoderdataPython
3383602
<filename>tamil_utils.py # -*- coding: utf-8 -*- import regex _UYIRGAL = ["அ","ஆ","இ","ஈ","உ","ஊ","எ","ஏ","ஐ","ஒ","ஓ","ஔ"] _MEYGAL=("க்","ங்","ச்","ஞ்","ட்","ண்","த்","ந்","ன்","ப்","ம்","ய்","ர்","ற்","ல்","ள்","ழ்","வ்","ஜ்","ஷ்","ஸ்","ஹ்","க்ஷ்","ஃ","்",) _VALLINAM = ("க","கா","கி","கீ","கூ","கு","கெ","கே","கை","கொ"...
StarcoderdataPython
393559
<reponame>NightySide/simple import ProgramState from funcs import next_line ps = ProgramState.ProgramState() ps.load("test.smp") while ps.line < len(ps.program): next_line(ps) print(ps)
StarcoderdataPython
1865593
<reponame>Joevaen/Scikit-image_On_CT # canny边缘检测 from skimage import data, feature, img_as_float, io image = img_as_float(io.imread('/home/qiao/PythonProjects/Scikit-image_On_CT/Test_Img/10.jpg')) gamma_corrected = feature.canny(image) io.imshow(image) io.show() io.imshow(gamma_corrected) io.show()
StarcoderdataPython
1713827
<reponame>ahfuck/panki<filename>tests/test_util.py import unittest from datetime import datetime, timezone import click import panki.util class TestUtil(unittest.TestCase): def test_strip_split(self): self.assertEqual( panki.util.strip_split(' a , b , c '), ['a', 'b', 'c'] ...
StarcoderdataPython
1745165
<filename>phantombuild/__main__.py """Phantom-build command line program.""" import click from . import __version__ from .phantombuild import build_phantom, read_config, setup_calculation, write_config @click.group() @click.version_option(version=__version__) def cli(): """Build and set up Phantom runs. ph...
StarcoderdataPython
1670671
<filename>make_datasets.py import os import os.path as path import pandas as pd src_path = '../disk' trgt_path = './Data' os.makedirs(trgt_path, exist_ok=True) def make_Bank(): dataset_path = path.join(src_path, 'Bank') def build(gt_file, csv_file): with open(path.join(dataset_path, gt_file), 'r') a...
StarcoderdataPython
9697114
''' # ambre.test.design_unit.py # # Copyright March 2013 by <NAME> # # This program is free software; you may redistribute it and/or modify its # under the terms of the GNU General Public License as published by the Free # Software Foundation; either version 2 of the License or # any later version. # # This prog...
StarcoderdataPython
4939963
<reponame>evonove/threejs-prototype from .base import * # security enforcement SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') SECURE_SSL_REDIRECT = env('DJANGO_SECURE_SSL_REDIRECT', True) SESSION_COOKIE_SECURE = env('DJANGO_SESSION_COOKIE_SECURE', True) # uncomment for cross-domain cookies # SESSION_C...
StarcoderdataPython
1778805
# Imports import cv2 import mediapipe as mp from numpy import result_type import pyautogui import math from enum import IntEnum from google.protobuf.json_format import MessageToDict from constants.hand_landmarks import HandLandmarks from constants.gest import Gest from models.hand_recog import HandRecog from models.c...
StarcoderdataPython
8089956
#!/usr/bin/env python # # Copyright (C) 2011 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
StarcoderdataPython
11390258
#!/usr/bin/env python from setuptools import setup, find_packages execfile('src/cuisine_sweet/version.py') setup( name = "cuisine_sweet", version = __version__, # pypi stuff author = "<NAME>", author_email = "<EMAIL>", description = "Sugar-coated declarative deployment recipes built on top of Fa...
StarcoderdataPython
6424547
# Copyright (c) 2015 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 writi...
StarcoderdataPython
245584
import logging import os import tempfile import gym import importlib_resources import pytest import pytest_notebook.nb_regression as nb from smarts.core.agent import Agent, AgentSpec from smarts.core.agent_interface import AgentInterface, AgentType from smarts.core.sensors import Observation from smarts.core.utils.ep...
StarcoderdataPython
11224831
# Generated by Django 3.2.3 on 2021-07-18 08:21 import api.validators import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0062_auto_20210717_0033'), ] operations = [ migrations.AlterField( mo...
StarcoderdataPython
5176602
<gh_stars>1-10 import os import config import discord from discord.ext import commands from colorama import Fore, Style # Цветная консоль from colorama import init # Цветная консоль TOKEN = config.TOKEN PREFIX = config.PREFIX STATUS = config.STATUS COLOR_ERROR = config.COLOR_ERROR client = commands.Bot(command_pre...
StarcoderdataPython
1954275
# -*- coding: utf-8 -*- """ ImageDataExtractor Microscopy image quantification. <EMAIL> ~~~~~~~~~~~~~~~ """ import logging from .extract import * from .figsplit import figsplit __title__ = 'ImageDataExtractor' __version__ = '2.0.0' __author__ = '<NAME>' __email__ = '<EMAIL>' __license__ = 'MIT License' logging.basic...
StarcoderdataPython
9731169
import imageio import os images = [] i = 0 for filename in os.listdir('./frames'): # print(filename) if i >= 700: break images.append(imageio.imread('./frames/frame{}.png'.format(i+300))) i += 1 imageio.mimsave('../assets/example_breakout.gif', images)
StarcoderdataPython
8053010
<filename>dfibers/examples/lorenz.py<gh_stars>1-10 """ Fiber-based fixed point location in the Lorenz system f(v)[0] = s*(v[1]-v[0]) f(v)[1] = r*v[0] - v[1] - v[0]*v[2] f(v)[2] = v[0]*v[1] - b*v[2] Reference: http://www.emba.uvm.edu/~jxyang/teaching/Math266notes13.pdf https://en.wikipedia.org/wiki/Lorenz_s...
StarcoderdataPython
11214870
import numpy import pandas from phipkit.score import compute_scores def test_basic(): counts_df = pandas.DataFrame(index=["clone_%d" % i for i in range(1000)]) beads_lambda = numpy.random.randint(0, 10, len(counts_df))**2 for i in range(8): counts_df["beads_%d" % i] = numpy.random.poisson( ...
StarcoderdataPython
9693397
from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from database_setup import User, Category, Item, Base engine = create_engine('sqlite:///catalog.db') # Bind the engine to the metadata of the Base class so that the # declaratives can be accessed through a DBSession instance Base.metadata.bi...
StarcoderdataPython
4847527
from data import get_csv from collections import deque from math import exp, log from datetime import datetime from statistics import median def parse(): from template import by_block, by_month #setup output list with keys as first element block_output = [[i] for i in list(by_block.keys())] month_out...
StarcoderdataPython
6612080
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Nov 29 23:07:14 2021 @author: bartelsaa """ import re, os, io from glob import glob import pandas as pd import sys import pytz # from sqlite3 import Error from models import Sensor from datetime import datetime, timezone import pathlib from maad.rois im...
StarcoderdataPython
37073
Scale.default = Scale.chromatic Root.default = 0 Clock.bpm = 120 var.ch = var(P[1,5,0,3],8) ~p1 >> play('m', amp=.8, dur=PDur(3,8), rate=[1,(1,2)]) ~p2 >> play('-', amp=.5, dur=2, hpf=2000, hpr=linvar([.1,1],16), sample=1).often('stutter', 4, dur=3).every(8, 'sample.offadd', 1) ~p3 >> play('{ ppP[pP][Pp]}', amp=.8,...
StarcoderdataPython
9771903
import pandas as pd import numpy as np import os import json import requests from bs4 import BeautifulSoup from io import StringIO # def get_current_players(): # rootdir = '../resources/players/' # player_names = [] # for subdir, dirs, files in os.walk(rootdir): # for file in files: # ...
StarcoderdataPython
4864858
import math import torch import torch.nn as nn import torch.nn.functional as F class UpResBlock(nn.Module): def __init__(self, ch): super(UpResBlock, self).__init__() self.c0 = nn.Conv2d(ch, ch, 3, 1, 1) nn.init.normal_(self.c0.weight, 0.02) self.c1 = nn.Conv2d(ch, ch, 3, 1, 1) ...
StarcoderdataPython
8052760
import logging import logging.config from zmq.log.handlers import PUBHandler class ProxyLogger(object): formatter = logging.Formatter("%(asctime)s - %(name)-30s - %(levelname)-8s - %(message)s") @classmethod def init_proxy_logger(cls, config): if config["logger_config"]: # NOTE: If us...
StarcoderdataPython
1907865
<gh_stars>0 from injector import inject from app.climates.models import Climate from app.climates.repositories import ClimateRepository from instance.resources.helpers import read_elements, climates_csv class ClimatePopulationService: @inject def __init__(self, climate_repository: ClimateRepository): ...
StarcoderdataPython
3416864
<filename>array/baseball_game.py def cal_points(ops): score = [] for op in ops: if op == '+': score.append(score[-1] + score[-2]) elif op == 'D': score.append(score[-1] * 2) elif op == 'C': score.pop() else: score.append(int(op)) ...
StarcoderdataPython
241108
<reponame>Z2PackDev/TBModels #!/usr/bin/env python # (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik # Author: <NAME> <<EMAIL>> """ Tests for the 'symmetrize' method. """ import copy import pytest import tbmodels @pytest.fixture def input_model(sample): return tbmodels.io.load(sample("InAs_nosym.h...
StarcoderdataPython
8107716
import torch def gumbel_sigmoid(logits: torch.Tensor, tau: float = 1, hard: bool = False, eps: float = 1e-10) -> torch.Tensor: uniform = logits.new_empty([2]+list(logits.shape)).uniform_(0,1) noise = -((uniform[1] + eps).log() / (uniform[0] + eps).log() + eps).log() res = torch.sigmoid((logits + noise) /...
StarcoderdataPython
56763
<filename>run_defense.py #from __future__ import print_function import sys, argparse import os import time import numpy as np import theano import theano.tensor as T import lasagne from sklearn.decomposition import PCA from matplotlib import pyplot as plt from lib.utils.data_utils import * from lib.utils.model_util...
StarcoderdataPython
5025849
<gh_stars>0 print('hello to Every one !!')
StarcoderdataPython
11374492
import pytest from django.utils.text import slugify from ..models import Board pytestmark = pytest.mark.django_db def test_create_board_via_factory(board): pass def test_generated_slug_is_based_on_slugifed_title(board): assert board.slug.startswith(slugify(board.title)) def test_fields_exist(): boar...
StarcoderdataPython
8127220
import pandas as pd import argparse import numpy as np import random import matplotlib.pyplot as plt from sklearn import linear_model class Portfolio(object): def __init__(self, sec1mean, sec2mean, sec1vol, sec2vol, corr, rebalance_threshold): self.numberOfStocks = 2 self.initprices = np.asarray([...
StarcoderdataPython
6654008
<filename>setup.py<gh_stars>0 import os from setuptools import setup, find_packages __version__ = '0.0.1' # We use the README as the long_description readme_path = os.path.join(os.path.dirname(__file__), "README.md") setup( name='insights-analytics-collector', version=__version__, url='http://github.com...
StarcoderdataPython
4903880
import geopandas as gpd # Networkx werkt erg traag gdf = gpd.read_file(r"C:\Users\bruno\Downloads\snelwegen_provincie.geojson") gdf
StarcoderdataPython
8166687
<gh_stars>1-10 """ Custom exceptions for errors related to Linear Algebra. """ class LinearAlgebraError(Exception): """ Base class for error related to Linear Algebra. """ pass class InconsistentDataSetError(LinearAlgebraError): """ Exception raised for errors that data set of two vecto...
StarcoderdataPython
1977925
<filename>test/test_del_contact.py from model.contact import Contact import random def test_delete_random_contact(app, db, check_ui): if len(db.get_contact_list()) == 0: app.contact.add(Contact(firstname="new", middlename="new", lastname="new", nickname="new", title="new", ...
StarcoderdataPython
346882
<filename>job_crawler/config.py<gh_stars>0 import os import json from enum import Enum from typing import Dict, List from dotenv import load_dotenv class CrawlerType(Enum): JSON = "json" class CrawlerConfig: name: str type: CrawlerType url: str base_path_parts: List[str] params: Dict[str, str...
StarcoderdataPython
8150084
import pickle from os import path from ctypes import Structure, windll, c_uint, sizeof, byref import time import schedule from rm_sync import get_files_from_zotero_storage from rm_sync import sync from config import config ''' Checks every 5 minutes if changes are made to the zotero storage if a change ...
StarcoderdataPython
3520350
<gh_stars>1-10 import tensorflow as tf import argparse import os, re import numpy as np import skimage as ski import skimage.data import skimage.transform import cv2 import tensorflow.contrib.layers as layers from tensorflow.contrib.framework import arg_scope import losses import eval_helper #import datasets.reader_r...
StarcoderdataPython
9773067
class LsvmInterface: def __init__(self, model_name): pass def calc(self) -> list: raise NotImplementedError def decrypt(self, encrypted_labels) -> list: raise NotImplementedError def get_labels(self) -> list: raise NotImplementedError
StarcoderdataPython
1778622
<reponame>thanhhvnqb/detectron2 import torch import torch.nn.functional as F from torch import nn import fvcore.nn.weight_init as weight_init from detectron2.layers import Conv2d, ShapeSpec, get_norm from detectron2.modeling.backbone.build import BACKBONE_REGISTRY from detectron2.modeling.backbone.fpn import FPN from...
StarcoderdataPython
12808149
<reponame>lematt1991/RecLab<gh_stars>10-100 """ The package for the Autorec recommender. See https://doi.org/10.1145/2740908.2742726 for details. """ from .autorec import Autorec
StarcoderdataPython
1629790
<reponame>gda2048/rest<gh_stars>1-10 from django.contrib import admin from chat_room.models import Room, Message @admin.register(Room) class RoomAdmin(admin.ModelAdmin): """Admin room admin""" list_display = ("creator", "invited_user", "date") filter_horizontal = ('invited', ) def invited_user(self, ...
StarcoderdataPython
12853180
<reponame>nokia/minifold<gh_stars>10-100 #!/usr/bin/env python3 # -*- coding: utf-8 -*- # # This file is part of the minifold project. # https://github.com/nokia/minifold __author__ = "<NAME>" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" __copyright__ = "Copyright (C) 2018, Nokia" __license__ = "BSD-3"...
StarcoderdataPython
8025189
from flask import render_template, Blueprint from models.estudiante import Estudiante perfil = Blueprint('perfil', __name__) @perfil.route('/perfil/<nombre_usuario>/') def detail(nombre_usuario): estudiante = Estudiante.get( nombre_usuario=nombre_usuario ) return render_template('detail.html', p...
StarcoderdataPython
4921475
from libmineshaft.blocks import Block, MultipleStateBlock, NoIDBlock class Air(Block): id = 0 imagecoords = (64, 176) resistance = -1 name = "Air" falls = False breaktime = -1 class StoneBlock(NoIDBlock): imagecoords = (16, 0) resistance = 10 name = "Stone" falls = False ...
StarcoderdataPython
215611
<reponame>JDatPNW/faceTrack<filename>src/clInitializer.py<gh_stars>0 import os from .Initializer import Initializer class clInitializer(Initializer): def getInput(self): self.visualize = input('Enable visualization? [1=Yes/0=No]: ') self.visualize = int(self.visualize) self.inputfile = i...
StarcoderdataPython
8144610
<gh_stars>1-10 class Solution: def countEven(self, num: int) -> int: t = 0 for i in range(1, num+1): s = sum([int(x) for x in str(i)]) if s % 2 == 0: t += 1 return t
StarcoderdataPython
5071439
import os from distutils.debug import DEBUG class Config: ''' General configurat3eerrfrfrfion parent class ''' NEWS_BASE_URL = 'https://newsapi.org/v2/{}?q=Apple&from=2022-01-25&sortBy=popularity&apiKey=11319835f3f642b08ffc5ed98495e990' NEWS_API_KEY='0aa9f5a46444443fb64afbece6ada52b' # NEWS_API...
StarcoderdataPython
322363
<filename>011-testunit/testFileMyName.py<gh_stars>0 import unittest from surveyTest import AnonymousSurvey class TestSurvey(unittest.TestCase): def setUp(self): #创建测试中的全局的一个对象供所有测试方法使用 question = "what language did you fitst learn to speak" self.my_survey = AnonymousSurvey(question) ...
StarcoderdataPython
9635485
"""The Tesla Powerwall integration base entity.""" from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.update_coordinator import CoordinatorEntity from .const import DOMAIN, MANUFACTURER, MODEL class PowerWallEntity(CoordinatorEntity): """Base class for powerwall entities.""" def...
StarcoderdataPython
3368817
<filename>vispy/scene/visuals/modular_visual.py # -*- coding: utf-8 -*- # Copyright (c) 2014, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. from __future__ import division, print_function import numpy as np from ... import gloo from .visual import Visual from ..sha...
StarcoderdataPython
5083160
import argparse import collections import datetime import logging import re import sys import mechanize from bs4 import BeautifulSoup BEAUTIFUL_SOUP_PARSER = 'html.parser' VIOLATIONS_URL = ('http://www1.nyc.gov/assets/finance/jump/' 'pay_parking_camera_violations.html') DELETED_VIOLATION_PATTERN = 'Violation E...
StarcoderdataPython
3404222
<filename>tests/tests_cli_common.py """ tests.tests_cli_common.py ~~~~~~~~~~~~~~~~~~~~~~~~~ Testing common cli functionality. :copyright: (c) 2019 by <NAME>. :license: Apache2, see LICENSE for more details. """ # -- Imports ------------------------------------------------------------------- import pytest from .u...
StarcoderdataPython
12802186
from .actor import CategoricalPolicy, DeterministicPolicy, StateDependentGaussianPolicy, StateIndependentGaussianPolicy from .base import MLP from .conv import DQNBody, SACDecoder, SACEncoder, SLACDecoder, SLACEncoder from .critic import ( ContinuousQFunction, ContinuousQuantileFunction, ContinuousVFunction...
StarcoderdataPython
1915159
import win32gui from win32con import * from win32gui import ShowWindow, SetWindowPos, GetWindowLong, SetWindowLong, SetLayeredWindowAttributes from win32gui import PostMessage, PostMessage, GetWindowRect, SetCapture, ReleaseCapture, GetCursorPos from win32api import GetAsyncKeyState from common.window import BaseWin...
StarcoderdataPython
6529938
#!/usr/bin/env python3 # Applies a commit or commits on baranch or branches # USAGE: # patch.py -c <commit-list> -b <branch-list> [-p] [-t] # - <commit-list>: list of commit SHAs to apply. # - <branch-list>: branches where the commit should be applied. * can be used as wildchar # - p: push the changes to <brac...
StarcoderdataPython
9731163
"""Pruned ResNetV1bs, implemented in Gluon.""" from __future__ import division import json import os from mxnet.context import cpu from mxnet.gluon import nn from mxnet import ndarray from ..resnetv1b import ResNetV1b from ..resnetv1b import BasicBlockV1b from ..resnetv1b import BottleneckV1b __all__ = ['resnet18_v1b...
StarcoderdataPython
5193555
<gh_stars>0 #! /usr/bin/env python import os import sys import fnmatch import time import shutil import subprocess import stat def readList(file): o = open(file) lines = o.read().splitlines() o.close() lines = filter(lambda line : line[0] != "#", lines) return lines def cleanup(path): if os.path.exists(path): ...
StarcoderdataPython
3372945
<reponame>adonaifariasdev/cursoemvideo-python3 # Faça um programa que leia o sexo de uma pessoa, mas só aceite os valores ‘M’ ou ‘F’. # Caso esteja errado, peça a digitação novamente até ter um valor correto. sexo = str(input('Qual o sexo? [M/F]: ')).upper().strip()[0] while sexo not in 'MmFf': print('Opção inváli...
StarcoderdataPython
1988740
<reponame>jmjacquet/IronWeb<filename>pyafipws/pyrece.py<gh_stars>0 #!usr/bin/python # -*- coding: utf-8-*- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3, or (at your option) a...
StarcoderdataPython
5150655
<reponame>pitzer42/telerem import pytest from unittest.mock import MagicMock @pytest.fixture def app(): return MagicMock() def test_smoke(app): assert app.events.on()
StarcoderdataPython
3461258
# 49. Group Anagrams # https://leetcode.com/problems/group-anagrams import unittest class Solution(object): def groupAnagrams(self, strs): """ :type strs: List[str] :rtype: List[List[str]] """ dic = {} for str in strs: sorted_str = tuple(sorted(str)) ...
StarcoderdataPython
8083047
<reponame>hamzamgit/pinax-teams from django import template from pinax.invitations.forms import InviteForm from pinax.invitations.models import InvitationStat register = template.Library() @register.inclusion_tag("pinax/invitations/_invites_remaining.html") def invites_remaining(user): try: remaining = ...
StarcoderdataPython
6404765
import pandas as pd import simpledorff import json import re from lxml import etree from django.shortcuts import render, redirect, reverse from django.http import Http404, JsonResponse from django.contrib import messages from django.contrib.auth.models import User, Group from django.contrib.auth.decorators...
StarcoderdataPython
3242851
class Tarea: def __init__(self, args = None, resultados = None): if args is None: args = {} if resultados is None: resultados = {} self.args = args self.resultados = resultados
StarcoderdataPython
4835810
<reponame>super-resolution/Impro """ """ from impro.data.image_factory import ImageFactory from impro.analysis.filter import Filter from impro.analysis.analysis_facade import * import os def setting_1(): # Create and prepare SIM image image = ImageFactory.create_image_file( r"D:\asdf\3D Auswertung 22...
StarcoderdataPython
8196977
<reponame>ezequielramos/oci-python-sdk<filename>src/oci/certificates_management/models/update_root_ca_by_generating_internally_config_details.py # coding: utf-8 # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License ...
StarcoderdataPython
8199947
<reponame>bcmi220/srl_syn_pruning import torch import torch.nn as nn class HighwayMLP(nn.Module): def __init__(self, input_size, gate_bias=-2, activation_function=nn.functional.relu, gate_activation=nn.functional.softmax): super(Highway...
StarcoderdataPython
12829285
""" A suite of functions for finding sources in images. :Authors: <NAME>, <NAME> :License: :doc:`LICENSE` """ import sys import math import numpy as np from scipy import signal, ndimage import stsci.imagestats as imagestats from . import cdriz __all__ = ['gaussian1', 'gausspars', 'gaussian', 'moments', 'errfunc'...
StarcoderdataPython
8077179
<reponame>Tlili-ahmed/2BiVQA import numpy as np import matplotlib.pyplot as plt import cv2 from scipy.optimize import curve_fit import os from scipy import stats from scipy.stats import spearmanr from sklearn.metrics import mean_squared_error from statistics import mean import pandas as pd from scipy.stats i...
StarcoderdataPython
260424
from openpype.pipeline import install_host from openpype.hosts.blender import api install_host(api)
StarcoderdataPython
9706052
#! /usr/bin/env python import sys, argparse def print_help(): print "usage: cluster_te.py [-i INFILE] \ \n\noptional arguments: \ \n -h help \ \n -o OUTFILE out file [optiional] \ \n -w WINDOW window size [3000] \ \n -s STEP window step size [500] \ \n -p PIRNA minimum numebr of piRNA p...
StarcoderdataPython