id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3230675 |
"""Trading Bot Class"""
from dataclasses import dataclass
import pandas as pd
from binancetrading.account import Account, log_msg
from binancetrading.exchange import Exchange, _candle_list_to_df, _refresh_candles
from binancetrading.strategies import TradingStrategy
@dataclass
class TradingBot:
"""Trading bot... | StarcoderdataPython |
1750288 | <filename>alfred/resources/cmd.py<gh_stars>0
import alfred
@alfred.command("hello_world")
@alfred.option("--name")
def hello_world(name):
print(f"hello world, {name}")
| StarcoderdataPython |
173790 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # S_To... | StarcoderdataPython |
3299792 | # -*- encoding=utf-8 -*-
# flag = 10
# while flag:
# print(flag)
# flag -= 1
flag = -10
while flag:
print(flag)
flag += 1
| StarcoderdataPython |
112224 | <reponame>tkamata-test/ydk-py
""" Cisco_IOS_XR_spirit_install_instmgr_oper
This module contains a collection of YANG definitions
for Cisco IOS\-XR spirit\-install\-instmgr package operational data.
This module contains definitions
for the following management objects\:
software\-install\: Install operations info
... | StarcoderdataPython |
12196 | from __future__ import absolute_import, division, print_function
import numpy as np
import wx
from dials.array_family import flex
from dials_viewer_ext import rgb_img
class wxbmp_from_np_array(object):
def __init__(
self, lst_data_in, show_nums=True, palette="black2white", lst_data_mask_in=None
):
... | StarcoderdataPython |
152277 | import hashlib
# Compare two files for the same
def getHash(f):
line = f.readline()
hash = hashlib.md5()
while (line):
hash.update(line)
line = f.readline()
return hash.hexdigest()
def IsHashEqual(f1, f2):
str1 = getHash(f1)
str2 = getHash(f2)
print(str1,str2)
return ... | StarcoderdataPython |
3226487 | # coding=utf-8
import re
from comply.rules.rule import *
from comply.rules.patterns import FUNC_BODY_PATTERN
from comply.util.scope import depth
class ScopeTooDeep(Rule):
""" Don't write deeply nested code.
A deeply nested scope is often an indication of too high complexity and can be
difficult to rea... | StarcoderdataPython |
3260342 | """
Set Matrix Zeroes:
Given an m x n matrix. If an element is 0, set its entire row and column to 0. Do it in-place.
Follow up:
A straight forward solution using O(mn) space is probably a bad idea.
A simple improvement uses O(m + n) space, but still not the best solution.
Could you devise a constant space solution?
... | StarcoderdataPython |
3205502 | <gh_stars>1-10
"""
Longest Substring Without Repeating Characters
-------------------------------------------------
Given a string, find the length of the longest substring without repeating characters.
Example 1:
Input: "abcabcbb"
Output: 3
Explanation: The answer is "abc", with the length of 3.
Example 2:
Input: "... | StarcoderdataPython |
35777 | <reponame>AhmedRaja1/Python-Beginner-s-Starter-Kit
# 11 List Comprehensions
products = [
("Product1", 15),
("Product2", 50),
("Product3", 5)
]
print(products)
# prices = list(map(lambda item: item[1], products))
# print(prices)
prices = [item[1] for item in products] # With list comprehensions we can ac... | StarcoderdataPython |
3309696 | # [기초-반복실행구조] 정수 1개 입력받아 카운트다운 출력하기1(설명)
# <EMAIL>
'''
문제링크 : https://www.codeup.kr/problem.php?id=1074
'''
n = int(input())
while n > 0:
print(n)
n -= 1 | StarcoderdataPython |
3254574 | <gh_stars>0
from ctypes import *
import os
import cv2
import time
import darknet_jphack
import argparse
import math
import numpy as np
import datetime
import json
import subprocess
import glab
from natsort import natsorted
#学習されたクラス名を取得
def classname_management(altNames,data_path):
if altNames is None:
try... | StarcoderdataPython |
115403 | """
#
n = int(input())
dic = {}
i= 0
while i<n:
s = input().split(" ")
dic[s[0]] = s[1]
i +=1
# print(dic)
i = 0
while i < n:
try:
s = input()
try:
print("{}={}".format(s, dic[s]))
except :
print("Not found")
except EOFError:
break
i += 1... | StarcoderdataPython |
160394 | <reponame>yisibl/picosvg
# Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | StarcoderdataPython |
1605380 | <reponame>MBoustani/Geothon
#!/usr/bin/env python
'''
Project: Geothon (https://github.com/MBoustani/Geothon)
File: Vector/buffer_shp.py
Description: This code generates buffer polygon around Shapefile.
Author: <NAME> (github.com/MBoustani)
'''
import os
try:
import ogr
except ImportError... | StarcoderdataPython |
1693700 | import numpy as np
import matplotlib.pyplot as plt
from plot import CarPlot, ValuePlot
class MountainCar(object):
LEFT, NEUTRAL, RIGHT = range(3)
def __init__(self):
np.random.seed()
self.mem_x = []
self.mem_action = []
#number of iterations
self.L = 100
... | StarcoderdataPython |
3249810 | <filename>ptset.py
#!/usr/bin/python3
DESCRIPTION = '''
Program for ptset drawing.
Some examples of usage:
python ptset.py -h
python ptset.py --curve 9 --draw_points A,0.199,True B,0.412,True
python ptset.py --curve 8 --draw_points A,-0.36,True X1,-0.26 B,0,True X2,0.26 C,0.36,True
python ptset.py --curve 7 --ta... | StarcoderdataPython |
3376878 | <filename>schedsi/log/binarylog.py
#!/usr/bin/env python3
"""Defines the :class:`BinaryLog` and the :func:`replay` function."""
import collections
import enum
import msgpack
from schedsi.cpu.time import Time, TimeType
_EntryType = enum.Enum('_EntryType', ['event', 'thread_statistics', 'cpu_statistics'])
_Event = enum... | StarcoderdataPython |
3297585 | <filename>python_test/seq/for_test1.py<gh_stars>0
#!/usr/bin/env python
# -*- coding=utf-8 -*-
Names = 'huangxiang'
for name in Names:
print('current name is:', name)
nameList = ['huangxiang', 'zhangjun', 'linaying']
"""通过序列项迭代"""
for eachName in nameList:
print('current name is:', eachName)
"""通过序列索引迭代
使用... | StarcoderdataPython |
3317596 | <reponame>athenian-ct-projects/Fortnite-AA<filename>Fortnite-AA.py
#FORTNITE
#FORTNITE
#FORTNITE
#FORTNITE
import random
print("Welcome to Fortnite Battle Royale *Fortnite music theme now cues*")
print("which fortnite skin to you desire to be? ")
costume=input("Brite Bomber, Skull Trooper, Renegade Raider, Dark Knig... | StarcoderdataPython |
1784440 | import os
import smtplib
smtpserver = smtplib.SMTP("smtp.gmail.com:587")
smtpserver.ehlo()
smtpserver.starttls()
red='\033[31m'
green='\033[32m'
orange='\033[33m'
pink='\033[95m'
print(f"{green}=============================")
print(f"{green} made by bad_boy ")
print(f"{green} my telegram id:@Bad_boy_468 ")
... | StarcoderdataPython |
1724791 | <filename>Macropad_Hotkeys/macros/midi.py
# MACROPAD Hotkeys example: MIDI
# The syntax for MIDI is based off of Tones in macros, in order to maintain
# backward compatibility with the original keycode-only macro files.
# The third item for each macro is a list in brackets, and each value within
# is normally an integ... | StarcoderdataPython |
1621843 | <gh_stars>1-10
import time
import torch
def str2bool(s):
return s.lower() in ('true', '1')
class Timer:
def __init__(self):
self.clock = {}
def start(self, key="default"):
self.clock[key] = time.time()
def end(self, key="default"):
if key not in self.clock:
raise ... | StarcoderdataPython |
3319955 | <reponame>JamessenLiu/pybigcommerce
from pybigcommerce.modules.customers import Customers
from pybigcommerce.modules.store_info import StoreInfo
class BigCommerceModel:
def __init__(self, store_hash, access_token):
self.customer = Customers(store_hash, access_token)
self.store_info = StoreInfo(st... | StarcoderdataPython |
3246517 | import os
import sys
import subprocess
import shutil
ENV_NAME = "pyxl_test_env_" + os.path.basename(sys.executable)
if not os.path.exists(ENV_NAME) or os.stat(sys.executable).st_mtime > os.stat(ENV_NAME + "/bin/python").st_mtime:
print "Creating virtualenv to install testing dependencies..."
VIRTUALENV_SCRIPT... | StarcoderdataPython |
3367708 | <filename>piglatin.py<gh_stars>0
def pigLatin(word):
return(word[1:] + word[0] + "ay")
print(pigLatin("bacon"))
print(pigLatin("eggs"))
print(pigLatin("cheese"))
#word = "eggs"
#pigLatin(word)
#print(word[3] + word + "ay") | StarcoderdataPython |
190046 | igrok1 = 0
igrok2 = 0
win = 0
draw = 0
lose = 0
list_choises = ['Камень', 'Ножницы', 'Бумага']
print("(Камень - 1, Ножницы - 2, Бумага - 3) Игрок 1, введите ваш номер:")
igrok1 = int(input())
while 1 < igrok1 > 3:
print("Введен некорректный номер")
print("(Камень - 1, Ножницы - 2, Бумага - 3) Игрок 1, введите... | StarcoderdataPython |
91840 | import torch
from tqdm import tqdm
import os
import numpy as np
train_features=torch.load('train_features.pt')
n = len(list(np.load('/facebook/data/images/train_imlist.npy')))
print(n)
os.makedirs('/siim/sim_pt_256', exist_ok=True)
for i in tqdm(range(n)):
a=torch.mm(train_features[i:i+1],train_features.t())
to... | StarcoderdataPython |
3376267 | import os
import logging
from flask import Flask
from es_io.bigqueryio import get_data_from_bq
from es_io.stackdriverio import StackDriverWriter
from metrics.metrics import MetricCalculator
app = Flask(__name__)
project_id = os.getenv("PROJECT_ID")
BILLING_TABLE = os.getenv("GCP_BILLING_TABLE")
def init():
# [ST... | StarcoderdataPython |
29908 | <filename>aoc/day11/__init__.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of Advent of Code 2020
# https://github.com/scorphus/advent-of-code-2020
# Licensed under the BSD-3-Clause license:
# https://opensource.org/licenses/BSD-3-Clause
# Copyright (c) 2020, <NAME> <<EMAIL>>
from aoc import s... | StarcoderdataPython |
1682267 | #-*- coding: utf-8 -*-
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='zerows',
version='1.0.0',
description='We... | StarcoderdataPython |
1718636 | from re import findall
from cloudbot import hook
from cloudbot.util.formatting import pluralize, get_text_list
polls = {}
class PollError(Exception):
pass
class PollOption:
def __init__(self, title):
self.title = title
self.votes = 0
class Poll:
def __init__(self, question, creator... | StarcoderdataPython |
3240503 | <filename>example.py
from colorprint.example import printall
from colorprint.unicolor import *
from colorprint.printer import uprint
printall()
| StarcoderdataPython |
1694488 | <filename>Simulations/TravelingWave.py
#!/usr/bin/env python
from __future__ import division
import matplotlib as mpl
#mpl.use('Agg')
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('seaborn-paper')
import matplotlib.animation as animation
mpl.rcParams.update({'text.usetex': True,
... | StarcoderdataPython |
1674580 | from matplotlib import pyplot as plt
import io
import urllib, base64
import pandas as pd
def plot():
plt.plot(range(10))
fig = plt.gcf()
buf = io.BytesIO()
fig.savefig(buf, format="png")
buf.seek(0)
string = base64.b64encode(buf.read())
uri = urllib.parse.quote(string)
return uri
| StarcoderdataPython |
4805714 | """RuleList for parsing and rule builders."""
from dataclasses import dataclass
from enum import IntEnum
from typing import Any, Callable, Dict, List, Optional, Pattern, Union
import regex
from traiter.const import FLAGS
TOKEN = 0
SIZE = 4
# Find tokens in the regex. Look for words that are not part of a group
# n... | StarcoderdataPython |
175674 | <filename>ShieldTester.py
import base64
import copy
import gzip
import itertools
import json
import math
import multiprocessing
import os
import queue
import re
import sys
import time
import unicodedata
from typing import Dict, List, Tuple, Optional, Any, Union
from .LoadOut import LoadOut
from .Shield... | StarcoderdataPython |
1783910 | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 22 11:29:15 2019
@author: GKX
"""
#import keras
from deform_conv.deform_conv import tf_batch_map_offsets
from keras.layers import Conv3D
import tensorflow as tf
from keras.initializers import RandomNormal
class ConvOffset3D(Conv3D):
"""
ConvOf... | StarcoderdataPython |
168478 | from opentera.db.Base import db, BaseModel
from enum import Enum
import random
from datetime import datetime, timedelta
import uuid
class TeraSessionStatus(Enum):
STATUS_NOTSTARTED = 0
STATUS_INPROGRESS = 1
STATUS_COMPLETED = 2
STATUS_CANCELLED = 3
STATUS_TERMINATED = 4
class TeraSession(db.Mod... | StarcoderdataPython |
4838573 | <filename>src/ethindex/util.py<gh_stars>1-10
from importlib.metadata import version
def get_version():
return version("eth-index")
| StarcoderdataPython |
7428 | <gh_stars>0
"""
Combinatorial maps
This module provides a decorator that can be used to add semantic to a
Python method by marking it as implementing a *combinatorial map*,
that is a map between two :class:`enumerated sets <EnumeratedSets>`::
sage: from sage.combinat.combinatorial_map import combinatorial_map
... | StarcoderdataPython |
3271533 | # -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import requests
from bs4 import BeautifulSoup
import json
import os
import itertools, string
from openpyxl import Workbook, load_workbook
import xlwt, xlrd
wb = Workbook()
excel_document = load_workbook('new.xlsx')
sheet = excel_docum... | StarcoderdataPython |
4802738 | <gh_stars>0
nums = [4, 7, 10, 2, 4, 7, 0, 2, 7, 3, 9]
print(nums)
print(len(nums))
searchNums = int(input())
searchIdx = -1
nums.append(searchNums)
n=0
while True:
if nums[n] == searchNums:
if n != len(nums) - 1:
searchIdx = n
break
n += 1
print(f"nums: {nums... | StarcoderdataPython |
3381106 | <reponame>okurman/CRISPR
#!/sw/bin/python2.7
__author__ = '<NAME>'
import os
import sys
if sys.platform=='darwin':
sys.path.append('/Users/hudaiber/Projects/SystemFiles/')
elif sys.platform=='linux2':
sys.path.append('/home/hudaiber/Projects/SystemFiles/')
import global_variables as gv
sys.path.append(gv.proj... | StarcoderdataPython |
1753111 | from Todim import Todim
import data_ingestion as di
import scrap
# PASSO 0 - Ingestão dos dados
(theta, colunas, pesos) = di.ingestTXT("matriz_decisao.txt")
(codigos, matriz) = di.ingestCSV(colunas)
# PASSO 1 - Carregar a matriz de decisão
matrizDecicao = Todim(matriz, pesos, codigos, theta, max=True)
# PASSO 2 - N... | StarcoderdataPython |
1675400 | <reponame>RMMichael/interop<filename>server/auvsi_suas/views/telemetry_test.py
"""Tests for the telemetry module."""
import time
from auvsi_suas.models.uas_telemetry import UasTelemetry
from auvsi_suas.proto.interop_api_pb2 import Telemetry
from django.contrib.auth.models import User
from django.test import TestCase
f... | StarcoderdataPython |
1681012 | <filename>tests/functional/transactions/test_read_consist_sttm_restart_on_update_03.py
#coding:utf-8
#
# id: functional.transactions.read_consist_sttm_restart_on_update_03
# title: READ CONSISTENCY. Check creation of new statement-level snapshot and restarting changed caused by UPDATE. Test-03.
# decri... | StarcoderdataPython |
166124 | # -*- coding:utf-8 -*-
#
# cluster.py
"""Cluster module."""
import networkx as nx
import numpy as np
import pandas as pd
from .utils import flatten_dict
from .utils import get_within_cutoff_matrix
from .utils import pairwise_distances
class Cluster:
"""Object to store and compute data about an individual parti... | StarcoderdataPython |
155015 | from scripts.simulation.SimulationWorld import SimulationWorld
from scripts.Robot.Robot import Robot
import numpy as np
import scripts.utils.yaml_paser as yaml
from scripts.utils.utils import Utils as utils
import logging
import os
from collections import OrderedDict
from scripts.DB.Mongo_driver import MongoDriver
impo... | StarcoderdataPython |
3302217 | """
test_generator_xrb.py
Author: <NAME>
Affiliation: University of Colorado at Boulder
Created on: Fri Jun 14 09:20:22 2013
Description:
"""
import ares
import numpy as np
import matplotlib.pyplot as pl
from ares.physics.Constants import erg_per_ev, c, ev_per_hz
# Initialize radiation background
pars = \
{
# So... | StarcoderdataPython |
51571 | <gh_stars>0
# 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 json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from . import utilities, tables
c... | StarcoderdataPython |
1793156 | """
Module implementing item
"""
from .discount_exception import ItemIsNowFreeException
class Item:
"""
Class representing one item that can be added to checkout
"""
def __init__(self, name, price, kind):
self.name = name
self.price = price
self.price_final = price
self.... | StarcoderdataPython |
1785187 | import os
import pytest
from pychara.session import (Session,
LOGIN,
LOGOUT)
from pychara.exceptions import LoginFailureException
class TestLogin():
def test_success_login(self):
secrets_path = os.environ.get('SECRETS', 'secrets')
with ... | StarcoderdataPython |
4812841 | <filename>setup.py
from codecs import open
import os
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md'), 'r') as infile:
long_description = infile.read()
about = {}
with open(os.path.join(here, 'aws_region_proximity', '__version__.py'), 'r', ... | StarcoderdataPython |
3336275 | import math
breakout = False
for a in range(1, 1000):
for b in range(1, 1000):
c_2 = ((a)**2) + ((b)**2)
c = math.sqrt(c_2)
if a + b + c == 1000:
print("a = %d\nb = %d\nc = %d" % (a, b, c))
breakout = True
if breakout:
break
if breakout:
break
print(a*b*c)
| StarcoderdataPython |
1732987 | <filename>quex/output/core/TEST/test-simple-6.py
#! /usr/bin/env python
import generator_test
import sys
if "--hwut-info" in sys.argv:
print "Simple: Reload Init State;"
print "CHOICES: ANSI-C, Cpp-Template;"
print "SAME;"
sys.exit(0)
if len(sys.argv) < 2 or not (sys.argv[1] in ["ANSI-C", "Cpp-Templat... | StarcoderdataPython |
3389547 | <reponame>grll/cache-manager
from typing import Callable, TypeVar, Iterable, Mapping, Any
from hashlib import sha256
from os.path import isfile, isdir,join
from os import getcwd, remove
from functools import wraps
import pickle
import time
T = TypeVar("T")
class CacheManager:
"""Cache the executions result of yo... | StarcoderdataPython |
3353382 | ############################################################
# FlatCAM: 2D Post-processing for Manufacturing #
# http://flatcam.org #
# Author: <NAME> (c) #
# Date: 2/5/2014 #
# MIT Licence ... | StarcoderdataPython |
3313509 | <gh_stars>1-10
import six
import types
import itertools
import numpy as np
class Sampling(object):
"""Some useful functions for sampling are defined
Attributes:
input_configuration (dict): store sampling yielders
_backup_input_configuration (dict): copy of self.input_configuration
_d... | StarcoderdataPython |
194598 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack, LLC
# Copyright 2011 Canonical Ltd.
# 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
#
... | StarcoderdataPython |
99705 | <gh_stars>0
from requests.packages.urllib3.exceptions import InsecureRequestWarning
import requests
import json
import pickle
import logging
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
class CfClient:
def __init__(self, userName, userPassword, controllerAddress):
self.userName = us... | StarcoderdataPython |
188734 | from json import loads as parse
from json import dumps
import urllib3
from time import sleep
def get_activity(user, page=1, auth = None):
url_str = f"https://api.github.com/users/{user}/events?page={page}"
reply = __load__(url_str)
try:
contents = parse(reply)
except:
print("Value Erro... | StarcoderdataPython |
3344822 | # -*- coding: utf-8 -*-
#
import websocket as ws
from websocket._abnf import *
import unittest
"""
test_abnf.py
websocket - WebSocket client library for Python
Copyright 2022 engn33r
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You m... | StarcoderdataPython |
1662136 | <gh_stars>0
import asyncio
import json
from twilio.rest import Client
async def main():
with open("private.json", "r") as read_file:
config = json.load(read_file)
client = Client(config["twilio-sid"], config["twilio-token"])
message = client.messages.create(
to = config["twilio-to"],
... | StarcoderdataPython |
1653351 |
import logging
import cPickle
from functools import partial
from plow import client
from plow.client import DependType
from plow.gui.manifest import QtCore, QtGui
from plow.gui import util
LOGGER = logging.getLogger(__name__)
########################
# FilterManager
#
class FilterManager(QtGui.QDialog):
... | StarcoderdataPython |
175879 | <filename>config.py<gh_stars>0
import board
# Pin for Stepper Drive Pulses
PUL_pin = board.D12
# Pin for Controller Direction Bit
DIR_pin = board.D11
# Pin for Controller Enable Bit
ENA_pin = board.D10
# This is actualy a delay between PUL pulses
# effectively sets the motor rotation speed.
delay = 0.0000001
# pause... | StarcoderdataPython |
105355 | letras = input().split()
| StarcoderdataPython |
3255659 | <filename>app/controllers/quote_controller_backup.py
from flask import jsonify
from ..models.quotes import Quotes
import random
from app import db
class QuoteController:
@staticmethod
def fetch_by_id(id):
quote = Quotes()
fetch_quote = quote.query.filter_by(quotes_id=id).first()
return jsonify({
... | StarcoderdataPython |
3328065 | """Given an array of names (consisting of lowercase characters) of candidates in an election.
A candidate name in array represents a vote casted to the candidate. Print the name of candidate that received Max votes.
If there is tie, print lexicographically smaller name.
Example 1:
Input:
n = 13
Votes[] = {john,johnny... | StarcoderdataPython |
473 | <reponame>sovrin-foundation/old-sovrin
import base58
from plenum.common.signer_did import DidSigner
from plenum.common.verifier import DidVerifier
from plenum.common.eventually import eventually
from plenum.test.helper import assertEquality
from sovrin.common.identity import Identity
MsgForSigning = {'sender': 'Mario... | StarcoderdataPython |
3342260 | import ssh.client
class UnknownPidError(Exception):
pass
class CommandError(Exception):
pass
class Command:
def __init__(self, host, logger):
self.connection = ssh.client.ssh(host)
self.logger = logger
def get_pid_for_user_with_grep_expression(self, user, grep):
pid = -1
... | StarcoderdataPython |
1648023 | <filename>pyBehave/page_objects/base_page.py
'''
Module representing abstract Base page for the application.
This page contains all parameters and methods called from all children-pages.
'''
class BasePage(object):
'''
Base class to initialize the base page that will be called from all pages.
Provides all... | StarcoderdataPython |
31310 | <filename>resorganizer/task.py
from resorganizer.aux import *
class Command(object):
"""Command is an abstraction for any command line able to be executed. Command line has the components:
program name, params (flags followed by some values, e.g. -f filename), flags (alone flags. e.g. -f)
and trailing arg... | StarcoderdataPython |
1665075 | from conftest import handler
from goalkeeper.models import Goal, Notification
def test_notifications():
# Initilize the app and client
h = handler
# h = TestHandler()
app = h.app
client = h.client
# register and login new user
h.register("f", "<EMAIL>", "f")
client.post("/accounts/lo... | StarcoderdataPython |
1681169 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import find_packages, setup
with open('DESCRIPTION.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
exec(open('tosker/__init__.py').read())
require... | StarcoderdataPython |
184460 | import math
def s(M_S,t_S,W_S,t):
return -1 * M_S * math.exp(-1 * ((t - t_S)/(math.sqrt(2) * W_S)) ** 2) | StarcoderdataPython |
1617177 | """This module contains the meta information of ApeGetAdaptorConnectivity ExternalMethod."""
import sys, os
from ..ucscoremeta import MethodMeta, MethodPropertyMeta
method_meta = MethodMeta("ApeGetAdaptorConnectivity", "apeGetAdaptorConnectivity", "Version142b")
prop_meta = {
"cookie": MethodPropertyMeta("Cookie... | StarcoderdataPython |
1671039 | <reponame>hero0926/PythonPlayground
from rnaom import randrange
from time improt sleep
from Queue import Queue
from myThread import MyThread
def writeQ(queue) :
queue.put('xxx', 1)
print "size now", queue.size()
def readQ(queue) :
val = queue.get(1)
print 'consumed object from Q...size now", queue.qsize()
d... | StarcoderdataPython |
1785959 | #MenuTitle: Realign Handles in Current Glyph
# -*- coding: utf-8 -*-
__doc__="""
Realigns Handles in Current Glyph. Glyph must be opened in Edit View.
"""
def realignHandles():
moveForward = NSPoint( 1, 1 )
moveBackward = NSPoint( -1, -1 )
currentController = Glyphs.currentDocument.windowController().activeEditView... | StarcoderdataPython |
28642 | <filename>piptui/custom/apNPSApplicationEvents.py
import collections
from npyscreen import StandardApp, apNPSApplicationEvents
class PipTuiEvents(object):
def __init__(self):
self.interal_queue = collections.deque()
super(apNPSApplicationEvents).__init__()
def get(self, maximum=None):
... | StarcoderdataPython |
1757785 | <gh_stars>0
"""
程式設計練習題 1-6 1-4 印出一表格.
請撰寫一程式,顯示如下的表單:
a a^2 a^3
1 1 1
2 4 8
3 9 27
4 16 64
"""
print("a a^2 a^3")
print("1 1 1 ")
print("2 4 8 ")
print("3 9 27 ")
print("4 16 64 ")
| StarcoderdataPython |
3385246 | import sqlite3
from dataclasses import dataclass
@dataclass
class Chat:
chat_id: int
chat_type: str
chat_desc: str = ""
@dataclass
class User:
user_id: int
first_name: str
username: str = ""
last_name: str = ""
birthday: str = ""
desc: str = ""
CREATE_TABLE_C... | StarcoderdataPython |
172124 | <reponame>civascu/hue<filename>desktop/core/ext-py/pyexcelerator/tools/xls2csv-gerry.py
#!/usr/bin/env python
# -*- coding: windows-1251 -*-
# Copyright (C) 2005 <NAME>
__rev_id__ = """$Id: xls2csv-gerry.py,v 1.1 2005/10/26 07:44:24 rvk Exp $"""
###--xls2csv.py
###--modified by gerry 10/5/2005
###--with args, process... | StarcoderdataPython |
3397916 | <filename>analytics/admin.py
from django.contrib import admin
from .models import objectViewed
# Register your models here.
admin.site.register(objectViewed) | StarcoderdataPython |
1680997 | import copy
import pytest
import sys
from awspricing.offers import EC2Offer
from tests.data.ebs_offer import (
BASIC_EBS_OFFER_SKU,
BASIC_IOPS_OFFER_SKU,
BASIC_EBS_OFFER_DATA
)
class TestEBSOffer(object):
@pytest.fixture(name='ebs_offer')
def ebs_offer(self):
offer = EC2Offer(BASIC_EBS_... | StarcoderdataPython |
167135 | <gh_stars>1-10
from boo.errors import WrongYearError
# Must manually hardcode new timestamps when new version arrives
TIMESTAMPS = {2012: 20190329,
2013: 20190411,
2014: 20190411,
2015: 20190411,
2016: 20190411,
2017: 20190423,
2018: 2... | StarcoderdataPython |
3217574 | <reponame>rxlqn/PointNav-VO<filename>pointnav_vo/vis/modified_env.py
"""
Modifications are based on https://github.com/facebookresearch/habitat-api/blob/e0807ed403902de78ee37b36766c2f06e5886fea/habitat/core/env.py
"""
import numpy as np
import cv2
from typing import Any, Dict, List, Optional, Type, Union
import gym
i... | StarcoderdataPython |
3251517 | import numpy as np
import tensorflow as tf
import re
class NodeLookup(object):
"""Converts integer node ID's to human readable labels."""
def __init__(self,
label_lookup_path=None,
uid_lookup_path=None):
if not label_lookup_path:
label_lookup_path = os.path.j... | StarcoderdataPython |
1604673 | <filename>Mac/Lib/lib-toolbox/MacTextEditor.py<gh_stars>1-10
# Generated from 'MacTextEditor.h'
def FOUR_CHAR_CODE(x): return x
false = 0
true = 1
kTXNClearThisControl = 0xFFFFFFFF
kTXNClearTheseFontFeatures = 0x80000000
kTXNDontCareTypeSize = 0xFFFFFFFF
kTXNDecrementTypeSize = 0x80000000
kTXNUseCurrentSelection = 0x... | StarcoderdataPython |
67532 | <filename>tests/test_views/test_record.py
from django.test import Client, TestCase
from core.models import ValidationScenario
from tests.utils import TestConfiguration, TEST_DOCUMENT
class RecordTestCase(TestCase):
def setUp(self):
self.config = TestConfiguration()
self.client = Client()
... | StarcoderdataPython |
183369 |
def write_moment1_hybrid(
cube, rms=None, channel_correlation=None,
outfile=None, errorfile=None,
overwrite=True, unit=None,
return_products=True,
strict_vfield=None,
broad_vfield=None,
broad_signal=None,
vfield_prior=None,
vfield_prior_res=None,
... | StarcoderdataPython |
199236 | <gh_stars>0
from django.contrib.auth import logout
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.exceptions import PermissionDenied
from django.shortcuts import redirect
from django.urls import reverse
from django.views import View
from django.views.generic import ListView, CreateView, Upda... | StarcoderdataPython |
1739446 | <reponame>crazytruth/inpanzee<gh_stars>0
from yarl import URL
def unpack_url(value, unpack_into=None):
if unpack_into is None:
unpack_into = {}
_url = URL(value)
unpack_into['host'] = _url.host
unpack_into['protocol'] = _url.scheme
unpack_into['port'] = _url.port
unpack_into['path'] =... | StarcoderdataPython |
1620087 | from line_profiler import LineProfiler
import numpy as np
from quantumGAN.discriminator import ClassicalDiscriminator
from quantumGAN.performance_testing.performance_qgan import Quantum_GAN
from quantumGAN.quantum_generator import QuantumGenerator
num_qubits: int = 3
# Set number of training epochs
num_epochs = 20
... | StarcoderdataPython |
3258101 | <reponame>IUNetSci/DrifterBot
from bot import Bot
from config_stat import activation_time
from datetime import datetime
from datetime import timedelta
import debug
import numpy as np
import os
import time
import random
import subprocess
import sys
def RandomizeTime(g=0.1, mmin=0, mmax=420, noise=True):
"""Sampled fr... | StarcoderdataPython |
139898 | <reponame>indhub/deep-learning-models<gh_stars>0
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# -*- coding: utf-8 -*-
'''
FPN model for Keras.
# Reference:
- [Feature Pyramid Networks for Object Detection](
https://arxiv.org/abs/1612.03144)
'''
im... | StarcoderdataPython |
3308441 | <filename>onfido/apis/default_api.py
# coding: utf-8
"""
Onfido API
The Onfido API is used to submit check requests.
OpenAPI spec version: 2.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not u... | StarcoderdataPython |
3221202 | # Copyright (c) Facebook, Inc. and 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 by applicable law or ... | StarcoderdataPython |
1754111 | import os
import tvm
from tvm.contrib import cc, util
def test_add(target_dir):
n = tvm.var("n")
A = tvm.placeholder((n,), name='A')
B = tvm.placeholder((n,), name='B')
C = tvm.compute(A.shape, lambda i: A[i] + B[i], name="C")
s = tvm.create_schedule(C.op)
fadd = tvm.build(s, [A, B, C], "llvm"... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.