id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
3382539
<gh_stars>0 import discord from discord.ext import commands import json import time import datetime import sys import psutil import time import platform def seconds_elapsed(): return time.time() - psutil.boot_time() OS = platform.platform() OS2 = platform.system() with open("cconf.json", "r") as ...
StarcoderdataPython
126432
<reponame>tlentali/cyanobyte<gh_stars>0 # Copyright (C) 2019 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 required by ...
StarcoderdataPython
1771426
import tempfile from unittest import TestCase from kg_covid_19.transform_utils.scibite_cord import ScibiteCordTransform class TestScibiteCord(TestCase): @classmethod def setUpClass(cls) -> None: cls.input_dir = "tests/resources/scibite_cord" cls.output_dir = "tests/resources/scibite_cord" ...
StarcoderdataPython
1647141
<reponame>developmentseed/ckanext-mvt<gh_stars>1-10 def task_imports(): return ['ckanext.mvt.tasks']
StarcoderdataPython
1783154
# -*- coding: utf-8 -*- from .base import Platform, MovingPlatform, FixedPlatform, MultiTransitionMovingPlatform __all__ = ['Platform', 'MovingPlatform', 'FixedPlatform', 'MultiTransitionMovingPlatform']
StarcoderdataPython
3384392
<reponame>underscorefan/itsachemtrail_gatherer from .url2doc import soup_from_response, new_soup, get_html
StarcoderdataPython
3226465
#!/usr/bin/env python3 # -*-coding:utf-8-*- from PySide2.QtWidgets import QApplication, QWidget, QLabel, QVBoxLayout, \ QPushButton, QLineEdit, QMessageBox class Form(QWidget): def __init__(self): super().__init__() nameLabel = QLabel("Name:") self.nameLine = QLineEdit() self....
StarcoderdataPython
1660047
<reponame>NSLS-II-OPLS/profile_collection from bluesky.callbacks.fitting import PeakStats import bluesky.preprocessors as bpp # NEEDS TO BE FIXED def set_zero_alpha(): chi_nom=geo.forward(0,0,0).chi yield from set_chi(chi_nom) phi_nom=geo.forward(0,0,0).phi yield from set_phi(phi_nom) tth_nom=ge...
StarcoderdataPython
194266
<gh_stars>1-10 # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Krb5(AutotoolsPackage): """Network authentication protocol""" homepage...
StarcoderdataPython
3284700
<reponame>46graus/pagarme-python # -*- coding: utf-8 -*- import os import re from setuptools import setup, find_packages __description__ = 'Pagar.me Python' __long_description__ = 'Python library for Pagar.me API' __author__ = '<NAME>, <NAME>' __author_email__ = '<EMAIL>' __special_things__ = '<NAME>, <NAME>' testi...
StarcoderdataPython
191410
from collections import ChainMap import logging import time import sys import GetArgs import GetSite from Config import Defaults from Config import LoadSites from Config import LoadConfig from Config import Settings def work(): def init_config(): args = GetArgs.get_args() return ChainMap(args, L...
StarcoderdataPython
3377654
# Generated by Django 3.2.8 on 2021-11-15 20:13 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('usuarios', '0002_auto_20211115_1703'), ] operations = [ migrations.RenameModel( old_name='Funcionarios', new_name='Funcionar...
StarcoderdataPython
1662972
<filename>tests/test_main.py from lrc_kit import ComboLyricsProvider, SearchRequest, KugouProvider, Flac123Provider, MegalobizProvider, PROVIDERS import lrc_kit import logging, os LOGGER = logging.getLogger(__name__) LOGGER.setLevel('DEBUG') def test_custom(): providers = lrc_kit.MINIMAL_PROVIDERS + [lrc_kit.Flac...
StarcoderdataPython
30360
<reponame>myworldhere/dailyfresh # coding=utf-8 from django.shortcuts import render, redirect from django.core.paginator import Paginator from models import * from haystack.views import SearchView # Create your views here. def index(request): category_list = Category.objects.all() array = [] for category...
StarcoderdataPython
154450
class Solution: def XXX(self, nums: List[int]) -> int: l=len(nums) ans=0 i=0 while 1: if (nums[ans]==nums[i+1]): i+=1 else: nums[ans+1]=nums[i+1] i+=1 ans+=1 if i>l-2: ...
StarcoderdataPython
3281326
<gh_stars>10-100 ''' Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you ...
StarcoderdataPython
1757134
<gh_stars>1-10 from setuptools import find_packages, setup with open("README.rst", "r") as readme: long_description = readme.read() setup( name = 'uwVIKOR', packages = find_packages(include=['uwVIKOR']), version = '0.1.0', author = '<NAME>', author_email='<EMAIL>', description = 'Unweighte...
StarcoderdataPython
3387393
<reponame>MIT-Hydration/HydrationIII from time import sleep # this lets us have a time delay import time from abc import ABC, abstractmethod # https://docs.python.org/3/library/abc.html import numpy import threading import configparser config = configparser.ConfigParser() config.read('config.ini') if config.getbo...
StarcoderdataPython
1636399
from __future__ import division import argparse import matplotlib.pyplot as plt import pickle import gzip import numpy as np import tensorflow as tf import matplotlib.gridspec as gridspec import os # from tensorflow.examples.tutorials.mnist import input_data # np.set_printoptions(threshold=np.inf) f =gzip.open('./scre...
StarcoderdataPython
1609326
<filename>modules/PiDisplaySleep/main.py<gh_stars>0 from os import popen,system from time import sleep state=1 #State of the display 1 On 0 Off ip="192.168.86.26" #Enter the IP address of the device that should keep the display awake while True: nmap_out=str(popen('nmap -sP '+ip).read()) #nmap command to scan on t...
StarcoderdataPython
3203589
<reponame>mattkjames7/themissc ''' Prod L Description ======================================================================== FGM 2 Fluxgate Magnetometer Level 2 CDF FGM 1 Fluxgate Magnetometer Level 1 CDF FGE 0 Fluxgate Magnetometer Engineering Rate L0 Packets FGH 0 Fluxgate Magnetometer High Rate Level 0 Packe...
StarcoderdataPython
1724164
<reponame>kojit/calendar_sync_garoon_outlook<filename>calendar_sync_garoon_outlook.py from pathlib import Path import base64 import datetime as dt import dateutil import json import requests from O365 import Account CONFIG_FILE = 'calendar_sync_garoon_outlook.json' WEEKS = 2 MAX_EVENT_NUM = 100 def get_period(): ...
StarcoderdataPython
194387
# -*- coding: utf-8 -*- # @Time : 2019-05-15 15:52 # @Author : ShaHeTop-Almighty-ares # @Email : <EMAIL> # @File : run.py # @Software: PyCharm import os import warnings import platform import threading from ApplicationExample import create_app from ExtendRegister.hook_register import * # 导入拦截器 from ExtendRe...
StarcoderdataPython
1769190
import numpy as np # linear algebra import pandas as pd import pickle from sklearn.naive_bayes import MultinomialNB from sklearn.model_selection import train_test_split file = pd.read_excel("../datasets/SportsArticles/features.xlsx") file.dropna() #print(str(file.head())) # Get columns names #print(str(list(file)))...
StarcoderdataPython
3292932
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
StarcoderdataPython
1677684
import numpy as np import matplotlib.pyplot as plt xm = np.array([78, 82, 72, 76, 74, 69]) xp = np.array([65, 70, 62, 82]) ym = np.array([44.44, 46.32, 90.91, 83.33, 78.95, 74.44]) yp = np.array([94.94, 84.51, 99.12, 42.55]) plt.scatter(xp, yp, c = 'c', marker = 'o', label = "Puiši") plt.scatter(xm, ym,c = 'm', m...
StarcoderdataPython
1771817
# Copyright 2015 Palo Alto Networks, 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 required by applicable law or agre...
StarcoderdataPython
3337373
<reponame>Balogunolalere/masonite-crud """Post Model.""" from masoniteorm.models import Model class Post(Model): """Post Model.""" __table__ = 'posts' __fillable__ = ['title', 'author', 'body', 'description']
StarcoderdataPython
137868
<reponame>mccreery/sandbox import math class Point(object): def __init__(self, x, y): self.x = x self.y = y def __repr__(self): return "(" + str(self.x) + ", " + str(self.y) + ")" def rotate(self, angle): sin = math.sin(angle) cos = math.cos(angle) x = self...
StarcoderdataPython
44736
#!/usr/bin/python import hsgw from sys import argv, exit if len(argv) != 4: print argv[0], "<key> <addr> <value>" (key, addr, value) = argv[1:] print "key =", key print "addr =", addr print "value =", value if not hsgw.initConnection(key = key): print "Could not initialize connection." exit(1) print "S...
StarcoderdataPython
3359007
# Copyright 1999-2020 Alibaba Group Holding Ltd. # # 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 a...
StarcoderdataPython
1787414
import cv2 as cv import os import imutils # La capa de entrada es la primera parte de nuestra pequeña red neuronal que almacenara # todos los datos iniciales de Reconocimiento Facial class Capa1Entrada(): def __init__(self): pass # La funcion busca la ruta y verifica si existe la carpeta ...
StarcoderdataPython
35078
<filename>slack_bolt/response/__init__.py<gh_stars>100-1000 from .response import BoltResponse
StarcoderdataPython
1756689
<gh_stars>0 from .core import get_tweets from .console import get_text def main(): text = get_text() if text: for tweet in get_tweets(text): print(tweet)
StarcoderdataPython
1645837
# !pip install selenium from selenium import webdriver from selenium.webdriver.common.keys import Keys from time import sleep, strftime from random import randint import pandas as pd from selenium.webdriver.common.by import By import time from config import * import logging logging.basicConfig(filename='test.log', l...
StarcoderdataPython
3328264
<gh_stars>0 import os from os import path as p import petpy import pandas import json key = os.getenv('API_KEY') secret = os.getenv('SECRET') pf = petpy.Petfinder(key=key, secret=secret) def breeds(): if p.exists("cats/cat_breeds.json") and p.exists("dogs/dog_breeds.json"): print("json already genera...
StarcoderdataPython
3206106
<filename>web3auth/fields.py from django.db import models from django import forms from web3auth.utils import validate_eth_address, validate_eth_transaction class EthAddressField(models.CharField): def __init__(self, *args, **kwargs): if 'max_length' not in kwargs: kwargs['max_length'] = 42 ...
StarcoderdataPython
191027
'''OpenGL extension SGIX.calligraphic_fragment This module customises the behaviour of the OpenGL.raw.GL.SGIX.calligraphic_fragment to provide a more Python-friendly API The official definition of this extension is available here: http://www.opengl.org/registry/specs/SGIX/calligraphic_fragment.txt ''' from OpenGL i...
StarcoderdataPython
94528
<reponame>sanskarvijpuria/Deposit-Information-System from num2words import num2words import streamlit as st from annotated_text import annotated_text import pandas as pd from babel.numbers import format_currency, format_decimal st.set_page_config(page_title= "Deposit Information", layout='wide', initial_sideba...
StarcoderdataPython
3259917
from django.contrib import admin from .models import Untappd, UntappdMapping, UserCheckIn, UserWishList # Register your models here. class UntappdAdmin(admin.ModelAdmin): list_display = ('beer_id', 'brewery', 'style', 'rating', 'num_r...
StarcoderdataPython
101781
import pPEG print("Arith operatpr expression example....") arith = pPEG.compile(""" exp = add add = sub ('+' sub)* sub = mul ('-' mul)* mul = div ('*' div)* div = pow ('/' pow)* pow = val ('^' val)* grp = '(' exp ')' val = " " (sym / num / grp) " " sym = [a-zA-Z]+ num = [0-9]+ """) tests = [ ...
StarcoderdataPython
1711179
<reponame>cleoold/types-linq from typing import TypedDict class ModuleSpec(TypedDict): file_path: str name: str classes: dict[str, 'ClassSpec'] class ClassSpec(TypedDict): methods: set[str] readonly_properties: set[str] # ========================================================== # This describe...
StarcoderdataPython
4818412
<gh_stars>0 import os def parseMegan(filename, prefix=""): ''' Takes the MEGAN_info file generated from the MEGAN GUI and split it into the respective categories (TAX, INTERPRO2GO etc). ''' output = {} key = "" data = "" with open(filename,"r") as f: while True: line = f...
StarcoderdataPython
1742593
import auxly.filesys import auxly.shell from auxly._modu import * from auxly._modu import __version__
StarcoderdataPython
1785521
<filename>common/commandqueue.py<gh_stars>0 # Command Queue is a queue to store command from collections import deque class Command: """ Command class that represents a command """ def __init__(self, id): self.id = id class CommandQueue: def __init__(self, MaxSize): self.CmdQueue = dequ...
StarcoderdataPython
80888
''' Tasks which control a plant under pure machine control. Used typically for initializing BMI decoder parameters. ''' import numpy as np import time import os import pdb import multiprocessing as mp import pickle import tables import re import tempfile, traceback, datetime import riglib.bmi from riglib.stereo_opengl...
StarcoderdataPython
1632480
import os from app import create_app, db from app.models import User """ Populates a test database with a root user """ app = create_app("test") with app.app_context(): root = User.query.filter_by(email="<EMAIL>").first() if root is None: root = User( username="sudo", ...
StarcoderdataPython
1730863
# -*- coding: utf-8 -*- import argparse import os from os.path import abspath, dirname, exists, join from shutil import rmtree from subprocess import call from tempfile import mkdtemp REPO_ROOT = dirname(dirname(abspath(__file__))) TEMPLATE_PATH = join(REPO_ROOT, 'project_template') DEV_SITE_NAME = 'dev_site' DEV_SIT...
StarcoderdataPython
186513
<gh_stars>0 from __future__ import division try: import caffe except: pass import torch import math import random from PIL import Image, ImageOps try: import accimage except ImportError: accimage = None import numpy as np import numbers import types import collections import torchvision.transforms.func...
StarcoderdataPython
199917
#!/usr/bin/python import os import sys from cryptography.fernet import Fernet from manageInventory import manage_host_config class manage_sec(manage_host_config): def __init__(self, **kwargs): super(manage_sec, self).__init__() def generateKey(self): return Fernet.generate_key() def creat...
StarcoderdataPython
64644
import os from pathlib import Path import cv2 import numpy as np import pandas as pd from pandas import DataFrame from sklearn.model_selection import train_test_split def create_info_csv(mvtec_dir: Path) -> DataFrame: df = pd.DataFrame({}) for data_type in ["train", "test"]: for p in mvtec_dir.glob...
StarcoderdataPython
3392768
<gh_stars>1-10 # -*- coding: utf-8 -*- """ Created on Wed Sep 19 14:40:44 2012 @author: VHOEYS """ import numpy as np import scipy as sp from scipy import special import matplotlib.pyplot as plt import matplotlib as mpl mpl.rcParams['font.size'] = 14 mpl.rcParams['axes.labelsize'] = 20 mpl.rcParams['lin...
StarcoderdataPython
1637353
from ddq.topics.logics.logic import Node class Quantifier(Node): pass
StarcoderdataPython
1760134
from __future__ import print_function import logging import os import random import numpy as np from tqdm import tqdm, trange from transformers_config import * import torch from torch.utils.data import DataLoader, RandomSampler ## Optimization from transformers import ( WEIGHTS_NAME, AdamW, get_linear_s...
StarcoderdataPython
1776204
<filename>algorithm/python/quick_sort.py #--------------------------------------------------------------- # QUICK SORT #--------------------------------------------------------------- # V0 # steps # 0) get pivot (last element from original array) # 1) init big, small sub array # 2) loop over element # -> put "<...
StarcoderdataPython
3203302
# Generated by Django 2.0.3 on 2018-06-18 22:12 import django.utils.timezone from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('zhihu', '0003_auto_20180616_2256'), ] operations = [ migrations.AddField( model_name='answercomment'...
StarcoderdataPython
91491
# Generated by Django 2.2.5 on 2020-11-12 01:58 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('users', '0011_auto_20201024_1533'), ] operations = [ migrations.RemoveField( model_name='costcenter', name='active', ...
StarcoderdataPython
3302228
#coding:utf-8 # # id: bugs.core_0053 # title: FIRST 1 vs ORDER DESC vs explicit plan (ODS11) # decription: # Test uses pre-created database which has several procedures for analyzing performance by with the help of MON$ tables. # Performance results are gathered in t...
StarcoderdataPython
63797
import pandas as pd import urllib.request # Linear pathway data BASE_URL = "https://github.com/sys-bio/network-modeling-summer-school-2021/raw/main/" BASE_DATA_URL = "%sdata/" % BASE_URL BASE_MODULE_URL = "%ssrc/" % BASE_URL BASE_MODEL_URL = "%smodels/" % BASE_URL LOCAL_FILE = "local_file.txt" def getData(csvFilenam...
StarcoderdataPython
3310020
# -*- coding: utf-8 -*- import io import socket import struct import time MSG_SIZE_FIELD_SIZE = 4 API_KEY_FIELD_SIZE = 2 API_VERSION_FIELD_SIZE = 2 FLAGS_FIELD_SIZE = 2 PARTITION_KEY_FIELD_SIZE = 4 TOPIC_SIZE_FIELD_SIZE = 2 TIMESTAMP_FIELD_SIZE = 8 KEY_SIZE_FIELD_SIZE = 4 VALUE_SIZE_FIELD_SIZE = 4 ANY_PARTITION_FIXE...
StarcoderdataPython
1651751
# Copyright 2020 The SQLFlow Authors. All rights reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
StarcoderdataPython
147617
#!/usr/bin/env python import roslib roslib.load_manifest('crazyflie_control') import rospy import sys from geometry_msgs.msg import Vector3 from nav_msgs.msg import Odometry from crazyflie_driver.msg import RPYT import dynamic_reconfigure.server from crazyflie_control.cfg import CrazyflieControlConfig from math imp...
StarcoderdataPython
1613602
""" Implements a task queue worker and routing. This is just a template and not the actual script which is run. Actual scripts can be found in /etc/appscale/celery/workers. Find and replace the following: APP_ID: Set this to the current application ID. CELERY_CONFIGURATION: The name of the celery ...
StarcoderdataPython
194603
import nomad.api as api import os class Nomad(object): def __init__(self, host='127.0.0.1', secure=False, port=4646, address=os.getenv('NOMAD_ADDR', None), namespace=os.getenv('NOMAD_NAMESPACE', None), token=os.getenv('NOMAD_TOKEN', None), timeout=5, ...
StarcoderdataPython
3393998
<reponame>mashaka/TravelHelper """ Copyright 2017, MachineHeads Author: <NAME> Description: Utils """ from geopy.distance import great_circle def flatten_music_events(music_events): """ Change a structure of JSON array Args: music_events: [{ "name": "<NAME>", "events": [{ ...
StarcoderdataPython
3224504
# Python3 from solution1 import arrayPacking as f qa = [ ([24, 85, 0], 21784), ([23, 45, 39], 2567447), ([1, 2, 4, 8], 134480385), ([5], 5), ([187, 99, 42, 43], 724198331) ] for *q, a in qa: for i, e in enumerate(q): print('input{0}: {1}'.format(i + 1, e)) ans = f(*q) if ans !...
StarcoderdataPython
4812327
import math import config class Object(object): def __init__(self, position=(0., 0.), velocity=(0., 0.), acceleration=(0., 0.), angle=0., rotation_speed=0.5): self.position = position self.velocity = velocity self.acceleration = acceleration self.angle = angle self.rotatio...
StarcoderdataPython
166241
from pathlib import Path import hydra import numpy as np import torch from hydra.utils import to_absolute_path from nnsvs.base import PredictionType from nnsvs.mdn import mdn_loss from nnsvs.pitch import nonzero_segments from nnsvs.train_util import save_checkpoint, setup from nnsvs.util import make_non_pad_mask from ...
StarcoderdataPython
1630728
<filename>fable/long.py def fromBits(lowBits: int, highBits: int, unsigned: bool): return lowBits + (highBits << 32) def op_LeftShift(self, numBits): return self << numBits
StarcoderdataPython
144851
<reponame>boniaditya/scraping from bs4 import BeautifulSoup import urllib2 import requests def get_tree(url): source = urllib2.urlopen(url).read() tree = BeautifulSoup(source, "html.parser") return tree happyhours = 'https://www.downtownla.com/explore/dining-nightlife' happy_source = urllib2.urlopen(happ...
StarcoderdataPython
1653234
<filename>purchases/views.py from typing import List from django.db.models import Count, F, QuerySet from django.urls import reverse from rest_framework import status from rest_framework.decorators import action from rest_framework.permissions import BasePermission, IsAdminUser, IsAuthenticated from rest_framework.req...
StarcoderdataPython
71746
<filename>virtual/lib/python3.6/site-packages/alembic/__init__.py<gh_stars>0 import sys from . import context from . import op __version__ = "1.7.4"
StarcoderdataPython
188999
<reponame>everthemore/opyrators import unittest import sys sys.path.append("..") from opyrators.fermions import operator class optermTest(unittest.TestCase): def setUp(self): return def test_operator_addition(self): A = operator({"112233":0.2}) B = operator({"112230":1.3}) C = ...
StarcoderdataPython
1681128
#!/usr/bin/env python # # generate a tester program for the API # import sys import os import string try: import libxml2 except: print("libxml2 python bindings not available, skipping testapi.c generation") sys.exit(0) if len(sys.argv) > 1: srcPref = sys.argv[1] + '/' else: srcPref = '' # # Module...
StarcoderdataPython
1710940
from .attribute_builder import AttributeBuilder class Method(AttributeBuilder): """ Represents 'method' attribute. """ def __init__(self): super().__init__() self.attributes = ["method"]
StarcoderdataPython
87238
import os from dataclasses import dataclass, field from enum import Enum from typing import Any, List, Optional from hydra.core.config_store import ConfigStore from omegaconf import MISSING from hiding_adversarial_attacks.config.attack.adversarial_attack_config import ( ALL_CLASSES, ) from hiding_adversarial_atta...
StarcoderdataPython
1700572
from copy import deepcopy import json import re from django.shortcuts import render, redirect from django.core.urlresolvers import reverse from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.contrib import messages from django.http import StreamingHttpRespon...
StarcoderdataPython
132583
<filename>Classification Based Machine Learning for Algorithmic Trading/default_predictions/SGDClassifier.py<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Sun Jun 25 22:02:07 2017 @author: Anthony """ import numpy as np import pandas as pd df = pd.read_csv("dataset_2.csv") df['default'].describe() sum(df['default...
StarcoderdataPython
161514
<gh_stars>1-10 """Computes the frame of the relevant cubes in the specified base frame.""" # Copyright (c) 2022, ABB # All rights reserved. # # Redistribution and use in source and binary forms, with # or without modification, are permitted provided that # the following conditions are met: # # * Redistributions of s...
StarcoderdataPython
1678990
# -*- coding: UTF-8 -*- ############################################################################## # # # Copyright (c) 2007-2010 <NAME> <<EMAIL>> # # ...
StarcoderdataPython
3315182
# coding: utf-8 """Attention module. Attention as defined in Attention is All you Need. https://arxiv.org/abs/1706.03762 """ from typing import Union, Optional import torch import torch.nn as nn from sgcn.masked.tensor import MaskedTensor from . import affinity as aff from . import normalization as norm class At...
StarcoderdataPython
75268
<gh_stars>0 #!/usr/bin/python3 import cherrypy import json static_dir = '/templates/' # Needs to have trailing and leading slash '/' class wellcome(object): '''Base Index constructor and expose function''' @cherrypy.expose def index(self): result = '''{ "firstName": "John", ...
StarcoderdataPython
3234050
<reponame>joewalk102/Adafruit_Learning_System_Guides # Quote board matrix display # uses AdafruitIO to serve up a quote text feed and color feed # random quotes are displayed, updates periodically to look for new quotes # avoids repeating the same quote twice in a row import time import random import board import term...
StarcoderdataPython
77203
<reponame>appointlet/span<gh_stars>1-10 from setuptools import setup setup( name="span", version="0.0.1", description="Helper for determining basic relationships between datetime ranges", long_description="Helper for determining basic relationships between datetime ranges", keywords="span, datetime...
StarcoderdataPython
20867
<reponame>blackcow/pytorch-cifar-master 第一题: import io import sys sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8') #str = input() #print(str) class Solution(object): def findMedium(l): length = len(l) l.sort() # 如果为奇数,输出中间的值 if length % 2 != 0: print(l[l...
StarcoderdataPython
3244276
from collections import deque from multiprocessing import Queue from threading import Thread, Condition import threading import traceback from typing import TypeVar, Generic, List, Optional from tudelft.utilities.listener.Listener import Listener from uri.uri import URI from geniusweb.connection.ConnectionEnd import ...
StarcoderdataPython
3243245
<reponame>vishalbelsare/tensorflow-riemopt<filename>tensorflow_riemopt/manifolds/hyperboloid_test.py import tensorflow as tf from absl.testing import parameterized from tensorflow.python.keras import combinations from tensorflow_riemopt.manifolds.test_invariants import ( TestInvariants, random_constant, ) fro...
StarcoderdataPython
4829349
<gh_stars>1-10 # add this to force db migrate to detect models from .model import User, UserConfirmation # noqa
StarcoderdataPython
1703555
""" Copyright (c) 2021, Electric Power Research Institute All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this li...
StarcoderdataPython
85714
from .common import get_tfvars_file, replace_tfvars, passwd_generator def configure_sonarqube_container(): """ Configure a containerized Sonar server. """ replace_tfvars("dockerizedSonarqube", "true", get_tfvars_file(), False) replace_tfvars('sonar_username', "admin", get_tfvars_file()) re...
StarcoderdataPython
36372
from ...reqs import publications from .. import main class Post(main._all["publication"]): """ Имитирует объект поста. """ __slots__ = ( "pages", "best_comment", "rubric_id", "rubric_name" ) def __init__(self, content): """ Создать класс...
StarcoderdataPython
81947
<filename>Genetic Algorithms/DEAP/Sudoku.py ''' May 27, 2019 <NAME>. This files utilizes the DEAP framework to implement a genetic algorithm and create a Sudoku. ''' import random import math import numpy as np import matplotlib.pyplot as plt from deap import base, creator, tools, algorithms class GenerateSudoku(): ...
StarcoderdataPython
4817782
# proxy module from __future__ import absolute_import from apptools.help.help_plugin.help_plugin import *
StarcoderdataPython
3341495
''' Author: He,Yifan Date: 2022-02-16 20:02:10 LastEditors: He,Yifan LastEditTime: 2022-02-20 22:46:22 ''' from functools import partial import os import time import numpy as np import yaml import sys from pgsyn.gp.estimators import PushEstimator from pgsyn.gp.genome import GeneSpawner from pgsyn.knowledge.base impo...
StarcoderdataPython
4810504
<reponame>neonbjb/DL-Art-School import torch import torch.nn as nn import torch.nn.functional as F from models.arch_util import ConvGnLelu, default_init_weights, make_layer from models.diffusion.nn import timestep_embedding from trainer.networks import register_model from utils.util import checkpoint # Conditionally...
StarcoderdataPython
1705391
<reponame>gadomski/pystac-client import json import logging from copy import deepcopy from typing import Callable, Iterator, Optional from urllib.parse import urlparse from urllib.request import Request, urlopen import requests from pystac import STAC_IO from .exceptions import APIError logger = logging.getLogger(__...
StarcoderdataPython
1726681
<filename>journal/models.py import datetime from django.db import models from django.utils import timezone class JournalEntry(models.Model): heading_text = models.CharField(max_length=200) entry_text = models.TextField() pub_date = models.DateTimeField('date published') def __str__(self): re...
StarcoderdataPython
4803134
<filename>supervisor/discovery/services/zwave_js.py<gh_stars>100-1000 """Discovery service for Zwave JS.""" import voluptuous as vol from supervisor.validate import network_port from ..const import ATTR_HOST, ATTR_PORT # pylint: disable=no-value-for-parameter SCHEMA = vol.Schema( { vol.Required(ATTR_HOST...
StarcoderdataPython
3204924
<reponame>hboueix/PyCheckers<filename>app/modules/inputbox.py import pygame COLOR_INACTIVE = pygame.Color('lightskyblue3') COLOR_ACTIVE = pygame.Color('dodgerblue2') class InputBox(pygame.sprite.Sprite): def __init__(self, x, y, w, h, text=''): super().__init__() self.rect = pygame.Rect(x, y, w,...
StarcoderdataPython
157684
#! /usr/bin/python # -*- coding: utf-8 -*- # # gdbm_create.py # # Jul/13/2010 import sys import string import anydbm # sys.path.append ('/var/www/uchida/data_base/common/python_common') # from dbm_manipulate import dbm_disp_proc,dbm_update_proc # ------------------------------------------------------------- print (...
StarcoderdataPython