text string | size int64 | token_count int64 |
|---|---|---|
from hal_impl import mode_helpers
from hal_impl.data import hal_data
import threading
import time
import wpilib
from ..physics.core import PhysicsInterface
from .sim_manager import SimManager
class RobotController:
'''
This manages the active state of the robot
'''
mode_map = {
Sim... | 5,742 | 1,638 |
import unittest
from core.engine.hybrid import HybridEngine
from core.engine.simple import Engine
from core.taxonomy import Taxonomy
class HybridTestCase(unittest.TestCase):
def setUp(self):
taxonomy = Taxonomy('base', {'key': 'value', 'key2': 'value2'})
component1 = Engine('recommender1', taxonomy... | 1,053 | 306 |
# CHAPTER 7 ํฉ์ฑ๊ณฑ ์ ๊ฒฝ๋ง(CNN)
# ์ ์ฒด๊ตฌ์กฐ
# ํฉ์ฑ๊ณฑ๊ณ์ธต๊ณผ ํ๋ง๊ณ์ธต์ด ์ถ๊ฐ๋๋ค.
# ์ง๊ธ๊น์ง ๋ณธ ์ ๊ฒฝ๋ง์ ์ธ์ ํ๋ ๊ณ์ธต์ ๋ชจ๋ ๋ด๋ฐ๊ณผ ๊ฒฐํฉ๋์ด ์๋ค. ์ด๋ฅผ ์์ ์ฐ๊ฒฐ์ด๋ผ๊ณ ํ๋ฉฐ, ์์ ํ ์ฐ๊ฒฐ๋ ๊ณ์ธต์ Affine๊ณ์ธต์ด๋ผ๋ ์ด๋ฆ์ผ๋ก ๊ตฌํํ๋ค.
##########################################
# 2์ฐจ์ ๋ฐฐ์ด ํฉ์ฑ๊ณฑ #@#!@#!$!$!@#@!$%!@#!@#
##########################################
import numpy as np
data = np.array(range(0,81)).reshape... | 11,611 | 8,056 |
import json
import logging
from bson import json_util
from handlers.base import BaseHandler
from lib.DBConnection import DriveFunctions
from lib.DBConnection import UserFunctions
logger = logging.getLogger('rishacar.' + __name__)
class UserProviderHandler(BaseHandler):
async def post(self):
if self.request.bod... | 1,303 | 391 |
"""
django:
https://docs.djangoproject.com/en/3.0/ref/settings/#databases
"""
from ..env import env
from .paths import SQLITE_PATH
DATABASE_TYPE = env("HCAP__DATABASE_TYPE", default="sqlite")
if DATABASE_TYPE == "sqlite":
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": str(SQLITE_PA... | 806 | 273 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""
FIXME:
sometimes you have to chown -R user:user ~/.theano or run with sudo the
first time after roboot, otherwise you get errors
CommandLineHelp:
python -m wbia_cnn --tf netrun <networkmodel>
--dataset, --ds = <dstag>:<subtag>
dstag is the main da... | 16,217 | 5,549 |
# Desenvolva um programa que leia o comprimento de trรชs retas
# e diga ao usuรกrio se elas podem ou nรฃo formar um triรขngulo.
print("-=-" * 15)
print("Vamos analisar um triรขngulo...")
print('-=-' * 15)
r1 = float(input('Informe o primeiro segmento: '))
r2 = float(input('Informe o segundo seguimento: '))
r3 = float(inpu... | 537 | 211 |
# coding: utf-8
from __future__ import absolute_import
import unittest
import ks_api_client
from ks_api_client.api.super_multiple_order_api import SuperMultipleOrderApi # noqa: E501
from ks_api_client.rest import ApiException
class TestSuperMultipleOrderApi(unittest.TestCase):
"""SuperMultipleOrderApi unit... | 1,032 | 346 |
import numpy as np
import os
import os.path as path
from keras.applications import vgg16, inception_v3, resnet50, mobilenet
from keras.preprocessing.image import load_img
from keras.preprocessing.image import img_to_array
import kmri
base_path = path.dirname(path.realpath(__file__))
img_path = path.join(base_path, 'i... | 956 | 359 |
import pytest
from secrethitlergame.phase import Phase
from unittest import mock
from secrethitlergame.voting_phase import VotingPhase
def test_initialization():
vp = VotingPhase()
assert isinstance(vp, Phase)
assert vp.chancelor is None
assert vp.president is None
def test_get_previous_government()... | 1,483 | 547 |
# import datetime
# import logging
# logger = logging.getLogger(__name__)
# logger.setLevel(logging.INFO)
def run(event, context):
# current_time = datetime.datetime.now().time()
# name = context.function_name
# logger.info("Your cron function " + name + " ran at " + str(current_time))
return "hello ... | 328 | 100 |
""" testapp2 admin configs """
from django.contrib import admin
from testapp2.models import Library
admin.site.register(Library)
| 131 | 37 |
import brownie
def test_set_minter_admin_only(accounts, token):
with brownie.reverts("dev: admin only"):
token.set_minter(accounts[2], {"from": accounts[1]})
def test_set_admin_admin_only(accounts, token):
with brownie.reverts("dev: admin only"):
token.set_admin(accounts[2], {"from": account... | 958 | 344 |
import numpy as np
import json
from collections import Counter
import matplotlib.pyplot as plt
DATASET_DIR = './dataset/tacred/train_mod.json'
with open(DATASET_DIR) as f:
examples = json.load(f)
def plot_counts(data):
counts = Counter(data)
del counts["no_relation"]
labels, values = zip(*counts.it... | 1,235 | 432 |
import sys
from fractions import Fraction as frac
from math import gcd, floor
from isqrt import isqrt
sys.setrecursionlimit(10**4)
# text=int(open("4.3_ciphertext.hex").read())
e=int(open("4.4_public_key.hex").read(),0)
n=int((open("4.5_modulo.hex").read()),0)
p = 0
q = 0
# print(text,"\n",e,"\n",n)
def ... | 1,776 | 849 |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 19 06:10:55 2018
@author: PC Lee
Demo of gradient boosting tree
A very nice reference for gradient boosting
http://homes.cs.washington.edu/~tqchen/pdf/BoostedTree.pdf
LightGBM
https://github.com/Microsoft/LightGBM/tree/master/examples/python-guide
Catboost
https://gith... | 2,161 | 829 |
# coding: utf-8
class RurouniException(Exception):
pass
class ConfigException(RurouniException):
pass
class TokenBucketFull(RurouniException):
pass
class UnexpectedMetric(RurouniException):
pass | 215 | 73 |
import numpy
from scipy.ndimage import gaussian_filter
from skimage.data import binary_blobs
from skimage.util import random_noise
from aydin.it.transforms.fixedpattern import FixedPatternTransform
def add_patterned_noise(image, n):
image = image.copy()
image *= 1 + 0.1 * (numpy.random.rand(n, n) - 0.5)
... | 1,756 | 650 |
from os import environ
from pathlib import Path
from appdirs import user_cache_dir
from ._version import version as __version__ # noqa: F401
from .bridge import Transform # noqa: F401
from .core import combine # noqa: F401
from .geodesic import BBox, line, panel, wedge # noqa: F401
from .geometry import get_coast... | 1,069 | 363 |
from morpion import Morpion
import argparse
if __name__=='__main__':
parser = argparse.ArgumentParser(description="Play Tic-Tac-Toe\n")
parser.add_argument('-mode', '--mode', help='play against Human', default=False)
args = parser.parse_args()
mode = False
if args.mode in ["h", "human", "humain",... | 421 | 146 |
"""
Mount /sys/fs/cgroup Option
"""
from typing import Callable
import click
def cgroup_mount_option(command: Callable[..., None]) -> Callable[..., None]:
"""
Option for choosing to mount `/sys/fs/cgroup` into the container.
"""
function = click.option(
'--mount-sys-fs-cgroup/--no-mount-sys-... | 715 | 219 |
# -*- coding: utf-8 -*-
'''
SOAP protocol implementation, dispatchers and client stub.
'''
from __future__ import absolute_import
import logging
import string
import requests
import six
from . import core, namespaces as ns, soap11, soap12, wsa
from .utils import uncapitalize
SOAP_HTTP_Transport = ns.wsdl_soap_http... | 5,676 | 1,626 |
"""functions that generate reports and figures using the .xml output from the performance tests"""
__all__ = ['TestSuite', 'parse_testsuite_xml']
class TestSuite:
def __init__(self, name, platform, tests):
self.name = name
self.platform = platform
self.tests = tests
def __repr__(self)... | 2,505 | 721 |
import os
import pdb
import torch
import random
import numpy as np
import pandas as pd
from torch.utils.data import Dataset
class SnippetsDataset(Dataset):
def __init__(self, data_path, labels_csv_file, mode, transform=None, train_valid_rate=0.8, seed=123):
random.seed(seed)
self.seed = seed
... | 2,538 | 817 |
# coding=utf-8
# Copyright 2018 The TF-Agents Authors.
#
# 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... | 2,809 | 913 |
import os
from selenium import webdriver
import random
import time
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.common.act... | 29,060 | 9,210 |
# __Date__ : 1/5/2020.
# __Author__ : CodePerfectPlus
# __Package__ : Python 3
# __GitHub__ : https://www.github.com/codeperfectplus
#
from Algorithms import LinearRegression
X = [12, 24, 36]
y = [25, 49, 73]
lr = LinearRegression()
lr.fit(X, y)
y_predict = lr.predict(12)
print(y_predict)
| 308 | 144 |
class ControlStyles(Enum,IComparable,IFormattable,IConvertible):
"""
Specifies the style and behavior of a control.
enum (flags) ControlStyles,values: AllPaintingInWmPaint (8192),CacheText (16384),ContainerControl (1),DoubleBuffer (65536),EnableNotifyMessage (32768),FixedHeight (64),FixedWidth (32),Opaque ... | 1,657 | 619 |
#!/usr/bin/env python
from __future__ import with_statement
from cogent import LoadTree
from cogent.phylo import nj as NJ
from cogent.phylo.distance import EstimateDistances
from cogent.core.info import Info
from cogent.util import progress_display as UI
__author__ = "Peter Maxwell"
__copyright__ = "Copyright 2007-20... | 3,858 | 1,226 |
from django.contrib import admin
from di_scoring import models
# copypastad with love from :
# `http://stackoverflow.com/questions/10543032/how-to-show-all-fields-of-model-in-admin-page`
# subclassed modeladmins' list_displays will contain all model fields except
# for id
class CustomModelAdminMixin(object):
def _... | 992 | 305 |
"""
how to create a class
a class is constructed through constructor
=> a class can be constructed through specific function called "__init__(self)"
"""
# let's create a Class
class Person:
"""
A class to create a person with the following attributes:
age, marks, phone, user_id, profession, goal
... | 4,654 | 1,360 |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from functools import partial
import compas_rhino
from compas.geometry import centroid_points
from compas.utilities import color_to_colordict
from compas.artists import NetworkArtist
from .artist import Rhino... | 9,309 | 2,514 |
# Originally auto-generated on 2021-02-15-12:14:36 -0500 EST
# By '--verbose --verbose x7.lib.shell_tools'
from unittest import TestCase
from x7.lib.annotations import tests
from x7.testing.support import Capture
from x7.lib import shell_tools
from x7.lib.shell_tools_load import ShellTool
@tests(shell_tools)
class T... | 1,873 | 609 |
from Crypto.Hash import HMAC, SHA256
import base64
def hmac256Calculation(keyHmac, data):
h = HMAC.new(keyHmac.encode("ascii"), digestmod=SHA256)
h.update(data.encode("ascii"))
return h.digest()
def base64Encoding(input):
dataBase64 = base64.b64encode(input)
dataBase64P = dataBase64.decode("UTF-8"... | 754 | 327 |
from frappe import _
def get_data():
return {
'fieldname': 'vache',
'non_standard_fieldnames': {
'Insemination': 'vache'
},
'transactions': [
{
'label': _('Reproduction'),
'items': ['Insemination','Velage','Diagnostique']
},
{
'label': _('Production'),
'items': ['Lactation item']
... | 408 | 195 |
#!/usr/bin/python
import setuptools
import os
version = {}
with open(os.path.join('stormshield', 'sns', 'sslclient', '__version__.py'), 'r') as fh:
exec(fh.read(), version)
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="stormshield.sns.sslclient",
version=ver... | 1,447 | 472 |
dom_list = ['an_h1']
| 23 | 15 |
# Copyright (c) 2001-2022 Aspose Pty Ltd. All Rights Reserved.
#
# This file is part of Aspose.Words. The source code in this file
# is only intended as a supplement to the documentation, and is provided
# "as is", without warranty of any kind, either expressed or implied.
import uuid
from datetime import datetime
im... | 50,713 | 15,502 |
from .utils import init_kernel
def test_read_string():
k = init_kernel()
k.RAM.load([ord(char) for char in "ABCDE"] + [0])
assert k.read_string(0) == "ABCDE"
k.RAM.load([ord(char) for char in "PYTHON"] + [0], base_address=40)
assert k.read_string(40) == "PYTHON"
def test_write_string():
k = ... | 690 | 278 |
# Copyright 2020 The TensorFlow Authors
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 10,183 | 3,516 |
from parameters import Parameters
from bs4 import BeautifulSoup
import requests
import json
def addr2latlng(addr):
params = Parameters('parameters.txt').load()
payload = {'clientID': params['apikey_naver_id'], 'query': addr}
headers = {
'Host': 'openapi.naver.com',
'User-A... | 1,780 | 672 |
import numpy as np
from sklearn.metrics import mean_squared_error, make_scorer
from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.base import BaseEstimator
from utils import timing # noqa
TUNING_OUTPUT_DEFAULT = 'tuning.txt'
RANDOM_STATE = 42 # Used for reproducible results
class Pre... | 3,297 | 917 |
#
# Licensed under the BSD license. See full license in LICENSE file.
# http://www.lightshowpi.com/
#
# Author: Todd Giles (todd@lightshowpi.com)
"""FFT methods for computing / analyzing frequency response of audio.
This is simply a wrapper around FFT support in numpy.
Initial FFT code inspired from the code posted... | 3,544 | 1,084 |
# -*- coding: utf-8 -*-
from misaka import Markdown, BaseRenderer, HtmlRenderer, \
SmartyPants, \
EXT_FENCED_CODE, EXT_TABLES, EXT_AUTOLINK, EXT_STRIKETHROUGH, \
EXT_SUPERSCRIPT, HTML_USE_XHTML, \
TABLE_ALIGN_L, TABLE_ALIGN_R, TABLE_ALIGN_C, \
TABLE_ALIGNMASK, TABLE_HEADER
class BleepRenderer(Htm... | 2,625 | 969 |
"""
The batchimport_settings.py module initializes itself with defaults but
allows for the values to be overridden via the django project's settings
file.
NOTE: These values should be considered CONSTANTS even though I'm kind
of cheating and using them as variables to initialize them here.
"""
import settings
def ... | 3,663 | 1,203 |
import os
import pytest
import slash
from lxml import etree
def test_xunit_plugin(results, xunit_filename):
assert os.path.exists(xunit_filename), 'xunit file not created'
schema_root = etree.XML(_XUNIT_XSD)
schema = etree.XMLSchema(schema_root)
parser = etree.XMLParser(schema=schema)
with open... | 10,119 | 2,863 |
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
default_params = {
'text.usetex': False,
'font.family': 'Times New Roman',
'font.serif': 'Times New Roman'
}
if __name__ == '__main__':
plt.rcParams.update(default_params)
myfont1 = matplotlib.font_manager.FontProperties(fname='C... | 2,495 | 1,143 |
import wsgi # noqa: F401
def test_connect_to_app(http_client):
response = http_client.get('/')
assert response.status_code == 404
| 144 | 54 |
from ceefax.page import Page
from ceefax import config
from ceefax import Ceefax
class IndexPage(Page):
def __init__(self, n):
super(IndexPage, self).__init__(n)
self.importance = 5
self.title = "Index"
def generate_content(self):
self.print_image(config.title, 1)
self... | 884 | 308 |
# encode = utf-8
import os
import sys
import re
ta_name = 'SA-ctf_scoreboard'
ta_lib_name = 'sa_ctf_scoreboard'
pattern = re.compile(r"[\\/]etc[\\/]apps[\\/][^\\/]+[\\/]bin[\\/]?$")
new_paths = [path for path in sys.path if not pattern.search(path) or ta_name in path]
new_paths.insert(0, os.path.sep.join([os.path.dir... | 372 | 156 |
# Generated by Django 2.0.1 on 2019-01-07 14:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('waitlist', '0001_initial'),
('books', '0008_bookcopy_borrow_date'),
]
operations = [
migrations.AddField(
model_name='li... | 503 | 169 |
import re
import tweepy
from tweepy import OAuthHandler
from textblob import TextBlob
# pip install tweepy
# pip install textblob
# developer.twitter.com/en/portal/dashboard
def istenmeyen_karakter_temizle(text):
istenmeyen_karakterler = [':',';','!','*','$','ยฝ','&']
for karakter in istenmeyen_... | 3,671 | 1,395 |
'''gtd.py'''
__version__ = '0.7.0'
__author__ = 'delucks'
| 58 | 30 |
#!/usr/bin/env python3
"""
A simple subreddit scraper
"""
import datetime as dt
import logging
import time
import os
import sys
import getopt
import praw
from psaw import PushshiftAPI
if __package__ == None:
import db
else:
from . import db
def init_log():
"""
Initiates a logger for psaw to be used ... | 7,695 | 2,458 |
class BadStatement(Exception):
pass
| 40 | 11 |
# Copyright 2021 The Trieste Contributors
#
# 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... | 1,222 | 350 |
from django.core.exceptions import ValidationError
from django.utils.deconstruct import deconstructible
VALIDATE_ONLY_LETTERS_EXCEPTION_MESSAGE = 'Ensure this value contains only letters.'
def validate_only_letters(value):
if not value.isalpha():
raise ValidationError(VALIDATE_ONLY_LETTERS_EXCEPTION_MESS... | 829 | 277 |
import mimetypes
import re
from urllib.parse import quote
from seleniumwire.thirdparty.mitmproxy.net.http import headers
def encode(head, l):
k = head.get("content-type")
if k:
k = headers.parse_content_type(k)
if k is not None:
try:
boundary = k[2]["boundary"].en... | 2,347 | 708 |
from django.apps import AppConfig
from django.utils.translation import gettext_lazy
class PluginApp(AppConfig):
name = 'pretalx_mattermost'
verbose_name = 'MatterMost integration for pretalx'
class PretalxPluginMeta:
name = gettext_lazy('MatterMost integration for pretalx')
author = 'Tosh... | 566 | 169 |
import json
from django.http import HttpResponse
from django.forms.widgets import Select
from django.contrib.auth.decorators import login_required
from flexselect import (FlexSelectWidget, choices_from_instance,
details_from_instance, instance_from_request)
@login_required
def field_changed(... | 1,156 | 317 |
########################################################################
#
# Vision Macro - Python source code - file generated by vision
# Thursday 01 July 2010 13:22:44
#
# The Scripps Research Institute (TSRI)
# Molecular Graphics Lab
# La Jolla, CA 92037, USA
#
# Copyright: Daniel Stoff... | 20,371 | 6,997 |
from django.shortcuts import render,redirect,HttpResponse
from repository import models
def trouble_list(request):
# user_info = request.session.get('user_info') # {id:'',}
current_user_id = 1
result = models.Trouble.objects.filter(user_id=current_user_id).order_by('status').\
only('title','status',... | 4,821 | 1,560 |
import cv2
from camio import Camera
camera = Camera(
src=0,
fps=30,
size=None,
emitterIsEnabled=False,
queueModeEnabled=False,
backgroundIsEnabled=True,
)
camera.start()
while True:
image = camera.read()
if image is not None:
c... | 442 | 144 |
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='pydata_jy',
version='1.0.0',
description='PyData Location List',... | 876 | 301 |
from datetime import datetime
from typing import Optional
from src.utils.config import config
from tortoise import fields
from tortoise.models import Model
defaule_nickname: str = config.get('default').get('nickname')
class BotInfo(Model):
'''QQๆบๅจไบบ่กจ'''
bot_id = fields.IntField(pk=True)
'''ๆบๅจไบบQQๅท'''
... | 4,759 | 1,661 |
import ckan.model as model
from ckan.tests.legacy import url_for, CreateTestData, WsgiAppCase
class TestAdminController(WsgiAppCase):
@classmethod
def setup_class(cls):
# setup test data including testsysadmin user
CreateTestData.create()
@classmethod
def teardown_class(self):
... | 5,816 | 1,709 |
"""
Copyright (c) 2019 Yevheniia Soroka
Licensed under the MIT License
Author: Yevheniia Soroka
Email: ysoroka@cs.stonybrook.edu
Last modified: 18/12/2019
Usage:
Run this script to train GloVe model on Adobe tags.
"""
import os
import gluonnlp as nlp
import numpy as np
import matplotlib.pyplot as plt
import seaborn a... | 943 | 352 |
#
# plot-sine-wave.py
# Produce a PNG file of a sine wave plot
#
# Sparisoma Viridi | https://butiran.github.io
#
# Execute: py plot-sine-wave.py
# Output: sine-t-<time>.png
#
# 20210212
# 1901 Create this by modifying moving-sine-wave.py from [1].
# 1902 Remove FuncAnimation from matplotlib.animation.
# 1904 Can s... | 3,592 | 1,577 |
from django.urls import path
from grandchallenge.emails.views import (
EmailCreate,
EmailDetail,
EmailList,
EmailUpdate,
)
app_name = "emails"
urlpatterns = [
path("", EmailList.as_view(), name="list"),
path("create/", EmailCreate.as_view(), name="create"),
path("<int:pk>/",... | 433 | 149 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from enum import Enum
__all__ = [
'AlertNotifications',
'AlertsToAdmins',
'DataSource',
'ExportData',
'RecommendationConfigStatus'... | 2,212 | 866 |
# Write a program that reads a word and prints all substrings, sorted by length. For
# example, if the user provides the input "rum" , the program prints
# r
# u
# m
# ru
# um
# rum
word = str(input("Enter a word: "))
wordLen = len(word)
subLen = 1
start = 0
for i in range(wordLen):
star... | 437 | 149 |
# -*- coding: utf-8 -*-
import json
from functools import partial
from fractions import Fraction
from barbecue import chef
from decimal import Decimal
def prepare_initial_bid_stage(bidder_name="",
bidder_id="",
time="",
amount_f... | 5,462 | 1,572 |
####################################################################################################
# @file pool.py
# @package
# @author
# @date 2008/10/29
# @version 0.1
#
# @mainpage
#
####################################################################################################
from weakref import... | 5,446 | 1,668 |
import argparse
import csv
import sys
import numpy as np
from BeesEtAl.BA_Garden import BA_Garden
from BeesEtAl.F3_Garden import F3_Garden
from BeesEtAl.Base_Coster import Base_Coster
from DomeBuilder.MaterialLib import MaterialLib
from DomeBuilder.Frame import Frame
# Defaults
bF3 ... | 13,287 | 4,812 |
file_counts = {"jpg":10, "txt":14, "csv":2, "py":23}
print(file_counts)
file_counts["txt"]
14
"jpg" in file_counts
True
"html" in file_counts
False
file_counts["cfg"] = 8
print file_counts
{"jpg":10, "txt":14, "csv":2, "py":23, "cfg" = 8 }
file_counts["csv"]= 17
print file_counts
{"jpg":10, "txt":14, "csv":17, "py":23,... | 333 | 169 |
"""
Database model for Monolithic application
~~~~~~~~~~~~~~~~~~~~~~~
:created date: Thursday, March 12, 2020
:description: Monolithic application implementation of simple order transaction scenario
:copyright: ยฉ 2020 written by sungshik (liks79@gmail.com)
:license: BSD 3-Clause License, see LI... | 3,632 | 1,214 |
#!/usr/bin/python3
import os
PROJ_PATH = os.getenv('NEU_PATH')
# Test
lib_list = [
'dev_global','libutils', 'libmysql_utils',
'libbasemodel', 'libspider', 'libnlp',
'libcontext', 'service_api', 'libstrategy', 'libtask']
# lib_list = ['libstrategy',]
for lib in lib_list:
print(f"[Building {lib}]")
#... | 662 | 252 |
###########################
#
# #116 Red, green or blue tiles - Project Euler
# https://projecteuler.net/problem=116
#
# Code by Kevin Marciniak
#
###########################
| 175 | 56 |
import numpy as np
import pickle
import pandas as pd
import random
from matplotlib import pyplot as plt
from plot_styles import *
# #################################################################
# Load data
# #################################################################
df_papers_auth = pickle.load(open('../... | 7,569 | 3,348 |
from builtins import str
from builtins import range
from builtins import object
import os
import re
import json
import math
import logging
import requests
import warnings
from time import mktime
from copy import deepcopy
from datetime import datetime
from datetime import date
from p2p import utils
from p2p.cache import... | 58,443 | 16,206 |
import pandas as pd
from scipy.stats import ttest_ind
experiments = ("creditcardfraud", "histology", "aki")
usecols = ("F1", ) # "Precision", "Recall"
alpha = 0.05
for experiment in experiments:
df_nn = pd.read_csv(f"./results/{experiment}/nn.csv", usecols=usecols)
df_dqn = pd.read_csv(f"./results/{experimen... | 707 | 279 |
from .MTRead import MTread,spec_plot,read_multiple_MT
from .main import MTreadgui,acousonde | 91 | 32 |
# -*- coding: utf-8 -*-
'''
split long seq into small sub_seq,
feed sub_seq to lstm
'''
from __future__ import division, print_function, absolute_import
import tflearn
import tflearn.data_utils as du
import numpy as np
import ReadData
import tensorflow as tf
from tensorflow.contrib import learn
from tensorflow.con... | 5,739 | 2,393 |
import os
import json
import config
import pandas as pd
def create_data_files(patents, ipcr):
chunk_count = 0
patent_count = 0
for chunk in patents:
# Combine patent with respective section info.
data = chunk.merge(ipcr, how='left', on='patent_id')
# Replace the letters with integ... | 3,277 | 1,020 |
import migrate
import argparse
import shutil
__author__ = "Joseph Azevedo"
__version__ = "1.0"
DESCRIPTION = "Migrates multiple repositories at once"
HTTPS_START = "https://"
REPO_FORMAT = "{}/{}/{}.git"
def main(source_site, dest_site, repos, dest_user=None, dest_token=None, source_user=None, source_token=None,
... | 3,291 | 998 |
# coding=utf-8
#!/usr/bin/env python3
from libs.animation import colorText
logo = '''
[[black-bright-background]][[red]] โโโ [[green]]โโโโ โ [[blue]] โโโโโโ [[magenta]]โโโโโโโโโ [[cyan]]โโโ [[red]] โโโโโโ [[green]]โโโโโโ [[blue]] โโโโโโ [[magenta]]โโโโโโ [[cyan]]โโโโโโ [[yellow]]โโโโโโโโโ[[r... | 2,704 | 1,274 |
# -*- coding: utf-8 -*-
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2008, Frank Scholz <coherence@beebits.net>
'''
Switch Power service
====================
'''
from twisted.web import resource
from coherence.upnp.core import service
from coherence.upnp.core.soap_s... | 1,228 | 366 |
# funรงรฃo enumerate
lista = ['abacate', 'bola', 'cachorro'] # lista
for i in range(len(lista)):
print(i, lista[i])
for i, nome in enumerate(lista):
print(i, nome)
# funรงรฃo map
def dobro(x):
return x * 2
valor = [1, 2, 3, 4, 5]
print(dobro(valor))
valor_dobrado = map(dobro, valor)
valor_dobrado = list... | 503 | 224 |
import datetime
import json
import logging
import operator
import os
from collections import defaultdict
from datetime import date
import vk_api
import vk_api.exceptions
from vk_api import execute
#from .TimeActivityAnalysis import VKOnlineGraph
from .VKFilesUtils import check_and_create_path, DIR_PREFIX
class VKAc... | 30,068 | 8,741 |
x = 100
y = 50
print('x=', x, 'y=', y)
| 40 | 29 |
import os
from hamcrest import *
from pytest import fixture
from tempfile import _get_candidate_names as temp_dir_candidates, tempdir
from time import sleep
from aeronpy import Archive
from aeronpy.driver import archiving_media_driver
@fixture()
def aeron_directory():
temp_dirs = temp_dir_candidates()
where ... | 4,776 | 1,799 |
import edits
from edits import PageEditor
pe = PageEditor(keyword='spider', orientation='block')
pe.edit() | 106 | 31 |
BASE_CASE = {
"model": {
"random_seed": 495279142,
"default_age_grid": "0 0.01917808 0.07671233 1 5 10 20 30 40 50 60 70 80 90 100",
"default_time_grid": "1990 1995 2000 2005 2010 2015 2016",
"add_calc_emr": "from_both",
"birth_prev": 0,
"ode_step_size": 5,
"m... | 6,095 | 2,070 |
from __future__ import print_function
import numpy as np
import os
from datetime import datetime
import random
import time
import pickle
from pyniel.python_tools.path_tools import make_dir_if_not_exists
import pandas as pd
from navrep.models.vae2d import ConvVAE
from navrep.models.vae1d import Conv1DVAE
from navrep.mo... | 14,778 | 5,020 |
#Write a function named "falling_distance" that accepts an object's falling time
#(in seconds) as an argument. The function should return the distance, in meters
#, that the object has fallen during the time interval.Write a program that
#calls the function in a loop that passes the values 1 through 10 as arguments
... | 893 | 277 |
from __future__ import print_function
import argparse
import os
import sys
import subprocess
import datetime
def get_formatted_time(seconds):
return str(datetime.timedelta(seconds=seconds))
# microsecond = int((seconds - int(seconds)) * 1000 * 1000)
# int_seconds = int(seconds)
# hour = int_seconds // 3... | 3,140 | 936 |
from typing import Any, Final, Tuple, List
from enum import IntEnum
from .MsgType import MsgType
class Message():
"""Base Message
Arguments:
type {MsgType} -- Type of message
payload {Any} -- Payload used for later handling
"""
def __init__(self, type: MsgType, payload: Any) ->... | 3,101 | 928 |
import time
import unittest
from web3 import Web3
from celo_sdk.kit import Kit
from celo_sdk.tests import test_data
class TestStableTokenWrapper(unittest.TestCase):
@classmethod
def setUpClass(self):
self.kit = Kit('http://localhost:8544')
self.stable_token_wrapper = self.kit.base_wrapper.c... | 2,984 | 1,020 |
"""Represent the command parameter strings."""
ARG_COMMAND = 'command'
ARG_ARGUMENT = 'argument'
ARG_COUNT = 'count'
ARG_CHANNEL = 'channel'
ARG_CLIENT = 'client'
ARG_GUID = 'guid'
ARG_CHANGELIST = 'cl'
ARG_DEV_CHANNEL = 'dev_channel'
ARG_QUEUE_WORKER_NUMBER = 'worker_number'
ARG_CALLBACK = 'callback'
ARG_PAYLOAD = 'pa... | 3,450 | 1,661 |
import json
import pandas
def output_sanitization(path_to_excel, path_to_out_json=None):
''' Find the Success percentage of each output report '''
path = path_to_excel
out_obj = []
excel_obj = []
# Output Sanitization
wb = pandas.read_excel(path, engine='openpyxl')
cols = 0
for s in ... | 3,412 | 1,027 |