content stringlengths 5 1.05M |
|---|
#!/usr/bin/env python
from distutils.core import setup
from pinder import __version__
setup(
name='pinder',
version=__version__,
description='Python API for Campfire.',
license='BSD',
author='Lawrence Oluyede',
author_email='l.oluyede@gmail.com',
url='http://dev.oluyede.org/pinder/',
... |
# Copyright 2020 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
##############################################
# The MIT License (MIT)
# Copyright (c) 2018 Kevin Walchko
# see LICENSE for full details
##############################################
# These are IntFlags, so you can compare them to ints. They
# start with 1 and go to N.
# ZmqType.pub == 1
# ZmqType.sub == 2
#
from enu... |
from openpyxl import Workbook, load_workbook
import os
import glob
import json
#directories
FIGRAM_PATH = '/media/mjia/Data/CNN-fMRI/FIGRIM/SCENES_700x700'
CROPPED_SUN_PATH = '/media/mjia/Data/CNN-fMRI/cropped'
TARGET_PATH = '/media/mjia/Data/CNN-fMRI/Pool'
if os.path.isdir(TARGET_PATH):
os.popen("rm -r -f" + TARG... |
# ---------------------------------------
# Program by Orlov.A.
#
#
# Version Date Info
# 1.0 2016 Initial Version
#
# ----------------------------------------
# x = 25
#
# if x == 25:
# print("YES, yo're right")
# else:
# print("NO!!!!!!!!!!!!!!!!!!!!!!!!")
age = 13
if (age <= 4):
print... |
elements = bytes([255])
print (elements[0])
|
# coding: UTF-8
import setting
TOKEN = setting.TOKEN
print(TOKEN)
## 以降ソースコード
|
# Ideal Gas Force Field
import numpy as np
class IdealGas:
def __init__(self):
pass
def __call__(self, x, *args, **kwargs):
return np.zeros_like(x) |
from http import HTTPStatus
from fastapi import Depends, Query
from starlette.exceptions import HTTPException
from lnbits.core.crud import get_user, get_wallet
from lnbits.core.services import check_invoice_status, create_invoice
from lnbits.decorators import WalletTypeInfo, get_key_type
from . import paywall_ext
fr... |
from __future__ import division
from warnings import warn
from numpy import sqrt, exp, power, linspace, interp, log, pi
from environment import Atmosphere, G_0
MAX_T_TO_W = 5
class Mission(object):
"""
A mission as defined by a list of segments.
"""
def __init__(self, segments=None, atmosphere=Non... |
import torch
import torch.nn as nn
from ..utils import ConvModule
from qd3dt.core import bbox_overlaps
class Relations(nn.Module):
def __init__(self,
in_channels=1024,
inter_channels=1024,
groups=16,
num_embed_convs=1,
share_em... |
T = int(raw_input())
for i in range (0,T):
money, item_price, exchange_wrapper = [int(x) for x in raw_input().split(' ')]
bought = money / item_price
answer = bought
wrappers = bought
while wrappers >= exchange_wrapper:
extra_items = wrappers / exchange_wrapper
answer += extra_... |
"""
abc-classroom.utils
===================
"""
import os
import subprocess
import sys
import tempfile
import textwrap
from contextlib import contextmanager
from functools import lru_cache
from shutil import copystat, copy2
from IPython import get_ipython
class Error(OSError):
pass
# a copy of shutil.copytr... |
"""
Solution to an exercise from
Think Python: An Introduction to Software Design
Allen B. Downey
This program requires Gui.py, which is part of
Swampy; you can download it from thinkpython.com/swampy.
This program started with a recipe by Noah Spurrier at
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/5219... |
import random
import discord
import discord.ext.commands as commands
from .util import checks
SHIMMY_SERVER_ID = '140880261360517120'
NSFW_ROLE_ID = '261189004681019392'
eight_ball_responses = [
# Positive
"It is certain",
"It is decidedly so",
"Without a doubt",
"Yes, definitely",
"You may... |
from tars_data_models.spendy.transaction import Transaction |
import os
from pyairtable import Table, Base, Api
from abc import ABC, abstractmethod
class DB_Connector(ABC):
@abstractmethod
def Get_Api(self):
pass
@abstractmethod
def Get_Base(self):
pass
@abstractmethod
def Get_Table(self, table_name: str):
pass
class PyAirtable_... |
import numpy as np
import matplotlib.pyplot as plt
import argparse
from random import shuffle
from mpl_toolkits.mplot3d import Axes3D
from tqdm import *
from sklearn.cluster import KMeans
from sklearn.preprocessing import normalize
from pymongo import MongoClient
from scipy.spatial import distance
from sklearn.metrics ... |
from flask import url_for
def test_hostgroups(client, access_token):
token = access_token
res = client.get(url_for('hostgroups'), headers={'authorization': "Bearer {token}".format(token=token)})
assert res.status_code == 200
assert res.json[0]['id'] == 1
assert res.json[0]['name'] == "default"
... |
'''
Configures logger
'''
import logging
import os
# Delete previous debug log
if os.path.exists("debug.log"):
os.remove("debug.log")
# Initialize logger
FORMAT = '[%(levelname)s] - %(asctime)s: %(message)s'
logging.basicConfig(handlers=[logging.FileHandler(filename='debug.log', encoding='utf-8', mode='a+')],
... |
__author__ = "Christian Kongsgaard"
__license__ = 'MIT'
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules
import matplotlib.pyplot as plt
# RiBuild Modules
from delphin_6_automation.database_interactions import mongo_setup
fro... |
import os
import warnings
import numpy as np
import pandas as pd
import uncertainties as un
import uncertainties.unumpy as unp
from matplotlib import pyplot as plt
from matplotlib import widgets
from skimage import io
from skimage.filters import sobel_v
from ...dir import d_drive, convert_dir_to_local
from ...uncerta... |
# Copyright (c) 2021 Princeton University
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import sys
import unittest
sys.path.insert(1, '../..')
from synthetic_workload_invoker.EventGenerator import *
class TestEventGenerator(unittest.TestC... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
class Solution:
def canPlaceFlowers(self, pos, n):
pos = [0] + pos + [0]
for i in range(1, len(pos)-1):
if n == 0: return True
if not (pos[i] or pos[i-1] or pos[i+1]):
pos[i] = 1
n -= 1
return n == 0
|
from devito import Eq, Operator, TimeFunction, left, right, staggered_diff
from examples.seismic import PointSource, Receiver
def ForwardOperator(model, source, receiver, space_order=4,
save=False, **kwargs):
"""
Constructor method for the forward modelling operator in an elastic media
... |
#####
# MySQL 5.5.45 (64bit) Local Credentials Disclosure
# Tested on Windows Windows Server 2012 R2 64bit, English
# Vendor Homepage @ https://www.mysql.com
# Date 05/09/2016
# Bug Discovered by Yakir Wizman (https://www.linkedin.com/in/yakirwizman)
#
# http://www.black-rose.ml
# Source Code for the executable... |
import os
import re
import sys
import json
import socket
import sqlite3
import logging
import datetime
import telegram
from time import sleep
from src.chrono import Chrono
from src.command import Task
from src.command import Command
from src.utils import get_api_token
from src.simple_parser import Parser
... |
#from django.forms import ModelForm, fields
from django import forms
from person.models import ImapServer, SmtpServer
class ImapServerForm(forms.ModelForm):
class Meta:
model = ImapServer
widgets = {
'passwd': forms.PasswordInput(),
}
class SmtpServerForm(forms.ModelForm):
... |
import click
from mysocketctl.utils import *
@click.group()
def socket():
"""Manage your global sockets"""
pass
def get_sockets(authorization_header):
api_answer = requests.get(api_url + "connect", headers=authorization_header)
validate_response(api_answer)
return api_answer.json()
def new_so... |
from rest_framework import status
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from .models import Project, Risk
from .serializers import (ProjectSerializer,
ProjectSerializerForUpdateReque... |
import urllib.request
import json
class ab_User():
def __init__(self):
self.appId = 'wxff3cfebbdcbcd135'
self.appScrect = 'b9774614f15c56e6e42884ff84ee5168'
def getOpenId(self, code):
getUrl = ' https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=au... |
"""
498. Diagonal Traverse
Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal order as shown in the below image.
Example:
Input:
[
[ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8, 9 ]
]
Output: [1,2,4,7,5,3,6,8,9]
Note:
The total number of elements of the given matrix will no... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from tqdm import tqdm
def evaluate(model, data_loader, metrics, device):
if model.training:
model.eval()
summary = {metric: 0 for metric in metrics}
for step, mb in tqdm(enumerate(data_loader), desc='steps', total=len(data_loader... |
import pytest
from cognigraph.nodes.processors import Beamformer
from cognigraph.nodes.sources import FileSource
from cognigraph.nodes.tests.prepare_tests_data import (info, # noqa
fwd_model_path,
data_path)
i... |
from pathlib import Path
import pytest
import pybmoore
@pytest.mark.parametrize(
"filename,terms",
[
(
"tests/data/br_constitution.txt",
["Deus", "Brasil"],
),
(
"tests/data/br_constitution.txt",
["Supremo Tribunal Federal", "Emenda Con... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Unit tests about articles' API"""
from logging import DEBUG
import pytest
from marucat_app import create_app
@pytest.fixture
def client():
app = create_app(level=DEBUG, db='test')
app.testing = True
return app.test_client()
def test_get_list(client):... |
# Copyright (c) 2018-2021, Texas Instruments
# 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
# list of condition... |
"""
@author: David Lei
@since: 20/10/2017
Given two sorted lists and return a list of their intersection with no
duplicates with O(1) space and O(n) run time
For example:
A[2,3,3,4,6,6,8] B[3,3,6,7,9]
should return [3, 6]
Approach:
So since they are sorted we can have pointers i looking at array a and j looking... |
from dataclasses import astuple
import agent
import numpy as np
import torch
import torch.nn as nn
from agent import NNBase
from gym import Space
from gym.spaces import Box, Dict, Discrete, MultiDiscrete
from my.env import Obs
from transformers import CLIPModel
from utils import init
def get_size(space: Space):
... |
import argparse
import os
import sys
import zipfile
def parse_args(args_list):
"""Parse input arguments."""
parser = argparse.ArgumentParser(description='install cudnn')
parser.add_argument('zipfile', help='downloaded cudnn zip file')
args = parser.parse_args(args_list)
return args
def main(args_... |
"""Configuring Django Mutadi app for Heroku"""
import django_heroku
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from .base import *
SECRET_KEY = os.environ["DJANGO_SECRET_KEY"]
DEBUG = False
ALLOWED_HOSTS = [os.environ["DJANGO_ALLOWED_HOSTS"]]
CSRF_COOKIE_SECURE = True
SESSION_CO... |
import os
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration
required_conan_version = ">=1.33.0"
class LibBasisUniversalConan(ConanFile):
name = "libbasisu"
description = "Basis Universal Supercompressed GPU Texture Codec"
homepage = "https://github.com/Binomia... |
from core import MLPActorCritic
import numpy as np
import torch
from torch.distributions import Normal
import torch.nn as nn
from torch.nn.modules import activation
from torch.nn import MSELoss
from torch.optim import Adam
import gym
import math
from skimage.transform import resize
from copy import deepcopy
# Bipedal... |
from django.conf import settings
from . import models
def init_paging_details(page_number):
page_size = settings.PAGE_SIZE
start = (page_number - 1) * page_size
return models.PagingDetails(
page_number=page_number,
start_record=start,
end_record=start + page_size,
prev_pa... |
"""
Use of this source code is governed by the MIT license found in the LICENSE file.
Socket connection
"""
import time
import threading
import logging
from queue import Queue
import socket
from plugwise.constants import SLEEP_TIME
from plugwise.connections.connection import StickConnection
from plugwise.message impor... |
import requests
url = "https://giftcards.reloadly.com/reports/transactions?startDate=2021-06-01 00:00:00&endDate=2021-06-18 23:17:02"
payload={}
headers = {
'Authorization': 'Bearer eyJraXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
'Content-Type': 'application/json',
'Accept': 'application/com.reloadly.giftcards-v1+json'
}... |
End of preview. Expand in Data Studio
Small Python Stack
This dataset contains a random sample of 20% of the Python code available in the original Stack.
- Downloads last month
- 271