id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
190986 | <gh_stars>1-10
# Bluerred Image Detection
#
# Author: Jasonsey
# Email: <EMAIL>
#
# =============================================================================
"""global config file"""
# ------------------------------net config------------------------
NUM_CLASS = 2 # number of classes
CUDA_VISIBLE... | StarcoderdataPython |
3323934 | <filename>bokehserverextension.py<gh_stars>0
# Copyright 2019 <NAME>, Daytum
#
# 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 requi... | StarcoderdataPython |
4815112 | <reponame>christopinka/django-civil
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from civil.library.admin import BaseAdmin
from .models import *
#==============================================================================
class SavedSearchItemIn... | StarcoderdataPython |
1782524 | <filename>cgtop/update_heuristics.py
class UpdateHeuristics:
"""
Heuristics to control thread based updates with user
triggered updates.
"""
ticks = 0
updated = 0
@staticmethod
def tick():
UpdateHeuristics.ticks += 1
UpdateHeuristics.updated += 1
@staticmethod
... | StarcoderdataPython |
3244138 | # -*- coding: utf8 -*-
from .base import INSTALLED_APPS
DATABASES = {
"TEST": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": "itdagene",
"USER": "itdagene",
"PASSWORD": "<PASSWORD>",
"HOST": "127.0.0.1",
"PORT": "",
},
"default": {
"EN... | StarcoderdataPython |
3361978 | #!/usr/bin/env python3
# vim: set et sw=4 sts=4 fileencoding=utf-8:
#
# The colorzero color library
#
# Copyright (c) 2016-2021 <NAME> <<EMAIL>>
#
# SPDX-License-Identifier: BSD-3-Clause
import sys
import os
import configparser
from datetime import datetime
from pathlib import Path
on_rtd = os.environ.get('READTHEDOC... | StarcoderdataPython |
3204834 | from flask import Flask, jsonify, make_response, request, abort
import sys
import logging as log
import datetime as dt
import RPi.GPIO as GPIO
import database
_host = '0.0.0.0'
_port = 4010
log.basicConfig(filename='{:%Y-%m-%d}.log'.format(dt.datetime.now()),
level=log.DEBUG,
format='%(asctime)s - %(name)s -... | StarcoderdataPython |
3308995 | from app.models.base import db, Base
from sqlalchemy import Column,Integer,String,Boolean,ForeignKey,desc,func
from sqlalchemy.orm import relationship
from app.models.shupiao_book import ShuPiaoBook
class Wish(Base):
id = Column(Integer, primary_key=True)
user = relationship('User')
uid = Column(Integer, F... | StarcoderdataPython |
3234468 | <reponame>jleinonen/downscaling-rnn-gan
import numpy as np
import tensorflow as tf
from tensorflow.python.keras.engine import InputSpec
from tensorflow.python.keras.engine import base_layer_utils
from tensorflow.python.ops import math_ops
from tensorflow.keras.layers import Layer
from tensorflow.keras.layers import Den... | StarcoderdataPython |
158526 | <reponame>o3seespy/o3seespy
import o3seespy as o3
import numpy as np
def test_build_regular_node_mesh_2dxy():
xs = [1, 2, 3]
ys = [3, 4]
zs = 4.5
osi = o3.OpenSeesInstance(ndm=3, ndf=3)
sn = o3.node.build_regular_node_mesh(osi, xs, ys, zs)
sn = np.array(sn)
print(sn.shape)
assert len(s... | StarcoderdataPython |
179244 | <gh_stars>0
from itertools import product
from pygraphblas import *
from src.LabeledGraph import LabeledGraph
from src.RegularPathQuering import rpq
def test_manual(manual_suite, tmp_path):
assert check(manual_suite['edges'], manual_suite['regex'], tmp_path)
def test_automatic(automatic_suite, tmp_path):
... | StarcoderdataPython |
1721807 | <gh_stars>0
from django.urls import path
from . import views
urlpatterns = [
path('', views.PostList.as_view(), name='blog'),
path('<int:pk>/', views.PostDetail.as_view(), name='post-detail'),
path('archive/<int:year>/', views.PostYearArchive.as_view(), name='post-year-archive'),
path('archive/<int:year>/<int:... | StarcoderdataPython |
22536 | <reponame>hudsonburgess/nutcracker
def get_field_name_from_line(line):
return line.split(':')[1].strip()
def remove_description(line):
if '-' in line:
return line.split('-')[0].strip()
else:
return line
def split_multiple_field_names(line):
if ',' in line:
field_names = line.sp... | StarcoderdataPython |
2925 | from scrapper.playstation.spider import main | StarcoderdataPython |
17592 | <gh_stars>100-1000
# This file contains functions designed for
# loading cron tables and storing new feeds.
from emissary import db
from sqlalchemy import and_
from emissary.controllers.utils import spaceparse
from emissary.controllers.cron import parse_timings
from emissary.models import APIKey, Feed, FeedGroup
def ... | StarcoderdataPython |
1734846 | <gh_stars>0
import os
from bs4 import BeautifulSoup
from le_utils.constants import content_kinds
from ricecooker.classes import nodes, files
from webmixer.scrapers.pages.base import PDFScraper, HTMLPageScraper, VideoScraper, WebVideoScraper
from webmixer.scrapers.pages.fullscreen import FullscreenPageScraper
from webm... | StarcoderdataPython |
4822476 | # %%
import re
import string
import tagging
re_var = re.compile(r'((@[ns]?|#|\$)[0-9]+)(\D|$)')
re_number = re.compile(r'[-]?[0-9]+([.][0-9]+)?(/[0-9]+([.][0-9]+)?)?')
re_string = re.compile(r'\(\w\)')
re_equation = re.compile('[0-9A-Z][0-9A-Z\.\+\-\*\/\(\)=<> ]*[=<>][0-9A-Z\.\+\-\*\/\(\)=<> ]*[0-9A-Z]') # ๋ฑํธ(=)๋ฅผ ํฌํจํ... | StarcoderdataPython |
3288003 | <reponame>bowen0701/python-algorithms-data-structures
"""Leetcode 40. Combination Sum II
Medium
URL: https://leetcode.com/problems/combination-sum-ii/
Given a collection of candidate numbers (candidates) and a target number (target),
find all unique combinations in candidates where the candidate numbers sums to targe... | StarcoderdataPython |
1606472 | from pathlib import Path
import depthai as dai
import cv2
import sys
# Importing from parent folder
sys.path.insert(0, str(Path(__file__).parent.parent.parent)) # move to parent path
from utils.draw import drawROI, displayFPS
from utils.OakRunner import OakRunner
def main():
# Set few parameters
nn_path = st... | StarcoderdataPython |
3315683 | # Generated by Django 3.0.7 on 2020-07-02 23:20
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('chatrooms', '0002_auto_20200627_1343'),
]
operations = [
migrations.RemoveField(
model_name='chatroom',
name='category',
... | StarcoderdataPython |
3229735 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
class Tree:
def __init__(self):
self.dirCount = 0
self.fileCount = 0
def register(self, absolute):
if os.path.isdir(absolute):
self.dirCount += 1
else:
self.fileCount += 1
def summary(sel... | StarcoderdataPython |
172467 | from parlai.agents.programr.parser.template.nodes.base import TemplateNode
from parlai.agents.programr.utils.logging.ylogger import YLogger
from parlai.agents.programr.utils.text.text import TextUtils
class TemplateWordNode(TemplateNode):
def __init__(self, word):
TemplateNode.__init__(self)
self... | StarcoderdataPython |
165656 | import logging
_logger = logging.getLogger('polyaxon.repos.git')
def set_git_repo(repo: 'Repo') -> str:
from libs.repos.git import ensure_repo_paths, get_git_repo
# Ensure paths
ensure_repo_paths(repo=repo)
# Create a new repo
get_git_repo(repo_path=repo.path, init=True)
return repo.path
| StarcoderdataPython |
1754863 | from django.db import models
from django.contrib.auth.models import User
import time
import datetime
# Create your models here.
class Plan(models.Model):
price_cents = models.IntegerField()
name = models.CharField(max_length=15)
num_bots_allowed = models.IntegerField()
max_trade_size_usd = mode... | StarcoderdataPython |
3266865 | <reponame>0x55AAh/anthill_gaming
from anthill.platform.services import PlainService, ControllerRole
from anthill.platform.api.internal import as_internal
class Service(ControllerRole, PlainService):
"""Anthill default service."""
master = 'game_master'
@staticmethod
def setup_internal_api():
... | StarcoderdataPython |
3267577 | <gh_stars>0
n = int(input())
inTunnel = []
outTunnel = []
for i in range(n):
inTunnel.append(input())
for i in range(n):
outTunnel.append(input())
ans = 0
for i in range(n):
car = outTunnel.pop(0)
if inTunnel[0] == car:
inTunnel.pop(0)
else:
ans += 1
inTunnel.remove(car)
prin... | StarcoderdataPython |
42212 | <gh_stars>0
import statistics
import random
import time
from typing import List, Tuple, Dict
from time import monotonic
from blessings import Terminal
from . import Note
_ACCIDENTALS: Dict[str, Dict] = {
'sharps': {
Note('C'): [],
Note('G'): [Note('F#')],
Note('D'): [Note('F#'), Note('C#'... | StarcoderdataPython |
3245734 | <filename>diccionario/dict.py<gh_stars>0
import requests
import sys
def request_dict(lang_code, word):
# lang_code (string): language code. Ex: es, en, etc...
# word (string): word that will be searched in the dictionary.
url = f"https://api.dictionaryapi.dev/api/v2/entries/{lang_code}/{word}"
r = req... | StarcoderdataPython |
175044 | import logging
import random
from constants import SLUG_LENGTH, SLUG_CHARACTERS, RESERVED_SLUGS
log = logging.getLogger(__name__)
def generate_slug() -> str:
while True:
slug = "".join([random.choice(SLUG_CHARACTERS) for _ in range(SLUG_LENGTH)])
if slug not in RESERVED_SLUGS:
return... | StarcoderdataPython |
156143 | <reponame>gabbpuy/vindauga
# -*- coding: utf-8 -*-
import logging
from vindauga.constants.command_codes import cmNext, cmPrev, cmReleasedFocus
from vindauga.constants.grow_flags import gfGrowHiX, gfGrowHiY
from vindauga.constants.event_codes import evCommand
from vindauga.constants.option_flags import ofTileable
from ... | StarcoderdataPython |
1701567 | <filename>Sketches/JL/Responder.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
#... | StarcoderdataPython |
1622443 | # Author : <EMAIL>
# Date : 2020-12-03
import pandas as pd
import os
import copy, shutil
import torch
import torch.nn.functional as F
from torch.optim import lr_scheduler
import torch.optim as optim
import torch.nn as nn
from collections import defaultdict
# ref : https://github.com/kakaobrain/fast-a... | StarcoderdataPython |
1670702 | from . import Base
from .named_model import NamedModel
class Browser(Base, NamedModel):
__tablename__ = 'browser'
| StarcoderdataPython |
4834344 | from .settings import *
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = <KEY>�##dpag=c%+'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
CELERY_BROKER_URL = "redis://localhost:6379/0"
CHEMSPIDER_APIKEY='<KEY>'
| StarcoderdataPython |
143923 |
'''Implements /src/Resource/index.ts'''
class Resource:
''' Enum implemenation '''
class Types:
WOOD = 'wood'
COAL = 'coal'
URANIUM = 'uranium'
def __init__(self, type, amount) -> None:
self.type = type
self.amount = amount
| StarcoderdataPython |
79573 | #
# Copyright (c) 2018 Via Technology Ltd. All Rights Reserved.
# Consult your license regarding permissions and restrictions.
#
"""
operations related to airspaces and intersections.
"""
from psycopg2 import Error, InternalError
from psycopg2.extensions import AsIs
from psycopg2.extras import DictCursor
from itertoo... | StarcoderdataPython |
47119 | # 2019-02-18
# sentence to dictionary meaning
sentence = "It is truth universally acknowledged"
f = open('dict_test.TXT', 'r', encoding='utf-8')
dictionary = {}
for line in f:
word = line[:-1].split(" : ", 1)
dictionary.update({word[0]:word[-1]})
f.close()
print("Sentence :", sentence)
for word in senten... | StarcoderdataPython |
88665 | <reponame>KendallPark/pangloss
import unittest
from panaugment import distortion
def int_add_fn(example, magnitude):
return example + magnitude
def int_sub_fn(example, magnitude):
return example - magnitude
def int_mult_fn(example, magnitude):
return example * magnitude
def int_div_fn(example, magnitude)... | StarcoderdataPython |
23720 | # This file is executed on every boot (including wake-boot from deepsleep)
import esp
import gc
import machine
import network
esp.osdebug(None)
# machine.freq(160000000)
def do_connect(wifi_name, wifi_pass):
ssid = 'microsonar'
password = '<PASSWORD>'
ap_if = network.WLAN(network.AP_IF)
ap_if.activ... | StarcoderdataPython |
1799769 | <gh_stars>0
import sys
print(sys.path)
sys.path.append(r"C:\LordKrishna\GitHub\LearningPython_2019\Session1\CustomModules")
print(sys.path)
| StarcoderdataPython |
1661084 | import pytest
from starlette.status import HTTP_200_OK
from starlette.testclient import TestClient
from slackers.hooks import commands
@pytest.mark.usefixtures("pass_header_verification")
def post_commands_should_emit_commands_event_with_payload(
mocker, client: TestClient, test_headers
):
@commands.on("foo... | StarcoderdataPython |
142540 | <filename>moto/s3control/__init__.py
"""s3control module initialization; sets value for base decorator."""
from .models import s3control_backends
from ..core.models import base_decorator
mock_s3control = base_decorator(s3control_backends)
| StarcoderdataPython |
320 | # -*- coding: utf-8 -*-
from __future__ import division, unicode_literals, print_function, absolute_import
from pint.util import (UnitsContainer)
from pint.converters import (ScaleConverter, OffsetConverter)
from pint.definitions import (Definition, PrefixDefinition, UnitDefinition,
Dime... | StarcoderdataPython |
38250 | <gh_stars>0
from random import randint
computador = randint(0, 10)
print('Sou seu computador... Acabei de pensar em um numero entre 0 e 10')
print('Tente adivinhar qual foi')
acertou = False
palpite = 0
while not acertou:
jogador = int(input('Digite um numero entre 0 e 10: '))
palpite += 1
if jogador == ... | StarcoderdataPython |
1621383 | <reponame>groundupnews/gu<filename>payment/migrations/0011_fund_funder.py
# Generated by Django 3.0.10 on 2021-03-11 20:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('payment', '0010_auto_20210311_2139'),
]
operations = [
migrations... | StarcoderdataPython |
1631259 | num = 7
if num == 5:
print("Number is 5")
else:
if num == 11:
print("Number is 11")
else:
if num == 7:
print("Number is 7")
else:
print("Number isn't 5, 11 or 7")
# equivalent as
num = 7
if num == 5:
print("Number is 5")
elif num == 11:
print("Number ... | StarcoderdataPython |
3383307 | <reponame>sdispater/poet
# -*- coding: utf-8 -*-
import os
from twine.commands.upload import upload
from twine.commands.register import register
from requests.exceptions import HTTPError
from ...publisher import Publisher
from .command import Command
class PublishCommand(Command):
"""
Publish the package ... | StarcoderdataPython |
1724064 | <reponame>costrouc/pymatgen-lammps
import time
import asyncio
from pmg_lammps.calculator import LammpsCalculator
script = [
('log', 'lammps.log'),
('units', 'metal'),
('dimension', 3),
('boundary', 'p p p'),
('atom_style', 'full'),
('read_data', 'initial.data'),
('kspace_style', 'pppm 0.0... | StarcoderdataPython |
153505 | <filename>datasets/udacity_dataset.py
import pandas as pd
import numpy as np
import torch
import torchvision
from torchvision import transforms as tf
import torch.nn as nn
import torch.utils.data as data
from PIL import Image
import random
import os
class UdacityDataset(data.Dataset):
def __init__(self, root, data... | StarcoderdataPython |
3295193 | <reponame>anubhav-tiwari-abt/projectaile
from functools import wraps
import random
# base augmentation method
def augmentation(config, apply_on_target=False):
if config:
# assign config vars to the function and use them
# otherwise use defaults
prob = config['apply_probability']
... | StarcoderdataPython |
1779784 | # Generated by Django 2.2 on 2019-04-08 20:17
import uuid
import django.contrib.postgres.fields.jsonb
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | StarcoderdataPython |
17100 | <gh_stars>1-10
import hassapi as hass
import csv
from collections import namedtuple
Profile = namedtuple(
"Profile", ["profile", "x_color", "y_color", "brightness"])
with open("/config/light_profiles.csv") as profiles_file:
profiles_reader = csv.reader(profiles_file)
next(profiles_reader)
LIGHT_PROFIL... | StarcoderdataPython |
4841722 | <filename>tests/lit.cfg.py
import os
import lit.formats
import urllib
# Download models if not exist
model_path = os.path.join(config.halo_build_dir, 'models')
urls = {'https://github.com/onnx/models/raw/master/vision/classification/'
'resnet/model/resnet50-v2-7.onnx': 'resnet50_v2.onnx'}
for url, filename in ... | StarcoderdataPython |
1726995 | #!/usr/bin/env python3
"""UNC to URL Converter."""
from __future__ import print_function
import sys
import argparse
import unicodedata
# from urllib.parse import unquote
sys.path.insert(0, "./lib") # for Alfred Workflow
import argcomplete # type: ignore # noqa: E402 # pylint: disable=C0413
# from . import __versi... | StarcoderdataPython |
3260266 | import os
import sys
import random
import math
import re
import time
ROOT_DIR = os.path.abspath("../../")
Sample_dir = os.path.join(ROOT_DIR, "samples")
# Import Mask RCNN
sys.path.append(ROOT_DIR) # To find local version of the library
sys.path.append(Sample_dir)
import numpy as np
import tensorflow as tf... | StarcoderdataPython |
3316365 | import os
# For reading, visualizing, and preprocessing data
import numpy as np
import pandas as pd
from sklearn.decomposition import PCA
from sklearn.model_selection import GroupKFold
from sklearn.preprocessing import StandardScaler
from xgboost import XGBClassifier
from alaska2.dataset import METHOD_TO_INDEX
from a... | StarcoderdataPython |
1644153 | def factorial(n):
assert n>=0 and int(n)==n, 'The number must be positive integer only'
if n==0:
return 1
return n*factorial(n-1)
print(factorial(-8)) | StarcoderdataPython |
93718 | import tensorflow as tf
import flask
from flask import request
import base64
import cv2
import numpy as np
from PIL import Image
from io import BytesIO
import transform
# print('Downloading CUM...')
# url = 'https://face-off-ai.s3.amazonaws.com/CUMv6.h5'
# r = requests.get(url)
# with open('CUMv6.h5', 'wb') as mod:
#... | StarcoderdataPython |
1610273 | <filename>release/scripts/addons/io_mesh_ply/__init__.py
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 you... | StarcoderdataPython |
4805877 | <filename>ch03/ex09.py
"""
PIL ํจํค์ง์ numpy ํจํค์ง๋ฅผ ์ด์ฉํ๋ฉด,
์ด๋ฏธ์ง ํ์ผ(jpg, png, bmp, ...)์ ํฝ์
์ ๋ณด๋ฅผ numpy.ndarray ํ์์ผ๋ก ๋ณํํ๊ฑฐ๋
numpy.ndarray ํ์์ ์ด๋ฏธ์ง ํฝ์
์ ๋ณด๋ฅผ ์ด๋ฏธ์ง ํ์ผ๋ก ์ ์ฅํ ์ ์์ต๋๋ค.
"""
from PIL import Image
import numpy as np
def image_to_pixel(image_file):
"""์ด๋ฏธ์ง ํ์ผ ์ด๋ฆ(๊ฒฝ๋ก)๋ฅผ ํ๋ผ๋ฏธํฐ๋ก ์ ๋ฌ๋ฐ์์,
numpy.ndarray์ ํฝ์
์ ๋ณด๋ฅผ ์ ์ฅํด์ ๋ฆฌํด."""
im... | StarcoderdataPython |
105917 | <filename>sonic-xcvrd/xcvrd/xcvrd_utilities/port_mapping.py
from sonic_py_common import daemon_base
from sonic_py_common import multi_asic
from swsscommon import swsscommon
SELECT_TIMEOUT_MSECS = 1000
class PortChangeEvent:
PORT_ADD = 0
PORT_REMOVE = 1
def __init__(self, port_name, port_index, asic_id, e... | StarcoderdataPython |
1772786 | #!/usr/bin/env python
# - coding: utf-8 -
import os
import sys
import re
import gtk
import keybinder
import ConfigParser
import gconf
try:
import dbus
from dbus.mainloop.glib import DBusGMainLoop
except: pass
class GSDesktop_Helper:
def __init__(self):
self._NAME = "GSDesktop Helper"
self._VERS... | StarcoderdataPython |
169341 | <filename>scan/link_finders/find_links_for_oteps.py
###############################################################################
# Copyright (c) 2017-2020 <NAME> (Cisco Systems), #
# <NAME> (Cisco Systems), <NAME> (Cisco Systems) and others #
# ... | StarcoderdataPython |
3333327 | <reponame>resuryasin/org-eval<gh_stars>0
# from common import make_dir
def make_sheet_recap(config):
sheet = config.load_sheet(config.config['resources_path']+'/format/process.xlsx')
active_sheet_idx = 0
miss_nim = []
import os.path
for cat in config.data:
for _ in config.data[cat]:
... | StarcoderdataPython |
3371361 | import relevance
import main
import requests
from bs4 import BeautifulSoup, SoupStrainer
import urllib3
import urllib
from lxml import etree
import html2text
import re
| StarcoderdataPython |
3334501 | from os import read
import urllib
import urllib.request
try:
site = urllib.request.urlopen('http://www.cruzeiro.com.br')
except urllib.error.URLError:
print('O site Cruzeiro nรฃo estรก acessรญvel no momento.')
else:
print('O site Cruzeiro estรก acessรญvel!')
print(site.read()) | StarcoderdataPython |
3252655 | '''
Python translation of the hybrid dynamicTreeCut
Reference:
<NAME>, <NAME>, <NAME> (2007) Defining clusters from a hierarchical cluster tree:
the Dynamic Tree Cut package for R. Bioinformatics 2008 24(5):719-720
'''
from .dynamicTreeCut import cutreeHybrid
__author__ = 'kylessmith' | StarcoderdataPython |
3212024 | <reponame>drozzy/autonomous-learning-library<filename>all/agents/independent.py
from ._multiagent import Multiagent
class IndependentMultiagent(Multiagent):
def __init__(self, agents):
self.agents = agents
def act(self, state):
return self.agents[state['agent']].act(state)
| StarcoderdataPython |
45185 | """Random subset dataset.
"""
import random
import numpy as np
import torch
from torch.utils.data import Dataset
from PIL import Image
class RandomSubset(Dataset):
"""Class allows to iterate every epoch through a different random subset of the original
dataset.
The intention behind this class is to spe... | StarcoderdataPython |
1720893 | <reponame>ShellCode33/NIST-Test-Vectors<filename>nist_tests_vectors/downloader.py
# coding: utf-8
import requests_cache
requests_cache.install_cache(
cache_name='nist_cache',
backend='sqlite',
#path=args.cache,
expire_after=30 * 24 * 60 * 60 # 30 days
)
def download(algorithm: str, dest_dir: str):
... | StarcoderdataPython |
1606703 | <reponame>cfpb/cfgov-django-setup<gh_stars>0
from distutils.command.build_ext import build_ext
from subprocess import check_call
from setuptools import Command
from setuptools.command.bdist_egg import bdist_egg
from wheel.bdist_wheel import bdist_wheel
def make_build_frontend_command(script_name):
class build_fr... | StarcoderdataPython |
4834443 | """Run doctests in pug.nlp.tutil."""
from __future__ import print_function, absolute_import
import doctest
import pug.nlp.tutil
from unittest import TestCase
class DoNothingTest(TestCase):
"""A useless TestCase to encourage Django unittests to find this module and run `load_tests()`."""
def test_example(se... | StarcoderdataPython |
72109 | <filename>default_settings.py
# Copy and rename this file to settings.py to be in effect.
# Maximum total number of files to maintain/copy in all of the batch/dst directories.
LIMIT = 1000
# How many seconds to sleep before checking for the above limit again.
# If the last number is reached and the check still fails,... | StarcoderdataPython |
3355097 | """itertools.py."""
| StarcoderdataPython |
1836 | import threading
from multiprocessing import Queue
results = []
results2 = []
def take_numbers(q):
print('Enter the numbers:')
for i in range(0,3):
num1 = int(input('Enter first number: '))
num2 = int(input('Enter second number: '))
q.put(num1)
q.put(num2)
def add_num(q):
... | StarcoderdataPython |
1630219 | <filename>info_panel.py
import connection
from kivy.uix.gridlayout import GridLayout
from kivy.lang import Builder
from kivy.properties import ObjectProperty, StringProperty
class Info_Panel(GridLayout):
hostname = StringProperty("loading...")
address = StringProperty("loading...")
isup = StringProperty("... | StarcoderdataPython |
19120 | import voluptuous as vol
from homeassistant.const import CONF_HOST, CONF_NAME
from .const import (
CONF_CHILD_LOCK,
CONF_CLIMATE,
CONF_DEVICE_ID,
CONF_DISPLAY_LIGHT,
CONF_LOCAL_KEY,
CONF_TYPE,
CONF_TYPE_AUTO,
CONF_TYPE_DEHUMIDIFIER,
CONF_TYPE_FAN,
CONF_TYPE_GECO_HEATER,
CONF... | StarcoderdataPython |
1743518 | #!/usr/bin/python3
################################################################################
# license
#
# license.py
# Written by <NAME>
# April 6 2014
#
# This program will place license agreement information at the top of source
# code files It reads your information from a config file, or requests your
# in... | StarcoderdataPython |
93138 | #!/usr/bin/python
from pbsuite.utils.FileHandlers import FastqFile, M5File
from pbsuite.utils.CommandRunner import exe
"""
This can be run inside of an assembly folder and create our filling sequence into
polish.out.fasta
"""
if __name__ == '__main__':
input = FastqFile("input.fastq")
fout = open("ref.fasta"... | StarcoderdataPython |
1717082 | from typing import Optional, List
from pydantic import BaseModel, HttpUrl
from .upload import UploadStatusBase
# Shared properties
class LicenseBase(BaseModel):
name: str
url: HttpUrl
class Config:
orm_mode = True
# Properties to receive via API on creation
class LicenseCreate(LicenseBase):
... | StarcoderdataPython |
3253045 | <filename>crossval_hyper.py
#Python2,3 compatible headers
from __future__ import unicode_literals,division
from builtins import int
from builtins import range
#System packages
import torch
from torch.autograd import Variable,grad
import torch.nn.functional as F
import torch.nn as nn
import torch.optim as opt... | StarcoderdataPython |
3204155 | from collections import defaultdict
from copy import deepcopy
from enum import Enum
from pybbn.graph.edge import JtEdge
from pybbn.graph.graph import Ug
from pybbn.graph.node import SepSet, Clique, BbnNode
from pybbn.graph.potential import Potential, PotentialEntry, PotentialUtil
from pybbn.graph.variable import Varia... | StarcoderdataPython |
1663925 | #!/usr/bin/env python3
import sys
# add search paths seen from project root folder
# (used for vscode test integration)
sys.path.insert(0, 'source')
sys.path.insert(0, 'tools/ubpf')
# add search paths when run from inside test folder
# (used when running test directly)
sys.path.insert(0, '../source')
sys.path.insert(0... | StarcoderdataPython |
129913 | <reponame>zenador/sporebusbot
from setuptools import setup
setup(name='SporeBusBot',
version='1.0',
description='A Telegram bot for next bus timings in Singapore',
author='Zenador',
author_email='<EMAIL>',
install_requires=['Flask>=0.10.1'],
)
| StarcoderdataPython |
1706261 | <gh_stars>0
import json
import os
import genshin
from genshin.client import GenshinClient
class ServerData:
data = {}
@staticmethod
def register(id, name):
if id not in ServerData.data:
ServerData.data[id] = Member(name)
ServerData.save_json()
return True
... | StarcoderdataPython |
3264355 | <reponame>RobotLocomotion/drake-python3.7<filename>tools/lint/library_lint.bzl<gh_stars>1-10
# -*- python -*-
load("@drake//tools/skylark:drake_py.bzl", "py_test_isolated")
# Keep this constant in sync with library_lint_reporter.py.
_TAG_EXCLUDE_FROM_PACKAGE = "exclude_from_package"
def library_lint(
existin... | StarcoderdataPython |
18574 | print ('hello world')
print ('hey i did something')
print ('what happens if i do a ;');
print ('apparently nothing')
| StarcoderdataPython |
68584 | import json
from typing import Dict, Sequence, List, Tuple, Union
from django import forms
from django.conf import settings
from django.contrib.postgres.forms import SimpleArrayField
from utilities.choices import ColorChoices
from .utils import add_blank_choice, parse_numeric_range
__all__ = (
'APISelect',
'... | StarcoderdataPython |
3353041 | <reponame>merrymercy/MobulaOP<gh_stars>0
import ctypes
import os
import hashlib
from . import glue
from .dtype import DType, TemplateType, UnknownCType
def get_func_idcode(func_name, arg_types):
arg_types_str = ','.join([e.cname for e in arg_types])
idcode = '{func_name}:{arg_types_str}'.format(
func_... | StarcoderdataPython |
1778666 | import cv2
import PIL
import numpy
from PIL import ImageGrab
class KeyType(object):
def __init__(self, src: str, dx=None, dy=None):
self.keysrc = src
self.dx = dx
self.dy = dy
def __str__(self):
return 'key: "%s", dx: %d, dy: %d' % (self.key, self.dx, self.dy)
class Position... | StarcoderdataPython |
3278695 | <gh_stars>0
# -*- coding:utf-8 -*-
# __author__ = '<NAME>'
# Sort Model
from flask_boilerplate.extensions import db
# ่กจๅ็ผ
prefix = 'flask_boilerplate'
class Sort(db.Model):
__tablename__ = '%s_sort' % prefix
sid = db.Column(db.Integer(), primary_key=True)
sortname = db.Column(db.VARCHAR(255), nullable=... | StarcoderdataPython |
72904 | <gh_stars>0
from difflib import get_close_matches
from cumulusci.core.config import BaseConfig
from cumulusci.core.config import FlowConfig
from cumulusci.core.config import TaskConfig
from cumulusci.core.exceptions import TaskNotFoundError
from cumulusci.core.exceptions import FlowNotFoundError
def list_infos(infos... | StarcoderdataPython |
6287 | from Enigma.Rotor import Rotor
from Enigma.Reflector import Reflector
from Enigma.Plugboard import Plugboard
class Enigma:
def __init__(self , rotors = [ Rotor(0,"IC") , Rotor(0,"IIC") , Rotor(0,"IIIC") ] , plugboard = Plugboard() , reflector = Reflector("A")):
self.rotors = rotors
for i in r... | StarcoderdataPython |
1634493 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: benchmark-opencv-resize.py
import cv2
import time
import numpy as np
"""
Some prebuilt opencv is much slower than others.
You should check with this script and make sure it prints < 1s.
On E5-2680v3, archlinux, this script prints:
0.61s for system opencv 3.... | StarcoderdataPython |
3227681 | <reponame>vanttec/vanttec_usv
#!/usr/bin/env python
from include.detector_lib import Detector
from std_msgs.msg import String
from imutils.video import VideoStream
from imutils.video import FPS
from usv_perception.srv import color_id
#from srv import DistanceCal
from cv_bridge import CvBridge, CvBridgeError
from sens... | StarcoderdataPython |
1610847 | <reponame>sabunculab/RegAgnosticCSMRI
import torch
import numpy as np
from regagcsmri import utils, train, dataset, model
import argparse
import os
if __name__ == "__main__":
############### Argument Parsing #################
parser = argparse.ArgumentParser()
parser.add_argument('-fp', '--filename_prefix... | StarcoderdataPython |
82414 | <gh_stars>0
#!/usr/bin/env python
#-*- coding: utf-8 -*-
#pylint: disable=C0301,R0903,R0912,W0703,C0103,R0914,W0603,R0902,R0913
"""
Basic interface to CERN ActiveMQ via stomp
"""
from __future__ import print_function
from __future__ import division
import os
import json
import time
import socket
import random
import l... | StarcoderdataPython |
3250801 | <gh_stars>10-100
# Code generated by `typeddictgen`. DO NOT EDIT.
"""V1VolumeAttachmentStatusDict generated type."""
from typing import TypedDict, Dict
from kubernetes_typed.client import V1VolumeErrorDict
V1VolumeAttachmentStatusDict = TypedDict(
"V1VolumeAttachmentStatusDict",
{
"attachError": V1Vol... | StarcoderdataPython |
92101 | <reponame>drakoleat/personfinder<filename>app/full_text_search.py
#!/usr/bin/python2.7
# coding: utf-8
# Copyright 2015 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
#
# ht... | StarcoderdataPython |
1764202 | <filename>server/controller/solr/solrArm.py
from pysolr import Solr
import requests
class SolrArm(object):
def __init__(self, armSettings):
self.grabOptions = armSettings.grabOptions
self.armOptions = armSettings.arm
self.returnOptions = armSettings.returnOptions
self.solrAr... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.