id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
4822038 | #!/usr/bin/env python3
# Copyright (c) 2019 MindAffect B.V.
# Author: <NAME> <<EMAIL>>
#
# 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 ... | StarcoderdataPython |
146468 | import cv2
import glob, os
import numpy as np
import re
import fnmatch
import pickle
import random
from shutil import copy, copyfile
import json
def saveAnnotation(jointCamPath, positions):
fOut = open(jointCamPath, 'w')
fOut.write("F4_KNU1_A " + str(positions[0][0]) + " " + str(positions[0][1]) + "\n")
f... | StarcoderdataPython |
4800366 | <gh_stars>0
def active_index_set(mode="", index=0):
'''Set active sculpt/paint brush from it’s number
:param mode: Mode, Paint mode to set brush for
:type mode: string, (optional, never None)
:param index: Number, Brush number
:type index: int in [-inf, inf], (optional)
'''
pass
def a... | StarcoderdataPython |
1754713 | <gh_stars>0
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
import os
import tempfile
import unittest
from chainer import optimizers
from chainer i... | StarcoderdataPython |
3229012 | <filename>code_week11_76_712/diving_board_lcci.py
'''
你正在使用一堆木板建造跳水板。有两种类型的木板,其中长度较短的木板长度为shorter,长度较长的木板长度为longer。你必须正好使用k块木板。编写一个方法,生成跳水板所有可能的长度。
返回的长度需要从小到大排列。
示例:
输入:
shorter = 1
longer = 2
k = 3
输出: {3,4,5,6}
提示:
0 < shorter <= longer
0 <= k <= 100000
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/diving... | StarcoderdataPython |
29770 | from modules.abstract_module import *
class MockModule(AbstractModule):
executed = False
name = "mock_module"
description = "Module for testing purposes."
arguments = [
ModuleArgumentDescription("Arg1", "Argument 1", True),
ModuleArgumentDescription("Arg2", "Argument 2",... | StarcoderdataPython |
11755 | from . import lights
from . import schedule
| StarcoderdataPython |
3359816 | #!/usr/bin/env python3
from setuptools import setup
packages = ['hackathonbaobab2020',
'hackathonbaobab2020.core',
'hackathonbaobab2020.solver',
'hackathonbaobab2020.execution',
'hackathonbaobab2020.solver.milp_LP_HL']
with open("README.md", "r") as fh:
long_descri... | StarcoderdataPython |
1701226 | #!/usr/bin/env python3
# coding=utf-8
import pika
class RabbitMQUtil:
def connect_vhost(self, url):
connection = pika.BlockingConnection(pika.URLParameters(url))
self.channel = connection.channel()
def connect(self, host='localhost', port=5672, username=None,
password=None):
... | StarcoderdataPython |
3240571 | <reponame>thermokarst-forks/q2-alignment
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2017, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# -------... | StarcoderdataPython |
13306 | <filename>half_json/json_util.py
# coding=utf8
import re
import json.decoder
from collections import namedtuple
from json.decoder import JSONDecoder
from json.scanner import py_make_scanner
from json.decoder import py_scanstring
class JSONDecodeError(object):
def __init__(self, parser, message):
self.me... | StarcoderdataPython |
3330088 | # Copyright (C) 2009 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the... | StarcoderdataPython |
1616683 | #============================================================
# Worklist.py - A worklist module to help support
# multithreaded environments.
#
# Often in a multithreaded environment, there is a piece
# of work (a task) that needs to be done within a certain
# predesignated thread (such as man... | StarcoderdataPython |
1741689 | <gh_stars>0
import logging
import great_expectations as ge
import pandas as pd
import unittest
from etl.helpers import common
from etl.helpers.dataset_shape import ShapePandasDataset
"""Unit tests for Great Expectations common helpers.
Run with `python -m etl.helpers.test_ge_common`.
"""
TEST_DATA = pd.DataFrame(
... | StarcoderdataPython |
59749 | <reponame>sarthak212/Own-Proxy
import colorama
from colorama import Fore, Back, Style
colorama.init(autoreset=True) # Reset Colour after every line
colorama.init() #Initialize
def col_info(msg):
print(Fore.MAGENTA + msg)
def col_connect(method,path):
print(Fore.GREEN + method+" ",end="")
print(Fore.CYAN... | StarcoderdataPython |
1746408 | import time
from basic_model.direction import Direction
from tools.mapper import simu_to_gamestate
from service.snake_controller import SnakeController, ControllerMode
from simu_model.guiboard import GuiBoard
class SimuGame:
def __init__(self, map_size, number_of_snakes):
self.map_size = map_size
... | StarcoderdataPython |
4817180 | <filename>SoftUni Exercices/Bomb Numbers.py<gh_stars>1-10
numbers = list(map(int, input().split()))
bomb, power = list(map(int, input().split()))
while bomb in numbers:
index = numbers.index(bomb)
left_range = max(0, index - power)
for i in range(left_range, index):
numbers.pop(left_range)
i... | StarcoderdataPython |
1637584 | <reponame>Polaris-Yang/DMFB_tool<gh_stars>1-10
############################################################################################
# Cell类用于表示路径的每一个cell
# Droplet类表示的是每一个液滴
# Created by 吴贻能 on 2019/12/10.
############################################################################################
class Cell:... | StarcoderdataPython |
3340225 | #!/usr/bin/torify /usr/bin/python
import Tkinter
import tkFont
import requests
import html2text
import urllib2
class TkDND(object):
def __init__(self, master):
master.tk.eval('package require tkdnd')
self.master = master
self.tk = master.tk
self._subst_format = ('%A', '%a', '%b', '... | StarcoderdataPython |
1741820 | # Copyright 2018 <NAME> and <NAME>. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | StarcoderdataPython |
111207 | <reponame>jcketterer/python-challenge-
import os
import csv
#Setting Dictionary for candidates
candidatedict = {}
#Setting total votes variable
total_votes = 0
line_break = "-"*30
#Setting path for CSV file
path = os.path.join("election_data.csv")
with open(path,newline="") as data:
data_reader = csv.reader(dat... | StarcoderdataPython |
13646 | <filename>convert.py<gh_stars>0
import wave
import struct
import subprocess
import os
import opusenc
import base64
import zlib
import sys
tmp = sys.argv[1] + ".wav"
subprocess.Popen(["ffmpeg", "-i", sys.argv[1], "-ar", "48000", "-ac", "2", "-y", tmp], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
... | StarcoderdataPython |
3342603 | """
Utilities for getting data directly from twitter
Uses Tweepy for getting tweets and trends
Uses mechanize+BeautifulSoup to get reply chains and top users
This file uses the "person" convention, because it provides REAL data from REAL twitter accounts
"""
import mechanize
import tweepy
from bs4 import BeautifulSoup... | StarcoderdataPython |
1678461 | <reponame>5l1v3r1/0-orchestrator
"""
Auto-generated class for Job
"""
from . import client_support
class Job(object):
"""
auto-generated. don't touch.
"""
@staticmethod
def create(id, logLevels, maxRestart, maxTime, queue, recurringPeriod, statsInterval, tags):
"""
:type id: str
... | StarcoderdataPython |
1648416 | <filename>PageBotNano-050-InDesign/pagebotnano_050/pysketch/sketchapi.py
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# -----------------------------------------------------------------------------
#
# S K E T C H A P P 2 P Y
#
# Copyright (c) 2016+ <NAME> + <NAME>
# www.pagebot.io
# Licensed under MIT conditions... | StarcoderdataPython |
75995 | #!/usr/bin/env python
import os
from os.path import join
from lxml import etree
CROWDIN = '../crowdin'
BASE = '../common/src/main/res'
STRINGS = 'strings.xml'
setup_names = set([
"setup_welcome_title",
"setup_welcome_additional_description",
"setup_start_action",
"setup_next_action",
"setup_steps_title",
"setup_step... | StarcoderdataPython |
96053 | from src.job import AutoHealthJob
def main():
AutoHealthJob()
if __name__ == '__main__':
main()
| StarcoderdataPython |
1723981 | <filename>setup.py
""" Module setup for umtool project """
from setuptools import setup, find_packages
with open('README') as f:
long_description = ''.join(f.readlines())
setup(
name='umtool',
version='0.1',
description='Terminal tool for UNIX user management',
long_description=long_description,
... | StarcoderdataPython |
3266312 | # O jogo consiste em resolver problemas matemáticos para ganhar.
print("Bem vindo! O jogo consiste em fazer cálculos matemáticos para sua sobrevivência, caso você erre uma questão, você perde, contudo, você poderá responder as outras questões caso o caminho que você tenha escolhido tenha mais de uma questão.")
jogador ... | StarcoderdataPython |
145011 | <gh_stars>1-10
from ..utils import Object
class GetPollVoters(Object):
"""
Returns users voted for the specified option in a non-anonymous polls. For the optimal performance the number of returned users is chosen by the library
Attributes:
ID (:obj:`str`): ``GetPollVoters``
Args:
c... | StarcoderdataPython |
3378446 | <reponame>schedutron/feast
import sys
from pyspark import cloudpickle
from pyspark.sql.types import BooleanType
import pandas as pd
import numpy as np
from great_expectations.dataset import PandasDataset
def create_suite():
df = pd.DataFrame()
df['num'] = np.random.randint(0, 10, 100)
df['num2'] = np.r... | StarcoderdataPython |
1745405 | import numpy as np
import numexpr as ne
from astropy import constants as const
class BlackBodySimpleSource(object):
"""
Simple packet source that generates packets for the Montecarlo part.
This uses the algorithm described in Bjorkman & Wood 2001 (page 4) which
references Carter & Cashwell 1975:
... | StarcoderdataPython |
109290 | <reponame>jbking/demo-appengine-django-golang
from django import forms
from django.contrib import admin
from django.contrib.admin.sites import NotRegistered
from django.contrib.auth.admin import UserAdmin
from .models import Greeting, User
admin.site.register(Greeting)
# This is ignore displaying that Custom User m... | StarcoderdataPython |
125361 | <reponame>seekrcentral/seekr2
"""
test_converge.py
Testing converge.py
"""
import os
import glob
import pytest
import seekr2.converge as converge
import seekr2.tests.test_common_converge as test_common_converge
import seekr2.modules.common_analyze as common_analyze
import seekr2.modules.common_converge as common_con... | StarcoderdataPython |
44352 | <gh_stars>10-100
#!/usr/bin/env python
import argparse
import glob
import os
import shutil
import cleanfid
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("stats_dir")
args = parser.parse_args()
assert os.path.isdir(args.stats_dir)
return args
def main():
args = par... | StarcoderdataPython |
4808425 | #!/usr/bin/env python
# Copyright (c) 2019, IRIS-HEP
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of ... | StarcoderdataPython |
13810 | ##########################################################################
#
# Copyright (c) 2016, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | StarcoderdataPython |
3327439 | """
Django settings for cert_manage project.
Generated by 'django-admin startproject' using Django 2.1
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
i... | StarcoderdataPython |
152591 | """
Draw a form diagram.
"""
from ghpythonlib.componentbase import executingcomponent as component
from compas_cem.ghpython import FormArtist
class FormArtistComponent(component):
def RunScript(self, form, node_keys, edge_keys, force_min, force_scale):
node_keys = node_keys or None
edge_keys = ed... | StarcoderdataPython |
93041 | from transaction import extractData
from dotenv import load_dotenv
from datetime import datetime
from zipfile import ZipFile
from difflib import Differ
import urllib.request
import pandas as pd
import sqlalchemy
import shutil
import redis
import sys
import os
import io
def connectDb():
load_dotenv()
try:
... | StarcoderdataPython |
1784293 | <reponame>justinshenk/simba
import os, glob
import pandas as pd
########### READ IN DATA ###########
filesFolder =
outputPath =
features2removeFile =
classifierName =
filesFound = glob.glob(filesFolder + '/*.csv')
counter = 0
concatDf = pd.DataFrame()
features2remove = pd.read_csv(features2removeFile)
... | StarcoderdataPython |
4831857 | import json
import logging
from localstack.services.generic_proxy import ProxyListener
from localstack.utils.analytics import event_publisher
from localstack.utils.common import to_str
LOG = logging.getLogger(__name__)
class ProxyListenerStepFunctions(ProxyListener):
def forward_request(self, method, path, data... | StarcoderdataPython |
1787029 | <reponame>Jeffreyo3/AdventOfCode2020
"""
Challenge 1:
Elves in accounting just need you to fix your expense report (your puzzle input); apparently, something isn't quite adding up.
Specifically, they need you to find the two entries that sum to 2020 and then multiply those two numbers together.
For example, suppose y... | StarcoderdataPython |
1619652 | <filename>homeassistant/components/environment_canada/__init__.py<gh_stars>0
"""The Environment Canada (EC) component."""
from datetime import timedelta
import logging
import xml.etree.ElementTree as et
from env_canada import ECAirQuality, ECRadar, ECWeather, ec_exc
from homeassistant.config_entries import ConfigEntr... | StarcoderdataPython |
1622412 | <reponame>Jack12xl/taichi_three
from .common import *
from .advans import *
import ezprof
EPS = 1e-6
INF = 1e6
@ti.func
def sphere_intersect(s_id, s_pos, s_rad, r_org, r_dir):
i_t = INF
op = s_pos - r_org
b = op.dot(r_dir)
det = b**2 - op.norm_sqr() + s_rad**2
if det >= 0:
det = ti.sqrt(... | StarcoderdataPython |
4803792 | import pytest
from eth_utils import (
force_bytes,
)
@pytest.fixture(autouse=True)
def wait_for_first_block(web3, wait_for_block):
wait_for_block(web3)
def test_eth_getCode(web3, wait_for_transaction, MATH_CODE, MATH_RUNTIME):
txn_hash = web3.eth.sendTransaction({
"from": web3.eth.coinbase,
... | StarcoderdataPython |
4834276 | """
Serialization support for compiled functions.
"""
from __future__ import print_function, division, absolute_import
import imp
import marshal
import sys
from types import FunctionType, ModuleType
from . import bytecode, compiler
#
# Pickle support
#
def _rebuild_reduction(cls, *args):
"""
Global hook t... | StarcoderdataPython |
3218753 | import os
import sys
import mock
import pathlib
import pytest
import six
@pytest.mark.parametrize("nproc", [1])
def test_ccp4_scalerA(regression_test, ccp4, dials_data, run_in_tmpdir, nproc):
if nproc is not None:
from xia2.Handlers.Phil import PhilIndex
PhilIndex.params.xia2.settings.multiproce... | StarcoderdataPython |
3349635 | class Solution:
def maximumProduct(self, nums: List[int]) -> int:
# min1, min2, .... max3, max2, max1
min1, min2, max3, max2, max1 = float('inf'), float('inf'), float('-inf'), float('-inf'), float('-inf')
for num in nums:
if num <= min1:
min2, min1 = min1, num
... | StarcoderdataPython |
3303075 | <filename>0x03-python-data_structures/8-multiple_returns.py
#!/usr/bin/python3
def multiple_returns(sentence):
"""
Returns a tuple with the length of a string and its first
character
"""
s_len = len(sentence)
if s_len == 0:
f_char = None
else:
f_char = sentence[0]
retur... | StarcoderdataPython |
186545 | # web_app/routes/user_routes.py
from flask import Blueprint, jsonify, request, render_template, flash, redirect
from web_app.models import Tweet, User, parse_records, db
import web_app.twitter
tweet_routes = Blueprint('tweet_routes', __name__)
@tweet_routes.route('/tweets.json')
def list_tweets():
print('VIEWED... | StarcoderdataPython |
82524 | # Copyright 2016 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | StarcoderdataPython |
1625952 |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... | StarcoderdataPython |
1775353 | <reponame>CardiacModelling/model-reduction-manifold-boundaries<filename>MBAM/lib/geodesic.py
from scipy.integrate import ode
import numpy as np
import time
from lib.likelihood import compute_eMRMS
# A default callback function
# the geodesic can be halted by the callback returning False
def callback_func(geo):
... | StarcoderdataPython |
3362179 | <reponame>lkugler/DART-WRF<filename>dartwrf/cleanup_exp.py
import os, glob
from config.cfg import exp, cluster
from utils import try_remove
"""Run this script after an experiment to reduce cluster disk usage.
1) remove wrfrst
2) remove run_DART folders from exp
3) remove run_WRF files from exp
"""
keep_last_init_wrfr... | StarcoderdataPython |
142481 | import itertools
input_list = [5, 6, 2, 10, 15, 20, 5, 2, 1, 3]
# xyz = [i for i in input_list if i % 5 == 0]
# print(xyz)
def div_true(num):
if num % 5 == 0:
return True
else:
return False
xyz = [i for i in input_list if div_true(i) == True] # Its a list
print(xyz)
xyz = (i for i in in... | StarcoderdataPython |
3321631 | import itertools
from type_registry import register, register_library
register_library('iter', itertools.chain)
@register('factory')
def sample_factory_method(**kwargs):
print(kwargs)
return []
| StarcoderdataPython |
45387 | <reponame>Itori/swarfarm
from django.core.management.base import BaseCommand
from bestiary import parse
class Command(BaseCommand):
help = 'Parse all bestiary data from game files'
def handle(self, *args, **kwargs):
self.stdout.write('Processing static files...')
parse.static.decrypt_images(... | StarcoderdataPython |
4825791 | # 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 writin... | StarcoderdataPython |
114115 | """
These tests are the test fits that come with C mpfit
"""
import mpyfit
import unittest
import numpy
class LinearFunction( unittest.TestCase):
@staticmethod
def func(p, args):
x, y, error = args
return (y - p[0] - p[1]*x)/error
def test_fit(self):
x = numpy.array([-1.7237128E... | StarcoderdataPython |
1615333 | import logging
from friendlyshell.basic_logger_mixin import BasicLoggerMixin
import pytest
def test_default_logger():
# Save any global loggers set up by the test runner
gl = logging.getLogger()
old_handlers = list()
for cur_handler in gl.handlers:
old_handlers.append(cur_handler)
old_leve... | StarcoderdataPython |
3293864 | <gh_stars>0
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from dataclasses import dataclass
from enum import Enum, auto
from flsim.utils.async_trainer.train... | StarcoderdataPython |
3235373 | from dataclasses import dataclass
BROADCASTING_MAC_ADDRESS = 'ff:ff:ff:ff:ff:ff'
@dataclass
class Person:
mac: str
manufacturer: str
@dataclass
class People:
newcomers: list
left: list
connected: list
def get_manufacturer(mac_address: str) -> str or None:
from requests import get
resp... | StarcoderdataPython |
160785 | # Problem 1
# 1'den 1000'e kadar olan sayılardan mükemmel sayı olanları ekrana yazdırın.
# Bunun için bir sayının mükemmel olup olmadığını dönen bir tane fonksiyon
# yazın.
# Bir sayının bölenlerinin toplamı kendine eşitse bu sayı mükemmel bir
# sayıdır. Örnek olarak 6 mükemmel bir sayıdır (1 + 2 + 3 = 6).
def perfNum... | StarcoderdataPython |
119790 | <filename>train_image_classifier.py<gh_stars>100-1000
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | StarcoderdataPython |
1738935 | """
Copyright 2013 <NAME>
This file is part of CVXPY.
CVXPY 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 License, or
(at your option) any later version.
CVXPY is distributed in the ho... | StarcoderdataPython |
1780211 | <gh_stars>0
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.urls import reverse
from hire.models import Service_category
def chat(request,stri_id):
print(stri_id)
ser = Service_category.objects.filter(handle=stri_id)
print(ser)
for ser in ser:
handle = ser.handle
r... | StarcoderdataPython |
3341784 | <filename>Arcade/Intr/ExploringWaters/areSimilar.py
def areSimilar(a, b):
# countA = countB = 0
# for item in range(len(b)):
# if a[item] in b:
# countA += 1
# print("a item" + str(a[item]))
# for item in range(len(b)):
# if b[item] in a:
# countB += 1
... | StarcoderdataPython |
3369027 | <reponame>igoose1/django-quest<filename>project/quest/views.py
# Copyright 2020-2021 <NAME>
#
# 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/LI... | StarcoderdataPython |
3291754 | import pandas as pd
from main_census_merge.utilities import clean_files as cf
from main_census_merge.utilities import fips_codes_generator as fcg
"""
Splitting city and county census files to city/county, urban and rural respectively
"""
def split_csv(file_path, cen_type, cen_year, out_path):
initial_csv_df = pd... | StarcoderdataPython |
197709 | __author__ = "<EMAIL>"
import re
import sys
from collections import defaultdict, namedtuple
from csv import DictWriter
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
from Bio import SeqIO
from bx.intervals import IntervalTree
from bx.intervals.cluster import ClusterTree
from cupcake im... | StarcoderdataPython |
1666005 | from setuptools import setup
def readme():
with open('README.txt') as f:
return f.read()
setup(name='HL7py',
version='1.02',
description='HL7 message parser',
long_description=readme(),
keywords='hl7 parsing ',
url='https://github.com/norlowski/HL7py',
author='<NAME>',
... | StarcoderdataPython |
57083 | <reponame>Tapyr/tapyr<filename>_GTW/_RST/_TOP/Gallery.py
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Mag. <NAME> All rights reserved
# Glasauergasse 32, A--1130 Wien, Austria. <EMAIL>
# #*** <License> ************************************************************#
# This module is part of the package GTW.RST.TOP.
#
# Th... | StarcoderdataPython |
3338599 | import RPi.GPIO as GPIO
import time
def irSensor1(sensorIr1, reportTime):
# IR sensor
GPIO.setmode(GPIO.BOARD) # Set GPIO to pin numbering
pir = 8 # Assign pin 8 to PIR
GPIO.setup(pir, GPIO.IN) # Setup GPIO pin PIR as input
print("Sensor initializing . . .")
time.sleep(2) # Give sensor tim... | StarcoderdataPython |
70933 | <reponame>User1m/sketch2pix
import sys
import cv2
#print(sys.argv[1])
#print(sys.argv[2])
bg_gray='pencilsketch_bg.jpg'
canvas = cv2.imread('/home/user1m/workspace/sketch2pix/dataset/PencilSketch/pencilsketch_bg.jpg', cv2.CV_8UC1)
if canvas is not None:
print("BACKGROND EXISTS")
else:
print("BACKGROND DOESN'T... | StarcoderdataPython |
19952 | """Tests for the bradley_terry module"""
# Copyright 2019 <NAME>
#
# 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 app... | StarcoderdataPython |
57540 | <filename>Lib/site-packages/sciplot/__init__.py
# -*- coding: utf-8 -*-
"""
SciPlot-PyQt: Publication-ready scientific plotting for Python
==============================================================
SciPlot-PyQt (aka SciPlot) is a user-interface/matplotlib wrapper built with
PyQt5 that allows interactive plotting ... | StarcoderdataPython |
3335890 | <gh_stars>0
#
# Copyright 2021. Clumio, Inc.
#
from typing import Any, Dict, Mapping, Optional, Sequence, Type, TypeVar
from clumioapi.models import mssql_pitr_options
from clumioapi.models import mssql_restore_from_backup_options
T = TypeVar('T', bound='MssqlRestoreSource')
class MssqlRestoreSource:
"""Implem... | StarcoderdataPython |
99223 | import pytest
from model_bakery import baker
from documents.models import Document
from .helpers import create_documents
@pytest.mark.django_db
def test_get_seller_orders_as_anonymous(api_client):
response = api_client.get("/orders/sales")
assert response.status_code == 401
@pytest.mark.django_db
def test... | StarcoderdataPython |
85501 | # Copyright 2016, 2017 IBM Corp.
#
# 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 writin... | StarcoderdataPython |
3355659 | <gh_stars>1-10
import logging
import sys
from django.conf import settings
from django.apps import AppConfig
logger = logging.getLogger(__name__)
class CmsConfig(AppConfig):
"""
This class represents the Django-configuration of the backend.
See :class:`django.apps.AppConfig` for more information.
:pa... | StarcoderdataPython |
1749381 | import os
import sys
import sh
def assert_is_git_repo():
try:
assert os.path.isdir('.git')
assert os.path.isfile('.git/HEAD')
except AssertionError:
print("This is not git repository")
sys.exit(2)
def get_current_branch() -> str:
current_branch = sh.git('rev-parse', '--ab... | StarcoderdataPython |
3257524 | def factorial(num):
if num == 1:
return 1
return factorial(num - 1) * num
print(factorial(5)) | StarcoderdataPython |
3299432 | <reponame>arponpes/football-statistics
from django.core.management.base import BaseCommand, CommandError
from datetime import datetime
from core.models import Team, Game, Statistics
import csv
class Command(BaseCommand):
help = 'Export all the results of La Liga'
def add_arguments(self, parser):
p... | StarcoderdataPython |
4804910 | <filename>test/test_lstm2d_inference.py
from unittest import TestCase, skip
import torch
from model.lstm2d import LSTM2d
class LSTM2dInferenceTest(TestCase):
"""
Unit tests for the 2D-LSTM in inference mode.
"""
embed_dim = 50
encoder_state_dim = 20
cell_state_dim = 25
batch_size = 42
... | StarcoderdataPython |
3245194 | ###############################################################################
# Name: ruby.py #
# Purpose: Define Ruby syntax for highlighting and other features #
# Author: <NAME> <<EMAIL>> #
# Copyright: (c) 2... | StarcoderdataPython |
95427 | <reponame>Animadversio/Visual_Neuro_InSilico_Exp
""""""
from GAN_utils import loadStyleGAN2, loadBigGAN
from GAN_utils import StyleGAN2_wrapper, BigGAN_wrapper
import torch
import numpy as np
import matplotlib.pylab as plt
import os
from os.path import join
from torchvision.utils import make_grid
from torchvision.tran... | StarcoderdataPython |
4832192 | <reponame>RupakMukherjee/comp-py-2021
print [1,24,76]
print ["red",'yellow',"blue"]
print['red',24,98.6]
print[1,[5,6],7]
print[]
for i in [5,4,3,2,1]:
print i
print 'Blastoff!'
friends = ['Joseph','Glenn',' Sally']
for i in friends:
print i
print friends [1]
fruit = "Banana"
# fruit[0] = b -- it will give error.... | StarcoderdataPython |
1626820 | <filename>indra/assemblers/index_card/__init__.py
from .assembler import IndexCardAssembler
| StarcoderdataPython |
4830003 | <reponame>rolandhill/simpeg<filename>SimPEG/EM/Static/IP/ProblemIP_2D.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from SimPEG import Utils
from SimPEG.EM.Static.DC.FieldsDC_2D import (
Fields_ky, Fields_ky_C... | StarcoderdataPython |
1694282 | name = input("Enter your name: ")
age = int(input("Enter your age: "))
height = float(input("Enter your height: "))
print("Hello there ", name, ". You are ", age, " years old and your height is ", height, "m.")
| StarcoderdataPython |
3396158 | <reponame>gurgy11/SliceOfPy
from .db_config import db_params
| StarcoderdataPython |
1665877 | #%%
import os
import gym
import pybullet as p
import numpy as np
import pybullet_envs
from gym import wrappers
from models import Agent
from utils import plot_learning_curve
env = gym.make('InvertedPendulumBulletEnv-v0')
agent = Agent(input_dims=env.observation_space.shape, env=env,
n_actions=env.action_space... | StarcoderdataPython |
3302074 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2018~2999 - Cologler <<EMAIL>>
# ----------
# a base extendable class
# ----------
import types
class Extendable:
_ENTENSION_METHODS: dict = {}
def __getattr__(self, attr):
for kls in type(self).__mro__:
ms = self._ENTENSION_METHODS.get(kls, {})
... | StarcoderdataPython |
1730298 | <filename>code/p1_tarea.py
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 7 20:08:02 2019
@author: if715029
"""
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
#%% 2.
accidents = pd.read_csv('../data/Accidents_2015.csv')
#%% a)
lat = accidents['Latitude'].values
lon = accidents['Longitude... | StarcoderdataPython |
107119 | <gh_stars>10-100
"""Constants for the ge_kitchen integration."""
from gekitchen.const import LOGIN_URL
DOMAIN = "ge_kitchen"
# TODO Update with your own urls
# OAUTH2_AUTHORIZE = f"{LOGIN_URL}/oauth2/auth"
OAUTH2_AUTH_URL = f"{LOGIN_URL}/oauth2/auth"
OAUTH2_TOKEN_URL = f"{LOGIN_URL}/oauth2/token"
AUTH_HANDLER = "aut... | StarcoderdataPython |
1789299 | #EJEMPLO1
#PARAMETROS TIPO LISTA
def sumarizar(lista):
suma=0
for x in range(len(lista)):
suma=suma+lista[x]
return suma
def mayor(lista):
may=lista[0]
for x in range(1,len(lista)):
if lista[x]>may:
may=lista[x]
return may
def menor(lista):
men=lista[0]
for x in range(1,len(lista)):
if... | StarcoderdataPython |
3231425 | from Spiders_.scrapy_me.core.spider import Spider
from Spiders_.scrapy_me.http.request import Request
import time
# 继承框架的爬虫基类
class BaiduSpider(Spider):
name = 'baidu'
start_urls = ['http://www.baidu.com']
total = 0
def parse(self, response):
self.total += 1
if self.total > 10:
... | StarcoderdataPython |
3321191 | <gh_stars>1-10
# These are reserved words by Redshift and cannot be used as column names.
RESERVED_WORDS = [
"AES128", "AES256", "ALL", "ALLOWOVERWRITE", "ANALYSE", "ANALYZE", "AND",
"ANY", "ARRAY", "AS", "ASC", "AUTHORIZATION", "BACKUP", "BETWEEN", "BINARY",
"BLANKSASNULL", "BOTH", "BYTEDICT", "BZIP2", "CA... | StarcoderdataPython |
3248593 | from flask import Flask
from flask import request
import simplejson
from database.db import db
app = Flask(__name__)
BAD_REQUEST = 'Bad Request'
KEY_NOT_FOUND = 'Key Not Found'
OK = 'Okay'
INSTRUCTIONS = """
Welcome to KV server.
"""
@app.route('/')
def index():
return INSTRUCTIONS, 200
@app.route('/add', ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.