content stringlengths 5 1.05M |
|---|
from __future__ import division
from operator import attrgetter
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import MAIN_DISPATCHER, DEAD_DISPATCHER
from ryu.controller.handler import CONFIG_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.lib import... |
import torch
from torch.utils.data import DataLoader, Dataset
import numpy as np
from librosa.util import find_files
from torchaudio import load
from torch import nn
import os
import re
import random
import pickle
import torchaudio
import sys
import time
import glob
import tqdm
from pathlib import Path
CACHE_PATH = ... |
"""
A component which allows you to send data to an Influx database.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/influxdb/
"""
import logging
import voluptuous as vol
from homeassistant.const import (
EVENT_STATE_CHANGED, STATE_UNAVAILABLE, STA... |
# Generated by Django 3.1.7 on 2021-03-07 16:44
from django.db import migrations
import django_enumfield.db.fields
import events.models
class Migration(migrations.Migration):
dependencies = [
('events', '0047_participant_date_of_birth'),
]
operations = [
migrations.AlterField(
... |
import warnings
import numpy as np
import torch
import torch.nn.functional as F
from sklearn import metrics
from torch.utils.data import DataLoader, SequentialSampler, TensorDataset
from tqdm import tqdm
from datasets.bert_processors.abstract_processor import convert_examples_to_features
from utils.preprocessing impo... |
from django.conf import settings
from django.conf.urls.static import static
from django.urls import path
from . import views
urlpatterns = [
path('', views.events_home, name='events_home'),
# Events urls.
path('eventos/', views.events_list, name='event_list'),
path('eventos/<pk>/configuracion/', views.... |
from ipykernel.comm import Comm
from varname import nameof
import inspect
# import threading
from multiprocessing import Process
from .mwserver import run_server, run_server_from_id
import uuid
import subprocess
import threading
# jupyter notebook --ip='*' --NotebookApp.token='' --NotebookApp.iopub_data_rate_l... |
import sys, os, collections, copy
import numpy as np
import pandas as pd
from pandas import DataFrame, Series
data_fn = 'data/WikiQA-train.tsv'
X = pd.read_csv(data_fn, sep='\t', header=0, dtype=str, skiprows=None, na_values='?', keep_default_na=False)
|
# -*- coding:utf-8 -*-
'''!
@file interrupt.py
@brief Interrupt detection of free fall, an interrupt signal will be generated in int1 once a free fall event occurs.
@n When a free-fall motion is detected, it will be printed on the serial port.
@n When using SPI, chip select pin can be modified by changing ... |
from django.conf.urls import url
from rest_framework_jwt.views import obtain_jwt_token
from . import views
from .views import RegisterUsernameCountAPIView, UserCenterInfoAPIView, UserEmailInfoAPIView,UserEmailVerificationAPIView, \
AddressViewSet
urlpatterns = [
url(r'^usernames/(?P<username>\w{5,20})/count/$... |
## Plotting functions
# Imports
import math
import matplotlib.pyplot as plot
import pandas
import seaborn
from evolve_soft_2d import file_paths
################################################################################
def histogram(
template,
tm: str,
data: list,
t: str,
y: str,
x:... |
from .box_colombia import BoxColombia
from .box_daily_square import BoxDailySquare
from .box_don_juan import BoxDonJuan
from .box_don_juan_usd import BoxDonJuanUSD
from .box_office import BoxOffice
from .box_partner import BoxPartner
from .box_provisioning import BoxProvisioning
|
from mintools import ormin
class Chaininfo(ormin.Model):
bestblockhash = ormin.StringField()
blocks = ormin.IntField()
mediantime = ormin.IntField()
class Block(ormin.Model):
height = ormin.IntField(index=True)
blob = ormin.TextField()
class Tx(ormin.Model):
blockhash = ormin.StringField(ind... |
# -*- coding: utf-8 -*-
"""Simple OSC client."""
import socket
try:
from ustruct import pack
except ImportError:
from struct import pack
from uosc.common import Bundle, to_frac
if isinstance("", bytes):
have_bytes = False
unicodetype = unicode # noqa
else:
have_bytes = True
... |
# Copyright (c) 2018 Robin Jarry
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distrib... |
import sys
import re
from setuptools.command.test import test as TestCommand
from setuptools import setup
from setuptools import find_packages
metadata = dict(
re.findall("__([a-z]+)__ = '([^']+)'", open('consul/__init__.py').read()))
requirements = [
x.strip() for x
in open('requirements.txt').readlin... |
import uuid
from app.api.models.namespaces import NamespacePrimaryKey, NamespaceSchema, NamespaceResources, NamespacePrimaryKeyProjectID
from app.db import namespaces, database
async def post(payload: NamespaceSchema):
query = namespaces.insert().values(payload.dict())
return await database.execute(query=que... |
# 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 may not u... |
import logging
from webapp2_extras.auth import InvalidAuthIdError, InvalidPasswordError
from authentication import BaseHandler
from authentication import app
@app.route('/login', 'login')
class LoginHandler(BaseHandler):
def get(self):
self._serve_page()
def post(self):
username = self.requ... |
import random
class Dealer:
'''
Represents the dealer in the game.
Responsible for drawing a card and showing it.
Responsible for showing the current card.
Attributes: last_card, current_card
'''
def __init__(self):
#Initializes the last card and sets current card equal to it
... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os,sys,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
from twitter import updater
from selenium import webdriver
from selenium.webdriver.common.k... |
import cv2
import numpy as np
from sklearn.metrics import mutual_info_score
import time
from tkinter import Tk
from tkinter.filedialog import askopenfilename
start_time = time.time()
detector = cv2.ORB_create()
Tk().withdraw()
path1 = askopenfilename(initialdir = "E:\Research\Datasets\MVS",
fi... |
# 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 Geant4(CMakePackage):
"""Geant4 is a toolkit for the simulation of the passage of particl... |
# import_export_ballotpedia/views_admin.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from .controllers import attach_ballotpedia_election_by_district_from_api, \
retrieve_ballot_items_for_one_voter_api_v4, \
retrieve_ballot_items_from_polling_location, retrieve_ballot_items_from_polling_loc... |
from django.contrib import admin
from . import models
admin.site.site_header = 'FAIR Data Management'
class BaseAdmin(admin.ModelAdmin):
"""
Base model for admin views.
"""
readonly_fields = ('updated_by', 'last_updated')
list_display = ('last_updated',)
def save_model(self, request, obj, f... |
#!/usr/bin/env python
from I3Tray import *
from os.path import expandvars
from icecube import icetray,dataclasses,dataio,phys_services
amageofile = expandvars("$I3_SRC/phys-services/resources/amanda.geo")
icecubegeofile = expandvars("$I3_SRC/phys-services/resources/icecube.geo")
tray = I3Tray()
tray.AddModule("I3Inf... |
import pytest
import numpy as np
from mcalf.utils.smooth import moving_average, gaussian_kern_3d, smooth_cube, mask_classifications
from ..helpers import class_map
def test_moving_average():
x = np.array([0.4, 1.2, 5.4, 8, 1.47532, 23.42, 63, 21, 14.75, 6, 2.64, 0.142])
res = moving_average(x, 2)
asser... |
def Validate(num, tar):
v = 0
while num>0:
v += num
num //= 10
return v == tar
if __name__ == '__main__':
s = input()
digits = len(s)
s = int(s)
chushu = 1
chenshu = 1
for i in range(digits-1):
chenshu*=10
chushu = chushu*10+1
success = False
... |
import urllib,json
def btc_alarm():
VOL_BUY=20
VOL_DIFF=100
url = "https://api.bitfinex.com/v1/trades/btcusd?limit_trades=500"
trades=json.loads(urllib.urlopen(url).read())
past_time=trades[0]['timestamp']-5*60
buy_volume=[float(trade['amount']) for trade in trades if trade['type']=='buy' and... |
from manim_imports_ext import *
class KmpPrefixScene(AlgoScene):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.data = "cbccbcbccb"
def compute_prefix_function(self):
t = self.data
n = len(t)
prefix = np.zeros(n, dtype=int)
prefix[0] = ... |
################################################################################
# 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... |
from itertools import permutations
class Solution:
def getProbability(self, balls: List[int]) -> float:
setOfBalls = []
currentBall = 1
for b in balls:
setOfBalls.extend([currentBall] * b)
currentBall += 1
equal = 0
total = 0
for choice in... |
from .item import get_basket_item_model
from .basket import get_basket_model, BaseBasket
from ..settings import basket_settings
if basket_settings.is_dynamic:
from .item import DynamicBasketItem
|
import pandas as pd
import plotly.express as px
prices = pd.read_csv("prices_history.csv", index_col=0)
prices.index = pd.to_datetime(prices.index, unit="s")
prices_change = prices / prices.mean()
print(prices_change)
prices_total_change = (prices_change.iloc[-1][:] - prices_change.iloc[0][:]) * 100
print(prices_total... |
from bitresource import resource_registry
from http_resource import HttpResource
@resource_registry.register()
class KrakenHttpResource(HttpResource):
name = 'kraken'
endpoint_url = 'https://api.kraken.com/0/public/'
CurrencyResource = KrakenHttpResource('Assets')
MarketResource = KrakenHttpResource('Asset... |
from spidriver import SPIDriver
s = SPIDriver("/dev/ttyUSB0") # change for your port
s.sel() # start command
s.write([0x9f]) # command 9F is READ JEDEC ID
print(list(s.read(3))) # read next 3 bytes
s.unsel() # end command
|
'''
Which stocks move together?
In the previous exercise, you clustered companies by their daily stock price movements. So which company have stock prices that tend to change in the same way? You'll now inspect the cluster labels from your clustering to find out.
Your solution to the previous exercise has already bee... |
'''
Made By Sai Harsha Kottapalli
Tested on python3
About : SSH Command
Use : make a connection to SSH server and run a command
'''
import sys
import paramiko
import subprocess
import argparse
def command(ip_addr,username,pwd,cmd):
client = paramiko.SSHClient()
#can use keys for authentication
#client.load_h... |
from PySide2.QtCore import QAbstractItemModel, QModelIndex, Qt
from hexrd.ui.tree_views.tree_item import TreeItem
KEY_COL = 0
class BaseTreeItemModel(QAbstractItemModel):
KEY_COL = KEY_COL
def columnCount(self, parent):
return self.root_item.column_count()
def headerData(self, section, orient... |
#!/usr/bin/env python3
"""Tests that all evidence codes seen in NCBI's gene2go have description."""
from __future__ import print_function
__copyright__ = "Copyright (C) 2016-2019, DV Klopfenstein, H Tang. All rights reserved."
__author__ = "DV Klopfenstein"
import os
from goatools.associations import dnld_ncbi_gene... |
# Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache License Version 2.0.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2018 Datadog, Inc.
import copy
import traceback
import re
import logging
import unicodedata
from aggreg... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
from parglare import GLRParser, Grammar, Parser, ParseError
from parglare.exceptions import SRConflicts
def test_lr2_grammar():
grammar = """
Model: Prods EOF;
Prods: Prod | Prods Prod;
Prod: ID "=" ProdRefs;
ProdRefs: ... |
from hatano.errors import HatanoError
import boto3
import zipfile
import shutil
import subprocess as sp
import os
import random
import string
import sys
import json
global_conf_file = './hatano_settings.json'
region = boto3.session.Session().region_name
class ZipSrc:
def __init__(self, src, stage):
self... |
########################################################
# neweggQuickSearch.py is a script which automates
# automates the process of searching for products
# and returns important information back in a CSV.
# Libraries Used: urllib.request and bs4 (BeautifulSoup)
# neweggQuickSearch.py asks the user to inp... |
from django.forms import ModelForm
from workouts.models import WorkoutSession
class WorkoutSessionForm(ModelForm):
class Meta:
model = WorkoutSession
fields = [
'name',
'description',
'location',
'workout_date',
]
|
import pandas as pd
import numpy as np
import plotly.graph_objects as go
import dash
dash.__version__
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input,Output
import dash_bootstrap_components as dbc
import plotly.io as pio
import os
print(os.getcwd())
df_input_l... |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 12 22:57:49 2021
@author: kylei
"""
import matplotlib.pyplot as plt
import time
import numpy as np
import matplotlib as mpl
import copy
# plt.style.use("science")
mpl.rcParams["figure.dpi"] = 300
plt.style.use("ieee")
class GAAP:
def __init__(
self,
... |
# Copyright 2019 Xilinx 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 agreed to in writin... |
# Kivy stuff
from kivy.uix.widget import Widget
from kivy.uix.label import Label
from kivy.lang import Builder
from kivy.properties import ObjectProperty, ListProperty
from kivy.graphics import Color, Ellipse, Line
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.factory import Factory
from kivy.cor... |
import scraper.adorama
import scraper.amazon
import scraper.bestbuy
import scraper.bhphotovideo
import scraper.canadacomputers
import scra... |
from django.contrib import admin
from django_admin_listfilter_dropdown.filters import RelatedDropdownFilter
from chartofaccountDIT.exportcsv import (
_export_historical_comm_cat_iterator,
_export_historical_exp_cat_iterator,
_export_historical_fco_mapping_iterator,
_export_historical_inter_entity_iter... |
# This file is part of nbplot. See LICENSE for details.
import logging
import string
import sys
# Extending string.Template to add the . to the idpattern
# expression and support ${input.xxx}
class StringTemplateWithDot(string.Template):
idpattern = '(?a:[_a-z][._a-z0-9]*)'
class LoggingLevelContext(object):
... |
import unittest
# The guess API is already defined for you.
# @param num, your guess
# @return -1 if my number is lower, 1 if my number is higher, otherwise return 0
_my_num = 0
def guess(num):
if _my_num < num:
return -1
elif _my_num > num:
return 1
return 0
class Solution:
def gue... |
from .cron import Cron
|
"""
This code is based on https://github.com/ekwebb/fNRI which in turn is based on https://github.com/ethanfetaya/NRI
(MIT licence)
"""
import numpy as np
import torch
from torch.utils.data.dataset import TensorDataset
from torch.utils.data import DataLoader
import torch.nn.functional as F
from torch.autograd import V... |
import yfinance as yf
import datetime as dt
import pandas as pd
from stonklib import returnFinraShortData
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from datetime import date
# start date, end date exclusive
tickerString = "GME"
startDateString = '2021-01-07'
endDateString = '2021-05-1... |
#!/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.
#
# Licensed under the Apache License,... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-11-19 00:07
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('base', '0017_auto_20161119_0005'),
]
operations =... |
try:
__PHASEPORTRAIT_MODULE_IMPORTED__
except NameError:
__PHASEPORTRAIT_MODULE_IMPORTED__= False
if not __PHASEPORTRAIT_MODULE_IMPORTED__:
from .RetratoDeFases2D import RetratoDeFases2D
from .RetratoDeFases3D import RetratoDeFases3D
from .Trayectorias3D import Trayectoria3D
from .Trayectorias2... |
"""
TimeSeries Datasets
-------------------
"""
try:
# Base classes for training datasets:
from .training_dataset import (
TrainingDataset,
PastCovariatesTrainingDataset,
FutureCovariatesTrainingDataset,
DualCovariatesTrainingDataset,
MixedCovariatesTrainingDataset,
... |
__all__ = [
'transformer',
'logistic_regression',
]
from . import logistic_regression
from .transformer import transformer
|
########################################
# script for merging all valid pairs files
########################################
import os
import logging
import subprocess
from python_bits.helpers import clean_dir
def merge_validpairs(Configuration, inputs):
"""take inputs and cat into a merged valid ... |
from datetime import datetime
from origin_takehome.services.risk_profile import RiskProfileService
def test_calculate_base_score_should_return_3():
profile = {
"age": 35,
"dependents": 1,
"house": {"ownership_status": "wrong"},
"income": 1500,
"marital_status": "married",
... |
"""
This file uses the configuration.json in the root folder and
collects all current role assignemnts for each identified sub.
Configuration Settings
subscriptions - List of subscription ID's
principals.roleDirectory - Directory to put assignments in
Outputs all data into
./[principals.roleDirectory]/[... |
import logging
from plugin import Plugin
log = logging.getLogger('discord')
class PluginManager:
def __init__(self, mee6):
self.mee6 = mee6
self.db = mee6.db
self.mee6.plugins = []
def load(self, plugin):
log.info('Loading plugin {}.'.format(plugin.__name__))
plugin_i... |
from random import random
class Triplet():
def __init__(self, entity_1, relation, entity_2, score = random()):
self.__entity_1 = entity_1
self.__relation = relation
self.__entity_2 = entity_2
self.__score = float(score) # for developing purposes
def __repr__(self):
... |
# coding: utf-8
x = stencil(shape=(100,100), step=(2,2))
c1 = eval('pyccel.calculus', 'compute_stencil_uniform', (2, 4, 0.0, 0.25))
c2 = eval('pyccel.calculus', 'compute_stencil_uniform', (2, 4, 0.0, 0.25))
for i1 in range(0, 100):
for i2 in range(0, 100):
for k1 in range(-2, 2+1):
for k2 in ... |
import json
import logging
import os
import copy
from pathlib import Path
from urllib.parse import urljoin
from typing import Optional
from gssutils.csvw.mapping import CSVWMapping
from gssutils.csvw.namespaces import URI
from gssutils.utils import pathify
class Cubes:
"""
A class representing multiple data... |
from core.abstract.serializers import AbstractSerializer
from core.user.models import User
class UserSerializer(AbstractSerializer):
class Meta:
model = User
# List of all the fields that can be included in a request or a response
fields = ['id', 'username', 'name', 'first_name', 'last_nam... |
# 名言
famous_name = 'Albert Einstein'
message = ' once sai,"A person who never made a mistake never tried anything new.'
print(famous_name + message)
|
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""add secondary contact columns
Revision ID: 555130f0a817
Revises: 44d5969c897b
Create Date: 2015-03-01 13:14:06.935565
"""
# revision identifiers, used by Alembic.
revision = '555130f0a817'
down_revisio... |
# =============================================================================
# periscope-ps (blipp)
#
# Copyright (c) 2013-2016, Trustees of Indiana University,
# All rights reserved.
#
# This software may be modified and distributed under the terms of the BSD
# license. See the COPYING file for details.
#
# ... |
# coding=utf-8
class CommonDisambiguationError(Exception):
def __init__(self, options):
self.options = options
def __unicode__(self):
return "There are more than one articles for that query"
|
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... |
import os
os.environ['OMP_NUM_THREADS'] = '1'
os.environ['NUMEXPR_NUM_THREADS'] = '1'
os.environ['OPENBLAS_NUM_THREADS'] = '1'
os.environ['MKL_NUM_THREADS'] = '1'
import sys,argparse
import random
import numpy as np
import math as m
import scipy.optimize as opt
from matplotlib import pyplot as plt
from mpl_toolkits.m... |
import django
from django.contrib import admin, messages
from django.template.response import TemplateResponse
from django.urls import path
from log_reader import settings
from log_reader.models import FileLogReader
from log_reader.utils import get_log_files, read_file_lines
@admin.register(FileLogReader)
class File... |
import csv
from datetime import datetime
from django.http import FileResponse, HttpResponse
from django.contrib.messages.api import success
from django.shortcuts import render, redirect, get_object_or_404
from django.views.generic import ListView, DetailView
from django.contrib import messages
from django.db.models imp... |
# Note: this script utilizes the updated Dashboard API endpoint that unifies the screenboard and timeboard APIs
# See API documentation for additional details: https://docs.datadoghq.com/api/?lang=python#dashboards
# Scripts that access the deprecated Screenboard and Timeboard endpoints are available in https://github... |
from __future__ import print_function
from __future__ import unicode_literals
from future import standard_library
standard_library.install_aliases()
from builtins import input
from argparse import ArgumentParser
import os
import os.path
import shutil
import platform
from io import StringIO
import subprocess
import sy... |
# 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, ... |
import pickle
class Score(object):
# Constructor
def __init__(self, new_score=0, new_name="Nobody"):
self.score = new_score
self.name = new_name
# Methods
def get_score(self):
return self.score
def get_name(self):
return self.name
def set_score(self, new_score... |
# coding: utf-8
"""
This module contains event manager for Windows platform.
"""
from __future__ import absolute_import
# Standard imports
import ctypes
from ctypes import byref
# External imports
from PyHook3 import HookManager
user32 = ctypes.cdll.LoadLibrary('user32.dll')
LONG = ctypes.c_int32
DWORD = ctypes.c_... |
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.decomposition import LatentDirichletAllocation
df = pd.read_csv('movie_data.csv', encoding='utf-8')
print(df.head(3))
count = CountVectorizer(stop_words='english',
max_df=.1,
ma... |
import numpy as np
import openmdao.api as om
class KineticEnergyComp(om.ExplicitComponent):
"""
Computes the kinetic energy of a particle based on its speed and mass
"""
def initialize(self):
self.options.declare('num_nodes', types=int)
def setup(self):
nn = self.options['num_no... |
"""Utility meter from sensors providing raw data."""
import logging
from decimal import Decimal, DecimalException
import homeassistant.util.dt as dt_util
from homeassistant.const import (
CONF_NAME, ATTR_UNIT_OF_MEASUREMENT,
EVENT_HOMEASSISTANT_START, STATE_UNKNOWN, STATE_UNAVAILABLE)
from homeassistant.core ... |
from .Block import *
from oredictnames import OreDict
from destroyGroup import *
@handler
class Dirt(Block):
def getTex(self):
return tex_coords((0, 1), (0, 1), (0, 1))
def getName(self):
return "minecraft:dirt"
oredictnames = [OreDict.DIRT]
destroygroups = [destroyGroups.SHOVEL]
... |
import plugins
import socket
import struct
import json
class Plugin(plugins.BasePlugin):
__name__ = 'minecraft'
def run(self, config):
'''
Fetch the amount of active and max players
add to /etc/nixstats.ini
[minecraft]
enabled=yes
hosts=127.0.0.1:8000,127.0.0.2:... |
def is_numeric(s):
try:
float(s)
return True
except (ValueError, TypeError):
return False
is_numeric('123.0')
|
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-05 17:42
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '0016_deprecate_rendition_filter_relation')... |
import time
import requests
import json
import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from google.cloud import storage
LOCAL_DEBUG = 'false'
# move to key management soon, create a new key and disable the current one
CREDLY_KEY = '435da75c82a0978a53e9377ebf51b7c6'
CREDLY_SECRET = '7fI/ZtKo... |
# Generated by Django 2.2.2 on 2020-03-04 13:24
from django.db import migrations, models
import enumfields.fields
from drf_request_logging.models import RESOURCE_TYPE
class Migration(migrations.Migration):
dependencies = [
('drf_request_logging', '0002_auto_20200124_1348'),
]
operations = [
... |
import random
import re
import discord
import jb2.command
import jb2.embed
class DziadusCommand(jb2.command.Command):
def __init__(self, connector):
with open('res/text/dziadziusie.txt') as file:
self.grandpas = file.readlines()
def get_pattern(self):
return r'dziadzius$'
as... |
# a=[1,2,3,4,5,6,7,8,8,9]
# b=[1,2,3,4,5,6,7,8,8,9]
# if a==b:
# print("hello")
# else:
# print("not equal")
# n=int(input())
# for i in range(n):
# x=int(input())
# if x==1:
# print("Yes")
# elif x%2==0:
# print("Yes")
# else:
# print("No")
def pattern(inputv):
if ... |
# Copyright 2020 Alexis Lopez Zubieta
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, ... |
num = int(input('Enter a num'))
if n % 2 == 0: print('Even') |
import scapy.all as scapy
from scapy.layers import http
import argparse
def get_arguments():
parser = argparse.ArgumentParser()
parser.add_argument('-i','--iface', dest ='interface', help = 'Name of interface to sniff on')
options=parser.parse_args()
return options.interface
def sniff(interface)... |
''' Core code for Phabricator Discord bot, phabbot
'''
import logging
import asyncio
import os
import re
import discord
import yaml
import behaviours
logging.basicConfig(level=logging.INFO)
CLIENT = discord.Client()
PHAB_URL = ''
LEARNED_BEHAVIOURS = {}
@CLIENT.event
async def on_ready():
''' Log Phabbot bas... |
import requests
import json
import collections
import re
import argparse
from secret import accessToken
headers = {"Authorization": "bearer "+ accessToken }
topic_query = """
query ($name:String!){
repositoryOwner(login:$name){
login
... on User {
name
... |
import os
import signal
import subprocess
import sys
import time
from jinja2 import Environment, FileSystemLoader, select_autoescape
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
###############
# JINJA BUILD #
###############
def render_page(env, page):
html = env.get... |
# install_libs.py - install libs to SDCard
#
# This code is in the Public Domain (or CC0 licensed, at your option.)
# Unless required by applicable law or agreed to in writing, this
# software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied.
#
import upip
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.