id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
3214460
<gh_stars>0 #!/usr/bin/env python # -*- coding:utf-8 -*- # @Time : 2022/2/12 7:09 下午 # @Author: zhoumengjie # @File : shellclient.py import logging import subprocess from wxcloudrun.bond.PageTemplate import PROJECT_DIR log = logging.getLogger('log') def generate_deploy_blog(markdown_file): p = subprocess.Popen...
StarcoderdataPython
236572
<gh_stars>0 """ @package base Base Page class implementation It implements methods which are common to all the pages throughout the application This class needs to be inherited by all the page classes This should not be used by creating object instances Example: Class PageClassName(BasePage) """ from abc import...
StarcoderdataPython
5046512
<reponame>prismai/cvat<filename>cvat/apps/engine/services.py<gh_stars>0 import os import logging import re import subprocess from django.conf import settings # Util service functions def get_pts_times(video_file: str) -> list: ffmpeg_cmd_line = 'ffmpeg -i "{video_file}" -an -vsync 0 -debug_ts -f null - 2>&1 | ...
StarcoderdataPython
6549220
# # Este arquivo é parte do programa multi_agenda # # Esta obra está licenciada com uma # Licença Creative Commons Atribuição 4.0 Internacional. # (CC BY 4.0 Internacional) # # Para ver uma cópia da licença, visite # https://creativecommons.org/licenses/by/4.0/legalcode # # <NAME> - <EMAIL> # https://www.linkedin.c...
StarcoderdataPython
1856172
from micropsi_core.nodenet.stepoperators import CalculateFlowmodules class CalculateNumpyFlowmodules(CalculateFlowmodules): def execute(self, nodenet, nodes, netapi): if not nodenet.flow_module_instances: return for uid, item in nodenet.flow_module_instances.items(): it...
StarcoderdataPython
4834906
<reponame>sethgld/userbotseth """No Logic Pligon for @PepeBot \nCoding by Legend @NeoMatrix90 \nType .logic to see many logical fact """ from telethon import events import asyncio import random from userbot.utils import admin_cmd @borg.on(admin_cmd(pattern=f"logic", allow_sudo=True)) @borg.on(events.NewMessage(patter...
StarcoderdataPython
5039846
<filename>src/pipelining/pipes/pipe_load_all_gold_data.py<gh_stars>0 from etl.gold_data_manager import GoldDataContainer from pipelining.pipe_root import ConfigRoot from etl import maxqdata_manager, gold_data_transform_rules, gold_data_manager from pipelining import data_flow_registry from IPython import embed import m...
StarcoderdataPython
3572243
""" Universal Office Converter - Convert between any document format supported by LibreOffice/OpenOffice. See: https://github.com/dagwieers/unoconv """ # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here...
StarcoderdataPython
5118725
import os from urllib import parse from flask import Flask, redirect, request, make_response from flask_cors import CORS from aim.web.utils import Singleton from aim.web.app.config import config from aim.web.app.db import Db # from services.executables.manager import Executables as ExecutablesManager class App(meta...
StarcoderdataPython
3446504
#!/usr/bin/env python """ Dumps a DCD file to PDBs """ from __future__ import print_function, division import argparse import logging import os import sys import numpy as np import mdtraj as md import simtk.openmm.app as app # necessary for topology reading from mmCIF # Format logger logging.basicConfig(stream=sy...
StarcoderdataPython
66920
#Developer by Bafomet # -*- coding: utf-8 -*- import requests from settings import shodan_api # color R = "\033[31m" # Red G = "\033[1;34m" # Blue C = "\033[1;32m" # Green W = "\033[0m" # white O = "\033[45m" # Purple def honeypot(inp): url = f"https://api.shodan.io/labs/honeyscore/{inp}" try: ...
StarcoderdataPython
8197047
import picamera import picamera.array import png import math from pixel_object import PixelObject """ Image processor that can find the edges in a PNG image captured by a PiCamera. """ class ImageProcessor: def __init__(self, res_width=96, res_height=96): self.camera = picamera.PiCamera(resolution=(res_...
StarcoderdataPython
6657100
<filename>trough/_download.py import numpy as np from datetime import datetime, timedelta import math import pathlib import socket import abc import ftplib from urllib import request import re import json import functools import logging import warnings try: import h5py from madrigalWeb import madrigalWeb im...
StarcoderdataPython
5002191
import cv2 import numpy as np vc = cv2.VideoCapture(0) while -1: ret, img = vc.read() cv2.imshow('pyCam', img) k = cv2.waitKey(30) & 0xff if k == 27: vc.release() cv2.destroyAllWindows()
StarcoderdataPython
341675
from mcscript.lang.Type import Type from mcscript.lang.atomic_types import MetaType from mcscript.lang.resource.base.ResourceBase import Resource class TypeResource(Resource): """ Holds a resource type """ def type(self) -> Type: return MetaType def supports_scoreboard(self) -> bool: ...
StarcoderdataPython
1736394
import functools from django.db import transaction from django.db.models.signals import post_delete, post_save from django.dispatch import receiver from . import models, serializers, utils @receiver(post_save, sender=models.Message) def message_post_processing(sender, instance, created, **_kwargs): # pylint: di...
StarcoderdataPython
16069
<reponame>eclee25/flu-SDI-exploratory-age #!/usr/bin/python ############################################## ###Python template ###Author: <NAME> ###Date: 10/14/14 ###Function: Export zOR retrospective and early warning classifications into csv file format (SDI and ILINet, national and regional for SDI) ### Use nation-l...
StarcoderdataPython
3280567
<gh_stars>1-10 __version__ = "0.1.0" from .core import Movie from .presets import rotating_globe
StarcoderdataPython
3326774
<gh_stars>1-10 # -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-07-20 15:28 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('lowfat', '0048_auto_20160720_1107'), ] operations = [ migrati...
StarcoderdataPython
11205427
<filename>ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HIVE/package/scripts/params.py #!/usr/bin/python2 """ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ow...
StarcoderdataPython
100854
# Generated by Django 2.2.10 on 2021-07-02 04:01 import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0003_customer_phone'), ] operations = [ migrations.AddField( model_name='customer', ...
StarcoderdataPython
365140
import time import copy import numpy as np import matplotlib.pyplot as plt import math import os from shutil import copy2 from mpl_toolkits.axes_grid1 import make_axes_locatable from mpi4py import MPI import sys import scipy.io as sio from pysit import * from pysit.gallery import horizontal_reflector from pysit.util...
StarcoderdataPython
8008045
from enum import Enum class State(Enum): BADEN_WUERTTENBERG = "Baden-Württenberg" BAYERN = "Bayern" BERLIN = "Berlin" BRANDENBURG = "Brandenburg" BREMEN = "Bremen" HAMBURG = "Hamburg" HESSEN = "Hessen" MECKLENBURG_VORPOMMERN = "Mecklenburg-Vorpommern" NIEDERSACHEN = "Niedersachen" ...
StarcoderdataPython
9618576
<reponame>fswzb/autotrade #!/usr/bin/env python # -*- coding: utf-8 -*- import abstract as tech_factor import talib.abstract __all__ = tech_factor.__all__ + list( filter(lambda x: x.isupper() and not x.startswith('_'), dir( talib.abstract)))
StarcoderdataPython
8096450
#python 3.5.2 def makeChange(coinValueList, change, debug): count = 0 coinValueList.sort(reverse=True) result = {} for coin in coinValueList: result[coin] = 0 if debug: print('COIN VALUES: ', coinValueList) while len(coinValueList) > count: if change -...
StarcoderdataPython
11367046
from colouring.colour import Colour class Node(object): def __init__(self, colour: Colour, id: int): self._colour = colour self.id = id def get_colour(self) -> Colour: return self._colour
StarcoderdataPython
4932507
<reponame>lupyuen/RaspberryPiImage<filename>usr/share/pyshared/ajenti/plugins/samba/smbusers.py import subprocess class SambaUser (object): def __init__(self): self.username = None self.sid = None class SambaUsers (object): def load(self): self.users = [] for un in [s.split('...
StarcoderdataPython
5090167
<reponame>danieldennett/gap_sdk # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite_schema_head import flatbuffers class DimensionMetadata(object): __slots__ = ['_tab'] @classmethod def GetRootAsDimensionMetadata(cls, buf, offset): n = flatbuffers.encode.Get(...
StarcoderdataPython
8103235
import argparse import pandas as pd from family import * from utils import * if __name__ == '__main__': argp = argparse.ArgumentParser() argp.add_argument('-p', '--pedfile', default="Test_Ped.txt") argp.add_argument('-d', '--data', default="Test_cleaned.txt") argp.add_argument('-o', '--output', default...
StarcoderdataPython
1881349
# Copyright 2015 redisapi authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. import unittest import mock import os import json from redisapi.storage import Instance, MongoStorage class DockerManagerTest(unittest.TestCase): def rem...
StarcoderdataPython
12832426
# -*- coding: utf-8 -*- __author__ = 'luckydonald' from .exceptions import NoResponse, IllegalResponseException from .encoding import to_unicode as u from time import sleep import atexit import logging logger = logging.getLogger(__name__) __all__ = ["receiver", "sender", "Telegram"] class Telegram(object): """ ...
StarcoderdataPython
1848991
<reponame>malyvsen/unifit import scipy.stats # some distributions were excluded because they were: # * deprecated # * raising errors during fitting # * taking ages to fit (levy_stable) names = [ 'alpha', 'anglit', 'arcsine', 'argus', 'beta', 'betaprime', 'bradford', 'burr', 'burr12...
StarcoderdataPython
3483867
# Copyright (c) 2021 The Trade Desk, Inc # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the following discl...
StarcoderdataPython
5084887
<filename>example.py<gh_stars>0 from yaml2args import yaml2args import argparse parser = argparse.ArgumentParser(description='PyTorch ImageNet Training') parser.add_argument('-c', '--config', default='config.yaml', type=str, help='path to config file.') parser.add_argument('--resume', default='', type=str, metavar='PA...
StarcoderdataPython
288287
from fontTools.cffLib import PrivateDict from fontTools.cffLib.specializer import stringToProgram from fontTools.misc.testTools import getXML, parseXML from fontTools.misc.psCharStrings import ( T2CharString, encodeFloat, encodeFixed, read_fixed1616, read_realNumber, ) from fontTools.pens.recordingP...
StarcoderdataPython
373003
from contextlib import contextmanager import enum import typing import pymongo from energuide import dwelling from energuide import logger LOGGER = logger.get_logger(__name__) class EnvVariables(enum.Enum): username = 'ENERGUIDE_USERNAME' password = '<PASSWORD>' host = 'ENERGUIDE_HOST' port = 'ENE...
StarcoderdataPython
8014426
from swingers import models
StarcoderdataPython
3361095
from collections import Counter from anytree import Node, PostOrderIter class Circus: day = 7 test = 2 def process(self, raw_input): nodes = {new_node.name: new_node for new_node in self.parseInput(raw_input)} for node in nodes.values(): if len(node.childrenNames)...
StarcoderdataPython
1737709
<filename>shaape/cairobackend.py import cairo import os import errno import math from drawingbackend import DrawingBackend import networkx as nx from translatable import Translatable from rotatable import Rotatable from node import Node import pangocairo import pango import warnings class CairoBackend(DrawingBackend):...
StarcoderdataPython
6519702
<filename>crawling_update7/crawlKoreaData_Seoul.py import requests from bs4 import BeautifulSoup from utils import write_data import time import datetime from datetime import date, timedelta def get_data(url): html = requests.get(url).text soup = BeautifulSoup(html, 'html.parser') updated = s...
StarcoderdataPython
8197153
from collections import defaultdict from decimal import Decimal from _datetime import datetime, timedelta from enum import Enum import math import random import re import requests import time from vnpy.app.algo_trading import AlgoTemplate from vnpy.trader.utility import round_to from vnpy.trader.constant import Direct...
StarcoderdataPython
6678927
<gh_stars>0 import numpy as np import cv2 as cv from matplotlib import pyplot as plt img = cv.imread('D:\@Semester 06\Digital Image Processing\Lab\Manuals\Figures\lab4\_img3.tif', 0) [w, h] = img.shape # Get image rows & cols histogram = list() # Create empty lists pdf = list() cdf = list() tf = list() for p...
StarcoderdataPython
394299
# -*- coding: utf-8 -*- import sys from ..decorators import linter from ..parsers.base import ParserBase @linter( name="black", install=[[sys.executable, "-m", "pip", "install", "-U", "black"]], help_cmd=["black", "-h"], run=["black"], rundefault=["black"], dotfiles=[], language="python"...
StarcoderdataPython
5126834
<gh_stars>0 from game_states import GameStates def kill_player(player, colors): player.char = '%' player.color = colors.get('dark_red') return 'You died!', GameStates.PLAYER_DEAD def kill_monster(monster, colors): death_message = '{0} is dead!'.format(monster.name.capitalize()) monster.char = ...
StarcoderdataPython
1879517
"""Helper functions used across this library.""" import os import re from functools import partial from itertools import islice from typing import Tuple EXTENSIONS = re.compile(r".+py$|.+zip$|.+egg$") def take(n, iterable): """ Return first n items of the iterable as a list Notes ----- From iter...
StarcoderdataPython
12830500
""" ml_digit_recognition.py Trains a neural network to recognize handwritten digits from the MNIST database. Author: <NAME> Created: 10 - 28 - 2017 """ import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data as mnist_input_data from random...
StarcoderdataPython
11261740
<reponame>spp2/PythonStdioGames import pytest import sys import io from gamesbyexample import mancala def test_getNewBoard(): assert mancala.getNewBoard() == {'1': 0, '2': 0, 'A': 4, 'B': 4, 'C': 4, 'D': 4, 'E': 4, 'F': 4, 'G': 4, 'H': 4, 'I': 4, 'J': 4, 'K': 4, 'L': 4} def test_displayBoard(capsys): game...
StarcoderdataPython
4891416
"""Fingerprint generate fingerprints from molecules. fp = Fingerprint(numIntegers) Generate a fingerprint object that stores fingerprints in an array of numIntegers. fp.addPath(path) add a path to the fingerprint. path is any str'able value. fp in fp2 returns 1 if the fingerprint fp is a containe...
StarcoderdataPython
9756440
""" Manual Control ============== Module storing an implementation of a controller and values associated with it. The `Controller` class is the implementation of a closed loop control system for the ROV, with the hardware readings executed in separate process. The readings are forwarded to the shared memory in a prev...
StarcoderdataPython
359098
#!/bin/env python3 import argparse import time import sqlite3 def search(c, target, threshold): return count, t2-t1 def tanimoto_count(connection, target, threshold): print('Target structure:', target) print('Minimum Tanimoto similarity:', threshold) t1 = time.time() count = connection.execute( ...
StarcoderdataPython
5048925
#!/usr/bin/env python import argparse import json import logging parser = argparse.ArgumentParser(description=( 'Converts text profile data into JSON format compatible with Chrome.')) parser.add_argument('profile', type=str, nargs='+', help='profile files') args = parser.parse_args(...
StarcoderdataPython
8136737
# Aula 13 (Estrutura de Repetição for) numero = int(input('Tabuada de: ')) for c in range(1, 11): print('{} X {}: {}'.format(numero, c, numero * c))
StarcoderdataPython
5088653
class Analyze( Demon, ): pass
StarcoderdataPython
3336263
from PIL import Image import subprocess def cleanFile(filePath, newFilePath): image = Image.open(filePath) #Set a threshold value for the image, and save image = image.point(lambda x: 0 if x<143 else 255) image.save(newFilePath) #call tesseract to do OCR on the newly created image subprocess....
StarcoderdataPython
4926791
<reponame>Nerd-Bear/DSM-API<filename>app_app/admin.py from django.contrib import admin from . import models class AppModelAdmin(admin.ModelAdmin): list_display = ('name', 'description', 'owner') admin.site.register(models.AppModel, AppModelAdmin)
StarcoderdataPython
12832400
<reponame>Badger-Finance/python-keepers import pytest import responses from requests import HTTPError from config.enums import Network from src.token_utils import get_token_price @responses.activate def test_get_token_price_prod(): currency = "usd" price = 8.75 responses.add( responses.GET, ...
StarcoderdataPython
1851780
<filename>tests/conftest.py import os import pytest @pytest.fixture def os_environ(monkeypatch): mock_environ = dict(os.environ) monkeypatch.setattr(os, 'environ', mock_environ) return mock_environ
StarcoderdataPython
205269
<filename>autosklearn/experimental/hyperboost/acquistion_function.py import numpy as np from smac.optimizer.acquisition import AbstractAcquisitionFunction class ScorePlusDistance(AbstractAcquisitionFunction): def __init__(self, model): super().__init__(model) def _compute(self, X: np.ndarray): ...
StarcoderdataPython
3513561
# -*- coding: utf-8 -*- from flask import render_template, Response, redirect, url_for, flash from flask_restful import Resource, reqparse from airports import db class Airport(Resource): def get(self, iata_code): if iata_code: query = db.engine.execute("SELECT * FROM airports WHERE iata_code=...
StarcoderdataPython
165931
import torch import torch.utils.data from rlkit.torch.pytorch_util import from_numpy from torch import nn from torch.autograd import Variable from torch.nn import functional as F from rlkit.pythonplusplus import identity from rlkit.torch import pytorch_util as ptu import numpy as np class RefinementNetwork(nn.Module):...
StarcoderdataPython
6476774
""" @brief Flask blueprint are registered in _init__.py file. @details The file contains a blueprint registered for Ticket Management app which is apis_blueprint. """ from flask import Flask from flask_sqlalchemy import SQLAlchemy import os from flask_migrate import Migrate from flask_security import SQLA...
StarcoderdataPython
9700282
def findtwo2020(filename): f = open(filename) data = f.readlines() f.close() data = [int(item.strip("\n")) for item in data] for i in range(len(data)): for j in range(i+1,len(data)): #print(data[i],data[j],data[i]+data[j]) if data[i]+data[j] == 2020: ...
StarcoderdataPython
6657638
<reponame>adamcvj/SatelliteTracker<gh_stars>1-10 #------------------------------------------------------------------------------ # Copyright (c) 2005, Enthought, Inc. # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be r...
StarcoderdataPython
1948923
<reponame>cjw296/carly import json from collections import Counter from twisted.internet.protocol import DatagramProtocol from twisted.internet.task import LoopingCall class CollectorProtocol(DatagramProtocol): def __init__(self): self.counts = Counter() def datagramReceived(self, data, addr): ...
StarcoderdataPython
3272804
<reponame>t4d-classes/python_03222021_afternoon from statistics import mean, median, stdev prices = [] with open("gme_price.txt", "r") as price_file: for price in price_file: prices.append(float(price)) print(f"Max: {max(prices)}") print(f"Min: {min(prices)}") print(f"Mean: {mean(prices)}") print(f"Med...
StarcoderdataPython
9647991
from parsl.config import Config from parsl.executors import WorkQueueExecutor config = Config( executors=[WorkQueueExecutor(port=50055, # init_command='source /home/yadu/src/wq_parsl/setup_parsl_env.sh; # echo "Ran at $date" > /home/yadu/src/wq_pars...
StarcoderdataPython
12863794
<reponame>sawood14012/fabric8-analytics-jobs<filename>f8a_jobs/handlers/flow.py<gh_stars>1-10 """Schedule multiple flows of a type.""" from .base import BaseHandler class FlowScheduling(BaseHandler): """Schedule multiple flows of a type.""" def execute(self, flow_name, flow_arguments): """Schedule m...
StarcoderdataPython
1780577
<reponame>meow464/pyobjus __version__ = '1.2.0' from .pyobjus import *
StarcoderdataPython
3255077
<gh_stars>0 #!/usr/bin/env python3 from SuPyModes.Geometry import Geometry, Circle from SuPyModes.Solver import SuPySolver from SuPyModes.sellmeier import Fused_silica import time Clad = Circle(Radi=62.5, Position=(0, 0), Index=Fused_silica(1.55)) Core0 = Circle(Position=Clad.C[0], Radi=4.2, Index=Fused_silica(1.55)...
StarcoderdataPython
4853204
<filename>plexmonitor/tasks/email_task.py<gh_stars>0 import email from sparts.tasks.periodic import PeriodicTask # type: ignore from plexmonitor.lib.command import Command from plexmonitor.lib.email import Inbox class EmailTask(PeriodicTask): """ Periodic task to read the email inbox and scan for new commands. ...
StarcoderdataPython
8199923
<gh_stars>10-100 # coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overlo...
StarcoderdataPython
4882632
# Given a parent-child list, filter remove all tuples with a term where another tuple # has a child term # Group by first column import sys if len(sys.argv) < 2: print sys.argv[0], "[parent-child file]" print "Filter all tuples having a parent term when a tuple with a child term exists" exit(1) sep="|" parents...
StarcoderdataPython
1853231
#!/usr/bin/env python3 # # How to run: python3 ocr_to_csv.py [filename] # import io, json, sys, os, psycopg2 from PIL import Image, ImageDraw from PIL import ImagePath from pathlib import Path from ocr import ocr_tesseract from ocr import ocr_google_vision if len(sys.argv) != 2: print("Error: filename missing."...
StarcoderdataPython
9769524
<reponame>philroche/teamclock<filename>teamclock/clocks/models.py # -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ from timezone_field impor...
StarcoderdataPython
12839361
<gh_stars>100-1000 import requests import json url = 'http://localhost:5000/invocations' data = { 'Pclass':[3,3,3], 'Sex': ['male', 'female', 'male'], 'Age':[4, 22, 28] } j_data = json.dumps(data) headers = {'Content-Type': 'application/json'} print("Sending request for model...") print(f...
StarcoderdataPython
4975847
<filename>src/index.py from __future__ import print_function, division import os import sys root = os.getcwd().split("MAR_test")[0] + "MAR_test/src/util" sys.path.append(root) from flask import Flask, url_for, render_template, request, jsonify, Response, json from pdb import set_trace from mar import MAR app = Flas...
StarcoderdataPython
151689
<gh_stars>10-100 # If you have not yet seen the source in basic/main.py, please take a look. # In this sample we override the ProtoRPC message schema of MyModel in both the # request and response of MyModelInsert and in the response of MyModelList. # This is used to randomly set the value of attr2 based on attr1. imp...
StarcoderdataPython
1894108
<reponame>nima1999nikkhah/SimSiam_gMLP import argparse import os import time import shutil import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.tensorboard import SummaryWriter import torchvision from torch.utils.data import Dataset, DataLoader import numpy as...
StarcoderdataPython
4807869
"""This is the package which contains all the cogs""" from .community import Community from .logs import Logs from .misc import Cmds from .sudo import Sudo # Yes this entire package will be one extension # This will speed up the launch! def setup(bot): bot.add_cog(Community(bot)) bot.add_cog(Logs(bot)) bo...
StarcoderdataPython
375332
import logging logging.basicConfig(level=logging.INFO, format="[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S") logger = logging.getLogger(__name__) def is_positive_number(value): try: value = int(value) return val...
StarcoderdataPython
9780616
<reponame>jshridha/home-assistant """Support for Lutron lights.""" import logging from homeassistant.components.light import ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light from . import LUTRON_CONTROLLER, LUTRON_DEVICES, LutronDevice _LOGGER = logging.getLogger(__name__) def setup_platform(hass, config, add_entities, ...
StarcoderdataPython
3479151
#!/usr/bin/env python3 class Solution: def findPeakElement(self, nums: [int]) -> int: if len(nums) == 0: return -1 left = 0 right = len(nums) while left < right: mid = (left + right) // 2 if nums[mid] < nums[mid+1]: left = mid+1 else: right = mid # Post-processing: # End Con...
StarcoderdataPython
1621732
# -*- coding: utf-8 -*- from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('open_humans', '0015_auto_20150410_0042'), ] operations = [ migrations.AlterModelManagers( name='member', managers=[ ], )...
StarcoderdataPython
3446888
<gh_stars>100-1000 import smtplib import ssl """Make sure that the gmail you are using have enabled less secure app otherwise email will not be sent""" def send_email(message): port = 465 # For SSL smtp_server = "smtp.gmail.com" sender_email = "Enter your Email" receiver_email = "Again Enter Sam...
StarcoderdataPython
11276282
<filename>fall_down_detecter.py #!/usr/bin/env python # encoding: utf-8 ''' @author: zhaoyuxin @connect: <EMAIL> @file: thinter_s.py @time: 2020/8/4 20:02 ''' import tkinter as tk from tkinter import messagebox import sys import os import threading import fileinput from demo import detect_main address_dir = 'Video_...
StarcoderdataPython
4955144
from setuptools import setup, find_packages setup( name='redshift_nn', version='1.0', packages=find_packages(), include_package_data=True, description='Redshfit NN using a keras model on Cloud ML Engine', author='<NAME>', author_email='<EMAIL>', license='MIT', install_requires=[ ...
StarcoderdataPython
11320486
<reponame>vinnamkim/pytorch-cifar<filename>only_test.py '''Train CIFAR10 with PyTorch.''' import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torch.backends.cudnn as cudnn import torchvision import torchvision.transforms as transforms import os import argparse from u...
StarcoderdataPython
3582586
<filename>examples/a_unicorn_examples/solve.py import unicorn import random import string import capstone import re import globalData import binascii def ranstr(num): salt = ''.join(random.sample(string.ascii_letters + string.digits, num)) return salt cs = capstone.Cs(capstone.CS_ARCH_ARM64, capstone.CS_MOD...
StarcoderdataPython
5127984
import sys from data_manager import DataManager # from flight_search import FlightSearch # from flight_data import FlightData # from notification_manager import NotificationManager dm = DataManager() first_name = input("Firstname: ") last_name = input("Lastname: ") email = input("Email: ") confirm_email = input("Conf...
StarcoderdataPython
6424808
<gh_stars>0 #! /usr/bin/env python3 """ multiple-well master equations """ import sys, os, time import ctypes import numpy as np import scipy.linalg from . import __version__ from . import constants from .solverlib import load_library from .solverlib import set_num_threads from .solverlib import restore_num_threads ...
StarcoderdataPython
4891551
<filename>chainerrl/v_function.py<gh_stars>100-1000 from abc import ABCMeta from abc import abstractmethod class VFunction(object, metaclass=ABCMeta): @abstractmethod def __call__(self, x): raise NotImplementedError()
StarcoderdataPython
3292461
from django.core.exceptions import PermissionDenied from django.contrib import messages from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect from django.utils.translation import ugettext_lazy as _ class BackendPermissionViewMixin(object): ''' Base mixin for views that are ...
StarcoderdataPython
9699721
# -*- coding: utf-8 -*- # Copyright (c) 2010-2017 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modif...
StarcoderdataPython
1921636
"""Process management module.""" from .manager import ProcessManager from .process import ManagedProcess, ProcessInfo __all__ = [ "ManagedProcess", "ProcessInfo", "ProcessManager", ]
StarcoderdataPython
3578625
import sys import matplotlib.pyplot as plt import csv import numpy title = "Server latency vs Number of clients" output = "comparison_latency.pdf" y_label = "Latency (μs)" def setBoxColors(bp): plt.setp(bp['boxes'][0], color='red') plt.setp(bp['medians'][0], color='red') plt.setp(bp['caps'][0], color='re...
StarcoderdataPython
333026
<reponame>jonasvj/TFDE<filename>datasets/synthetic.py import datasets import numpy as np class EightGaussians: class Data: def __init__(self, data): self.x = data.astype(np.float32) self.N = self.x.shape[0] def __init__(self): file = datasets.root + 'synthetic/8gaussi...
StarcoderdataPython
5159739
<gh_stars>0 """Add Envelope Functionality Revision ID: b3c0c76ac2e6 Revises: <PASSWORD> Create Date: 2018-04-06 20:17:17.556595 """ # revision identifiers, used by Alembic. revision = 'b3c0c76ac2e6' down_revision = '<PASSWORD>' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto ge...
StarcoderdataPython
3201346
<filename>openmldefaults/config_spaces/svc.py<gh_stars>1-10 import ConfigSpace def get_hyperparameter_search_space_small(seed): """ Small version of svm config space, featuring important hyperparameters based on https://arxiv.org/abs/1710.04725 Parameters ---------- seed: int Random s...
StarcoderdataPython
11350627
<reponame>floatofmath/floatofmath.github.com """This is the simple python script that does all the work for setting up the beautiful bioinformatics site. First we look into site.info were all pages are defined by the triple of page name, which will determine the file names, page title, which determines the ...
StarcoderdataPython
8058512
import random def write_file(path: str): new_file = open("reduced_data.list", "w+") with open(path, "r", errors='ignore') as file: for line in file.readlines()[14:]: probability = random.uniform(0, 1) if probability > 0.99: new_file.write(line) def make_film_...
StarcoderdataPython