id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
4827360 | <reponame>IshanKamboj/Giveaway-Bot
from pathlib import Path
import discord
from discord.ext import commands
import sqlite3
class GiveawayBot(commands.Bot):
def __init__(self):
self._cogs=[p.stem for p in Path(".").glob("./bot/cogs/*.py")]
super().__init__(command_prefix=self.prefix, case_insensitiv... | StarcoderdataPython |
3298378 | # -*- coding:utf-8 -*-
from ftplib import FTP
import os
def ftpconnect():
ftp_server = '192.168.0.23'
username = 'ximage'
password = '<PASSWORD>'
ftp=FTP()
ftp.set_debuglevel(2) #打开调试级别2,显示详细信息
ftp.connect(ftp_server,21) #连接
ftp.login(username,password) #登录,如果匿名登录则用空串代替即可
return ftp
def ... | StarcoderdataPython |
1628241 | <reponame>Andrew-Chen-Wang/django-crispy-markdown-editor
from django.contrib import admin
# Register your models here.
from .models import Blah
admin.site.register(Blah) | StarcoderdataPython |
168568 | <reponame>dls-controls/atip<filename>tests/test_load.py
import mock
import pytac
import pytest
import atip
def test_load_pytac_side(pytac_lattice, at_diad_lattice):
lat = atip.load_sim.load(pytac_lattice, at_diad_lattice)
# Check lattice has simulator data source
assert pytac.SIM in lat._data_source_manag... | StarcoderdataPython |
88605 | from __future__ import absolute_import
from __future__ import print_function
import veriloggen
import types_axi_slave_readwrite_lite_simultaneous
expected_verilog = """
module test;
reg CLK;
reg RST;
wire [32-1:0] sum;
reg [32-1:0] myaxi_awaddr;
reg [4-1:0] myaxi_awcache;
reg [3-1:0] myaxi_awprot;
reg m... | StarcoderdataPython |
181590 | <reponame>Justasic/Privacy.py
"""The embed related model(s)."""
from datetime import datetime
import typing
from privacy.schema.base import CustomBase
class EmbedRequest(CustomBase):
"""
The EmbedRequest model.
Attributes:
token (str): The globally unique identifier for the card to be displayed... | StarcoderdataPython |
114062 | import pytest
import pypipegraph as ppg
import pandas as pd
from mbf_genomics import DelayedDataFrame
from mbf_comparisons import Comparisons, venn, Log2FC
from mbf_qualitycontrol.testing import assert_image_equal
@pytest.mark.usefixtures("new_pipegraph_no_qc")
class TestVenn:
def test_venn_from_logfcs(self):
... | StarcoderdataPython |
3344444 | """Auto-generated file, do not edit by hand. KZ metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_KZ = PhoneMetadata(id='KZ', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='[134]\\d{2,4}', possible_length=(3, 4, ... | StarcoderdataPython |
1694715 | <reponame>kiyoon/cystage_ticketing_gen<filename>old/instagram.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Use text editor to edit the script and type in valid Instagram username/password
from InstagramAPI import InstagramAPI
import io
import getpass
import os
"""
## Uploading a timeline album (aka... | StarcoderdataPython |
94910 | <reponame>zfl273/meiduo_web
# celery 运行入口,启动celery
import os
from celery import Celery
# 在发送邮件的异步任务中,需要用到django的配置文件,
# 所以我们需要修改celery的启动文件main.py,在其中指明celery可以读取的django配置文件,
# 并且注册添加email的任务
if not os.getenv('DJANGO_SETTINGS_MODULE'):
os.environ['DJANGO_SETTINGS_MODULE'] = 'meiduo_web_01.settings.dev'
# 创建cele... | StarcoderdataPython |
62497 | <gh_stars>1-10
"""
Fun facts about the St. Jude Memphis Marathons.
Data retrieved from:
https://www.stjude.org/get-involved/at-play/fitness-for-st-jude/memphis-marathon/participants/results.html
"""
import locale
import sys
from statistics import mean, median, mode, StatisticsError
from collections import Counter
i... | StarcoderdataPython |
3202349 | print("noop")
| StarcoderdataPython |
3350808 | <gh_stars>0
from rest_framework import serializers
from . import models
class CreateNewRoomCategorySerializers(serializers.ModelSerializer):
class Meta:
model = models.RoomCategories
fields = ['name', 'price', 'notes']
class CreateRoomRentalsSerializers(serializers.ModelSerializer):
class ... | StarcoderdataPython |
48436 | <reponame>flymin/robustbench<gh_stars>1-10
from collections import OrderedDict
from typing import Any, Dict, OrderedDict as OrderedDictType
from robustbench.model_zoo.cifar10 import cifar_10_models
from robustbench.model_zoo.cifar100 import cifar_100_models
from robustbench.model_zoo.enums import BenchmarkDataset, Thr... | StarcoderdataPython |
105454 | <filename>config.py<gh_stars>0
VARS = {
'CLIENT_SECRET_PATH': 'res/client_secret.json',
'SCOPES': 'https://www.googleapis.com/auth/spreadsheets',
'APPLICATION_NAME': 'Google Sheets API Python Quickstart',
'DISCOVERY_URL': 'https://sheets.googleapis.com/$discovery/rest?version=v4'
}
CONSTANTS = {
'CR... | StarcoderdataPython |
3308145 | <reponame>wjiec/packages
#!/usr/bin/env python3
#
# Copyright (C) 2019 jayson
#
import time
import random
import logging
from config import RABBITMQ_MASTER
from utils.logging import init_logging
from utils.connection import get_durable_queue_connection
from pika.adapters.blocking_connection import BlockingCha... | StarcoderdataPython |
4840854 | <filename>Exercicios/par_impar.py
#MaBe
#Le um numero e diz se é par ou impar
n = int(input("Digite um numero qualquer: "))
res = n % 2 #fornece o resto da divisão por 2
if res == 0:
print("Numero par!")
else:
print("Numero impar!")
| StarcoderdataPython |
3239595 | from reader._plugins import global_metadata
def test_plugin(make_reader, db_path):
reader = make_reader(db_path, plugins=[global_metadata.init_reader])
reader = make_reader(db_path, plugins=[global_metadata.init_reader])
reader.update_feeds()
assert dict(reader.get_global_metadata()) == {}
asser... | StarcoderdataPython |
3353884 | <filename>isi_sdk_8_1_1/isi_sdk_8_1_1/models/job_policy_interval.py
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 6
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re... | StarcoderdataPython |
3344185 | <reponame>TobleMiner/psydewalk
class MethodNotImplementedException(Exception):
"""docstring for MethodNotImplementedException"""
def __init__(self):
super(MethodNotImplementedException, self).__init__('Method not implemented')
class NoTransportException(Exception):
"""docstring for NoTransportException"""
def __... | StarcoderdataPython |
3208040 | # Capture multi video from webcam
# Display the frame 4 times on canvas
import numpy
import cv2
# 0 means 1st webcam
cap = cv2.VideoCapture(0)
while True:
ret, frame = cap.read()
width = int(cap.get(3))
height = int(cap.get(4))
img = cv2.line(frame,
(0, 0),
(width, hei... | StarcoderdataPython |
41988 | #!/usr/bin/env python
"""
Author: <NAME> <<EMAIL>>
License: LGPL
Note: I've licensed this code as LGPL because it was a complete translation of the code found here...
https://github.com/mojocorp/QProgressIndicator
Adapted to spectrochempy_gui
"""
import sys
from spectrochempy_gui.pyqtgraph.Qt import QtCo... | StarcoderdataPython |
4831093 | <reponame>andersonwillsam/Will_OS
# <NAME>
# 4/11/21
# Color Game
# import the modules
import tkinter
import random
# list of possible colour.
colours = ['Red','Blue','Green','Pink','Black',
'Yellow','Orange','White','Purple','Brown']
score = 0
# the game time left, initially 30 seconds.
timeleft = 3... | StarcoderdataPython |
161189 | <reponame>nielsdrost/pymt
import numpy as np
from ._version import get_versions
__version__ = get_versions()["version"]
del get_versions
# See https://github.com/numpy/numpy/blob/master/doc/release/1.14.0-notes.rst#many-changes-to-array-printing-disableable-with-the-new-legacy-printing-mode
try:
np.set_printopt... | StarcoderdataPython |
3241910 | <reponame>jiadaizhao/LintCode
"""
Definition of TreeNode:
"""
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
class Solution:
"""
@param nums: the sorted array
@return: the root of the tree
"""
def convertSortedArraytoBinarySearchTree(... | StarcoderdataPython |
68732 | <filename>bin/export_grafana_snapshot.py
import argparse
import datetime
import json
import os
import time
import requests
import requests.auth
import schedule
from datetime import datetime
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutExceptio... | StarcoderdataPython |
4840639 | '''
Creates the Automl classification model using dataset on bucket
'''
import argparse
import os
import shutil
import time
from google.cloud import automl_v1beta1 as automl
from google.cloud import storage
DATE_STR = time.strftime("%Y%m%d%H%M%S")
AUTOML_CLIENT = automl.AutoMlClient()
STORAGE_CLIENT = storage.Client... | StarcoderdataPython |
3242201 | <gh_stars>1-10
from itertools import combinations
if __name__ == '__main__':
valid = 0
while True:
try:
passphrase = input().split()
except EOFError:
break
for combi in combinations(passphrase, 2):
if sorted(list(combi[0])) == sorted(list(combi[1])):
... | StarcoderdataPython |
51731 | <gh_stars>0
import parseCount
def parse_nodes(filename): #extracts information from the list of hypernodes and puts them into node objects. Right now it only actually uses the names of the nodes.
node_ls = []
with open(filename, 'r') as file:
file.readline()
for line in file.readlines():... | StarcoderdataPython |
41751 | # Generated by Django 2.2.6 on 2020-01-24 00:50
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('books', '0006_auto_20200124_0048'),
]
operations = [
migrations.AddField(
model_name='doubleent... | StarcoderdataPython |
4832813 | <filename>src/euler_python_package/euler_python/easiest/p015.py
from euler_python.utils import eulerlib
def problem015():
"""
Starting in the top left corner of a 2×2 grid, and only being able to move
to the right and down, there are exactly 6 routes to the bottom right
corner.
How many ... | StarcoderdataPython |
1670166 | # coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... | StarcoderdataPython |
3335155 | <gh_stars>1-10
from unittest import TestCase
from unittest.mock import Mock, patch
from django.http import HttpResponseRedirect, HttpResponse
from django.test.client import RequestFactory
from easydmp.site.views import Homepage, LoginView
class HomepageTest(TestCase):
def setUp(self):
request = Request... | StarcoderdataPython |
3285780 | def my_func(n):
return n*10
a = 5
a = my_func(a)
print(a)
| StarcoderdataPython |
1653255 | import unittest
from teams_utils import Team
class TestTeams(unittest.TestCase):
def test_full_name(self):
team = Team("New York", "Giants", [])
self.assertEqual(team.full_name, "<NAME>")
if __name__ == "__main__": # only run if this script is invoked from command line
unittest.main() | StarcoderdataPython |
119401 | import numpy as np
import os
import cv2
class VideoStartOrEndOutOfBoundsException(RuntimeError):
'''Invalid start or end location in VideoFile'''
class VideoNotFoundException(RuntimeError):
'''Raise when local video file could not be found'''
class VideoCouldNotBeOpenedException(RuntimeError):
'''Raise wh... | StarcoderdataPython |
3372843 | <filename>osmcli.py
import urlutil
import xml.etree.ElementTree as ET
from xml.sax.saxutils import escape
class GoneError(RuntimeError):
pass
class OsmCli(object):
def __init__(self, apiUrl):
self.apiUrl = apiUrl
self.openChangeSet = None
self.userpass = None
def SetUserPass(self, username, password):
sel... | StarcoderdataPython |
3329428 | URL_API = "https://api.gleif.org/api/v1/lei-records/"
URL_LEVEL2_CONCAT_FILES = (
"https://leidata.gleif.org/api/v1/concatenated-files/rr/%date%/zip"
)
URL_SEARCH = "https://api.gleif.org/api/v1/lei-records?filter%5Bfulltext%5D="
URL_DIRECT_CHILD = (
"https://api.gleif.org/api/v1/lei-records/{}/direct-" "child-... | StarcoderdataPython |
32256 | <gh_stars>0
#! /usr/bin/env python
import matplotlib.colors as mc
import numpy as np
import re
class Palette(object):
black = "#000000"
white = "#ffffff"
blue = "#73cef4"
green = "#bdffbf"
orange = "#ffa500"
purple = "#af00ff"
red = "#ff6666"
yellow = "#ffffa0"
@staticmethod
... | StarcoderdataPython |
46892 | <reponame>elderdk/pyxliff
# -*- coding: utf-8 -*-
# pyxliff/__init__.py
"""Provides useful functions for SDLXliff terms verification and discovery."""
__version__ = "0.1.0"
| StarcoderdataPython |
92974 | a = int(input())
b = int(input())
def rectangle_area(a, b):
return '{:.0f}'.format(a * b)
print(rectangle_area(a, b))
| StarcoderdataPython |
1720741 | <gh_stars>0
"""Custom topology example
Two directly connected switches plus a host for each switch:
host --- switch --- switch --- host
Adding the 'topos' dict with a key/value pair to generate our newly defined
topology enables one to pass in '--topo=mytopo' from the command line.
"""
from mininet.topo import Topo... | StarcoderdataPython |
3383719 | #/usr/local/env python
# Problem link: https://oj.leetcode.com/problems/merge-intervals/
# Definition for an interval.
class Interval:
def __init__(self, s=0, e=0):
self.start = s
self.end = e
def __repr__(self):
return "["+str(self.start)+","+str(self.end)+"]"
class Solution:
... | StarcoderdataPython |
189707 | import os, sys
import datetime
import glob
import math
import json
import urllib
from Queue import Queue, PriorityQueue
import sqlite3 as sql
import struct
import threading
from PySide import QtGui, QtCore
from viewer import config
from viewer.ports import ask_for_port
from viewer.sample import *
#from viewer.sampl... | StarcoderdataPython |
1640057 | import logging
from typing import Iterator
from typing import Tuple
from typeguard import check_argument_types
from espnet2.fileio.read_text import read_2column_text
from espnet2.samplers.abs_sampler import AbsSampler
class UnsortedBatchSampler(AbsSampler):
"""BatchSampler with constant batch-size.
Any sor... | StarcoderdataPython |
28013 | <reponame>sudhirrd007/LeetCode-scraper
# ID : 18
# Title : 4Sum
# Difficulty : MEDIUM
# Acceptance_rate : 35.2%
# Runtime : 72 ms
# Memory : 12.7 MB
# Tags : Array , Hash Table , Two Pointers
# Language : python3
# Problem_link : https://leetcode.com/problems/4sum
# Premium : 0
# Notes : -
###
def fourSum(self, nu... | StarcoderdataPython |
3271158 | from typing import List
class Solution:
def expressiveWords(self, S: str, words: List[str]) -> int:
numExtent = 0
(sLetter, sCount) = self.wordToCount(S)
sString = ''.join(sLetter)
for word in words:
(wLetter, wCount) = self.wordToCount(word)
wString = ''.joi... | StarcoderdataPython |
3398774 | from pylab import *
import sys
import pdb
import matplotlib.pyplot as plt
import numpy as np
import pylab
from matplotlib import rc
from pylab import *
rc('text', usetex=True)
rc('font', family='serif')
font = {'family' : 'normal',\
'size' : 18}
matplotlib.rc('font', **font)
print 'Usage : ... | StarcoderdataPython |
50332 | # coding=utf-8
from bluebottle.utils.model_dispatcher import get_donation_model
from bluebottle.utils.serializer_dispatcher import get_serializer_class
from rest_framework import serializers
DONATION_MODEL = get_donation_model()
class ManageDonationSerializer(serializers.ModelSerializer):
project = serializers.S... | StarcoderdataPython |
3285153 | <reponame>Anoop01234/Go-Travel
from django.urls import path
from . import views
app_name='Booking'
urlpatterns=[
path('event/',views.EventBooking,name='event'),
path('table/',views.TableBooking,name='table'),
]
| StarcoderdataPython |
3253528 | <filename>tests/tsa/test_tsa.py
from timemachines.inclusion.statsmodelsinclusion import using_statsmodels
if using_statsmodels:
from timemachines.skaters.tsa.tsaconstant import tsa_p1_d0_q0, tsa_aggressive_ensemble
from timemachines.skaters.tsa.tsahypocratic import tsa_quickly_hypocratic_d0_ensemble
from t... | StarcoderdataPython |
3254988 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'cnheider'
from utilities.curriculum.grid_world import *
from .difficulty import *
| StarcoderdataPython |
192851 | import numpy as np
WALL = '%'
START = 'P'
DOT = '.'
SPACE = ' '
PATHCHAR = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
class MazeSearchNode:
def __init__(self, state, parent=None, cost=0):
self.state = state
self.parent = parent
self.cost = cost
self.ate = No... | StarcoderdataPython |
133802 | #!usr/bin/env python
#-*- coding: utf-8 -*-
import logging
import numpy as np
import sklearn
from sklearn import metrics
from sklearn import neighbors
from sklearn import cross_validation
from sklearn.datasets import load_svmlight_file
from sklearn.cross_validation import cross_val_score
import math
import sys
import ... | StarcoderdataPython |
1619294 | import re
from django import template
from django.template.defaultfilters import stringfilter
tex_re = re.compile(r'([&$#{}%]{1})')
register = template.Library()
@register.filter
@stringfilter
def texify(value):
""" Escape symbols that have meaning to TeX. """
return tex_re.sub(r'\\\1', value)
| StarcoderdataPython |
114121 | from neighbors.knn_classifier import KNNClassifier
from neighbors.knn_regressor import KNNRegressor
| StarcoderdataPython |
193280 | <filename>liBlog/comments/templatetags/licomments.py
# -*- coding:utf-8 -*-
import datetime
from django.conf import settings
from django.db.models import Count
from django import template
from liBlog.blogs.models import Tag
register = template.Library()
@register.filter
def conver_date(value):
if not isinstanc... | StarcoderdataPython |
1697105 | <gh_stars>10-100
"""Module describing the planemo ``shed_serve`` command."""
import click
from planemo import io
from planemo import options
from planemo import shed
from planemo.cli import command_function
from planemo.galaxy import shed_serve
from planemo.galaxy.serve import sleep_for_serve
@click.command("shed_se... | StarcoderdataPython |
4841270 | import itertools, random, time, matplotlib,sys
import matplotlib.pyplot as plt
import dynamic_weights
Num_cities=raw_input('Enter number of cities')
priority = 0
City = complex
"""
You cannot apply the algorithm on a set of random cities and on a graph entred by yousimultaneously. If you choose 'Other set' as the op... | StarcoderdataPython |
11735 | """Genshin chronicle notes."""
import datetime
import typing
import pydantic
from genshin.models.genshin import character
from genshin.models.model import Aliased, APIModel
__all__ = ["Expedition", "ExpeditionCharacter", "Notes"]
def _process_timedelta(time: typing.Union[int, datetime.timedelta, datetime.datetime]... | StarcoderdataPython |
1613315 | # -*- coding: utf-8 -*-
"""Implementation of :class:`biblary.bibliography.storage.AbstractStorage` that stores on the local file system."""
import hashlib
import io
import pathlib
import typing as t
from ..entry import BibliographyEntry
from .abstract import AbstractStorage, FileType
__all__ = ('FileSystemStorage',)
... | StarcoderdataPython |
143992 | #!/bin/python
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import numpy as np
import math
# State vector:
# 0-3: quaternions (q0, q1, q2, q3)
# 4-6: Velocity - m/sec (North, East, Down)
# 7-9: Position - m (North, East, Down)
# 10-12: Delta Angle bias - rad (X,Y,Z)
#... | StarcoderdataPython |
3359787 | <reponame>CloudCray/TigerShark
#!/usr/bin/env python
"""Top-level application programs.
- :mod:`tools.convertPyX12`.
Converts Python :file:`.xml` files to :mod:`X12.parse` structures.
From these structures visitors in :mod:`X12.map` can emit Python source
as well as Django ORM structures.
- :mod:`tool... | StarcoderdataPython |
3318260 | from django.apps import AppConfig
class CurdConfig(AppConfig):
name = 'curd'
| StarcoderdataPython |
3259550 | #!/bin/env python3
import os
import sys
import mmap
import time
import struct
from db_helper import DbHelper
from data_point import DataPoint
def get_atom_info(data):
try:
atom_size, atom_type = struct.unpack(">I4s", data)
except struct.error:
return -1, "(Unpack Error)"
except Exception as e:
print("Error!... | StarcoderdataPython |
3380975 | <filename>tests/chainer_tests/functions_tests/math_tests/test_erf.py
import math
import unittest
import numpy
from chainer import cuda
import chainer.functions as F
from chainer import testing
def _erf_cpu(x, dtype):
return numpy.vectorize(math.erf, otypes=[dtype])(x)
def _erf_gpu(x, dtype):
return cuda.t... | StarcoderdataPython |
156930 | # Generated by Django 2.1.2 on 2019-01-30 16:23
from django.db import migrations, models
import django.db.models.deletion
import mrp_system.models
class Migration(migrations.Migration):
dependencies = [
('mrp_system', '0072_auto_20190130_1515'),
]
operations = [
migrations.CreateModel(
... | StarcoderdataPython |
3227270 | <gh_stars>1-10
import numpy as np
import config_pb2
from google.protobuf import text_format
import h5py
import sys
def ReadDataProto(fname):
data_pb = config_pb2.Data()
with open(fname, 'r') as pbtxt:
text_format.Merge(pbtxt.read(), data_pb)
return data_pb
def ChooseDataHandler(data_pb):
if data_pb.datase... | StarcoderdataPython |
1677439 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# OpenCenter(TM) is Copyright 2013 by Rackspace US, Inc.
##############################################################################
#
# OpenCenter is licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compli... | StarcoderdataPython |
961 | <filename>GPT-distributed.py<gh_stars>100-1000
import argparse
import logging
import torch
import torch.nn.functional as F
import numpy as np
from torch import nn
from torch.autograd import Variable
from transformers import GPT2Config
from transformers import GPT2LMHeadModel, GPT2Tokenizer, BertTokenizer
from DataLoade... | StarcoderdataPython |
3391446 | import math
a, b, c = [int(x) for x in input().split(' ')]
if(c <= b):
print(-1)
else:
print(math.floor(a / (c - b)) + 1) | StarcoderdataPython |
149451 | from django.test import TestCase
from curious.graph import traverse
from curious_tests.models import Blog, Entry, Author
from curious_tests import assertQueryResultsEqual
class TestFunc(TestCase):
def setUp(self):
blog = Blog(name='Databases')
blog.save()
self.blogs = [blog]
authors = ('<NAME>', '<... | StarcoderdataPython |
3287252 | <gh_stars>0
import random
class API:
def __init__(self, config):
self.url = "https://konachan.com/post.json?limit=1&"
self.tags = ["tags=order:random"]
if config.getSearchTags() is not None and len(config.getSearchTags()):
self.tags.append(random.choice(config.getSearchTags()))... | StarcoderdataPython |
1602823 | <reponame>Enderdead/sphinx-action<filename>entrypoint.py
#!/usr/bin/env python3
import os
from sphinx_action import action
# This is the entrypoint called by Github when our action is run. All the
# Github specific setup is done here to make it easy to test the action code
# in isolation.
if __name__ == "__main__":
... | StarcoderdataPython |
1630461 | import pytest
from rethinkdb.errors import ReqlRuntimeError, ReqlOpFailedError
from tests.helpers import IntegrationTestCaseBase, INTEGRATION_TEST_DB
@pytest.mark.integration
class TestTable(IntegrationTestCaseBase):
def setup_method(self):
super(TestTable, self).setup_method()
self.test_table_na... | StarcoderdataPython |
3233853 | # ~$ python3 classify.py model.pickle languages.txt ./wikipedia/
import os
import re
import argparse
import pickle
import random
import nltk
from os import listdir
from tqdm import tqdm
from sklearn.naive_bayes import MultinomialNB
from sklearn.pipeline import Pipeline
from nltk.metrics import ConfusionMatrix
def... | StarcoderdataPython |
1652407 | from test.test_functools import TestPartial, capture
from rdc.dic.definition import dereference
from rdc.dic.reference import _partial
class ReferenceTestCase(TestPartial):
thetype = _partial
def test_reference(self):
p = self.thetype(capture)
self.assertEqual(dereference(self.thetype(p)), (()... | StarcoderdataPython |
1794541 | """
Application module
"""
from app.process_manager import ProcessManager
from app.election import BullyAlgorithm
from app.multiprocessing import ProcessThread
from app.utils import show_time
class Application:
"""
Application Class
"""
def __init__(self) -> None:
self.process_manager = Proce... | StarcoderdataPython |
1714758 | <gh_stars>0
from urllib.parse import urlencode, parse_qsl
from twilio.twiml.voice_response import VoiceResponse
class TwilioNotifier:
def __init__(self, twilio_client, *, call_from, call_to):
self.twilio = twilio_client
self.call_from = call_from
self.call_to = call_to
def notify(se... | StarcoderdataPython |
65716 | <reponame>persianyagami90xs/darwin-py<filename>darwin/client.py
import os
import time
from pathlib import Path
from typing import Dict, Iterator, Optional, Union
import requests
from darwin.config import Config
from darwin.dataset import RemoteDataset
from darwin.dataset.identifier import DatasetIdentifier
from darwi... | StarcoderdataPython |
1610097 | # Copyright (c) 2019 Teradici Corporation
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import shutil
import sys
import urllib.request
import zipfile
TEMP_DIR = '/tmp'
TERRAFORM_VERSION = '0.12.3'
TERRAFORM_BIN_DIR =... | StarcoderdataPython |
1602156 | colors = [["#282c34", "#282c34"], # panel background
["#3d3f4b", "#434758"], # background for current screen tab
["#ffffff", "#ffffff"], # font color for group names
["#ff5555", "#ff5555"], # border line color for current tab
["#74438f", "#74438f"], # border line color for 'other... | StarcoderdataPython |
119508 | import arcade
def test_point_in_rectangle():
polygon = [
(0, 0),
(0, 50),
(50, 50),
(50, 0),
]
result = arcade.is_point_in_polygon(25, 25, polygon)
assert result is True
def test_point_not_in_empty_polygon():
polygon = []
result = arcade.is_point_in_polygon(25... | StarcoderdataPython |
1767936 | import re
SQF_KEYWORDS: set[str] = {"true", "false", "WEST", "EAST", "GUER"}
SQF_BUILTINS : tuple[str]=tuple(sorted({"abs",
"accTime",
"acos",
"action",
"actionIDs",
"actionKeys",
... | StarcoderdataPython |
1719916 | <gh_stars>0
from typing import Optional, Union
import discord
import time
import importlib
import asyncio
import aiohttp
from discord.ext import commands
from fcts import args, checks
importlib.reload(args)
importlib.reload(checks)
from libs.classes import Zbot, MyContext
class Partners(commands.Cog):
def __init_... | StarcoderdataPython |
1653147 | import attr
import json
@attr.s
class HyperParams(object):
# training
train_iters = attr.ib(default=20)
episodes = attr.ib(default=256)
epochs = attr.ib(default=10)
eval_interval = attr.ib(default=1)
reward_decay = attr.ib(default=0.9)
# losses
value_coef = attr.ib(default=1e-3)
e... | StarcoderdataPython |
3206800 | from unittest import TestCase
import numpy as np
import nucleoatac.NucleosomeCalling as Nuc
import pyatac.VMat as V
from pyatac.chunkmat2d import BiasMat2D
from pyatac.chunk import ChunkList
from pyatac.bias import InsertionBiasTrack
class Test_variance(TestCase):
"""class for testing variance calculation on back... | StarcoderdataPython |
145026 |
import analogio
from digitalio import DigitalInOut, Direction
import time
class Battery():
def __init__(self, pin):
self._adc = analogio.AnalogIn(pin)
def voltage(self):
return self._adc.value * 3.3 / 65536.0 * 2.0
class PowerSwitch():
def __init__(self, pin):
self._done = Digita... | StarcoderdataPython |
3200322 | # This program was created in correlation with a computational linguistics class.
# Main emphasis was in using the python package Natural Language Toolkit, found here https://www.nltk.org/
# This program is my introduction to Naive Bayes text classifier.
# The main difference between this program and other Naïve Bay... | StarcoderdataPython |
4836757 | from colors import RGB
from led_driver import LedDriver
from colorsys import hsv_to_rgb
from time import sleep
import collections
from encode import encode_rgb
def generate_rainbow(number):
data = []
h = 0.0
for i in range(number):
r, g, b = hsv_to_rgb(h, 1.0, 0.05)
data.append(RGB(r, g, b... | StarcoderdataPython |
57616 | <reponame>Rakeshpatil01/ReProj<filename>clearance_pricing_mdp.py
from modules.markov_decision_process import (
FiniteMarkovDecisionProcess, FiniteMarkovRewardProcess)
from modules.policy import FiniteDeterministicPolicy, FinitePolicy
from modules.finite_horizon import WithTime
from typing import Sequence, Tuple, It... | StarcoderdataPython |
1729218 | <filename>checkmate/contrib/plugins/golang/gosec/analyzer.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import
from checkmate.lib.analysis.base import BaseAnalyzer
import logging
import os
import tempfile
import json
import pprint
import subprocess
logger = loggi... | StarcoderdataPython |
3256581 | from rest_framework import viewsets
from .models import TemplateBracket
from .serializers import TemplateBracketSerializer
# TemplateBracket ViewSet
# ==================================================
class TemplateBracketViewSet(viewsets.ModelViewSet):
# Properties
# ----------------------------------------... | StarcoderdataPython |
57887 | <reponame>jwbrooks0/johnspythonlibrary2<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 7 10:18:11 2021
@author: jwbrooks
"""
import johnspythonlibrary2 as jpl2
import nrl_code as nrl
import numpy as np
import matplotlib.pyplot as plt
import xarray as xr
import pandas as pd
from time import sleep
import s... | StarcoderdataPython |
105392 | import logging
import math
import time
from typing import Any, Dict, Iterator, Optional, Union
from allennlp.common import Tqdm
from allennlp.common import util as common_util
from allennlp.data.dataloader import TensorDict
from allennlp.nn import util as nn_util
from allennlp.training import Trainer, GradientDescentT... | StarcoderdataPython |
1774845 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import os
import signal
import sys
from PyQt5.QtCore import pyqtSignal, QSettings
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QMainWindow, QAction, QFileDialog
from database import Database
from misc import getSPMTVersion, prin... | StarcoderdataPython |
4826585 | # Copyright 2019 TWO SIGMA OPEN SOURCE, 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 or agre... | StarcoderdataPython |
1622419 | <reponame>davejlin/treehouse<filename>python/python-scripts/unit tests/functions.py
def sum_safe(*args):
try:
return sum(list(args))
except:
return 0 | StarcoderdataPython |
20541 | """
This test module has tests relating to kelvin model validations.
All functions in /calculations/models_kelvin.py are tested here.
The purposes are:
- testing the meniscus shape determination function
- testing the output of the kelvin equations
- testing that the "function getter" is performing as exp... | StarcoderdataPython |
162066 | <gh_stars>1-10
# ------------------------------------------------------------------------------
# Python API to access CodeHawk Java Analyzer analysis results
# Author: <NAME>
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2016-2018 Kestrel Tec... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.