id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1716953 | <gh_stars>0
from django.shortcuts import render,redirect,HttpResponse
from PIL import Image, ImageDraw, ImageFont
import os,csv,json,hashlib,shutil,base64
from datetime import datetime
from .models import csvdata,saveimage,fonts
from django.core.files.base import ContentFile
from django.contrib.auth.forms import UserCr... | StarcoderdataPython |
1614166 | """
This is is a part of the DeepLearning.AI TensorFlow Developer Professional Certificate offered on Coursera.
All copyrights belong to them. I am sharing this work here to showcase the projects I have worked on
Course: Introduction to TensorFlow for Artificial Intelligence, Machine Learning, and Deep Learning
... | StarcoderdataPython |
1668418 | <reponame>scuml/publishstatic
import context
import unittest
from publishstatic,management.commands.publishstatic import handle
class StorageSuite(unittest.TestCase):
def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(StorageSuite))
return suite
if __name__ == "__main__":
... | StarcoderdataPython |
150423 | <gh_stars>0
# -*- coding: utf-8 -*-
"""Example Google style docstrings.
"""
import os
import helper
def alg1(data, print_debug):
return 0
def alg2(data, print_debug):
return 0
def part1(fname: str, print_debug = False):
print("=== PART 1 ===")
print(f"-- {fname} --")
result = 0
result = ... | StarcoderdataPython |
87167 | import logging
from datetime import datetime
from typing import Optional, Mapping, List
import paho.mqtt.client as mqtt
from p2k16.core import P2k16UserException
from p2k16.core import account_management, event_management, badge_management
from p2k16.core.models import db, Account, Circle, Event
logger = logging.getL... | StarcoderdataPython |
3385299 | #!/usr/bin/env python
#coding: utf-8
class Solution:
def _next(self, sn):
i, lsn = 0, len(sn)
nsn = []
while i < lsn:
c = sn[i]
i += 1
pi = i
while i < lsn and c == sn[i]:
i += 1
nsn.extend([str(i - pi + 1), c])
... | StarcoderdataPython |
157483 | from boundlexx.api.common.views import ExportedFileViewSet, GameFileViewSet
from boundlexx.api.routers import APIDocsRouter
from boundlexx.api.v2 import views
API_DESCRIPTION = """
Boundless Lexicon API v2. Everything about the game Boundless.
Disclaimer: Boundlexx is an unoffical API for the game Boundless. There is... | StarcoderdataPython |
1695250 | from copy import deepcopy
class callback(object):
def __init__(self, var_names):
self.store = {v: [] for v in var_names}
def __call__(self, params):
for p in self.store.keys():
if p in params.keys():
self.store[p].append(deepcopy(params[p]))
def __getitem__(se... | StarcoderdataPython |
3325311 | <filename>autogluon/searcher/__init__.py
from .searcher import *
from .skopt_searcher import *
from .rl_controller import *
from .grid_searcher import *
| StarcoderdataPython |
128404 | import pandas as pd
from sklearn.metrics import accuracy_score, recall_score
import models
import qa_experimenters
from interpreters import baseline_interpreter
# disable info logging for datasets
qa_experimenters.datasets.logging.set_verbosity_error()
# load models
model_classif = models.Model_Classification()
mode... | StarcoderdataPython |
3367552 | from functools import reduce
from operator import xor
from typing import Tuple
import advent
SUFFIX = bytes((17, 31, 73, 47, 23))
LOOP_LENGTH = 256
NUM_LOOPS = 64
class Twister:
def __init__(self, lengths, debug, part=1) -> None:
self.lengths = lengths
self.loop_length = LOOP_LENGTH
if d... | StarcoderdataPython |
4822199 | <filename>tests/unit_tests/test_responsebot.py
from unittest.case import TestCase
from tweepy.error import TweepError
from responsebot.common.exceptions import MissingConfigError, APIQuotaError, AuthenticationError
try:
from mock import patch, MagicMock
except ImportError:
from unittest.mock import patch, Ma... | StarcoderdataPython |
3325634 | <gh_stars>0
#!/usr/bin/env python3
#
# Copyright (c) 2021, LabN Consulting, L.L.C.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any la... | StarcoderdataPython |
1750610 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | StarcoderdataPython |
1731340 | <filename>google/ads/google_ads/v3/proto/services/expanded_landing_page_view_service_pb2_grpc.py
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.ads.google_ads.v3.proto.resources import expanded_landing_page_view_pb2 as google_dot_ads_dot_googleads__v3_dot_proto_dot_resour... | StarcoderdataPython |
1758036 | <filename>tests/test_http.py<gh_stars>1-10
# import pytest
# import requests
# from pizdyuk.pzd_http import PizdyukServer, PizdyukRequestHandler
# url = "http://localhost:8080"
# def test_server(mocker):
# server = start_and_get_server()
# assert server.is_running
# assert server.server_address == "local... | StarcoderdataPython |
4840976 | <gh_stars>1-10
__author__ = '<NAME> (<EMAIL>)'
import re
import copy
import json
from wtforms.validators import Length, NumberRange, Email, EqualTo, IPAddress, \
Regexp, URL, AnyOf, Optional, InputRequired, MacAddress, UUID, NoneOf
try:
from wtforms.validators import DataRequired
except ImportError:
# wtf... | StarcoderdataPython |
1618302 | <reponame>iliadmitriev/taskcamp<gh_stars>1-10
# Generated by Django 3.1.7 on 2021-03-21 08:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0006_auto_20210321_0828'),
]
operations = [
migrations.AlterField(
mod... | StarcoderdataPython |
3364390 | import os
import argparse
import random
import time
def make_directory(dirpath):
os.makedirs(dirpath,exist_ok=True)
def train_argparser():
parser = argparse.ArgumentParser()
parser.add_argument("-o", "--odir", type=str, default=None, help="output directory")
parser.add_argument("-d", "--debug", action... | StarcoderdataPython |
115729 | #!/usr/bin/env python3
"""
Created on Mon Jan 29 06:47:58 2018
@author: Swathi
"""
'''
Create a program that will play the “cows and bulls” game with the user. The game works like this:
Randomly generate a 4-digit number. Ask the user to guess a 4-digit number. For every digit that the user guessed correctly in the
... | StarcoderdataPython |
4840730 | <reponame>VMQA/python_training<gh_stars>0
# -*- coding: utf-8 -*-
import pytest
from contact import Contact
from application import Application
@pytest.fixture
def app(request):
fixture = Application()
request.addfinalizer(fixture.destroy)
return fixture
def test_add_contact(app):
app.login(username... | StarcoderdataPython |
1724470 | <gh_stars>10-100
from copy import deepcopy
from causallearn.graph.Edge import Edge
from causallearn.graph.Endpoint import Endpoint
def meek(cg, background_knowledge=None):
'''
Run Meek rules
Parameters
----------
cg : a CausalGraph object. Where cg.G.graph[j,i]=1 and cg.G.graph[i,j]=-1 indicates... | StarcoderdataPython |
1701721 | from sys import maxsize
class Contact:
def __init__(self, firstname=None, lastname=None, nickname=None, title=None, company=None, address=None,
home=None, mobile=None, work=None, fax=None, email=None, email2=None, email3=None, phone2=None, bday=None, bmonth=None, byear=None,
id=No... | StarcoderdataPython |
3258075 | import sys
import pygame
from operator import sub
from matplotlib.pyplot import text
import pandas as pd
import random
import numpy as np
import math
import color as c
import axis as ax
import palletts as p
import graph_props as m
def round_dig(num, base=5, dig=1):
num = float(num)
num = num / (math.pow(base,... | StarcoderdataPython |
3256064 | <reponame>DHI-GRAS/atmcorr<filename>atmcorr/metadata/landsat8.py
import satmeta.l8.meta as l8meta
def get_date(mtdFile):
with open(mtdFile) as fin:
metadata = l8meta.parse_metadata(fin)
return metadata['sensing_time']
| StarcoderdataPython |
3206411 | #!/usr/bin/env python3
import unicodedata
combining = set()
col_widths = [7, 54, 20]
rows = [['MacRom', 'UTF-8 NFC', 'UTF-8 NFD']]
for i in range(256):
rows.append(['[%02X]' % i])
for form in ('NFC', 'NFD'):
unistr = bytes([i]).decode('mac_roman')
unistr = unicodedata.normalize(form, unistr)
... | StarcoderdataPython |
3231549 | import os
from typing import Optional, Dict
import codecs
import logging
import _easyice
from enum import IntEnum
logger = logging.getLogger(__name__)
def process_ts(*, filename: str) -> Optional[Dict[str, str]]:
""" analyze the ts file and return a dict of json str
{
"ffprobe":"",
"mediainfo... | StarcoderdataPython |
88934 | import os
from pyfakefs.fake_filesystem_unittest import TestCase
from starwhale.utils import config as sw_config
from starwhale.utils.error import NotFoundError
from starwhale.utils.config import (
SWCliConfigMixed,
load_swcli_config,
get_swcli_config_path,
)
from .. import get_predefined_config_yaml
_e... | StarcoderdataPython |
3379666 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017, Data61
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# ABN 41 687 119 230.
#
# This software may be distributed and modified according to the terms of
# the BSD 2-Clause license. Note that NO WARRANTY is provided.
# ... | StarcoderdataPython |
3275365 | <gh_stars>0
import networkx as nx
import numpy as np
from numpy import log, exp
import scipy as sp
import pymc
from scipy import stats
import emcee
import random
import matplotlib as mpl
import matplotlib.pyplot as plt
from itertools import product
from sklearn.metrics import mutual_info_score
from scipy.stats import g... | StarcoderdataPython |
1687153 | <filename>dali/test/python/test_operator_readers_index.py
# Copyright (c) 2021, NVIDIA CORPORATION. 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.apa... | StarcoderdataPython |
1725673 | import json
import unittest
import player
TWO_PAIR_HAND = [
{
"rank": "A",
"suit": "hearts"
},
{
"rank": "A",
"suit": "spades"
},
{
"rank": "8",
"suit": "hearts"
},
{
"rank": "8",
"suit": "spades"
},
{
"rank": ... | StarcoderdataPython |
1764908 | <reponame>nomike/spambayes
# Test sb_imapfilter script.
import re
import sys
import time
import email
import types
import socket
import threading
import imaplib
import unittest
import asyncore
import StringIO
try:
IMAPError = imaplib.error
except AttributeError:
IMAPError = imaplib.IMAP4.error
import sb_test... | StarcoderdataPython |
1669154 | <filename>src/consumer.py
import abc
import logging
import pika
LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(name) -30s %(funcName) '
'-35s %(lineno) -5d: %(message)s')
LOGGER = logging.getLogger(__name__)
class Consumer(metaclass=abc.ABCMeta):
"""
An abstract consumer class that p... | StarcoderdataPython |
1769800 | <reponame>lstmemery/qlearning
from collections import deque
import gym
from keras.models import Sequential
from keras.layers import Convolution2D, Dense, Activation
import numpy as np
import random
import tensorflow as tf
# I worked through this tutorial https://keon.io/deep-q-learning/
# That tutorial is not asynchr... | StarcoderdataPython |
1738049 |
import sys
sys.path.append("C:\\Users\\Admin\\Desktop\\YaoNLP")
from data_helper import load_ctb
def make_vocab(data_path: str, vocab_file: str) -> None:
word_vocab:dict = {} # <pad>, <root>, <unk> = 0, 1, 2
tag_vocab:dict = {}
head_vocab:dict = {}
rel_vocab:dict = {}
for sentence in load_ctb(... | StarcoderdataPython |
3239248 | <reponame>KarthickNamakkalKrishnan/eloquent<filename>eloquent/dbal/platforms/postgres_platform.py
# -*- coding: utf-8 -*-
from .platform import Platform
from ..table import Table
from ..column import Column
class PostgresPlatform(Platform):
INTERNAL_TYPE_MAPPING = {
'smallint': 'smallint',
'int2... | StarcoderdataPython |
3216985 | <reponame>zengchen1024/mindarmour
"""
This module includes detector methods on distinguishing adversarial examples
from benign examples.
"""
from .mag_net import ErrorBasedDetector
from .mag_net import DivergenceBasedDetector
from .ensemble_detector import EnsembleDetector
from .region_based_detector import RegionBased... | StarcoderdataPython |
1757532 | from im2mesh.encoder import (
conv, pix2mesh_cond, pointnet,
psgn_cond, r2n2, voxels, graphs, pointnet2,
deepsets, transformer, kpconv, perceiver
)
encoder_dict = {
'simple_conv': conv.ConvEncoder,
'resnet18': conv.Resnet18,
'resnet34': conv.Resnet34,
'resnet50': conv.Resnet50,
'resnet... | StarcoderdataPython |
3261963 | <filename>dhcs/dhcs/settings.py<gh_stars>0
# //=======================================================================
# // Copyright Projectile, IIIT Delhi 2017.
# // Distributed under the MIT License.
# // (See accompanying file LICENSE or copy at
# // http://opensource.org/licenses/MIT)
# //========================... | StarcoderdataPython |
1739546 | <filename>code/auth.py<gh_stars>10-100
from eve.auth import BasicAuth
class MyBasicAuth(BasicAuth):
""" Custom authentication logic is provided by a subclass of
eve.auth.BasicAuth
"""
def check_auth(self, username, password, allowed_roles, resource, method):
""" Override the base check_outh met... | StarcoderdataPython |
191607 | <gh_stars>0
from sqlalchemy import MetaData
from sqlalchemy_schemadisplay import create_schema_graph
# create the pydot graph object by autoloading all tables via a bound metadata object
graph = create_schema_graph(metadata=MetaData('sqlite:////tmp/Rainet/rainet.db.sqlite'),
show_datatypes=False, # The image would ... | StarcoderdataPython |
3362365 | from . import ScribeModuleBaseClass
from . lib.util import format_url
class Cpu_vulnerabilities(ScribeModuleBaseClass):
def __init__(self, input_dict=None, module_name=None, host_name=None,
input_type=None, scribe_uuid=None):
ScribeModuleBaseClass.__init__(self, module_name=module_name,
... | StarcoderdataPython |
1654095 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'test_dialog_ui.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.se... | StarcoderdataPython |
3248310 | <filename>app/worker.py
# This will fetch jobs from a queue (as many as concurrency is set),
# mark them as processing and update them with a result
# A worker will run as a daemon and does not exit
| StarcoderdataPython |
22938 | """Module controling search and replace tab."""
import logging
from wiki_music.constants import GUI_HEADERS
from wiki_music.gui_lib import BaseGui, CheckableListModel
from wiki_music.gui_lib.qt_importer import QMessageBox, QPushButton, QIcon, QStyle
__all__ = ["Replacer"]
log = logging.getLogger(__name__)
log.debug(... | StarcoderdataPython |
116037 | <reponame>Lesleis-Nagy/m4db-database<filename>alembic/versions/07a8b226f9c5_add_unique_constraint_to_physical_.py
"""add unique constraint to physical_constant table
Revision ID: <KEY>
Revises: e2ff5bce75e7
Create Date: 2021-10-28 10:41:16.942669
"""
from alembic import op
import sqlalchemy as sa
# revision identif... | StarcoderdataPython |
93371 | #!/usr/bin/env python
# Needed to set seed for random generators for making reproducible experiments
from numpy.random import seed
seed(1)
from tensorflow import set_random_seed
set_random_seed(1)
import numpy as np
import tifffile as tiff
import os
import random
import shutil
from PIL import Image
from ..utils impor... | StarcoderdataPython |
1734683 | """JSPEC Testing Module for matching JSPEC documents for
``JSPECTestMatcherMacro``.
"""
import os
from test.matcher import JSPECTestMatcher
os.environ["TEST_OBJECT"] = '{"hello": "world"}'
os.environ["TEST_ARRAY"] = '["hello", "world", 123]'
os.environ["TEST_STRING"] = '"Hello World!"'
os.environ["TEST_INT"] = '456'... | StarcoderdataPython |
122666 | from email.mime import image
from app.extract_vector import search
import io
import base64
import time
from PIL import Image
def get_similar(image_endcoded, dataset):
msg = base64.b64decode(image_endcoded)
buf = io.BytesIO(msg)
img = Image.open(buf)
begin = time.time()
result = search(img, 50, dat... | StarcoderdataPython |
3220681 | from nltk import word_tokenize, download, PorterStemmer
from nltk.corpus import stopwords
from wordsegment import load, segment
download('punkt')
download('wordnet')
download('stopwords')
stop_words = set(stopwords.words('english'))
other_stop_words = [",", "?", "-", "_", ";", "\"", "—", "\\n", "==", "0", "1", "2", "3... | StarcoderdataPython |
3246521 | """ This module modifies the date and the time so that alarms can be schedualed
and so that alarms and notifications titles can print the current time"""
import time
def current_time():
""" This functions returns a string with the current date and time """
day = str(time.localtime().tm_mday)
month = str... | StarcoderdataPython |
31797 | #! /usr/bin/env -S python3 -u
import os, shutil, sys, glob, traceback
from easyterm import *
help_msg="""This program downloads one specific NCBI assembly, executes certains operations, then cleans up data
### Input/Output:
-a genome NCBI accession
-o folder to download to
### Actions:
-c bash command ... | StarcoderdataPython |
1677650 | <gh_stars>1-10
import contextlib
import os
import textwrap
import unittest
from git import Repo
from conda_gitenv import resolve, tag_dates, label_tag, deploy
from conda_gitenv.tests.integration.setup_samples import (create_repo, add_env,
update_env)
class Te... | StarcoderdataPython |
3362167 | import Fibonacci_Sequence as fibonacci
assert len(fibonacci.fibonacci(20)) == 19
assert fibonacci.fibonacci(5) == [1,1,2,3]
a = fibonacci.fibonacci(20)
assert a[18] == a[17] + a[16]
| StarcoderdataPython |
109928 | <reponame>FinMacDov/AMR_code<filename>mhd/python/old/test_reader.py
# -*- coding: utf-8 -*-
"""
Created on Wed May 9 13:12:34 2018
@author: fionnlagh
"""
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import os
def listdir_fullpath(d):
return [os.path.join(d, f) for f in os.lis... | StarcoderdataPython |
1734305 | <reponame>Lain-progressivehouse/atCoder
def bellman_ford(edges, num_v, start, end):
"""
ベルマンフォード法
:param edges: (from, to, cost)のリスト
:param num_v: 頂点の数
:param start: 始点
:param end: 終点
:return: 最小コスト
"""
inf = float("inf")
dist = [inf] * num_v
dist[start - 1] = 0
ans = -1
... | StarcoderdataPython |
3342084 | <reponame>icr-ctl/dencam
import socket
import subprocess
import netifaces as ni
def get_network_info():
interfaces = ni.interfaces()
text = (socket.gethostname() + '\n')
for interface in interfaces:
try:
ip = ni.ifaddresses(interface)[ni.AF_INET][0]['addr']
except KeyError:
... | StarcoderdataPython |
1690951 | # Copyright 2020 Zadara Storage, Inc.
# Originally authored by <NAME> - https://github.com/jwbrown77
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at:
#
# http://www.apache.org/licenses/LICEN... | StarcoderdataPython |
3270753 | #!/bin/python3/
import discord
| StarcoderdataPython |
1604919 | from .ctm_to_textgrid import *
from .textgrid_to_elan import *
from .raw_to_elan import *
| StarcoderdataPython |
1622795 | #!/bin/ipython
# ---LICENSE-BEGIN - DO NOT CHANGE OR MOVE THIS HEADER
# This file is part of the Neurorobotics Platform software
# Copyright (C) 2014,2015,2016,2017 Human Brain Project
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as p... | StarcoderdataPython |
3381603 | <gh_stars>1-10
# -*- coding:utf-8 -*-
class PageBarHelper(object):
@classmethod
def get_page_bar(cls, pageIndex, pageCount):
"""
:param pageIndex: 当前页
:param pageCount: 总页数
:return:
"""
if pageCount == 1:
return ""
start = pageIndex - 5 # 计算起... | StarcoderdataPython |
3312146 | <gh_stars>10-100
"""
Copyright (c) 2018 <NAME>. All Rights Reserved.
https://blog.quarkslab.com/author/gwaby.html
"""
from win32api import (
GetCurrentProcess,
RegOpenKeyEx,
RegEnumValue,
RegQueryValueEx,
RegCloseKey
)
from win32con import (
TOKEN_ALL_ACCESS,
HKEY_LOCAL_MACHINE,
... | StarcoderdataPython |
19502 | <gh_stars>1-10
import json
import time
from glob import glob
from pathlib import Path
from adet.data.video_data.util import *
from PIL import Image, ImageFont, ImageDraw
import os
import random
categories = ['airplane', 'ape', 'bear', 'bike', 'bird', 'boat', 'bucket', 'bus', 'camel', 'cat',
'... | StarcoderdataPython |
1656110 | # -*- coding: utf-8 -*-
#############################################################################
# SRWLIB Example View Data File: View data stored in a file
# v 0.01
#############################################################################
from __future__ import print_function #Python 2.7 compatibility
from u... | StarcoderdataPython |
190611 | <gh_stars>10-100
from .exu import ExU
from .relu import LinReLU
| StarcoderdataPython |
3325608 | #!/usr/bin/env python3
from setuptools import setup, find_packages
setup(
name="coffeeconnection",
version="0.2.0",
packages=find_packages(),
install_requires=["appdirs", "requests"],
entry_points={
"console_scripts": ["coffeeconnection = coffeeconnection.coffeeconnection:main"]
},
... | StarcoderdataPython |
55243 | import datetime
import glob
import os.path
import tensorflow as tf
def make_summary_writer(exp_name="AIRL", graph=None):
summary_base = os.path.join("output/", exp_name, "summary/")
today_str = datetime.datetime.today().strftime('%Y-%m-%d')
dir_list = glob.glob(os.path.join(summary_base, today_str + "*/"))
... | StarcoderdataPython |
37950 | """
<NAME>
<NAME>
<NAME>
<NAME>
CISC 204
Modelling project
Wed december 9th 2020
Professor Muise
"""
#Import
from nnf import Var
from nnf import Or
import nnf
from lib204 import Encoding
from csvReader import readCSV
'''
Customer class
Used to create a class containing the various restrictions a
person might have ... | StarcoderdataPython |
3393442 | <gh_stars>1-10
from directors import (get_movies_by_director, get_average_scores,
_calc_mean, print_results, main)
def test_get_movies_by_director():
pass
def test_get_average_scores():
pass
def test_calc_mean():
pass
def test_print_results():
pass
def test_main():
p... | StarcoderdataPython |
3208222 | from app import app, db
from app.models import Commander, RecsText
@app.shell_context_processor
def make_shell_context():
return {'db': db, 'Commander': Commander, 'RecsText': RecsText} | StarcoderdataPython |
1651449 | from django.test import TestCase
# Create your tests here. django 测试
| StarcoderdataPython |
1651495 | # Replace header inoriginal file header with header in header file, writing output to outputfile
# Larz60+
# from pathlib import Path
import os
import sys
import argparse
class SwapHeaders:
def __init__(self, origfile=None, headerfile=None, outfile=None):
# Note Modern pathlib objects removed because they... | StarcoderdataPython |
159704 | from .defaults import CenterTrainer | StarcoderdataPython |
138368 | <gh_stars>10-100
import multiprocessing
import signal
from signal import SIGINT, SIG_IGN
from queue import Empty as EmptyQueue
import sys
import tqdm
from functools import partial
import logging
from .logger import setup_logger_child_process
logger = logging.getLogger(__name__)
class MultiProcessTqdm(object):
def... | StarcoderdataPython |
1690211 | import argparse
import copy
import gym
import torch as th
from stable_baselines3 import TD3, SAC, CQL, MIN, BCQ, BEAR, SACAUBCQ, UWAC, TQC
from stable_baselines3.common.evaluation import evaluate_policy
def get_algorithm(name: str):
if name == "td3" or name == "TD3":
return TD3
elif name == "sac" or... | StarcoderdataPython |
127921 | <filename>features/basis_functions.py<gh_stars>1-10
import numpy as np
from math import factorial
from itertools import combinations_with_replacement
from functools import reduce
def polynomial_basis(X, degree):
"""
Calculates a polynomial function of the input X
with the specified degree. For datasets of ... | StarcoderdataPython |
1607996 | <filename>message.py
user = "Admin"
action = "Очистка"
log_message = '{} зашел на сайт и выполнил действие: {}'.format(user, action)
print(log_message) | StarcoderdataPython |
3352410 | <reponame>mrocklin/napari
from .utils import create_vispy_visual
from .vispy_axes_visual import VispyAxesVisual
| StarcoderdataPython |
3246158 | """Recreates datasets with current data downloaded from ChEMBL"""
import xlwt
import pandas as pd
from modSAR.datasource import ChEMBLApiDataSource
from modSAR.network_algorithms import ModSAR
CHEMBL_DATASETS = ['CHEMBL245', 'CHEMBL2363', 'CHEMBL202', 'CHEMBL4777', 'CHEMBL4018']
for dataset in CHEMBL_DATASETS:
... | StarcoderdataPython |
175437 | <reponame>XufengXufengXufeng/Kashgari
# encoding: utf-8
"""
@author: BrikerMan
@contact: <EMAIL>
@blog: https://eliyar.biz
@version: 1.0
@license: Apache Licence
@file: crf_accuracies.py.py
@time: 2019-01-23 17:10
"""
from keras import backend as K
"""
from https://github.com/keras-team/keras-contrib
"""
def _get_... | StarcoderdataPython |
3206554 | from boto3 import client
from json import dumps
from os import environ
'''
Coding notes:
1) If the source language is the same target language, a JSON is also stored
using the original transcription text.
2) AWS translate_text() allows 5000 bytes per request, so original
transcription must be split in case its... | StarcoderdataPython |
1789434 | <reponame>Amourspirit/ooo_uno_tmpl
# 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-... | StarcoderdataPython |
1790024 | <reponame>fingafrog/python-dat
import requests
class Dat:
login_url = 'https://rateview.dat.com/api/session/login'
locations_url = 'https://rateview.dat.com/api/location/suggestions'
historicals_url = 'https://rateview.dat.com/api/search/getRateSearch'
rate_market = 'Spot'
rate_type = 'PerTrip'
cl... | StarcoderdataPython |
27803 | <gh_stars>100-1000
a = str(input())
b = {'0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0}
for i in a:
b[i] = b[i] + 1
for i in range(len(b)):
if b[str(i)] == 0:
continue
print(str(i) + ':' + str(b[str(i)]))
| StarcoderdataPython |
121069 | #!/usr/bin/env python3
"""
Build a package to be installed by opkg for use with CVRA package management.
See https://raymii.org/s/tutorials/Building_IPK_packages_by_hand.html for
reference.
"""
import argparse
import tempfile
import subprocess
import os
import shutil
import contextlib
import logging
logger = logging... | StarcoderdataPython |
191959 | <reponame>ASC8384/-<filename>SmallTool/DataMining/zhihu/save_answer_all_images.py
'''
@Copyright Human
@Author ASC_8384
@Mail <EMAIL>
@Website http://ASC8384.top
@FileName save_answer_all_images.py
@Description 保存知乎某个问题下所有未折叠答案的图片
@HomepageURL https://github.com/ASC8384/MyCodeSnippets
@License CC0
@... | StarcoderdataPython |
1687110 | <filename>src/changeset/html.py<gh_stars>1-10
# -*- mode: python; encoding: utf-8 -*-
#
# Copyright 2012 <NAME>, Opera Software ASA
#
# 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... | StarcoderdataPython |
151818 | from pydantic import BaseSettings
class Config(BaseSettings):
bot_id: str
bot_guild_id: str
class Config:
extra = "ignore"
| StarcoderdataPython |
112 | <filename>tests/test_process.py
import pytest
from utils.process import run, silent_run, RunError
from utils.fs import in_temp_dir
def test_run(capsys):
with in_temp_dir():
assert run('echo hello > hello.txt; echo world >> hello.txt', shell=True)
out = run('ls', return_output=True)
asser... | StarcoderdataPython |
3316111 | <filename>tests/test_rdfox_api.py
# -*- coding: utf-8 -*-
import pytest
from pathlib import Path
from io import StringIO
from rdflib import Namespace, Literal, URIRef
from rdflib.namespace import RDF, FOAF
import requests
from rdfox_runner.run_rdfox import RDFoxRunner
from rdfox_runner.rdfox_endpoint import ParsingE... | StarcoderdataPython |
3295043 | from os.path import join
from pprint import pformat
variants = ['classique', 'moderne', 'reforme1990', 'toutesvariantes']
header = '''"""
Ligature dictionary
"""
'''
class Word(object):
def __init__(self, wordline):
self._line = wordline # for debugging
if "/" in wordline:
self.wor... | StarcoderdataPython |
1729625 | from random import randint
class Die():
""" a class that represents a single dice """
def __init__(self, num_sides=6):
self.num_sides = num_sides
def roll(self):
""" show a random value of sides """
return randint(1, self.num_sides)
| StarcoderdataPython |
184212 | ###################################################################################
#
# Copyright (C) 2017 MuK IT GmbH
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, eithe... | StarcoderdataPython |
83624 | import logging
import subprocess
import uuid
import boto3
import os
import json
import sys
import math
import PIL.Image as Image
from botocore.exceptions import ClientError
s3 = boto3.client('s3')
rek = boto3.client('rekognition')
sqs = boto3.client('sqs')
dynamoDBTableName = "metaData"
dynamodb = boto3.resource("dy... | StarcoderdataPython |
11463 | from settings import VAR_DIR
CACHE=VAR_DIR/'cache'
| StarcoderdataPython |
70950 | <reponame>BenAAndrew/VolumeController
import os
import serial
import imageio
import time
serial = serial.Serial("COM3", 9600, timeout=1)
time.sleep(5)
def is_done():
return serial.read() == b'd'
def send_icon(icon_path):
image = imageio.imread(icon_path)
for row in image:
serial.write(bytes(row))... | StarcoderdataPython |
3388773 | # coding: utf-8
"""
LOCKSS Configuration Service REST API
API of the LOCKSS Configuration REST Service # noqa: E501
OpenAPI spec version: 1.0.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class Config... | StarcoderdataPython |
1712235 | import socket
import sys
# it should be in .env
ip = 'localhost'
port = 10000
# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Connect the socket to the port where the server is listening
server_address = (ip, port)
print('CLIENT>connecting to {} port {}'.format(*server_address))
s... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.