content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
import tensorflow as tf
from tensorflow.contrib.framework.python.ops import arg_scope
#from utils_fn import *
from ops import *
import time
class InpaintModel():
def __init__(self, args):
self.model_name = "InpaintModel" # name for checkpoint
self.img_size = args.IMG_SHAPES
# yj... | nilq/baby-python | python |
import os
#determine n - the number of training observations
nFile = open('CV_folds/training_set_0.txt','r')
n = 0.0
for i in nFile:
n += 1
#determine the number of folds
#nFolds = sum(os.path.isdir(i) for i in os.listdir('CV_decomp'))
nFolds = len(os.listdir('CV_decomp'))
print nFolds
#determine values of p
inL... | nilq/baby-python | python |
import re
import random
import os
import pandas as pd
try:
import torch
except ImportError:
pass
from tqdm import tqdm
import spacy
from spacy import displacy
from visuUtils import train2myVisu, build_color_scheme
from visuUtils import conll2sent_list, sent_list2spacy, myScores
class visualizer(object):
... | nilq/baby-python | python |
from ._text import BufferText
__all__ = [
"BufferText",
]
| nilq/baby-python | python |
#!/usr/bin/env python
import xml.etree.ElementTree as ET
import six
from leather import svg
from leather import theme
class Axis(object):
"""
A horizontal or vertical chart axis.
:param ticks:
Instead of inferring tick values from the data, use exactly this
sequence of ticks values. Th... | nilq/baby-python | python |
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class GaussianMixture(nn.Module):
def __init__(self, n_mix, d_inp, learn_var=True, share_prior=False):
super(GaussianMixture, self).__init__()
"""
The current implementation is s... | nilq/baby-python | python |
#!/usr/bin/env python
from iris_sdk.models.base_resource import BaseData
from iris_sdk.models.data.rate_centers_list import RateCentersList
from iris_sdk.models.maps.rate_centers import RateCentersMap
class RateCentersData(RateCentersMap, BaseData):
@property
def total_count(self):
return self.result... | nilq/baby-python | python |
from rest_framework import permissions
from rest_framework.generics import CreateAPIView
from django.contrib.auth.models import User
from rest_framework import viewsets
from usuarios.serializers import UserSerializer
class UserViewSet(viewsets.ModelViewSet):
serializer_class = UserSerializer
def get_queryset(... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lpp_test', '0003_auto_20191024_1701'),
]
operations = [
migrations.AddField(
model_name='uhost',
nam... | nilq/baby-python | python |
import pglet
from pglet import Icon
def test_icon_add():
c = Icon(name="Mail", color="#FF7F50", size="tiny")
assert isinstance(c, pglet.Control)
assert isinstance(c, pglet.Icon)
# raise Exception(s.get_cmd_str())
assert c.get_cmd_str() == (
'icon color="#FF7F50" name="Mail" size="tiny"'
... | nilq/baby-python | python |
# CyberHeist Lab - Beginner Level
# Good luck :D
import hashlib
import binascii
import colorama
import cowsay
USERNAME = "Grubsy"
PASSWORD = "4aa765fdbe4bf83f7a51a1af53b170ad9e2aab35a9b9f0b066fd069952cffe44"
# PASSWORD HINT: Tristan really likes noodles
# In order he likes:
# 1) udonnoodles (not the password)
# 2) *... | nilq/baby-python | python |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import click
from ..data import EventList
from ..maps import Map
from ..cube import fill_map_counts
log = logging.getLogger(__name__)
@click.command("bin")... | nilq/baby-python | python |
import json
from threading import Lock
from requests.exceptions import HTTPError
from py42.exceptions import Py42ChecksumNotFoundError
from py42.exceptions import Py42Error
from py42.exceptions import Py42HTTPError
from py42.exceptions import Py42SecurityPlanConnectionError
from py42.exceptions import raise_py42_erro... | nilq/baby-python | python |
from trame import state
from trame.html import vuetify, Element, simput
from ..engine.simput import KeyDatabase
def update_cycle_list(*args, **kwargs):
pxm = KeyDatabase().pxm
cycleIds = []
subCycleIds = {}
for cycle in pxm.get_instances_of_type("Cycle"):
cycleIds.append(cycle.id)
subC... | nilq/baby-python | python |
from typing import List
def pascal(N: int) -> List[int]:
"""
Return the Nth row of Pascal triangle
"""
# you code ...
if N == 0:
return []
triangle_rows = []
for i in range(1, N+1):
add_row = [None]*i
add_row[0] = 1
add_row[-1] = 1
... | nilq/baby-python | python |
# Copyright (c) 2021 PaddlePaddle 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 ap... | nilq/baby-python | python |
import numpy as np
import pandas as pd
from pandas import DataFrame
from pandas.core.indexes.timedeltas import timedelta_range
import pandas.util.testing as tm
from pandas.util.testing import assert_frame_equal
class TestTimedeltaIndex(object):
def test_asfreq_bug(self):
import datetime as dt
df ... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
import os
import sys
package_path = '/user/specified/path/to/matsdp/'
sys.path.insert(0, os.path.abspath(package_path))
def test_plot_proxigram_csv():
from matsdp.apt import apt_plot
retn_val = apt_plot.plot_proxigram_csv(
proxigram_csv_file_path = './apt/profile-interface0.csv... | nilq/baby-python | python |
import os
import pandas as pd
import nltk
import gensim
from gensim import corpora, models, similarities
os.chdir("D:\semicolon\Deep Learning");
df=pd.read_csv('jokes.csv');
x=df['Question'].values.tolist()
y=df['Answer'].values.tolist()
corpus= x+y
tok_corp= [nltk.word_tokenize(sent.decode('utf-8')) for sent i... | nilq/baby-python | python |
#!/usr/bin/env python
import subprocess
x = list(range(1,9))
print(x)
y = [];
resultf = open('avg', 'a')
for i in x:
i = 2 ** i
print(i)
out_bytes = subprocess.check_output(['../../build/bin/mapreduce_hand', '131072', str(i)])
out_text = out_bytes.decode('ascii')
value = out_text.split('\n')[-2]
value = value.sp... | nilq/baby-python | python |
# coding: utf-8
"""
InfluxDB OSS API Service.
The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. # noqa: E501
OpenAPI spec version: 2.0.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa:... | nilq/baby-python | python |
# flake8: noqa
"""
This is the local_settings file for Mezzanine's docs.
"""
from random import choice
from mezzanine.project_template.project_name.settings import *
DEBUG = False
ROOT_URLCONF = "mezzanine.project_template.project_name.urls"
characters = "abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)"
# Gener... | nilq/baby-python | python |
import json
import datetime as dt
import dateutil.parser
import backends.entities.Players as Players
import backends.database as db
import backends.trueskillWrapper as ts
## A comment on why the login-offset is nessesary ##
## - losing teams tend to have players leaving and joining more rapidly
## - every time... | nilq/baby-python | python |
from .declare_a_mapping import User, create_table
from .connection import Session
session = Session()
def user_operator():
ed_user = User(name='ed', fullname='Ed Jones', nickname='edsnickname')
session.add(ed_user)
our_user = session.query(User).filter_by(name='ed').first()
print(ed_user is our_user)... | nilq/baby-python | python |
import enchant
import re
import itertools
# derived from a google image search of an "old fashioned" phone
letters_from_numbers_lookup = {'2': ['A', 'B', 'C'],
'3': ['D', 'E', 'F'],
'4': ['G', 'H', 'I'],
'5': ['J', 'K', 'L'],
... | nilq/baby-python | python |
# --depends-on config
# --depends-on format_activity
from src import ModuleManager, utils
from src.Logging import Logger as log
@utils.export("botset", utils.BoolSetting("print-motd", "Set whether I print /motd"))
@utils.export(
"botset",
utils.BoolSetting("pretty-activity", "Whether or not to pretty print a... | nilq/baby-python | python |
import numpy as np
import dask.array as da
from napari.components import ViewerModel
from napari.util import colormaps
base_colormaps = colormaps.CYMRGB
two_colormaps = colormaps.MAGENTA_GREEN
def test_multichannel():
"""Test adding multichannel image."""
viewer = ViewerModel()
np.random.seed(0)
data... | nilq/baby-python | python |
import argparse
import collections
import datetime
import os
import shutil
import time
import dataset
import mlconfig
import toolbox
import torch
import util
import madrys
import numpy as np
from evaluator import Evaluator
from tqdm import tqdm
from trainer import Trainer
mlconfig.register(madrys.MadrysLoss)
# General... | nilq/baby-python | python |
"""
"""
from jax import numpy as jnp
from jax import jit as jjit
@jjit
def _calc_weights(x, x_table):
n_table = x_table.size
lgt_interp = jnp.interp(x, x_table, jnp.arange(0, n_table))
it_lo = jnp.floor(lgt_interp).astype("i4")
it_hi = it_lo + 1
weight_hi = lgt_interp - it_lo
weight_lo = 1 - w... | nilq/baby-python | python |
import os
DEBUG = True
SECRET_KEY = os.getenv("APP_SECRET_KEY")
MYSQL_USERNAME = os.getenv("MYSQL_USERNAME")
MYSQL_PASSWORD = os.getenv("MYSQL_PASSWORD")
MYSQL_PORT = 3306
MYSQL_DB = os.getenv("MYSQL_DB")
LOGGING_LEVEL = "DEBUG"
LOGGIN_FILE = "activity.log"
LOGGING_BACKUPS = 2
LOGGING_MAXBYTES = 1024
TIMEZONE = "... | nilq/baby-python | python |
#
# PySNMP MIB module HP-ICF-OOBM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-OOBM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:34:51 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | nilq/baby-python | python |
"""
MARL environment for google football
"""
import numpy as np
import gym
import gfootball.env.football_env as football_env
from gfootball.env import _process_representation_wrappers
from gfootball.env import _process_reward_wrappers
from gfootball.env import config
from gfootball.env import wrappers
class Goog... | nilq/baby-python | python |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""This mo... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file and with no dependencies... | nilq/baby-python | python |
#!/usr/bin/env python
def getinput(): return open('day23.input.txt').read()
### PART 1
import re
def solve(program, a=0, hack=False):
instrs = [l.split() + [''] for l in program.strip().splitlines()]
tgl = { 'cpy': 'jnz', 'inc': 'dec', 'dec': 'inc', 'jnz': 'cpy', 'tgl': 'inc' }
ip, regs = 0, { 'a': a, ... | nilq/baby-python | python |
"""
二维数组
"""
# use numpy
import numpy as np
import pandas as pd
sdarry = np.array([
[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]
])
# different way to get element
print(sdarry[1, 2])
print(sdarry[:, 2])
print(sdarry[2, :])
# get a row or a column mean of data
# axis=1 is row
# axis=0 is column
print(sdar... | nilq/baby-python | python |
from .confirm import ShutdownConfirmationDialog
def load(manager, params):
"""Launch shutdown confirmation manager"""
pos = (100, 100)
if params and len(params) > 0:
pos = params[0]
ShutdownConfirmationDialog(pos, manager)
| nilq/baby-python | python |
from handlers.chord import ChordHandler
from handlers.base import IndexHandler
url_patterns = [
(r"/index/", IndexHandler),
]
| nilq/baby-python | python |
"""
Pytools
Server module
Run server
>> (base) C:\\Users\\ginanjar\\AppData\\Roaming\\Sublime Text 3\\Packages\\pythontools>python core\\server\\pytools
""" | nilq/baby-python | python |
import unittest
from operator import itemgetter
import tonos_ts4.ts4 as ts4
from utils.wallet import create_wallet, DEFAULT_WALLET_BALANCE
from utils.nft_root import create_nft_root, mint_nft, get_nft_addr, DEFAULT_NFT_ROOT_BALANCE
from utils.nft import restore_nft_by_addr, get_nft_info
from random import randint
un... | nilq/baby-python | python |
__author__ = 'akshay'
import socket
import time
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
# create a socket and bind socket to the host
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect(('10.42.0.1', 8001))
buffe=1024
def measure():
"""
measure distance
"""
... | nilq/baby-python | python |
"""
Function for matching delimiters in an arithmetic expression
"""
from ArrayStack import *
def is_matched(expr):
"""
Return True if all delimiters are properly match; False otherwise
"""
lefty = '({['
righty = ')}]'
S = ArrayStack()
for c in expr:
if c ... | nilq/baby-python | python |
"""
File: caesar.py
Name: Max Chang
------------------------------
This program demonstrates the idea of caesar cipher.
Users will be asked to input a number to produce shifted
ALPHABET as the cipher table. After that, any strings typed
in will be encrypted.
"""
# This constant shows the original order of alphabetic ... | nilq/baby-python | python |
from django.db import models
from django.contrib.auth.models import AbstractUser
class StudentUser(AbstractUser):
matric_no = models.CharField(max_length=14, unique=True)
mac_add = models.CharField(max_length=17, unique=True)
| nilq/baby-python | python |
from typing import Any, Dict
import attr
from targets.config import is_in_memory_cache_target_value
@attr.s(frozen=True)
class TargetCacheKey(object):
target = attr.ib(converter=str)
value_type = attr.ib(converter=str)
class TargetCache(object):
def __init__(self, cache=None):
self._cache = ca... | nilq/baby-python | python |
import datetime
from Module.MainThread_Socket_Client import MainThread_Socket_Client
from Module.SocketServer_Client import SocketServer_Client
class Socket_Client_Core():
def __init__(self):
try:
self.MainThread_Socket_Client=MainThread_Socket_Client
self.SocketServer_C... | nilq/baby-python | python |
from tqdm import tqdm
from src.reranker.lambdamart import LambdaMart
from src.interface.corpus import Corpus
from src.interface.iohandler import InputOutputHandler
from src.interface.features import FeatureEngineer
# import src.evaluation.validate_run as validate
OUT = f"./evaluation/fairRuns/submission_lambdamart-fu... | nilq/baby-python | python |
# coding: utf-8
import time
i=0
while(i<20):
print('-----------main--------[',i,']')
i+=1
time.sleep(1)
print("ok man yeaaaaahh!")
#send block --> input IP and message
#message='abcedf'
#IP='127.0.0.1'
#send_len=client.sendto(message.encode('utf-8'),(IP,recieve_port))
#recieve block -->None
#rx_message,... | nilq/baby-python | python |
#main.py
# set up track structure
# this one loops over alpha and epsilon
import numpy as np
from placerg.funcs import *
from placerg.funcsrg import *
from placerg.objects import *
from placerg.runfunc import *
N0 = 2048 # number of cells
nstim = 10 # number of nonplace stimuli
percell= 1.0 # probability that eac... | nilq/baby-python | python |
#Created by Oli MacPherson and Ben O'Sullivan!
#For use with only Python 2 at the moment cause i cant be bothered changing all the raw_inputs.
import sys, os, random
import time
intro_phrases = ["The world is changing. \n",
"Humanity's voracious appetite for and consumption of electricity born of bu... | nilq/baby-python | python |
HW_SOURCE_FILE = __file__
def num_eights(x):
"""Returns the number of times 8 appears as a digit of x.
>>> num_eights(3)
0
>>> num_eights(8)
1
>>> num_eights(88888888)
8
>>> num_eights(2638)
1
>>> num_eights(86380)
2
>>> num_eights(12345)
0
>>> from construct_c... | nilq/baby-python | python |
from cacahuate.auth.base import BaseHierarchyProvider
class BackrefHierarchyProvider(BaseHierarchyProvider):
def find_users(self, **params):
return [
(params.get('identifier'), {
'identifier': params.get('identifier'),
'email': params.get('identifier'),
... | nilq/baby-python | python |
# coding: utf-8
# # Categorical VAE with Gumbel-Softmax
#
# Partial implementation of the paper [Categorical Reparameterization with Gumbel-Softmax](https://arxiv.org/abs/1611.01144)
# A categorical VAE with discrete latent variables. Tensorflow version is 0.10.0.
# # 1. Imports and Helper Functions
# In[1]:
i... | nilq/baby-python | python |
#!/usr/bin/env python3
""" Checks if a new ts3 version is available """
import re
import smtplib
import json
import sys
from email.mime.text import MIMEText
from email import utils
import argparse
import requests
"""
CONFIG = {}
CONFIG['CHANGELOG'] = ''
CONFIG['URL'] = 'https://www.teamspeak.com/versions/server.jso... | nilq/baby-python | python |
import bsddb3
import struct
import json
import flask
import time
from threading import Thread
from Queue import Queue
from StringIO import StringIO
from sqlalchemy import text
from sqlalchemy.sql.elements import TextClause
from table_pb2 import *
from itertools import product, chain, combinations
from dct import *
de... | nilq/baby-python | python |
from collections import deque
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
res = 0
def diameterOfBinaryTree(self, root: TreeNode) -> int:
... | nilq/baby-python | python |
def f(<caret>x):
return 42 | nilq/baby-python | python |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import scriptcontext as sc
import compas_fofin
__commandname__ = "FoFin_init"
def RunCommand(is_interactive):
sc.sticky["FoFin"] = {
'cablenet' : None,
'settings' : {
'scale... | nilq/baby-python | python |
import pytest
from geocodr.keys import APIKeys
from werkzeug.test import EnvironBuilder
from werkzeug.wrappers import Request
@pytest.fixture()
def key_file(tmpdir):
key_file = tmpdir.join("keys.csv")
key_file.write(
'key,domains\n'
'wildcard,\n'
'# comment,with,commas,\n'
'mu... | nilq/baby-python | python |
#!/usr/bin/env python
import rospy
from std_msgs.msg import Header
from humanoid_league_msgs.msg import BallRelative, ObstaclesRelative, ObstacleRelative, Strategy, GameState, RobotControlState
from geometry_msgs.msg import Point, PoseWithCovarianceStamped, Pose2D
import math
import yaml
import rospkg
import os
impo... | nilq/baby-python | python |
import os
import sys
sys.path.append('../')
import numpy as np
import convert_weights
import tensorflow as tf
############## REPRODUCIBILITY ############
tf.set_random_seed(0)
np.random.seed(0)
###########################################
from keras.models import load_model
from keras.models import Sequential, Model
f... | nilq/baby-python | python |
from django.contrib import admin
# DJANGAE
from djangae.contrib.gauth.sql.models import GaeUser
admin.site.register(GaeUser)
| nilq/baby-python | python |
from .handler import handler
| nilq/baby-python | python |
"""OVK learning, unit tests.
The :mod:`sklearn.tests.test_learningrate` tests the different learning rates.
"""
import operalib as ovk
def test_constant():
"""Test whether constant learning rate."""
eta = ovk.Constant(1)
assert eta(10) == 1
def test_invscaling():
"""Test whether inverse scaling le... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Discovery
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
... | nilq/baby-python | python |
# coding: utf-8
from common.db import write_session_scope
from mall_spider.common.enums import TaobaoPageType, TaobaoTaskType
from mall_spider.dao.stream_handle_task_dao import get_stream_handle_task_dao
from mall_spider.dao.stream_opt_data_dao import get_stream_opt_data_dao
from mall_spider.dao.stream_unhandle_task_d... | nilq/baby-python | python |
from qtpy import QtCore, QtGui
class DataTreeModel(QtCore.QAbstractItemModel):
def __init__(self, data_node, parent=None):
super(DataTreeModel, self).__init__(parent)
self.data_node = data_node
self.rootItem = DataTreeItem(self.data_node)
data_node.changed.connect(self.on_node_chan... | nilq/baby-python | python |
import math
style_normal = "\033[0m"
style_great_success = "\033[1;32m"
style_success = "\033[32m"
style_error = "\033[31m"
style_warning = "\033[33m"
style_info = "\033[0m"
style_stealthy = "\033[1;37m"
def __generic_style(c):
def _x(s):
return c + s + style_normal
return _x
success = __generic_style(style... | nilq/baby-python | python |
# pip install feedparser
# pip install notify2
# [Python Desktop News Notifier in 20 lines](http://geeksforgeeks.org/python-desktop-news-notifier-in-20-lines/)
# [Desktop Notifier in Python](https://www.geeksforgeeks.org/desktop-notifier-python/)
import feedparser
import notify2
import os
import time
# https://www.es... | nilq/baby-python | python |
import requests
from sniplink.utils import *
from sniplink.api import API
from sniplink.objects import ShortLinkData
class Client:
"""
The Backend Client
Sniplink-Py is powered by a back-end client/runner, this system is responsible for ensuring safety among API access.
Once you've registered a clien... | nilq/baby-python | python |
class AbilityChangeEvent:
"""Event that indicates an ability change"""
def __init__(self, data, type) -> None:
"""Init event"""
self.data = data
self.type = type
@property
def sphere_id(self) -> str:
return self.data['sphere']['id']
@property
def cloud_id(self)... | nilq/baby-python | python |
from tkinter import messagebox
import pandas as pd
import matplotlib.pyplot as plt
import tkinter as tk
import os
def get_chart_user(date):
if os.path.exists("re/drowsiness_files/"+date+".csv"):
data=pd.read_csv("re/drowsiness_files/"+date+".csv")
data.fillna("Unknown",inplace=True)
gb=data... | nilq/baby-python | python |
"""User memberships in teams."""
import dataclasses
import kaptos.db
import roax.schema as s
from roax.resource import operation
@dataclasses.dataclass
class Member:
"""User membership in team."""
id: s.uuid(description="Identifies the membership.")
team_id: s.uuid(description="Identifies the team.")
... | nilq/baby-python | python |
#
# Copyright (c) 2016, deepsense.io
#
# 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 w... | nilq/baby-python | python |
#!/usr/bin/env python
# coding=utf-8
from setuptools import setup
# setup configuration is in `setup.cfg`
setup()
| nilq/baby-python | python |
import hashlib
import requests
# import uuid
import os
import tempfile
def get_file(logger, storage_root, doc_uuid, image_url):
# local_path = "%s/%s/images/tmp/%s.%s" % (storage_root, doc_uuid, uuid.uuid4(), image_url["extension"])
try:
r = requests.get(image_url["url"])
temp = tempfile.Named... | nilq/baby-python | python |
import socket
import sys
import pickle
import time
from tkinter import *
from tkinter import ttk
from tkinter import messagebox, BooleanVar
from tkinter import font
from PIL import Image
import glob
import os
from PIL import Image, ImageTk
import argparse
import pprint
import random
import numpy as np
import struct
i... | nilq/baby-python | python |
import sys
import collections
Record = collections.namedtuple('Record', ['timestamp', 'action', 'km'])
class Car:
def __init__(self, plate):
self.plate = plate
self.records = []
def add_record(self, record):
record[2] = int(record[2])
self.records.append(Record(*record))
... | nilq/baby-python | python |
# Copyright 2013-2020 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 *
import glob
class Efivar(MakefilePackage):
"""Tools and libraries to work with EFI variables"""
... | nilq/baby-python | python |
# Copyright (c) 2019 Sony Corporation. 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 applicabl... | nilq/baby-python | python |
import os
import subprocess
import shutil
import datetime
import pandas as pd
SNAPSHOT_FOLDER = "big_test_snapshots_diarios"
RETROACTIVE_FOLDER = "retroactive_data"
def daterange(start_date, end_date, step=None):
for n in range(0,int((end_date - start_date).days),step):
yield start_date + datetime.timedelta(day... | nilq/baby-python | python |
import os
import numpy as np
import mdtraj as md
from simtk import unit
from simtk.openmm import LangevinIntegrator
from simtk.openmm.app import Simulation
from simtk.openmm.app.pdbfile import PDBFile
from cg_openmm.cg_model.cgmodel import CGModel
from cg_openmm.utilities.iotools import write_pdbfile_without_to... | nilq/baby-python | python |
#!/usr/bin/env python
import asyncio
import sys
import logging
import unittest
import conf
from os.path import join, realpath
from hummingbot.market.bitcoin_com.bitcoin_com_websocket import BitcoinComWebsocket
from hummingbot.market.bitcoin_com.bitcoin_com_auth import BitcoinComAuth
sys.path.insert(0, realpath(join(_... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 13 13:57:29 2020
@author: lentzye
"""
import mykeys
| nilq/baby-python | python |
from IBM_diffprivlib import diffprivlib_single_query
from smartnoise import smartnoise_single_query
from openmined_pydp import openmind_pydp_single_query
library_name = 'smartnoise' # libraries: 'difforivlib', 'smartnoise', additive_noise', 'openmined_pydp'
dataset_folder_path = 'E:\\MS_Thesis\\publication_stuff\\c... | nilq/baby-python | python |
N = int(input())
A = []
for ii in range(N):
A.append(int(input()))
s = set()
for ii in range(len(A)):
s.add(A[ii])
print(len(s)) | nilq/baby-python | python |
# -*- coding: UTF-8 -*-
"""
This module provides the abstract base classes and core concepts
for the model elements in behave.
"""
import os.path
import sys
import six
from behave.capture import Captured
from behave.textutil import text as _text
from enum import Enum
PLATFORM_WIN = sys.platform.startswith("win")
def... | nilq/baby-python | python |
#!/usr/bin/env python3
from pybf import BloomFilter
def test_bf_int(num_items=1000000, error=0.01):
"""Test the BloomFilter with parameters 'num_items' & `error`"""
print(f"Bloom filter test for integer keys")
bf = BloomFilter(num_items, error)
sz = len(bf)
print(f'size: {sz}')
# checking
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
"""
from __future__ import absolute_import
import mock
import pytest
import easy_acl.rule as rule
__copyright__ = "Copyright (c) 2015-2019 Ing. Petr Jindra. All Rights Reserved."
def test_init_without_wildcard():
definition = "foo.bar.foo-bar"
parts = ("foo", "bar", "foo-bar")... | nilq/baby-python | python |
import socket
import re
try:
url = input('Enter - ') # http://data.pr4e.org/romeo.txt
HOST = re.findall(r'http[s]?://([\S\d.]*)/.*?', url)
mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
mysock.connect((HOST[0], 80))
cmd = 'GET ' + url + ' HTTP/1.0\r\n\r\n'
cmd = cmd.encode()
my... | nilq/baby-python | python |
"""Tests for envs module.
Need rework.
"""
from __future__ import absolute_import
# import unittest
# from numpy.testing import *
import inspect
from functools import partial
import SafeRLBench.envs as envs
import numpy as np
import gym
gym.undo_logger_setup()
from mock import Mock
class TestEnvironments(object... | nilq/baby-python | python |
'''
Tipo String
Em Python, um dado é considerado do tipo string sempre que:
- Estiver entre aspas simples -> 'uma string', '234', 'a', 'True', '42.3'
- Estiver entre aspas duplas -> "uma string", "234", "a", "True", "42.3"
- Estiver entre aspas simples triplas;
- Estiver entre aspas simples duplas.
nome = 'Geek Univ... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
__version__ = '1.0.3'
from .fixedrec import RecordFile, RecordFileError
| nilq/baby-python | python |
import json
import os
import time
from abc import ABC
import numpy as np
import torch
from agent0.common.utils import set_random_seed
from agent0.ddpg.agent import Agent
from agent0.ddpg.config import Config
from ray import tune
from ray.tune.trial import ExportFormat
class Trainer(tune.Trainable, ABC):
def __in... | nilq/baby-python | python |
"""Bay Bridge simulation."""
import os
import urllib.request
from flow.core.params import SumoParams, EnvParams, NetParams, InitialConfig, \
SumoCarFollowingParams, SumoLaneChangeParams, InFlows
from flow.core.params import VehicleParams
from flow.core.params import TrafficLightParams
from flow.core.experiment i... | nilq/baby-python | python |
import logging
from queue import Queue
from common.configuration import ConfigurationService
from common.reddit import get_relevat_subreddits
from common.settings import Setting
from common.storage import StorageService
from functools import wraps
from telegram import Bot, ChatAction, Update
from telegram.ext import C... | nilq/baby-python | python |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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,
... | nilq/baby-python | python |
import bz2
import re
import sys
from collections import namedtuple
from pathlib import Path
from xml.etree import cElementTree as ElementTree
from urllib.parse import urljoin
from urllib.error import URLError
import mwparserfromhell
import numpy
import pycountry
from sklearn.feature_extraction.text import CountVectori... | nilq/baby-python | python |
#! /usr/bin/env python3
###
# KINOVA (R) KORTEX (TM)
#
# Copyright (c) 2018 Kinova inc. All rights reserved.
#
# This software may be modified and distributed
# under the terms of the BSD 3-Clause license.
#
# Refer to the LICENSE file for details.
#
###
import sys
import os
from kortex_api.RouterClient import Route... | nilq/baby-python | python |
class Gif:
pass
| nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.