id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1693888 | # Copyright (c) 2018 PaddlePaddle Authors. 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 app... | StarcoderdataPython |
3308765 | <reponame>modera-manyrepo-packages/mcloud
import json
from twisted.internet import reactor, defer
import txredisapi as redis
from twisted.python import log
from mcloud.util import txtimeout
class EventBus(object):
redis = None
protocol = None
def __init__(self, redis_connection):
super(EventBus,... | StarcoderdataPython |
88235 | import unittest
import uuid
import requests
SERVICE_URL = 'http://localhost:8080'
class MyTestCase(unittest.TestCase):
def test_status_returns_ok(self):
r = requests.get(f'{SERVICE_URL}/status')
self.assertEqual('OK', r.json()['status'])
def test_version_returns_some_version(self):
... | StarcoderdataPython |
1685836 | # -*- coding: utf-8 -*-
# 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
#
# Unless required by applicable law o... | StarcoderdataPython |
1645207 | from lib.gui_controls import Controls
import time
import win32api
import win32gui
import win32con # 导入win32api相关模块
from lib.utils import win_key_dc
def get_xy(x,y):
x_list = [win_key_dc[xx] for xx in str(x)]
y_list = [win_key_dc[yy] for yy in str(y)]
return x_list,y_list
def move_to_pos(hwnd,x,y):
#... | StarcoderdataPython |
81180 | <filename>setup.py
from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='An applied Data Science project on anaylzing the COVID-19 data.',
author='<NAME>',
license='MIT',
)
| StarcoderdataPython |
1718108 | '''
point processing based image enhancement using:
1. Log and Inverse log transformations
2. Gamma corrections(Power law transformation) with +ve and -ve values
'''
import cv2
import numpy as np
############## log transform ############
img = cv2.imread('transformation.png', -1)
prop = img.shape
c = 20
for i in ra... | StarcoderdataPython |
3294080 | <reponame>OpenIdentityPlatform/forgerock-persistit<gh_stars>1-10
#!/usr/bin/env python
# coding: utf-8
#
# Copyright 2011-2012 Akiban Technologies, 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 ... | StarcoderdataPython |
1692457 | from .core import pre_compute
from ..dispatch import dispatch
from ..expr import Expr
from odo.backends.json import JSON, JSONLines
from odo import into
from collections import Iterator
from odo.utils import records_to_tuples
@dispatch(Expr, JSON)
def pre_compute(expr, data, **kwargs):
seq = into(list, data, **kw... | StarcoderdataPython |
3202643 | #!/usr/bin/env python
# coding: utf-8
# info
__version__ = "0.1"
__author__ = "<NAME>"
__date__ = "04/10/19"
from gpiozero import Button
import time
BUCKET_SIZE = 0.2794
rain_count = 0
rain_interval = 5
def bucket_tipped():
global rain_count
rain_count += 1
def reset_rainfall():
global rain_count
... | StarcoderdataPython |
1676889 | <reponame>heldermarchetto/ElmitecReadUviewFileFormat<gh_stars>0
# -*- coding: utf-8 -*-
"""
Copyright 2019 Dr. <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/l... | StarcoderdataPython |
148953 | <filename>astroquery/simbad/__init__.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
The SIMBAD query tool creates a `script query
<http://simbad.u-strasbg.fr/simbad/sim-fscript>`__ that returns VOtable XML
data that is then parsed into a :class:`~astroquery.simbad.core.SimbadResult` object.
This... | StarcoderdataPython |
1641880 | <gh_stars>0
# Natural Language Toolkit utilities used in classifier module, should be migrated to main utilities later
# Author: <NAME> <sumukh dot ghodke at gmail dot com>
#
# URL: <http://nltk.sf.net>
# This software is distributed under GPL, for license information see LICENSE.TXT
import UserList, math
class StatLi... | StarcoderdataPython |
3203994 | <filename>collector_v2.py
# 이 코드가 완벽히 이해가 된다면 봇 개발 절반은 성공.
print("collector 프로그램이 시작 되었습니다!")
# crtl + alt + 좌우방향키 : 이전 커서 위치로
# 아래 세줄 -> mysql이라는 데이터베이스를 사용하기 위해 필요한 패키지들 -> 암기X! 그냥 다음에 mysql을 사용하고 싶으면 아래 세 줄을 복사, 붙여넣기
from sqlalchemy import create_engine
import pymysql
pymysql.install_as_MySQLdb()
# -> openapi.... | StarcoderdataPython |
129899 | ##########################################################################
#
# Copyright (c) 2015, 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 |
1679659 | <gh_stars>0
import pyperclip
import unittest # Importing the unittest module
from socialAccounts import SocialAccounts
class TestSocialAccounts(unittest.TestCase):
'''
Test class that we define and test methods to use in the SocialAccount class
'''
def tearDown(self):
'''
this is to ens... | StarcoderdataPython |
1721267 | # GENERATED BY KOMAND SDK - DO NOT EDIT
from .execute_script.action import ExecuteScript
from .powershell_string.action import PowershellString
| StarcoderdataPython |
3354983 | <filename>sdk/python/pulumi_google_native/bigquerydatatransfer/v1/outputs.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any... | StarcoderdataPython |
1647373 | <reponame>unistra/schedulesy<filename>schedulesy/apps/ade_api/migrations/0007_resource_parent.py
# Generated by Django 2.1.12 on 2019-09-26 15:32
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ade_api', '0006_auto_20190... | StarcoderdataPython |
3265548 | <reponame>shersonb/codecfactory<filename>codecfactory/exc.py
class DecodeError(BaseException):
def __init__(self, codec, message, offset=None, exc=None):
self.codec = codec
self.offset = offset
self.exc = exc
super(DecodeError, self).__init__(message)
class NoMatch(DecodeError):
... | StarcoderdataPython |
1708993 | <reponame>gardar/ahvl<gh_stars>1-10
#
# import modules
#
from ahvl.options.base import OptionsBase
#
# OptionsGenerateSalt
#
class OptionsGenerateSalt(OptionsBase):
# set option prefix
def get_prefix(self):
# return option prefix
return "ahvl_generate_salt"
# set path
# useable vari... | StarcoderdataPython |
1777572 | <reponame>zfang-slim/PysitForPython3<filename>pysit/solvers/constant_density_acoustic/time/scalar/setup.py
from distutils.core import setup, Extension
import numpy
from Cython.Distutils import build_ext
import os
import os.path
#
os.environ["CC"] = "gcc-8"
os.environ["CXX"] = "g++-8"
setup(
cmdclass={'build_ext': ... | StarcoderdataPython |
3314881 | <gh_stars>0
from django_tables2 import RequestConfig
from django.shortcuts import render
from django.forms import modelformset_factory
from django.views.decorators.csrf import csrf_protect
from django.contrib.auth.decorators import login_required
from .tables import CashUpReportTable
from .commons import *
from .models... | StarcoderdataPython |
3311593 | <filename>projects/dccon-downloader/app.py
import sys
import tkinter as tk
from dcinside.downloader import Downloader
title = '흔한 찐따의 디시콘 다운로더'
icon = 'icon.ico'
if __name__ == '__main__':
root = tk.Tk()
downloader = Downloader(root, title=title, icon=icon)
downloader.mainloop()
s... | StarcoderdataPython |
131472 | import traceback, sys, string
import win32com.server.util
from win32com.util import IIDToInterfaceName
from win32com.client.util import Enumerator
from win32com.server.exception import COMException
import pythoncom
from framework import trace
from win32com.axdebug import axdebug, gateways, contexts, stackframe, docume... | StarcoderdataPython |
3214109 | <filename>manual_exercises/ex4_5/dtft.py
import numpy as np
import matplotlib.pyplot as plt
def H(z):
num = np.polyval([1,0,1],z**(-1))
den = np.polyval([0.5,1],z**(-1))
H = num/den
return H
#Input and Output
omega = np.linspace(-3*np.pi,3*np.pi,int(10e2))
#subplots
plt.plot(omega,abs(H(np.exp(1j*omega))))
plt.t... | StarcoderdataPython |
1615245 | <reponame>predatell/satchmo
from django.contrib import admin
from payment.models import CreditCardDetail
from payment.forms import CreditCardDetailAdminForm
class CreditCardDetail_Inline(admin.StackedInline):
model = CreditCardDetail
form = CreditCardDetailAdminForm
extra = 1
| StarcoderdataPython |
120261 | import os
if os.getenv("LEVEL") == "PRODUCTION":
print('RUN PRODUCTION MODE')
from .production import *
else:
print('RUN LOCAL MODE')
from .local import *
from .base import *
| StarcoderdataPython |
199390 | from pkgcheck.checks import header
from .. import misc
class TestEbuildHeaderCheck(misc.ReportTestCase):
check_kls = header.EbuildHeaderCheck
def mk_pkg(self, **kwargs):
return misc.FakePkg("dev-util/diffball-0.5", **kwargs)
def test_empty_file(self):
fake_pkg = self.mk_pkg(lines=())
... | StarcoderdataPython |
61501 | from copy import deepcopy
import torch
from torch import nn
import torch.nn.functional as F
import numpy as np
from apex import amp
from torch.cuda.amp import autocast as autocast
from transformers import BertModel, BertTokenizer
from util import text_processing
from collections import OrderedDict
from . import ops a... | StarcoderdataPython |
1646543 | from os.path import join, exists, isdir, abspath
from packaging import version
import torch
ROOT_DIR = abspath('.')
DATA_DIR = join(ROOT_DIR, 'dataset/')
MODEL_DIR = join(ROOT_DIR, 'models/')
RESULT_DIR = join(ROOT_DIR, 'result/')
MID_PRODUCT = join(ROOT_DIR, 'mid_product/')
for d in [DATA_DIR, MODEL_DIR, RESUL... | StarcoderdataPython |
1722591 | <filename>reachyAudio/reachyAudio.py
"""The reachyAudio module defines the ReachyAudio class."""
import time
from math import cos, sin, radians
from .reachyAudioPlayerRecorder import ReachyAudioPlayerRecorder
from .reachyAudioTextToSpeech import ReachyAudioTextToSpeech
from .reachyAudioMicArrayFeatures import ReachyA... | StarcoderdataPython |
3302836 | """Playwell RPA Base
"""
| StarcoderdataPython |
142456 | <reponame>Piero-Palevsky-OH/aldjemy
class Wrapper:
"Wrapper to disable commit in sqla"
def __init__(self, obj):
self.obj = obj
def __getattr__(self, attr):
if attr in ["commit", "rollback"]:
return lambda *args, **kwargs: None
obj = getattr(self.obj, attr)
if at... | StarcoderdataPython |
173574 |
from sqlalchemy import Column, String, ForeignKey
from fr.tagc.rainet.core.util.sql.Base import Base
from fr.tagc.rainet.core.util.sql.SQLManager import SQLManager
from fr.tagc.rainet.core.util.exception.NotRequiredInstantiationException import NotRequiredInstantiationException
from fr.tagc.rainet.core.util.exception... | StarcoderdataPython |
10996 | import re
textinput = widget_inputs["text1"]
comments = []
def commentizer(new):
if new not in comments:
comments.append(new)
is_correct = False
result = re.match(".*window.*", textinput, flags=re.IGNORECASE)
if result:
is_correct = True
commentizer("You're right, but there's a little more to it... | StarcoderdataPython |
154899 | from django import forms
from .models import Member, get_config
from .util import validate_country
class MemberForm(forms.ModelForm):
class Meta:
model = Member
fields = ('fullname', 'country', 'listed')
def clean_country(self):
if self.instance.country_exception:
# No co... | StarcoderdataPython |
1632216 | #!/usr/bin/python
#coding = utf-8
import QuantLib as ql
import pandas as pd
def getDigitsFromStr(string:str,withDigitPoint:bool = False):
"""
Extract number from a string. Return a list whose element is strings that is number.
Parameters
----------
string : str
The string that may contain numbers.
withDigitPo... | StarcoderdataPython |
151915 | import cv2
import numpy as np
from imutils.video import FileVideoStream
import imutils
import time
vs = FileVideoStream('messi.webm').start()
while vs.more():
frame=vs.read()
if frame is None:
continue
output=frame.copy()
gray=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
gray=cv2.medianBlur(gray,5)
gray=cv2.adaptiveT... | StarcoderdataPython |
4836274 | ctx.tex_radius = ctx.gen_texture.radius.cell()
ctx.tex_radius.set(32)
ctx.tex_filename = ctx.gen_texture.filename.cell()
ctx.tex_filename.set("")
ctx.gen_texture.as_float.cell().set(True)
ctx.gen_texture.output.connect(ctx.texture)
| StarcoderdataPython |
1779942 | from threading import Thread
import pat
import patl
import logging
import argparse
import time
from patutils import SEPARATOR, BOX_LENGTH, BASE, USE_SEPARATOR
""" A chat protocol based loosely off IRC
The whole thing works with ASCII256 text
"""
standard_ascii = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0... | StarcoderdataPython |
1797706 | <gh_stars>0
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import sklearn
# Load the data
oecd_bli = pd.read_csv("BLI_20042020185733310.csv", thousands=',')
gdp_per_capita = pd.read_csv("WEO_Data.csv", thousands=',', delimiter='\t',
encoding='latin1', na_values="n/a")
# Prepar... | StarcoderdataPython |
3369822 | <reponame>viraajpunia/Mini-Amazon<gh_stars>0
from flask import current_app as app
class Product:
def __init__(self, id, category, name, descrip, img_link, price, available):
self.id = id
self.category = category
self.name = name
self.descrip = descrip
self.img_link = img_li... | StarcoderdataPython |
3246660 | <filename>Python/questions/BinarySearchTreeIterator/binary-search-tree-iterator-solution-1.py<gh_stars>0
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class BSTIterator:
def __init__(self, root: TreeNode):
... | StarcoderdataPython |
1682784 | <reponame>WillGreen98/University-INTPROG-Python<gh_stars>1-10
class Coin(object):
def __init__(self, value):
self.value = value
def flip(self):
self.flip_value = random.randint(0, 1)
if self.flip_value == 0:
print("Heads")
else:
print("Tails")
# pence =... | StarcoderdataPython |
3266614 | <filename>psrasvr.py
import atddm
import numpy as np
import pandas as pd
from sklearn.svm import SVR
from sklearn.metrics import r2_score, mean_squared_error, mean_absolute_error
from sklearn.model_selection import cross_validate, TimeSeriesSplit
from constants import CODES, TZONES, INTERVAL
nairp = len(CODES)
CODES.s... | StarcoderdataPython |
68338 | """
error models for pybugsnag
"""
class PyBugsnagException(Exception):
"""base pybugsnag exception class"""
def __init__(self, *args, **kwargs):
extra = ""
if args:
extra = '\n| extra info: "{extra}"'.format(extra=args[0])
print(
"[{exception}]: {doc}{extra}".... | StarcoderdataPython |
54225 | <gh_stars>0
"""
The is the abstract defender base class.
A defender can see all values at the beginning of
each simulation round and can try to detect an attack.
It is also possible to first let the defender learn
before running an attack.
"""
from abc import ABC, abstractmethod
__author__ = '<N... | StarcoderdataPython |
77832 | """Philips Hue Sync Box integration."""
import ipaddress
import homeassistant.helpers.config_validation as cv
import voluptuous as vol
from .const import *
from . import services
DEFAULT_NAME = 'Hue Sync'
def coerce_ip(value):
"""Validate that provided value is a valid IP address."""
if not value:
... | StarcoderdataPython |
3369342 | <reponame>tuvshinot/algorithm-sorting-DS
from math import floor
def decimal_to_binary(num):
acc = []
remainder = 0;
binary = ''
while num > 0:
remainder = num % 2
acc.append(1) if remainder == 1 else acc.append(0)
num = floor(num / 2)
acc.reverse()
binary = ''.join(str... | StarcoderdataPython |
178724 | import tensorflow as tf
from keras.models import Sequential,load_model,model_from_json
from keras.layers import Dense, Dropout,Activation,MaxPooling2D,Conv2D,Flatten
from keras.applications.imagenet_utils import preprocess_input, decode_predictions
from keras.preprocessing.image import load_img
from keras.preprocessing... | StarcoderdataPython |
3271427 | <reponame>cyrusradfar/vaex
def connect(url, **kwargs):
"""Connect to remote server (default is tornado)"""
# dispatch to vaex.server.tornado package
from .tornado_client import connect
return connect(url, **kwargs)
| StarcoderdataPython |
1673770 | <reponame>tsaycal/romodel
from .knapsack import Knapsack
from .portfolio import Portfolio
from .pooling import Pooling
| StarcoderdataPython |
1639965 | <filename>logic/flatpak.py
from helper import run_cmd
class Flatpak:
@staticmethod
def do(cmd):
"""run an unimplemented command"""
run_cmd(f"flatpak {cmd}")
@staticmethod
def update():
Flatpak.do("update")
@staticmethod
def remote_add(name, url, *args):
cmd = ... | StarcoderdataPython |
3297053 | <reponame>okfde/ckankrzn
../v19_01_error/plugin.py | StarcoderdataPython |
3200332 | <filename>prc/app_post2.py
'''
Created on 18.04.2018
@author: trevaz
--------------------------------------------------------------------------------
app: post-process
--------------------------------------------------------------------------------
'''
################################################################... | StarcoderdataPython |
114188 | import discord
import json
from config import config
bot = config.bot()
def get_role(role, ctx):
return discord.utils.get(ctx.guild.roles, name=role)
def roles():
with open("Moderating/Perms/roles.json") as file:
return json.load(file)
async def is_muted(user):
return get_role(role="Muted", c... | StarcoderdataPython |
127080 | # uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\clubs\club_commands.py
# Compiled at: 2019-11-07 00:04:00
# Size of source mod 2**32: 26533 bytes
im... | StarcoderdataPython |
1775101 | #!/usr/bin/env python3
# Copyright 2022 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import time
for x in range(30):
print("Hi! %s" % x)
time.sleep(1)
| StarcoderdataPython |
3377694 | import collections.abc
from crims2s.training.util import find_checkpoint_file
import torch
import torch.nn as nn
import numpy as np
from typing import Mapping, TypeVar, Callable, Iterable, Hashable
from ...util import ECMWF_FORECASTS
class PytorchMultiplexer(nn.Module):
"""Model multiplexer that only works on ... | StarcoderdataPython |
1661767 | import wx
import sys, platform, time, ast
from packages.rmnetwork import netutil
import packages.rmnetwork as network
from packages.rmnetwork.constants import *
from packages.lang.Localizer import *
from wx.lib.wordwrap import wordwrap
import wx.lib.scrolledpanel as scrolled
import wx.lib.masked as masked
if platform.... | StarcoderdataPython |
3264464 | """
The LcCatalog provides a semantic interface to a collection of (local and remote) read-only LcArchives, which provide
access to physical data.
It is made up of the following components:
* built on an LciaEngine
+ local, persistent storage of resources, indexes, cache data + etc
+ A resolver, which translate... | StarcoderdataPython |
26742 | <gh_stars>0
import unittest
#4.定义测试类,父类为unittest.TestCase。
#可继承unittest.TestCase的方法,如setUp和tearDown方法,不过此方法可以在子类重写,覆盖父类方法。
#可继承unittest.TestCase的各种断言方法。
class Test(unittest.TestCase):
#5.定义setUp()方法用于测试用例执行前的初始化工作。
#注意,所有类中方法的入参为self,定义方法的变量也要“self.变量”
def setUp(self):
print("开始。。。。。。。。")
self.num... | StarcoderdataPython |
62264 | import mysql.connector
conn = mysql.connector.connect(
host="192.168.99.102",
user="root",
passwd="<PASSWORD>",
database="user_db",
port="3308"
)
def find_all():
query = "SELECT * FROM users"
try:
cursor = conn.cursor()
rows = cursor.execute(query)
cursor.close()
ret... | StarcoderdataPython |
4836496 | import numpy as np
from UCTB.dataset import NodeTrafficLoader
from UCTB.model import DCRNN
from UCTB.evaluation import metric
class my_data_loader(NodeTrafficLoader):
def diffusion_matrix(self, filter_type='random_walk'):
def calculate_random_walk_matrix(adjacent_mx):
d = np.array(adjacent_m... | StarcoderdataPython |
3281385 | <filename>Lib/plat-irix6/cdplayer.py
# This file implements a class which forms an interface to the .cdplayerrc
# file that is maintained by SGI's cdplayer program.
#
# Usage is as follows:
#
# import readcd
# r = readcd.Readcd()
# c = Cdplayer(r.gettrackinfo())
#
# Now you can use c.artist, c.title and c.track[trackno... | StarcoderdataPython |
3334412 | from dateutil.parser import parse
def capitalizeinput(inputparameter):
'''
This will take the raw input text and
tokenize the string and capitalize all
the token and returns the formatted
capitalized text.
:param inputparameter :type str
:return: string(text will all the tokens capitalized)... | StarcoderdataPython |
15391 | import math
import numpy as np
import torch
from torch import nn
from torch.backends import cudnn
from torch.utils.data import DataLoader
from tqdm import tqdm
from model import CharRNN
from data import TextDataset, TextConverter
class Trainer(object):
def __init__(self, args):
self.args = args
... | StarcoderdataPython |
1658791 | # Under MIT licence, see LICENCE.txt
from ai.STA.Tactic.Tactic import Tactic
from ai.STA.Action.MoveToPosition import MoveToPosition
from ai.STA.Action.Idle import Idle
from ai.STA.Tactic import tactic_constants
from ai.Util.ball_possession import hasBallFacingTarget
from ai.STA.Tactic.tactic_constants import Flags
fr... | StarcoderdataPython |
31666 | <filename>references/encase/code/resNet_3.py<gh_stars>1-10
# -*- coding: utf-8 -*-
'''
split long seq into small sub_seq,
feed sub_seq to lstm
'''
from __future__ import division, print_function, absolute_import
import tflearn
import tflearn.data_utils as du
import numpy as np
import ReadData
import tensorflow as ... | StarcoderdataPython |
155083 | <filename>widgets/comboBox.py<gh_stars>1-10
from .base import *
class ComboBoxTemplateWidget(TemplateWidget):
def __init__(self, **kwargs):
super(ComboBoxTemplateWidget, self).__init__(**kwargs)
layout = QVBoxLayout()
self.setLayout(layout)
layout.setContentsMargins(0, 0, 0, 0)
... | StarcoderdataPython |
155705 | """Output utilities
===================
Tiny module to hide fluiddyn for users of fluidlab.
"""
from fluiddyn.output.figs import show
| StarcoderdataPython |
109061 | """
These are some scripts used in testing multiple particles.
"""
import time
import datetime
import numpy as np
from particle import Particle
#==============================================================================
def fill_particles(diameter, density, births, lifetime, initial_positions, u0):
# somePart... | StarcoderdataPython |
1655130 | from .keys import (BadSignatureError, BadPrefixError,
create_keypair, SigningKey, VerifyingKey,
remove_prefix, to_ascii, from_ascii)
(BadSignatureError, BadPrefixError,
create_keypair, SigningKey, VerifyingKey,
remove_prefix, to_ascii, from_ascii) # hush pyflakes
from ._version i... | StarcoderdataPython |
3343554 | <reponame>sekikn/spark-executor-dict-plugin
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, V... | StarcoderdataPython |
75836 | <reponame>kostrse/coworkingmap
import os
import subprocess
def _get_exec_extensions():
if os.name == "nt":
return os.getenv("PATHEXT").split(os.pathsep)
else:
return [""]
def _resolve_path(command):
extensions = _get_exec_extensions()
def is_exec(filenanme):
return os.path.i... | StarcoderdataPython |
3213405 | <filename>62-reticulate/simple.py
import matplotlib.pyplot as plt
import numpy as np
x = np.array([1,2,3])
y = np.square(x)
plt.figure()
plt.plot(x,y)
plt.show()
| StarcoderdataPython |
4835916 | """
Consolidate Services
Description of all APIs # noqa: E501
The version of the OpenAPI document: version not set
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from argocd_python_client.api_client import ApiClient, Endpoint as _Endpoint
from arg... | StarcoderdataPython |
3272478 | import requests
import json
import os
TOKEN = os.environ.get("STRAVA_BEARER")
try:
response_length = 100
data = []
page = 1
while response_length > 0:
r = requests.get(
"https://www.strava.com/api/v3/athlete/activities?per_page=30",
headers={f"Authorization": "Bearer {T... | StarcoderdataPython |
125550 | __all__ = [
'extern_progs',
'set_config'
]
from XICRA.config import *
| StarcoderdataPython |
3331686 | import numpy as np
def RotZ(heading):
psi = heading
R = np.array([[np.cos(heading), -np.sin(heading), 0],
[np.sin(heading), np.cos(heading), 0],
[0, 0, 1]])
return R
R = RotZ(-1.889)
wayp = np.array([[6000],
[-300],
[-... | StarcoderdataPython |
1788960 | <gh_stars>1-10
#!/usr/bin/env python3
from datetime import datetime
import pytest
from astranslate import PBbool, PBdate, PBdict, PBlist, PBnumber, PBstring
def test_PBBool_ToApplescript_GivenBoolean_ReturnsBooleanString():
assert PBbool.to_applescript(True) == "True"
def test_PBBool_ToApplescript_GivenNumber_Re... | StarcoderdataPython |
1695775 |
import pygame
import file_importer as fi
from math import pi
pygame.init()
size = (700, 700)
screen = pygame.display.set_mode(size)
pygame.display.set_caption('3D OBJ File Renderer')
clock, fps = pygame.time.Clock(), 30
screen_plane = (300, 300)
path = 'TestModels/robot.obj'
shape = fi.load_obj(path, ... | StarcoderdataPython |
3304326 | <reponame>AgPipeline/AgPypeline
#!/usr/bin/env python3
"""
Purpose: Unit testing for entrypoint.py
Author : <NAME> <<EMAIL>>
Notes:
This file assumes it's in a subfolder off the main folder
"""
import argparse
import json
import os
import piexif
from agpypeline import configuration, environment
TEST_FILES = ['agp... | StarcoderdataPython |
3391359 | from flask import current_app, request
from flask_security.confirmable import requires_confirmation
from flask_security.forms import (
NextFormMixin,
get_form_field_label,
config_value,
)
from flask_security.utils import get_message, verify_and_update_password
from flask_wtf import FlaskForm
from werkzeug.l... | StarcoderdataPython |
3281978 | <reponame>etdv-thevoid/pokemon-rgb-enhanced
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import absolute_import
import sys
import os
import time
import datetime
from ctypes import c_int8
from copy import copy
import json
# New versions of json don't have read anymore.
if not hasattr(j... | StarcoderdataPython |
1677494 | <gh_stars>0
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016, the cclib development team
#
# This file is part of cclib (http://cclib.github.io) and is distributed under
# the terms of the BSD 3-Clause License.
"""Bridge for using cclib data in PyQuante (http://pyquante.sourceforge.net)."""
from __future__ imp... | StarcoderdataPython |
1643860 | # Each view is responsible for doing one of two things: returning an HttpResponse object to the contents of the requested page, or raising an exception such as Http404. The rest is up to you.
# Here we just use the render method imported so we can render a html-page
from django.shortcuts import render
# Create your v... | StarcoderdataPython |
3220303 | """
Experimental tests that play with thin-edge.io.
See https://thin-edge.io
"""
import logging
import os
import time
import pytest
CURL = "/usr/bin/curl -X POST http://localhost:{} -d hello_my_plugins"
import pytest
def test_go():
pass
def test_use_case_help(process_factory):
help = process_factory(["... | StarcoderdataPython |
4809337 | from pathlib import Path
import stubber
from packaging.version import parse
try:
import tomllib # type: ignore
except ModuleNotFoundError:
import tomli as tomllib
def test_package_versions_are_in_sync():
"""Checks if the pyproject.toml and package.__init__.py __version__ are in sync."""
# Q&D Locati... | StarcoderdataPython |
75477 | <filename>tests/fileoperation_test.py
"""
Tests for file related operation
"""
import os
import pytest
from xkye import IO as io
# To test the missing file
def test_missing_input_file():
""" To test the missing input file """
xky_file = "../test/test.xky"
with pytest.raises(Exception):
mxkye ... | StarcoderdataPython |
3225619 | <gh_stars>10-100
# Copyright (c) 2018 <NAME>
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
from phylanx import Phylanx
@Phylanx
def foo():
f = lambda a: a # noqa: E731
f(42)
assert (foo() == 42)
| StarcoderdataPython |
1780352 | """File downloader for the Virtual Campus of the Valladolid Unversity."""
from ._version import get_versions
__version__ = get_versions()["version"]
del get_versions
| StarcoderdataPython |
1744924 | <filename>atomic_reactor/inner.py
"""
Copyright (c) 2015-2022 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
Script for building docker image. This is expected to run inside container.
"""
import functools
import ... | StarcoderdataPython |
1643536 | """
This tutorial shows you how to use a data recorder to record some data for
imitation learning for instance and how to load the data again. Or replay some
episodes.
"""
from causal_world.envs.causalworld import CausalWorld
from causal_world.task_generators.task import generate_task
from causal_world.loggers.data_re... | StarcoderdataPython |
4821907 | <gh_stars>1-10
import numpy
import pandas
import pymol
from io import StringIO
#import itertools
import os
import re
import subprocess
import sys
import time
from csubst import sequence
from csubst import utility
def initialize_pymol(g):
#pymol.pymol_argv = ['pymol','-qc']
#pymol.finish_launching()
pymol... | StarcoderdataPython |
1697151 | <filename>pyon/core/governance/conversation/core/local_type.py
class Enum(set):
def __getattr__(self, name):
if name in self:
return name
raise AttributeError
LocalType = Enum(["SEND", "RESV"]) | StarcoderdataPython |
1607709 | # -*- coding: utf-8 -*-#
# -------------------------------------------------------------------------------
# Name: 3.8
# Description: 多层感知机章节
# Author: xuyapeng
# Date: 2020/8/26
# -------------------------------------------------------------------------------
import tensorflow as tf
from matpl... | StarcoderdataPython |
1631001 | # -*- coding: UTF-8 -*-
# @Time: 2020-06-11 17:09
# @Author: wyd
# @File: toast获取.py
from appium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from appium.webdriver.common.mobileby import MobileBy
import time
desired_caps = ... | StarcoderdataPython |
1638684 | from StaticMethods.Exceptions import exception
from StaticMethods.addition import addition
from StaticMethods.division import division
from StaticMethods.roundOff import roundOff
def calMedian(a):
length = len(a)
half = int(division(2, length))
for val in a:
exception(val)
if length % 2 == 0... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.