id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
144730 | #!/usr/bin/env python3
# -+-coding: utf-8 -+-
#--------------------------------------------
# Authors: <NAME> <<EMAIL>>
#
#--------------------------------------------
# Date: 05.09.19
#--------------------------------------------
# License: BSD (3-clause)
#--------------------------------------------
# Updates
#-----... | StarcoderdataPython |
188115 | <reponame>henryse/pi-weather-pro
# device present global variables
DS3231_Present = False
BMP280_Present = False
AM2315_Present = False
ADS1015_Present = False
ADS1115_Present = False
| StarcoderdataPython |
3292861 | <filename>asystem-anode/src/main/python/anode/plugin/plugin.py
from __future__ import print_function
import HTMLParser
import StringIO
import abc
import base64
import calendar
import datetime
import decimal
import io
import json
import logging
import numbers
import operator
import os.path
import re
import shutil
impor... | StarcoderdataPython |
60342 | <reponame>csadsl/poc_exp
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#__Author__ = ko0zhi
#__Service_ = Wordpress
#__Refer___ = http://www.beebeeto.com/pdb/poc-2014-0174/
#___Type___ = sql
#___name___ = http://www.exploit-db.com/exploits/35447/
'''
Wordpress插件漏洞, Google Document Embedder漏洞
'''
def assign(... | StarcoderdataPython |
134448 | import cv2
import numpy as np
def filterClusters(clusters):
# Remove things with angle far from median
for i in range(len(clusters)):
cluster = clusters[i]
if len(cluster) > 9:
median = np.median([facelet[2] for facelet in cluster])
clusters[i] = [facelet for facelet... | StarcoderdataPython |
43451 | <filename>api/notificationserializer.py
from rest_framework import serializers
from shared.models import Notification
class NotificationSerializer(serializers.Serializer):
title = serializers.CharField(max_length=60)
content = serializers.CharField()
date = serializers.DateTimeField()
source = serial... | StarcoderdataPython |
136105 | <reponame>imankulov/flask-boilerplate<gh_stars>0
"""
Flask application.
The module is used to initialize the main project: load configuration, attach
blueprints and initialize services.
What app.py can import?
-----------------------
Services, configuration, and everything that is needed to initialize blueprints,
in... | StarcoderdataPython |
3208734 | import os
import logging
import json
import boto3
logger = logging.getLogger()
logger.setLevel(logging.INFO)
client = boto3.client('lambda')
code_pipeline = boto3.client('codepipeline')
def put_job_success(job, message):
logger.info('Putting job success')
logger.info(message)
code_pipeline.put_job_succe... | StarcoderdataPython |
3387657 | <gh_stars>0
import cv2
import numpy as np
# Функция для вывода изображения на экран
def viewImage(image, window_name='window name'):
cv2.imshow(window_name, image)
cv2.waitKey(0)
cv2.destroyAllWindows()
# Считываем и визуализируем изображения
cone = cv2.imread('2.png')
road = cv2.imread('1.png')
viewIma... | StarcoderdataPython |
1720078 | from __future__ import unicode_literals
import os
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse
from django.utils.translation import ugettext as _
from django.views.decorators.vary import vary_on_headers
from django.core.files import File
from wagtail import VERSION ... | StarcoderdataPython |
3292500 | <reponame>DerekYJC/bmi_python<gh_stars>0
#!/usr/bin/python
'''
Test case for PPFDecoder
'''
import numpy as np
from scipy.io import loadmat, savemat
import utils
from riglib.bmi import sim_neurons
import imp
imp.reload(sim_neurons)
kin_data = loadmat('paco_hand_kin.mat')
hand_kin = kin_data['hand_kin']
hand_vel = han... | StarcoderdataPython |
1694558 | # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Also available under a BSD-style license. See LICENSE.
from typing import List, Optional, Tuple, NamedTuple
import tor... | StarcoderdataPython |
3347496 | from python_library.src.custom_sqlalchemy.database import db
from python_library.src.custom_sqlalchemy.database import engine
from python_library.src.custom_sqlalchemy.database import session
class db_manager:
"""
DB管理クラス(シングルトンを想定)
"""
__instance = None
def __new__(cls, *args, **kwargs):
"... | StarcoderdataPython |
1798837 | <filename>Math_Apps/Leibnitz_sector_formula/leibnitz_settings.py
__author__ = 'benjamin'
# general settings
# visu
x_min_view = -1
x_max_view = 3
y_min_view = -2
y_max_view = 2
# control degree
t_value_min = 0
t_value_max = 1
t_value_step = .01
t_value_init = 0
resolution = 100
sample_curve_names = [
("circle",... | StarcoderdataPython |
116237 | <reponame>fnbillimoria/OPEN
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
OPEN Energy System Module.
The EnergySystem Class has two types of methods
i) energy management system (EMS) methods which implement algorithms to
calculate Asset control references, and
ii) simulation methods which call an EMS method to ob... | StarcoderdataPython |
3312325 | <gh_stars>1-10
import os
from flask import Flask, flash, redirect, render_template, request, session, abort, url_for, make_response, Response
import sys
import yaml
import os.path
import base64
from predict_digit import *
from matplotlib import image as mplimg
import cv2
import numpy as np
#from flask_json import Flask... | StarcoderdataPython |
84236 | <reponame>dHannasch/python-packaging-test-bed<gh_stars>0
import setuptools
import os.path
import sphinx.setup_command
# To build the documentation: python setup.py build_sphinx
# To install this package: $ pip install --requirement ./requirements.txt --editable .
# To run the tests: $ python setup.py test or pytest
... | StarcoderdataPython |
52316 | import os
from aztk.models.plugins.plugin_configuration import PluginConfiguration, PluginPort, PluginTargetRole
from aztk.models.plugins.plugin_file import PluginFile
dir_path = os.path.dirname(os.path.realpath(__file__))
class SparkUIProxyPlugin(PluginConfiguration):
def __init__(self):
super().__init_... | StarcoderdataPython |
3225814 | <filename>tests/components/ozw/test_cover.py
"""Test Z-Wave Covers."""
from openpeerpower.components.cover import ATTR_CURRENT_POSITION
from openpeerpower.components.ozw.cover import VALUE_SELECTED_ID
from .common import setup_ozw
VALUE_ID = "Value"
async def test_cover(opp, cover_data, sent_messages, cover_msg):
... | StarcoderdataPython |
82633 | <reponame>Soulter/SoEarth---a-real-time-Earth-Wallpaper<filename>main.py<gh_stars>1-10
# -*- coding:UTF-8 -*-
from PIL import Image,ImageFont,ImageDraw
import requests
import urllib
import urllib.request
import win32api,win32con,win32gui
import json
import os
import time,datetime,threading
from tkinter import Button,Tk... | StarcoderdataPython |
136261 | <gh_stars>0
import itertools
import openmdao.api as om
from openaerostruct.aerodynamics.control_surfaces import ControlSurface
def _pairwise(iterable): # From itertools recipes
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
a, b = itertools.tee(iterable)
next(b, None)
return zip(a, b)
class ControlSurfac... | StarcoderdataPython |
4838599 | <reponame>ihsuy/Train-by-Reconnect<filename>train_by_reconnect/viz_utils.py<gh_stars>1-10
import textwrap
import math
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import ConnectionPatch
def Profiler(model, nrows=None, ncols=None, skip_1d=True, path=None, wrapwidth=30):
"""Plot weight... | StarcoderdataPython |
1642393 | <filename>random-commander-app.py<gh_stars>0
from app import app
import os
if __name__ == '__main__':
port = os.getenv('VCAP_APP_PORT', '8080')
print('Running On Port: ' + str(port))
app.run(debug=True, host='0.0.0.0', port=port) | StarcoderdataPython |
1765774 | <reponame>sugarsack/sugar
# coding: utf-8
"""
Task processing daemon.
"""
import time
from twisted.internet import reactor, threads
from twisted.internet import task as twisted_task
import twisted.internet.error
from sugar.lib.compat import yaml
from sugar.lib.logger.manager import get_logger
from sugar.lib.compiler.o... | StarcoderdataPython |
3320542 | # Tensorboard writer
import os
import torch
import numpy as np
from tensorboardX import SummaryWriter
class TensorboardWriter():
''' Tensorboard Writer '''
def __init__(self, log_dir=None):
self.log_dir = log_dir
self.writer = SummaryWriter(log_dir=log_dir)
def write(self, result, n_iter):
... | StarcoderdataPython |
102364 | <filename>src/open_sea/__init__.py
from .open_sea import OpenSea | StarcoderdataPython |
36156 | <filename>pysnmp/ALVARION-SMI.py
#
# PySNMP MIB module ALVARION-SMI (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALVARION-SMI
# Produced by pysmi-0.3.4 at Mon Apr 29 17:06:07 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ver... | StarcoderdataPython |
1622578 | #-*- coding:utf-8 -*-
__version__ = '0.1.0'
__author__ = '<NAME>, <NAME> 20.03.2019'
__status__ = 'dev' # options are: dev, test, prod
from ioproc.tools import action
from ioproc.logger import mainlogger
@action('general')
def printData(dmgr, config, params):
'''
simple debugging printing function. Prints ... | StarcoderdataPython |
1705349 | # Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory
# 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/LICEN... | StarcoderdataPython |
3252688 | """Remember umbrella
Use :py:mod:`requests` to scrape data from http://weather.gov/.
Write a program that runs just before you wake up in the morning and checks
whether it’s raining that day. If so, have the program text you a reminder to pack
an umbrella before leaving the house.
"""
import requests, bs4, datetime... | StarcoderdataPython |
3331179 | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import json
from django.test import (Client,
TestCase,
LiveServerTestCase)
from django.contrib.auth.models import User
from rest_fram... | StarcoderdataPython |
3287707 | <gh_stars>0
#!/usr/bin/python
#
# Copyright (c) 2016 <NAME>, <<EMAIL>>
# <NAME>, <<EMAIL>>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metad... | StarcoderdataPython |
182034 | <filename>get_gsheet.py
#!/usr/bin/env python3
from pprint import pprint
from pydoc import help
import pickle
import json
from google_auth_oauthlib import flow
from apiclient.discovery import build
AUTH_FILE = 'oauth2.json'
SCOPES = ["https://www.googleapis.com/auth/spreadsheets.readonly"]
SPREADSHEET_ID... | StarcoderdataPython |
165540 | <filename>main.py
import pygame as pg
import sys
import random
import math
import os
# init
pg.init()
pg.font.init()
# font
title_font = pg.font.SysFont('MalgumGothic', 96)
block_font1 = pg.font.SysFont('MalgunGothic', 72)
block_font2 = pg.font.SysFont('MalgunGothic', 55)
block_font3 = pg.font.SysFont('Ma... | StarcoderdataPython |
159164 | #!/usr/bin/env python3
import json
from datetime import datetime, timedelta
import os
from functools import partial
import pathlib
import requests
import sys
import time
import threading
TOK_THINGSPEAK_PRIMARY_ID = "THINGSPEAK_PRIMARY_ID"
TOK_THINGSPEAK_PRIMARY_ID_READ_KEY = "THINGSPEAK_PRIMARY_ID_READ_KEY"
DATA_DIR ... | StarcoderdataPython |
50482 | <filename>test/e2e/containers/dsd_sender/sender.py
import datadog
import time
client = datadog.dogstatsd.base.DogStatsd(socket_path="/var/run/dogstatsd/dsd.socket")
while True:
# Nominal case, dsd will inject its hostname
client.gauge('dsd.hostname.e2e', 1, tags=["case:nominal"])
client.service_check('dsd... | StarcoderdataPython |
1731077 | <gh_stars>0
"""
练习:
在终端中,循环录入字符串,如果录入空则停止.
停止录入后打印所有内容(一个字符串)
"""
result = []
while True:
content = input("请输入内容:")
if content == "":
break
result.append(content)
result = "_".join(result)
print(result)
| StarcoderdataPython |
95316 | import tictac.cli
tictac.cli.main()
| StarcoderdataPython |
3282737 | """
Test suite for all utils in the `core` application
"""
from django.test import override_settings
from cms.api import Page
from cms.test_utils.testcases import CMSTestCase
from richie.apps.core.factories import PageFactory
from richie.apps.core.helpers import create_i18n_page
class PagesTests(CMSTestCase):
"... | StarcoderdataPython |
1784496 | <filename>licytacje_api/database.py
import sqlite3
import json
def open_db():
conn = sqlite3.connect('auctions.db')
print("Opened database successfully")
return conn
def create_db_table(table_name: str, schema: dict, conn: sqlite3.Connection):
cursor = conn.cursor()
schema_str = ', '.join([str(k)... | StarcoderdataPython |
3263986 | <reponame>SamiIbishi/applied-machine-learning<filename>src/trainer/FaceNetTrainer.py
# General Packages
import json
import os
import time
import typing
import datetime
import numpy as np
# Torch Packages
import torch
import torch.nn.functional as f
# Utilities
from src.utils.utils_tensorboard import MySummaryWriter
f... | StarcoderdataPython |
49241 | <reponame>Darklanx/rl-baselines3-zoo
"""
Run multiple experiments on a single machine.
"""
import subprocess
import numpy as np
ALGOS = ["sac"]
ENVS = ["MountainCarContinuous-v0"]
N_SEEDS = 10
EVAL_FREQ = 5000
N_EVAL_EPISODES = 10
LOG_STD_INIT = [-6, -5, -4, -3, -2, -1, 0, 1]
for algo in ALGOS:
for env_id in ENV... | StarcoderdataPython |
60738 | <reponame>kentoku24/isobmff<filename>isobmff/iinf.py
# -*- coding: utf-8 -*-
from .box import FullBox
from .box import indent
from .box import read_box
from .box import read_int
from .box import read_string
class ItemInformationBox(FullBox):
box_type = 'iinf'
is_mandatory = False
def __init__... | StarcoderdataPython |
100518 |
def kIsClicked():
print("Character moves right ")
def hUsClikced():
print("Charater moves left")
keepGoing = True
#boolean = 뭐냐면 TRUE 또는 False냐의 변수
while True:
userInput = input("which number do you want to choose? (1~9) type 9 ")
if userInput == "k":
kIsClicked()
elif userI... | StarcoderdataPython |
3270553 | from django.db import transaction
from django.core.management.base import BaseCommand
import json
from binascii import hexlify
from simplecrypt import encrypt
from events.models import Event
from events.tasks import encrypt_event
class Command(BaseCommand):
help = 'Exports emails for campaigns - temp fix.'
d... | StarcoderdataPython |
1737326 | # -*- coding: utf-8 -*-
import mock
from h.viewpredicates import FeaturePredicate
class TestFeaturePredicate(object):
def test_text(self):
predicate = FeaturePredicate('foo', mock.sentinel.config)
assert predicate.text() == 'feature = foo'
def test_phash(self):
predicate = Feature... | StarcoderdataPython |
3301554 | <filename>Email Slicer/email_slicer.py
email = input('Enter you email: ').strip()
username = email[:email.index('@')]
domain = email[email.index('@') + 1:]
print(f"Your username is {username} and your domain name is {domain}") | StarcoderdataPython |
1676943 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 2 10:28:33 2021
@author: venkateshprasads
Input: nums = [2,7,11,15], target = 9
Output: [0,1]
Output: Because nums[0] + nums[1] == 9, we return [0, 1].
"""
class solution:
def __init__(self,nums,target):
self.nums=nums
s... | StarcoderdataPython |
48643 | # encoding: utf-8
"""
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for mor... | StarcoderdataPython |
3380222 | <reponame>fredricksimi/leetcode
"""
Knapsack Problem:
You're given an array of arrays where each subarray holds two integer values and represents an item;
the first integer is the item's value, and the second integer is the item's weight.
You're also given an integer representing the maximum capacity of a knapsack th... | StarcoderdataPython |
3315217 | interaction_model = "stream"
def bidirectional(stream):
return (item.upper() for item in stream)
def filter(stream):
return (item for item in stream if "foo" in item)
def source():
from itertools import count
return(str(item) for item in count())
| StarcoderdataPython |
4802037 | from flask import render_template,request,redirect,url_for
from . import main
from app.request import getRequest
rqst = getRequest()
@main.route('/')
def index():
'''
Highlight root page function that returns the index page and its data
'''
sources = rqst.get_sources('tech')
if sources:
r... | StarcoderdataPython |
152858 | <reponame>hadleyhzy34/GANs-practice
# -*- coding: utf-8 -*-
import torch.nn as nn
class discriminator(nn.Module):
def __init__(self):
super(discriminator, self).__init__()
self.main = nn.Sequential(
nn.Linear(784, 256),
nn.LeakyReLU(0.2),
nn.Linear(256, 256),
... | StarcoderdataPython |
3326869 | from statzcw import zvariance
from math import sqrt
def stddev(in_list):
"""
Calculates standard deviation of given list
:param in_list: list of values
:return: float rounded to 5 decimal places
"""
var = zvariance.variance(in_list)
std_dev = sqrt(var)
return round(std_dev, 5)
| StarcoderdataPython |
151824 | <reponame>hitchtest/hitchstory<gh_stars>10-100
def email_was_sent():
print("Email was sent")
| StarcoderdataPython |
3271763 | <filename>pyecs/__init__.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from entity import Entity
from events import Events
from component import Component
from .decorators import *
from . import components
from application import Application, profile
version = "0.0.11" | StarcoderdataPython |
1618704 | <filename>src/prostatex/preprocessing.py
import numpy
from numpy import pad
import math
from constants import Variables
from prostatex.model import Image
from prostatex.normalization import NormalizationMean, NormalizationFeatureScaling, NormalizationMedian
from scipy.ndimage.interpolation import zoom
def roi_mm(imag... | StarcoderdataPython |
3211867 | from .api.client import OpenFinClient
from .api.key import SubKey
from .exceptions import OpenFinWebSocketException
__VERSION__ = "0.1.0"
| StarcoderdataPython |
189383 | def user_selection(message, options):
# taken from https://github.com/Asana/python-asana/blob/master/examples/example-create-task.py
option_list = list(options)
print(message)
for i, option in enumerate(option_list):
print(i, ": " + option["name"])
index = int(input("Enter choice (default 0)... | StarcoderdataPython |
63703 | # coding:utf-8
import csv
from bs4 import BeautifulSoup
import requests
if __name__ == '__main__':
user_agent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1'
headers = {'User-Agent': user_agent}
r = requests.get('ht... | StarcoderdataPython |
172767 | from .value_empty import ValueEmpty | StarcoderdataPython |
3303074 | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software.
#The license can also be read online: <https://creativecommons.org/publicdomain/zero/1.0/>. If this online license dif... | StarcoderdataPython |
72423 | <filename>kalman/animation.py
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as pl
def draw3d(ax, xyz, R, quadcolor):
# We draw in ENU coordinates, R and xyz are in NED
ax.scatter(xyz[1], xyz[0], -xyz[2], color=quadcolor)
ax.quiver(xyz[1], xyz[0], -xyz[2], R[0, 1], R[0, 0], R[0, 2], pivo... | StarcoderdataPython |
105684 | <filename>SC/acme_report.py
from random import randint, sample, uniform
from acme import Product
ADJECTIVES = ['Awesome', 'Shiny', 'Impressive', 'Portable', 'Improved']
NOUNS = ['Anvil', 'Catapult', 'Disguise', 'Mousetrap', '???']
def generate_products():
products = []
for i in range(30):
name = '{}... | StarcoderdataPython |
92251 |
import urllib
import urllib.parse
import zlib
class Uri:
def __init__(self, scheme: str, hostname: str, port: int, resource: str):
""" Simple Uri (Universal Resource Identifier) class to split/join uri components
format: scheme://hostname:port/resource (e.g. http://stuff.com:1234/personal/ad... | StarcoderdataPython |
3238185 | <filename>python_schema/field/int_field.py<gh_stars>1-10
from python_schema import exception
from .base_field import BaseField
class IntField(BaseField):
def normalise(self, value):
value = super().normalise(value)
if value is None:
return value
message = f"IntField cannot b... | StarcoderdataPython |
1781400 |
import sys
with open(sys.argv[1], 'r') as test_cases:
for test in test_cases:
stringe = test.strip()
lista = str(stringe)
lista2 =[]
indices = []
si_no = 0
for i in lista:
lista2.append(int(i))
for j in range (0,len(lista2))... | StarcoderdataPython |
133976 | from nosuch.midiutil import *
from traceback import format_exc
from time import sleep
from nosuch.mididebug import *
from nosuch.midipypm import *
if __name__ == '__main__':
Midi.startup()
# m = MidiDebugHardware()
m = MidiPypmHardware()
a = m.input_devices()
for nm in a:
print "Opening input = ",nm
i = m.... | StarcoderdataPython |
3237392 | from .Inventory import *
import globals as G
import EventHandler
class hotbar(Inventory):
def __init__(self):
Inventory.__init__(self)
EventHandler.eventhandler.on_event("on_draw_2D", self.draw)
def getSlots(self):
y = 27
return [
Slot(197, y),
Slot(23... | StarcoderdataPython |
1743418 | # Copyright (c) 2012-2013, <NAME> <<EMAIL>>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSHelperFn, AWSObject, AWSProperty
from .validators import boolean, integer, positive_integer
EC2_INSTANCE_LAUNCH = "autoscaling:EC2_INSTANCE_LAUNCH"
EC2_INSTANCE_LAUNCH_ERROR = "autoscaling:EC2_I... | StarcoderdataPython |
1645153 | import sys
import os
import os.path as osp
from torchvision.datasets import CIFAR10 as TVCIFAR10
from torchvision.datasets import CIFAR100 as TVCIFAR100
from torchvision.datasets import SVHN as TVSVHN
import knockoff.config as cfg
from torchvision.datasets.utils import check_integrity
import pickle
class CIFAR10(TV... | StarcoderdataPython |
3210793 | <filename>website/backend/webserver/api/views/model_classes.py
from django.http import JsonResponse
from ..models import Project, ModelClass, DefaultAttribute
import json
from django.views.decorators.http import require_POST
from django.views.decorators.csrf import csrf_exempt
from pprint import pprint
import pathlib
i... | StarcoderdataPython |
1755938 | <reponame>hackersandslackers/jsonld-scraper-tutorial<filename>main.py
"""Script entry point."""
from extruct_tutorial import scrape
from config import URL
scrape(URL)
| StarcoderdataPython |
1627962 | <filename>test/unit/test_global_reduction.py
# This file is part of PyOP2
#
# PyOP2 is Copyright (c) 2012, Imperial College London and
# others. Please see the AUTHORS file in the main source directory for
# a full list of copyright holders. All rights reserved.
#
# Redistribution and use in source and binary forms, w... | StarcoderdataPython |
57410 | <gh_stars>1-10
#!/usr/bin/env python
import sys, os
from argparse import ArgumentParser
from .encryptor import getEncryptor
from .poller import createPoller
from .tcp_connection import TcpConnection
class Utility(object):
def __init__(self, args):
self.__result = None
if self.__getData(args):
... | StarcoderdataPython |
1606832 | import shlex
import aiohttp
import discord
import discord.ext
import logging
import argparse
import commands
import datetime
from cmd_manager import dispatcher
from config import config
from cmd_manager.bot_args import parser, HelpException, UnkownCommandException
from utils.handle_messages import send_message, delete_... | StarcoderdataPython |
1624846 | <filename>plugin.video.salts/scrapers/moviehut_scraper.py
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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 of the ... | StarcoderdataPython |
3036 | <gh_stars>1000+
"""Test Evil Genius Labs light."""
from unittest.mock import patch
import pytest
from homeassistant.components.light import (
ATTR_COLOR_MODE,
ATTR_SUPPORTED_COLOR_MODES,
ColorMode,
LightEntityFeature,
)
from homeassistant.const import ATTR_SUPPORTED_FEATURES
@pytest.mark.parametrize... | StarcoderdataPython |
1761930 | <gh_stars>100-1000
import pathlib
from setuptools import setup
here = pathlib.Path(__file__).parent
readme = (here / "README.md").read_text()
setup(
name="pygame-textinput",
version="1.0.0",
description="Enter text using pygame",
long_description=readme,
long_description_content_type="text/markdown... | StarcoderdataPython |
121461 | <filename>env/lib/python3.8/site-packages/location/runtests.py<gh_stars>0
#!/usr/bin/env python
import os
import sys
from os.path import dirname, abspath
from django.conf import settings
TRAVIS = False
if os.environ.get('TRAVIS') is not None:
TRAVIS = True
if not settings.configured:
DATABASES = {
'... | StarcoderdataPython |
3351640 | # Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
# Level 1
{
'target_name': 'test_wl1_fail',
'type': 'executable',
'msvs_settings': {
'VCCLCompilerTool': {
... | StarcoderdataPython |
4832185 | <gh_stars>0
import requests
import json
def check_response_body(responseContent):
# Checks if the structure of the response body has all required fields
# data
if not 'data' in responseContent:
print('No data field in response json!')
return False
# timelines - existence, list type, ... | StarcoderdataPython |
3311503 | <reponame>thusithathilina/FW-DDSM
import pickle
from numpy.random import choice
from json import dumps, load
from pathlib import Path
from numpy import genfromtxt
from fw_ddsm.scripts import household_generation
from fw_ddsm.scripts import household_scheduling
from fw_ddsm.tracker import *
class Household:
def ... | StarcoderdataPython |
4821634 | <gh_stars>0
# THIS FILE CONFIGURES YOUCOMPLETEME, ARGUABLY OBSOLETE FOR RECENT neovim.
# SEE '.ccls' FOR CONFIGURATION OF LANGUAGE PARSING FOR neovim-0.5 AND LATER.
# ALSO SEE https://tevaughan.gitlab.io/scripta/2021/08/16/neovim-c++.html
# See
# https://raw.githubusercontent.com/ycm-core/ycmd/master/.ycm_extra_conf.... | StarcoderdataPython |
3279131 | <reponame>chicm/draw
import os, glob
import numpy as np
import pandas as pd
import torch
import torch.utils.data as data
from torchvision import datasets, models, transforms
import cv2
import json
from PIL import Image
import random
from utils import get_classes, get_train_meta, get_val_meta, draw_cv2, get_country_code... | StarcoderdataPython |
3244140 | import os
import json
import requests
def get_uat(data,data_dict):
if isinstance(data,dict):
try:
data_dict[data['name'].strip()] = data['uri'].strip().split('/')[-1]
except:
pass
try:
data['children']
except:
pass
else:
... | StarcoderdataPython |
1629924 | from gpiozero import LED
from time import sleep
import RPi.GPIO as GPIO
import time
class DisplayManager(object):
def __init__(self):
GPIO.setmode(GPIO.BOARD)
GPIO.setup(8, GPIO.OUT)
GPIO.setwarnings(False)
# Flash the LED logo at initialization
print("Init")
def ... | StarcoderdataPython |
3361367 | <filename>mapping/gis/yoink/config_io.py
'''Loading and saving of Config objects.
'''
import ConfigParser
import datetime, logging, os
from ordereddict import OrderedDict
from .config import Config
from .feed import Feed
from .util import fullpath
logger = logging.getLogger('yoink.config_io')
def _make_feed(confi... | StarcoderdataPython |
1687792 | import pathlib
from setuptools import setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="etnapy",
version="1.0.0",
author="<NAME>",
author_email="<EMAIL>",
description="A python wrapper around the ETNA School API",
long_description=long_description,
long... | StarcoderdataPython |
3377985 | #!/usr/bin/env python
# Copyright (c) 2019 Cisco and/or its affiliates.
# 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 ... | StarcoderdataPython |
1654861 | <reponame>NicolasGrosjean/Paradox_Conflict_Detector
import argparse
import os
def get_args():
parser = argparse.ArgumentParser(
description="Detect conflicts between Paradox mods"
)
parser.add_argument(
"mod_repo_path",
type=str,
help="Path of the directory containing all t... | StarcoderdataPython |
3276674 | ##Patterns: E1124
def my_method(arg1, arg2):
print arg1 + arg2
def main():
##Err: E1124
my_method(1, arg1=2)
my_method(1, 2) | StarcoderdataPython |
116562 | import torch
# Methods for calculating properties of simulation system
class Observables():
def __init__(self, observable_dict):
supported_observables = ['kinetic_energy', 'angles']
def kinetic_energy(self, ): | StarcoderdataPython |
3352189 | # convenience wrapper for urllib2 & friends
import cookielib
import json
import urllib
import urllib2
import urlparse
import re
from urllib import quote, quote_plus as _quote_plus
from lxml import etree, html
from bs4 import BeautifulSoup
# used in plugins that import this
from urllib2 import URLError, HTTPError
u... | StarcoderdataPython |
170288 | <gh_stars>1-10
class Solution:
def brokenCalc(self, X: int, Y: int) -> int:
count = 0
while Y>X:
if Y%2==0:
Y //= 2
else:
Y += 1
count += 1
return count + X - Y
| StarcoderdataPython |
1740319 | <reponame>thinkgradient/solution-accelerator-many-models
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from azureml.core import Run
import pandas as pd
import numpy as np
import os
import argparse
import datetime
import joblib
from sklearn.metrics import mean_squared_er... | StarcoderdataPython |
1769470 | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | StarcoderdataPython |
1648685 | from mighty.forms.widgets.date import DateInput
from mighty.forms.widgets.time import TimeInput
from mighty.forms.widgets.ckeditor import Document, Classic
from mighty.forms.widgets.signature import SignatureInput
__all__ = (
DateInput, TimeInput, Document, Classic, SignatureInput
) | StarcoderdataPython |
88577 | <filename>problem0426.py
###########################
#
# #426 Box-ball system - Project Euler
# https://projecteuler.net/problem=426
#
# Code by <NAME>
#
###########################
| StarcoderdataPython |
3325003 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import joblib as jl
from matplotlib.patches import ConnectionPatch
plt.style.use('figstyle.mplstyle')
def style_plot(fig, axes):
fig.subplots_adjust(hspace=0.1)
for i, ax in enumerate(axes):
ax.patch.set_alpha(0.0)
side = ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.