id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
11373 | <gh_stars>0
########################################################################
# import default libraries
########################################################################
import os
import csv
import sys
import gc
########################################################################
########... | StarcoderdataPython |
87869 | <reponame>paul90317/minecraft-craft
import json
import os
path=os.path.join(r"mcpath","launcher_accounts.json")
with open(path,'r') as f:
data=json.load(f)
for acc in data['accounts']:
data['accounts'][acc]['minecraftProfile']['name']='yourname'
with open(path,'w') as f:
json.dump(data,f) | StarcoderdataPython |
3298823 | from distutils.util import strtobool
from random import shuffle, randint
from math import floor
from enum import Enum
from time import time
DEBUG = False
class Card:
"""A class containing the value and suit for each card"""
def __init__(self, value, suit):
self.value = value
self.suit = suit
... | StarcoderdataPython |
3389361 | class Transaction():
def __init__(self, txid, fee, weight, parents, ancesCnt=-1):
"""Object that is used to store a transaction
Args:
txid (str): hash of a transaction
fee (int): miners fee (i.e, the fee that a miner gets for including this transaction in their block)
... | StarcoderdataPython |
30892 | import pytest
from checkout_sdk.events.events import RetrieveEventsRequest
from checkout_sdk.events.events_client import EventsClient
@pytest.fixture(scope='class')
def client(mock_sdk_configuration, mock_api_client):
return EventsClient(api_client=mock_api_client, configuration=mock_sdk_configuration)
class T... | StarcoderdataPython |
122347 | <reponame>random-weights/Tensorflow-Project-Template
import json
from bunch import Bunch
import os
def write_to_json(exp_name, epochs, iter_per_epoch, batch_size, learning_rate):
"""
Makes sense to store each config file inside the experiments/exp_name dir.
That way all the data regarding an experiment is in one d... | StarcoderdataPython |
3225666 | try:
from . import _levenshtein
from ._levenshtein import *
except ImportError:
_levenshtein = None
else:
__doc__ = _levenshtein.__doc__
__version__ = "0.13.1"
__author__ = "<NAME>"
| StarcoderdataPython |
3229793 | <gh_stars>1-10
import logging
from homeassistant.components.binary_sensor import BinarySensorEntity
from . import DingzCoordinator, DingzEntity
from .api import State
from .const import DOMAIN
logger = logging.getLogger(__name__)
async def async_setup_entry(hass, entry, async_add_entities):
c: DingzCoordinator... | StarcoderdataPython |
1705545 | #!/usr/bin/python
import numpy as np
import wxmplot.interactive as wi
x = np.arange(0.0,10.0,0.1)
y = np.sin(2*x)/(x+2)
win1 = wi.plot(x, y, title='Window 1', xlabel='X (mm)', win=1)
win2 = wi.plot(x, np.cos(x-4), title='Window 2', xlabel='X (mm)', win=2)
pos = win2.GetPosition()
siz = win1.GetSize()
win2.SetPositi... | StarcoderdataPython |
1723873 | <reponame>asb/opentitan
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
"""
Generate Rust constants from validated register JSON tree
"""
import io
import logging as log
import sys
import textwrap
import warnings
from ty... | StarcoderdataPython |
1766999 | # coding: utf-8
import pytz
from dateutil.relativedelta import relativedelta
from calendar import monthrange
from .tools import yearrange
from .dow import DATEUTIL_DOWS,DOWS
class BaseSnap(object):
def __init__(self,timezone):
self.timezone = timezone
def _localized_datetime(self,datetime):
... | StarcoderdataPython |
116368 | <reponame>opennode/waldur-rijkscloud<filename>src/waldur_rijkscloud/views.py
from __future__ import unicode_literals
from waldur_core.structure import views as structure_views
from . import filters, executors, models, serializers
class ServiceViewSet(structure_views.BaseServiceViewSet):
queryset = models.Rijksc... | StarcoderdataPython |
1785350 | #!/usr/bin/env python
# Python 2.7.14
import argparse
import os
import pandas
import numpy
import matplotlib.pyplot
import matplotlib.dates
import datetime
fig_dir = 'fig'
table_dir = 'table'
class Pointing:
def __init__(self, data_path):
self.file_base, _ = os.path.splitext(os.path.basename(data_path))... | StarcoderdataPython |
189850 | <filename>setup.py
import setuptools
# read the contents of the README file
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setuptools.setup(
name='metcli',
version='0.1.1',
... | StarcoderdataPython |
1714454 | <filename>chat/face_detect.py
from __future__ import print_function
from google.cloud import vision
uri_base = 'gs://cloud-vision-codelab'
pics = ('face_surprise.jpg', 'face_no_surprise.png')
client = vision.ImageAnnotatorClient()
image = vision.Image()
for pic in pics:
image.source.image_uri = '%s/%s' % (uri_ba... | StarcoderdataPython |
3374448 | #!/usr/bin/python
#### Copyright (c) 2015, swpm, <NAME>
#### All rights reserved.
#### See the accompanying LICENSE file for terms of use
from SwpmGraph import GraphWorldLoader
import kivy
kivy.require("1.9.1")
from kivy.app import App
from kivy.uix.scatterlayout import ScatterLayout
from kivy.uix.relativelayout ... | StarcoderdataPython |
170245 | <filename>source/dicom/test/run_tests.py
# run_tests.py
"""Call all the unit test files in the test directory starting with 'test'"""
# Copyright (c) 2008-2012 <NAME>
# This file is part of pydicom, released under a modified MIT license.
# See the file license.txt included with this distribution, also
# available... | StarcoderdataPython |
4820215 | """ Utility for cating files. """
from fishnet.cmds.base import UnixCommand
from fishnet.config import config
def cat_local_op(channel, shell_glob):
""" Perform a cat on the local machine. """
import glob
import subprocess
filenames = list(glob.glob(shell_glob))
p = subprocess.Popen(
["/... | StarcoderdataPython |
1777509 | <filename>src/plotFunctions.py
import matplotlib.pyplot as plt
import constants
import numpy as np
from statistics import mean
from scipy.signal import savgol_filter
def plotNodeCharacteristics(nodeList):
FKs, BKs, mks= [], [], [];
index = np.array(range(constants.NODES))
for node in nodeList:... | StarcoderdataPython |
134439 | from unittest import TestCase
from haleasy import HALEasy
import responses
class TestHaleasyHaltalk(TestCase):
haltalk_root = '''{
"_links": {
"self": {
"href":"/"
},
"curies": [
{
"name": "ht",
"hr... | StarcoderdataPython |
3370936 | <reponame>Mr-TelegramBot/python-tdlib
from ..factory import Type
class richTextUrl(Type):
text = None # type: "RichText"
url = None # type: "string"
| StarcoderdataPython |
93373 | <reponame>image72/browserscope
#!/usr/bin/python2.4
#
# Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the 'License')
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | StarcoderdataPython |
20942 | <reponame>willogy-team/insights--tensorflow<gh_stars>0
import os
import argparse
import numpy as np
import tensorflow as tf
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.models import Model
from tensorflow.keras.preprocessing.image import load_img, img_to_array
import matplotlib.pyplot as plt
fro... | StarcoderdataPython |
3205202 | <filename>dilated_encoder.py
import tensorflow as tf
import numpy as np
from layers import *
from BN_layers import *
class Dilated_Block(object):
def __init__(self, prefix, is_training, filter_width, conv_in_channels, conv_out_channels, skip_channels, dilation, clust_size = None, use_skip = True):
self.use_dense =... | StarcoderdataPython |
185068 | # Generated by Django 2.1.3 on 2018-12-04 13:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('openbook_follows', '0007_remove_follow_list'),
('openbook_lists', '0002_auto_20181023_1331'),
]
operations = [
migrations.AddField(
... | StarcoderdataPython |
1707056 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Standard Python imports
#
import sys
import platform
import os
import json
import pprint
import argparse
import datetime
# Use local Python modules if requested
#
if "--local" in sys.argv:
if platform.system() == "Windows":
sys.path.insert(0, "D:\\keep\\pack... | StarcoderdataPython |
1676134 | <gh_stars>1-10
from flask import Flask
from werkzeug.utils import import_string
from utils import mysql
from flask_cors import *
# import utils.mysql as mysql
blueprints = [
'src.veiws.classRoom:classRoom',
'src.veiws.user:user',
'src.veiws.class:my_class',
'src.veiws.sc:sc',
'src.veiws.course:co... | StarcoderdataPython |
3318323 | <filename>predict.py
import tensorflow as tf
from model.create_model import get_model
from datetime import datetime
import pandas as pd
import numpy as np
import sys
import pickle
import math
from model.data_preprocessor import generate_lstm_data
from helpers.settings import *
from model.config import HISTORY_SIZE, RO... | StarcoderdataPython |
3273510 | <gh_stars>0
from django.urls import path
from wallet.views import WalletDetail
from wallet.views import WalletList
from wallet.views import WalletUpdate
urlpatterns = [
path("", WalletList.as_view(), name="wallet_list"),
path("<pk>", WalletDetail.as_view(), name="wallet_detail"),
path("<pk>/update", Walle... | StarcoderdataPython |
3277435 | import logging
LOG = logging.getLogger(__name__)
class TargetBase(object):
TARGET_TYPE = "base"
def __init__(self, target):
self._target = target
def log(self, msg):
LOG.info(msg)
@property
def workspace(self):
raise NotImplementedError()
def prepare(self):
... | StarcoderdataPython |
3373056 | <filename>Cura/Uranium/UM/OutputDevice/OutputDevicePlugin.py
# Copyright (c) 2019 <NAME>.
# Uranium is released under the terms of the LGPLv3 or higher.
from typing import Optional, Callable
from UM.OutputDevice.OutputDeviceManager import ManualDeviceAdditionAttempt
from UM.PluginObject import PluginObject
from UM.Ap... | StarcoderdataPython |
1752737 | from __future__ import print_function
import json
import os
try:
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
Signal = pyqtSignal
except ImportError:
from PySide2.QtWidgets import *
from PySide2.QtGui import *
from PySide2.QtCore import *
import hou
... | StarcoderdataPython |
1609920 | import pytest
from tf_yarn._env import (
gen_pyenv_from_existing_archive,
CONDA_CMD, CONDA_ENV_NAME
)
test_data = [
("/path/to/myenv.pex",
"./myenv.pex",
"myenv.pex"),
("/path/to/myenv.zip",
f"{CONDA_CMD}",
CONDA_ENV_NAME)
]
@pytest.mark.parametrize(
"path_to_archive,expected... | StarcoderdataPython |
134256 | <filename>fem/utilities/command_dispatcher/test.py
import inspect
def check_types(*args):
def check_args(func, *args2):
types = tuple(map(type, args2))
for i in range(len(types)):
if not isinstance(types[i], args[i]):
raise TypeError("Argument types for %s%s do not ma... | StarcoderdataPython |
1786112 | <gh_stars>0
import sys
import io
from mlad.cli import context
from . import mock
def setup_function():
mock.setup()
def teardown_function():
mock.teardown()
def test_ls():
origin_stdout = sys.stdout
mock.add('test1')
mock.add('test2')
sys.stdout = buffer = io.StringIO()
context.ls()
... | StarcoderdataPython |
153573 | <filename>pebble/build/c4che/_cache.py
BINDIR = '/usr/local/bin'
BLOCK_MESSAGE_KEYS = []
BUILD_TYPE = 'app'
BUNDLE_NAME = 'pebble.pbw'
DEFINES = ['RELEASE']
LIBDIR = '/usr/local/lib'
LIB_DIR = 'node_modules'
LIB_JSON = []
MESSAGE_KEYS = {}
MESSAGE_KEYS_HEADER = '/mnt/files/scripts/pebble/pebble-navigation/pebble/build/... | StarcoderdataPython |
1686628 | import json
import operator
import os
import pickle
import subprocess
from django.contrib.auth import logout, authenticate, login
from django.shortcuts import render, render_to_response
from django.utils.datastructures import MultiValueDictKeyError
from django.contrib.auth.models import User
from carnivora.instabot.c... | StarcoderdataPython |
3241433 | import numpy as numpy
a = numpy.array([1,2,3,4])
b = numpy.array([10,20,30,40])
c = a * b
print (c) | StarcoderdataPython |
147807 | <filename>Scripts/random_sampler.py
import os
import itertools
import numpy as np
import random
import math
import shutil
random.seed(100)
np.random.seed(100)
def populate(images, split_index=1):
assert type(images) is list and len(images) > 0, "Check input..."
cache_dict = dict()
count_dic... | StarcoderdataPython |
3382670 | <gh_stars>1-10
import numpy as np
from sklearn.preprocessing import MinMaxScaler
from collections import Counter
from matplotlib import pylab as plt
from tqdm import tqdm
## El conjunto de datos se descargó de:
## http://www.stat.cmu.edu/~larry/all-of-statistics/=Rprograms/a1882_25.dat
D = [list(map(float, x.strip().... | StarcoderdataPython |
3245355 | <filename>Codewars/8kyu/calculate-bmi/Python/test.py
# Python - 3.4.3
Test.describe('Basic tests')
Test.assert_equals(bmi(50, 1.80), 'Underweight')
Test.assert_equals(bmi(80, 1.80), 'Normal')
Test.assert_equals(bmi(90, 1.80), 'Overweight')
Test.assert_equals(bmi(110, 1.80), 'Obese')
Test.assert_equals(bmi(50, 1.50), '... | StarcoderdataPython |
1775249 | <reponame>andyasne/commcare-hq
from datetime import datetime
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import authenticate, login
from django.contrib.auth.models import User
from django.contrib.auth.views import redirect_to_login
from django.core.exceptions import Va... | StarcoderdataPython |
3243302 | import pglive.examples_pyqt6 as examples
from threading import Thread
from pglive.sources.data_connector import DataConnector
from pglive.sources.live_plot import LiveHBarPlot
from pglive.sources.live_plot_widget import LivePlotWidget
"""
In this example Horizontal Bar plot is displayed.
"""
win = LivePlotWidget(titl... | StarcoderdataPython |
1677850 | <gh_stars>1-10
from marl_env.envs.marl_farm import FarmMARL | StarcoderdataPython |
4838352 | """
Django settings for example project.
Generated by Cookiecutter Django Package
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# Build paths inside ... | StarcoderdataPython |
1617052 | <reponame>TheTacoScott/GoAtThrottleUp<filename>ServerRelay/gatu/globals.py
import threading
class camera_data(object):
def __init__(self,id):
self.id = id
self.img_data = ""
self.img_lock = threading.Lock()
self.img_updated = -1.0
def setdata(self,data):
with self.img_lock:
self.img_da... | StarcoderdataPython |
3228945 | import base64
import os
import math
import time
import requests
import json
from config import config
from api_client.url_helpers.internal_app_url import get_chunk_upload_url
from Logs.log_configuration import configure_logger
from models.api_header_model import RequestHeader
log = configure_logger('default')
def c... | StarcoderdataPython |
3367921 | <filename>src/parser.py
# coding=utf-8
import csv
# Classe que modela o conjunto de treinamento/teste
class Data:
def __init__(self, tweet, target, stance, opinion_towards, sentiment):
# type: (basestring, basestring, basestring, string, string, basestring) -> object
self.tweet = tweet # Esse vai... | StarcoderdataPython |
4812571 | <filename>tests/v1/python/accounts/test_serializers.py
import responses
from rest_framework import status
from rest_framework.test import APITestCase
from accounts.v1.serializers import LoginRegistrationSerializer, OneSignalSerializer, UserRegistrationSerializer, \
UserEmailUpdateSerializer, UserAppVersionUpdateSe... | StarcoderdataPython |
3271218 | <reponame>amochtar/adventofcode<gh_stars>1-10
#!/usr/bin/env python
import aoc
@aoc.timing
def part1(inp):
cnt = 0
for line in inp.splitlines():
_, outs = (part.split(' ') for part in line.split(' | ', 1))
cnt += sum(1 for d in outs if len(d) in [2, 3, 4, 7])
return cnt
@aoc.timing
def ... | StarcoderdataPython |
198644 | import six
from pubnub import utils
from pubnub.endpoints.endpoint import Endpoint
from pubnub.enums import HttpMethod, PNOperationType
from pubnub.models.consumer.history import PNHistoryResult
class History(Endpoint):
HISTORY_PATH = "/v2/history/sub-key/%s/channel/%s"
MAX_COUNT = 100
def __init__(self... | StarcoderdataPython |
1767256 | <reponame>object-oriented-human/competitive
n = int(input())
while n != 0:
sn = 0
for _ in list(str(n)):
sn += int(_)
p = 10
np = n * p
snp = 0
while sn != snp:
p += 1
np = n * p
snp = 0
for x in list(str(np)):
snp += int(x)
print(p)
... | StarcoderdataPython |
4826968 | #!/usr/bin/env python
"""Reverse DNS lookup for a list of IPs separated by a new line
Should work with python 2.7.15 and 3.6.5"""
import argparse
import json
import os
import socket
import sys
PARSER = argparse.ArgumentParser(
description="Reverse DNS lookup for a list of IPs separated by a new line"
)
PARSER.add... | StarcoderdataPython |
1635697 | <filename>Lib/test/test_cinder.py<gh_stars>0
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
import asyncio
import asyncio.tasks
import cinder
import inspect
import sys
import unittest
import weakref
from cinder import (
async_cached_classproperty,
async_cached_property,
cached_... | StarcoderdataPython |
1723275 | import os
'''
import re
data = os.popen('ls -l')
count = 0
for lines in data.readlines() :
#pat = '*\s*'
pat = '\d[0]'
for line in lines :
if re.search(pat, line) :
count = count + 1
else :
continue
print(count)
'''
data = os.popen('ls -l')
records = list(data)
count = 0
for record in records[1 : ] :... | StarcoderdataPython |
3202956 | """
Automatic detection of natural language used in a text.
Use this program as a CLI.
Without arguments, enters into a REPL that recognises sentences.
"""
import argparse
import csv
import math
import pathlib
import sys
from typing import List
from pynapl.APL import APL
from pynapl.APLPyConnect import Connection
L... | StarcoderdataPython |
67556 | import test_support
class DiagnosticHandlerTest(test_support.TestBase):
def test_compile_warning_in_source_file(self):
self.assert_colobot_lint_result(
source_file_lines = [
'int Foo()',
'{',
'}',
''
],
addi... | StarcoderdataPython |
52682 | import numpy as np
import xarray as xr
from numpy import asarray
import scipy.sparse
from itertools import product
from .util import get_shape_of_data
from .grid_stretching_transforms import scs_transform
from .constants import R_EARTH_m
def get_troposphere_mask(ds):
"""
Returns a mask array for picking out t... | StarcoderdataPython |
185782 | <reponame>earth-chris/elapid
"""Backend helper and convenience functions."""
import gzip
import multiprocessing as mp
import os
import pickle
import sys
from typing import Any, Callable, Dict, Iterable, Tuple, Union
import numpy as np
import pandas as pd
import rasterio as rio
n_cpus = mp.cpu_count()
MAXENT_DEFAULT... | StarcoderdataPython |
102500 | <reponame>Maosef/qb
import json
from os import path
from luigi import LocalTarget, Task, WrapperTask, Parameter
import yaml
from sklearn.model_selection import train_test_split
from qanta.util.io import shell, get_tmp_filename, safe_path, safe_open
from qanta.util.constants import (
DATASET_PREFIX,
DS_VERSION,... | StarcoderdataPython |
3242323 | import os
import socket
from OpenSSL import crypto, SSL
# OpenVPN is fairly simple since it works on OpenSSL. The OpenVPN server contains
# a root certificate authority that can sign sub-certificates. The certificates
# have very little or no information on who they belong to besides a filename
# and any required info... | StarcoderdataPython |
3222568 | <gh_stars>0
# -*- coding: utf-8 -*-
import numpy as np
from kbcr.util import make_batches
from kbcr.training.data import Data
from typing import Tuple
class Batcher:
def __init__(self,
data: Data,
batch_size: int,
nb_epochs: int,
... | StarcoderdataPython |
1681728 | from os import path
#import argparse
#from collections import namedtuple
from futen import get_netlocs, execute
from Timer import Timer
from retic import Int
#bg: all test files should be in current directory when tests run
def main(n:Int)->Void:
testfile = path.join(path.dirname(__file__), 'ssh.config.dat')
... | StarcoderdataPython |
1757381 | <reponame>MioYvo/app_manager
# coding=utf-8
# __author__ = 'Mio'
from os import getenv
from pathlib import Path
from sanic import Sanic
from gino.ext.sanic import Gino
# -------------------- Application --------------------
app = Sanic()
APP_PORT = getenv("APP_PORT", "8888")
# -------------------- Databa... | StarcoderdataPython |
185696 | from .translated_object import TranslatedObject
from .base_translator import BaseTranslator
BASE_HEADERS: dict = {
"User-Agent": "GoogleTranslate/6.6.1.RC09.302039986 (Linux; U; Android 9; Redmi Note 8)",
}
| StarcoderdataPython |
3272339 | <gh_stars>0
"""
PEP8 - Python Enhancement Proposal
São propostas de melhorias para a linguagem Python
A ideia de PEp8 é que possamos escrever códigos de forma Pythonica.
[1] - Utilize Camel Case para nomes de classes:
class Calculadora:
pass
class CalculadoraCientifica:
pass
[2] - Utilizae nomes em minús... | StarcoderdataPython |
3335447 | <filename>pclub/account/migrations/0001_initial.py
# Generated by Django 3.0.7 on 2020-06-23 03:04
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Account',
... | StarcoderdataPython |
182002 | <gh_stars>0
###############################################################################
# Author: CallMeCCLemon
# Date: 2019
# Copyright: 2019 <NAME> (@CallMeCCLemon) - Modified BSD License
###############################################################################
import os
from PythonApp.pillar.Pill... | StarcoderdataPython |
1645301 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Author : <NAME>
# E-mail : <EMAIL>
# Date : 15/12/21 12:16:48
# Desc :
#
import sae.storage
def Courses(Content):
kebiao = Content.split()
try:
numxh = int(kebiao[0])
shijian = str(kebiao[1])
s = sae.storage.Client()
s.list_domain... | StarcoderdataPython |
3346343 | import bz2
import codecs
import gzip
import io
import lzma
import typing
import urllib.request
import warnings
from http.client import HTTPResponse
from typing import BinaryIO, ByteString, Dict, Optional, Union, cast
import chardet
MAGIC_GZIP = bytearray([0x1F, 0x8B])
MAGIC_LZMA = bytearray([0xFD, 0x37, 0x7A, 0x58, 0... | StarcoderdataPython |
3357748 | """
determine_data_frequency
"""
import logging
import traceback
from collections import Counter
# @added 20210619 - Feature #4148: analyzer.metrics_manager.resolutions
# Bug #4146: check_data_sparsity - incorrect on low fidelity and inconsistent metrics
# Feature #3870: metrics_man... | StarcoderdataPython |
1628859 | <filename>mtl_coherency.py
import time
import os
import operator
import random
import datetime
import logging
import sys
import argparse
import numpy as np
import pandas as pd
from copy import deepcopy
from collections import Counter
from ast import literal_eval
from tqdm import tqdm, trange
from nltk.corpus import sto... | StarcoderdataPython |
3382587 | <reponame>phillipjhl/artoo_engine<gh_stars>0
#!/usr/bin/env python3
import board
import busio
import time
import adafruit_dht
from datetime import datetime
class DHT_SENSOR:
def __init__(self, sensor_type = "DHT11", temp_format = "F"):
self.sensor_type = sensor_type
self.temp_format = temp_format
... | StarcoderdataPython |
173374 | <gh_stars>0
from django_filters import rest_framework as fl
from django_filters.filters import CharFilter, NumberFilter
from reviews.models import Title
class TitleFilter(fl.FilterSet):
category = CharFilter(field_name='category__slug',
lookup_expr='contains')
genre = CharFilter(fiel... | StarcoderdataPython |
3282267 | # -*- coding: utf-8 -*- #
# Copyright 2016 Google LLC. 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 requir... | StarcoderdataPython |
81848 | <gh_stars>0
# -*- coding: utf-8 -*-
from typing import Dict, List
# If id <> number indicates an alternate form of the Pokémon.
# https://www.pokemon.com/es/pokedex/, https://bulbagarden.net/
KANTO = [
{'id': '1', 'name': 'Bulbasaur', 'number': '1'},
{'id': '2', 'name': 'Ivysaur', 'number': '2'},
{'id': '... | StarcoderdataPython |
3388016 | <reponame>Zhylkaaa/nboost<filename>nboost/plugins/qa/base.py<gh_stars>0
from typing import Tuple
import time
from nboost.plugins import Plugin
from nboost.delegates import ResponseDelegate
from nboost.database import DatabaseRow
from nboost import defaults
from nboost.logger import set_logger
class QAModelPlugin(Plug... | StarcoderdataPython |
86796 | # -*- coding: utf-8 -*-
"""Module defining Interval model and operations"""
# ActiveState recipe 576816
class Interval(object):
"""
Represents an interval.
Defined as closed interval [start,end), which includes the start and
end positions.
Start and end do not have to be numeric types.
"""
... | StarcoderdataPython |
1619845 | <filename>bakkes_rcon/__init__.py
from .client import *
from .exceptions import *
from .inventory import *
__version__ = '0.1.0'
__all__ = [
'BakkesRconClient',
'Quality',
]
| StarcoderdataPython |
120196 | <filename>src/02/count.py
import sys
n_huruf=0;
n_angka=0;
lines_number = 0
for line in sys.stdin:
for chara in line:
if(chara.isdigit()):
n_angka+=1
elif(chara.isalpha()):
n_huruf+=1
lines_number = lines_number + 1
sys.stdout.write('Jumlah huruf :'+str(n_huruf))
sys.std... | StarcoderdataPython |
146975 | <filename>RS_scpFile.py<gh_stars>1-10
import paramiko
#hostname = '10.57.29.175'
hostname = '10.57.29.175'
password = '<PASSWORD>'
username = "coding4"
port = 22
mypath='/Users/alan/Desktop/my_file'
remotepath='/Users/coding4/my_file'
t = paramiko.Transport((hostname, 22))
t.connect(username=username, password=pass... | StarcoderdataPython |
3267261 | # Copyright 2022 The T5X Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | StarcoderdataPython |
172741 | import io
from PIL import Image, ImageDraw, ImageFont
from fastapi.param_functions import File
from app.models.schemas.words import (
WordOutWithIdDate
)
from app.resources import strings
from typing import List
# import datetime as dt
from O365 import calendar
import textwrap
""" Return byte buffer if output=='_... | StarcoderdataPython |
3383349 | from unittest import TestCase
from os.path import dirname, realpath
from fil_io.json import load_single
from jsonschema.exceptions import ValidationError
class TestSchemaValidation(TestCase):
pass
class TestFullSchemaValidation(TestSchemaValidation):
def test_basic_schema(self):
from aws_schema impo... | StarcoderdataPython |
90967 | <filename>src/drivers/ssc_interface/launch/ssc_interface.launch.py<gh_stars>1-10
# Copyright 2020 The Autoware Foundation
#
# 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.ap... | StarcoderdataPython |
1600838 | <gh_stars>0
import requests
import re
username = 'natas2'
password = '<PASSWORD>'
url = f'http://{username}.natas.labs.overthewire.org/files/users.txt'
response = requests.get(url, auth=(username, password))
content = response.text
print(re.findall('natas3:(.*)', content)[0]) | StarcoderdataPython |
67130 | # Print N reverse
# https://www.acmicpc.net/problem/2742
print('\n'.join(list(map(str, [x for x in range(int(input()), 0, -1)]))))
| StarcoderdataPython |
3298196 | <reponame>gem763/bmatch-api
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse
from django.conf import settings
from django.views.generic import View
from gensim.models import Doc2Vec #, Word2Vec
import os
import time
import json
import re
import numpy as np
# Create your views here... | StarcoderdataPython |
165180 | <reponame>shell909090/acme-tiny<gh_stars>0
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@date: 2019-04-28
@author: Shell.Xu
@copyright: 2019, Shell.Xu <<EMAIL>>
@license: MIT
'''
import os
import re
import logging
from os import path
import acme
class Validator(object):
re_token = re.compile(r'[^A-Za-z0-9_\-]'... | StarcoderdataPython |
1797823 | <filename>dvt/byod_dvt/fargate/validation/src/app.py
from clevercsv import read_dataframe
from rules import CsvHeaderRule
from rules import FileSizeEncodingRule
import boto3
import s3fs
import csv
import os
import time
import datetime
TABLE_NAME = os.environ['TABLE_NAME']
QUEUE_URL = os.environ['QUEUE_URL']
SOURCE_BUC... | StarcoderdataPython |
1780685 | """
project = Election scraper
author = <NAME>
"""
from time import time
import requests
from bs4 import BeautifulSoup as BS
import csv
import sys
# training website
INPUT = "https://volby.cz/pls/ps2017nss/ps3?xjazyk=CZ"
def get_districts(web):
"""
Přijímá webovku a vrátí extrahovaný seznam... | StarcoderdataPython |
51821 | from .index import index
from .dashboard import dashboard
from .player_list import player_list
from .player_info import player_info
from .server_statistics import server_statistics | StarcoderdataPython |
4811494 | <reponame>computer-geek64/scripts<filename>src/python/git_backup.py
#!/usr/bin/python3
# git-backup.py v1.4
# <NAME>
# December 29th, 2018
try:
import os
import git
import requests
import json
import sys
from datetime import datetime
except ImportError:
print("[-] Installing dependencies...")
if os.system("pip... | StarcoderdataPython |
29519 | import argparse
import glob
import os
import random
import re
from dataclasses import dataclass
from functools import partial
from math import ceil
from typing import List, Optional
import numpy as np
import torch
from torch.optim.lr_scheduler import ReduceLROnPlateau
from tqdm import tqdm
import util
tqdm.monitor_i... | StarcoderdataPython |
1600147 | # -*- encoding: utf-8 -*-
from sympy import symbols, simplify
n = symbols('n', integer=True)
p = symbols('p')
a1_a1 = 1 - p + p/(n+1)
a1na1 = p - p/(n+1)
a2_a2__a1_a1 = 1 - p + p/(n+1)
a2_a2__a1na1 = p / (n+1)
a2na2__a1_a1 = p - p/(n+1)
a2na2__a1na1 = 1 - p/(n+1)
simplify(a2_a2__a1_a1 + a2na2__a1_a1)
# 1
simplify(a... | StarcoderdataPython |
3258099 | # -*- coding: utf-8 -*-
import collections
import itertools
class LineNumbering(object):
"""A class responsible for managing line numbers."""
Step = collections.namedtuple('Increment', 'bytecode_step, line_step')
def __init__(self, code_object):
"""
Initializes the LineNumbering manager... | StarcoderdataPython |
1750041 | <gh_stars>10-100
from .logging import logs
__all__ = ['logs', 'models', 'utils']
| StarcoderdataPython |
187161 | <gh_stars>0
# Code from Chapter 6 of Machine Learning: An Algorithmic Perspective (2nd Edition)
# by <NAME> (http://stephenmonika.net)
# You are free to use, change, or redistribute the code in any way you wish for
# non-commercial purposes, but please maintain the name of the original author.
# This code comes with n... | StarcoderdataPython |
4800471 | <filename>.silver-system-programs/disk-info.py
import os
import subprocess
class color():
purple = '\033[95m'
cyan = '\033[96m'
darkcyan = '\033[36m'
blue = '\033[94m'
blued = '\033[92m'
yellow = '\033[93m'
red = '\033[91m'
silver = '\033[3;30;47m'
orange= '\033[31;43m'
bold = '\033[1m'
... | StarcoderdataPython |
1638241 | import sys
import os
from gittra.script import parse_back
#function to call merge inside the original directory
def gittra_merge(initial_dir, final_dir):
parse_back(initial_dir, final_dir)
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.