text string | size int64 | token_count int64 |
|---|---|---|
import collections
from typing import Callable
import torch.nn as nn
from ..modules import DropBlock
class DenseNetOperation(nn.Sequential):
'''
Operation class for DenseNets.
'''
def __init__(
self,
in_channels: int,
out_channels: int,
stride: int,
growth: i... | 1,787 | 517 |
import os
import rospy
from shutil import move
from tempfile import gettempdir, NamedTemporaryFile
from ipfshttpclient import connect
from rosbag import Bag
def ipfs_download_txt_file(ipfs_hash: str) -> str:
temp_log = NamedTemporaryFile(delete=False)
ipfs_download_file(connect(), ipfs_hash, temp_log.name)
... | 1,664 | 538 |
from duck import Duck
class TurkeyAdapter(Duck):
def __init__(self, turkey):
self.turkey = turkey
def quack(self):
self.turkey.gobble()
def fly(self):
for _ in range(5):
self.turkey.fly()
| 240 | 87 |
import rdflib as rl
import pyld as ld
import json
g = rl.ConjunctiveGraph()
g.parse(('https://raw.githubusercontent.com/incf-nidash/nidm-specs/master/nidm/nidm-results'
'/spm/example001/example001_spm_results.ttl'),
format='turtle')
g2 = g.serialize(format='json-ld')
context = { "@context": "https://... | 475 | 197 |
import datetime
def get_timestamp_min_in_past(min_ago: int) -> datetime.datetime:
dt = datetime.datetime.now() - datetime.timedelta(minutes=min_ago)
return dt.replace(tzinfo=datetime.timezone.utc)
| 207 | 72 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'competition.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, ... | 13,571 | 4,887 |
# !/usr/bin/python
# -*-coding:utf-8 -*-
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
class AutoBookTKB:
def __in... | 5,200 | 1,599 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import unittest
import numpy as np
from mripy import afni, math
class test_afni(unittest.TestCase):
def test_get_prefix(self):
# 3d dset
self.assertEqual(afni.get_prefix... | 3,019 | 1,253 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import connection, migrations
def populate_data_type_tags(apps, schema_editor):
# Go through all of the ScaleFile models and convert the data_type string into an array of tags
update = 'UPDATE scale_file SET data_type_tags = string... | 1,245 | 373 |
import sys
from basic import *
import tcr_distances
import parse_tsv
import numpy as np
from scipy.cluster import hierarchy
from scipy.spatial import distance
import util
import html_colors
from all_genes import all_genes
with Parser(locals()) as p:
#p.str('args').unspecified_default().multiple().required()
p... | 30,750 | 10,047 |
"""
Import all of the processing functions.
"""
from .engine import *
from .manage import *
from .services import *
from .viz import *
| 135 | 40 |
import pytest
pytest.importorskip("hvac")
| 43 | 18 |
# File: cybereason_consts.py
#
# 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, ... | 1,436 | 467 |
from django.urls import path
from django.views.decorators.csrf import csrf_exempt
from config.settings import TG_WEB_HOOK_URL
from .views import tg_web_hook
urlpatterns = [
path(TG_WEB_HOOK_URL, csrf_exempt(tg_web_hook)),
]
| 230 | 90 |
import collections
import types
try:
import graphviz
GRAPHVIZ_INSTALLED = True
except ImportError:
GRAPHVIZ_INSTALLED = False
from .. import base
from . import func
__all__ = ['TransformerUnion']
class TransformerUnion(collections.UserDict, base.Transformer):
"""Packs multiple transformers into a... | 4,242 | 1,281 |
"""
Attribution:
1. Fire SVG made by made by Deepak K Vijayan (2xsamurai). Available from: https://codepen.io/2xsamurai/pen/EKpYM". Logo animation and form animation were made by me.
2. "round_up" function wirtten by Priyankur Sarkar. AVailable from: https://www.knowledgehut.com/blog/programming/py... | 30,740 | 8,794 |
import os
from dateutil.parser import parse
import unittest
from modispds.earthdata import query, download_granule
class TestCMR(unittest.TestCase):
""" Test query and downloading from CMR """
date1 = parse('2016-01-01').date()
date2 = parse('2016-01-02').date()
date3 = parse('2016-01-30').date()
... | 1,398 | 552 |
#!/usr/bin/python
# use serial python lib included in MansOS
import sys
sys.path.append('../../../mos/make/scripts')
import serial
import threading
import random
import time
baudRate = 38400
try:
ser = serial.Serial(
port='/dev/ttyUSB0',
baudrate=baudRate,
parity=serial.PARITY_NONE,
... | 1,787 | 587 |
import h5py
import sys
file = h5py.File(sys.argv[1], "r")
for chr in file.keys():
data = file[chr][:]
print(chr, data.mean())
| 137 | 57 |
#!/usr/bin/env python
from setuptools import setup
setup(
name='k5test',
version='0.10.0',
author='The Python GSSAPI Team',
author_email='sross@redhat.com',
packages=['k5test'],
description='A library for testing Python applications in '
'self-contained Kerberos 5 environments'... | 1,205 | 372 |
from src.dmri import (run_spm_fsl_dti_preprocessing,
run_dti_artifact_correction,
correct_dwi_space_atlas,
get_con_matrix_matlab,
run_dtk_tractography,
)
from src.interfaces import (CanICAInterface,
... | 2,677 | 647 |
# Copyright 2016 NOKIA
#
# 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... | 1,062 | 358 |
####################################################### CREATE INTERFACE GUI ###########################################
import os
from tkinter import *
import time
window = Tk()
window.title("DEX PancakeBot")
window.minsize(width=500, height= 600)
window.config(padx=20, pady=20)
# Title
Title = Label(text... | 4,195 | 1,400 |
from .views import movie_details, movie_list
from django.urls import path, include
urlpatterns = [
path('all/', movie_list, name="movie-list"),
path('<int:pk>/', movie_details, name="movie-details"),
]
| 211 | 68 |
from graphene import relay
from graphene_django import DjangoObjectType
from graphene_federation import key
from ...reviews.models import Performer
@key("mbid")
class PerformerType(DjangoObjectType):
class Meta:
model = Performer
interfaces = (relay.Node,)
| 280 | 80 |
"""Tests for `python_dev_tools` package."""
import sys
from pathlib import Path
from textwrap import dedent
import python_dev_tools.whataformatter
import python_dev_tools.whatalinter
from python_dev_tools.whataformatter import main as main_formatter
from python_dev_tools.whatalinter import lint, main as main_linter
... | 3,550 | 1,218 |
"""Classes for evaluating generated DeepA2 records"""
# flake8: noqa
# pylint: skip-file
from deepa2.metrics.metric_handler import (
DA2PredictionEvaluator,
)
| 164 | 58 |
"""
Models for the dark-launching languages
"""
from config_models.models import ConfigurationModel
from django.db import models
class DarkLangConfig(ConfigurationModel):
"""
Configuration for the dark_lang django app.
.. no_pii:
"""
released_languages = models.TextField(
blank=True,
... | 1,664 | 460 |
# ___ ___ _ __ _ _ _ __ ___ _ __ ___ _ _
# / __|/ __| '__| | | | '_ ` _ \| '_ ` _ \| | | |
# \__ \ (__| | | |_| | | | | | | | | | | | |_| |
# |___/\___|_| \__,_|_| |_| |_|_| |_| |_|\__, |
# |___/
__title__ = 'scrummy'
__description__ = 'Plaintext Scrum-like Todo and ... | 548 | 237 |
"""
*Calculates the specular (Neutron or X-ray) reflectivity from a stratified
series of layers.
The refnx code is distributed under the following license:
Copyright (c) 2015 A. R. J. Nelson, ANSTO
Permission to use and redistribute the source code or binary forms of this
software and its documentation, with or with... | 3,210 | 1,295 |
from sklearn.model_selection import GridSearchCV
from sklearn.metrics import roc_auc_score, accuracy_score
from sklearn.naive_bayes import GaussianNB
from xgboost import XGBClassifier
import os
from Logger import AppLogger
class ModelFinder:
'''
This class shall be used to find the model with best acc... | 7,015 | 2,220 |
"""empty message
Revision ID: 8778f6b803ae
Revises: 309f6ca2a8ec
Create Date: 2018-03-04 18:11:47.289975
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = '8778f6b803ae'
down_revision = '309f6ca2a8ec'
branch_labels = None
depe... | 2,547 | 1,000 |
# 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, software
# distributed under the... | 7,248 | 2,161 |
# Copyright 1999-2018 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 35,539 | 10,445 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# The MIT License (MIT)
#
# Copyright (c) 2017 Sean Robertson
#
# 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... | 5,574 | 1,626 |
from django.db import models
import datetime, time
import django.utils.timezone as timezone
from student.models import Student
from teacher.models import Teacher
from utils.customfilefield.storage import FileStorage
# Create your models here.
class EduProject(models.Model):
#教改/教研/教材项目数据模型
TYPE_CHOIC... | 6,200 | 2,707 |
import pandas as pd
import pytest
from iexfinance.stocks import Stock
from iexfinance.utils.exceptions import IEXQueryError
class TestStockPrices(object):
def setup_class(self):
self.a = Stock("AAPL")
self.b = Stock(["AAPL", "TSLA"])
self.c = Stock("SVXY")
self.d = Stock(["AAPL", ... | 2,374 | 798 |
# coding = utf-8
# -*- coding: utf-8 -*-
import json
from openpyxl import load_workbook
# 读取某一个region,从此之下读取两列拼装成map
def read_region_below_map(fn, sheet_name, region_name):
mp = {}
wb = load_workbook(fn)
ws = wb[sheet_name]
region = ws[region_name]
next_row = region.row + 1
column = region.co... | 3,855 | 1,447 |
## Sid Meier's Civilization 4
## Copyright Firaxis Games 2005
from CvPythonExtensions import *
import CvUtil
import ScreenInput
import CvScreenEnums
import math
# globals
gc = CyGlobalContext()
ArtFileMgr = CyArtFileMgr()
localText = CyTranslator()
# this class is shared by both the resource and technology foreign ad... | 42,562 | 18,812 |
# 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 aspose.words as aw
from api_example_b... | 6,300 | 1,889 |
from PreprocessData.all_class_files.StructuredValue import StructuredValue
import global_data
class PriceSpecification(StructuredValue):
def __init__(self, additionalType=None, alternateName=None, description=None, disambiguatingDescription=None, identifier=None, image=None, mainEntityOfPage=None, name=None,... | 3,036 | 957 |
#!/usr/bin/python3
import numpy as np
from numpy import matlib
from numpy import random
import sys
import copy
import scipy.signal
import scipy.stats.stats
from matplotlib import pyplot as plt
import unittest
def Norm(t):
while t > np.pi:
t -= 2 * np.pi
while t < -np.pi:
t += 2 * np.pi
return t
def Sign... | 43,682 | 18,596 |
class Solution(object):
def prefixesDivBy5(self, A):
"""
:type A: List[int]
:rtype: List[bool]
"""
return self.prefixMod(A)
def forLoop(self, A):
A = "".join([str(x) for x in A])
ret = [False] * len(A)
for i in range(len(A)):
if int(A[... | 671 | 264 |
from .base import BaseKey, BaseKeyControl
from .exceptions import KeyNotFound
from evechem_api.maps import application_map
from evechem_api.models import Error
class APIKey(BaseKey):
valid_permissions = [
'master',
'director',
'manager',
'auditor',
'customer']
def __init__(self, value, operation_id, perm... | 1,105 | 418 |
heatmap_prep_plotnine = survey_data.groupby([survey_data['eventDate'].dt.year,
survey_data['eventDate'].dt.month]).size()
heatmap_prep_plotnine.index.names = ["year", "month"]
heatmap_prep_plotnine = heatmap_prep_plotnine.reset_index(name='count') | 293 | 95 |
from django.urls import path
from Apps.Colaborativo import views
app_name = 'Colaborativo'
urlpatterns = [
path('', views.goEspacioColaborativo, name="colaboracion"),
path('update/<int:ida>', views.updateInfoAuditoria, name="update"),
] | 248 | 85 |
from pyexpat import model
from django.db import models
from django.contrib.auth.models import User
from cloudinary.models import CloudinaryField
# Create your models here.
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE, verbose_name='User')
bio = models.TextField(max_le... | 3,200 | 994 |
# script to record my location.
from time import sleep
import csv
import android
i=0
documentCount = 0
droid = android.Android()
while 1:
try:
sleep(5)
droid.startLocating(30,5)
sleep(5)
location = droid.readLocation().result
droid.stopLocating()
if hasatt... | 1,261 | 350 |
# Generated by Medikit 0.7.5 on 2020-05-19.
# All changes will be overriden.
# Edit Projectfile and run “make update” (or “medikit update”) to regenerate.
from codecs import open
from os import path
from setuptools import find_packages, setup
here = path.abspath(path.dirname(__file__))
# Py3 compatibility hacks, bo... | 2,123 | 731 |
import sys
import tkinter as tk
from tkinter import messagebox as tkMessageBox
import re
import subprocess
import datetime
import getpass
import tkinter.simpledialog
import os
# location of configuration file
# this file in this version nees to command
# 1- COMMAND -> command that run for make backup -> use rsync re... | 3,947 | 1,237 |
from mlctl.interfaces.Hosting import Hosting
from mlctl.plugins.utils import parse_config
import boto3
class SagemakerHosting(Hosting):
def __init__(self, profile=None):
if profile:
boto3.setup_default_session(profile_name=profile)
self._client = boto3.client("sagemaker")
def crea... | 3,061 | 698 |
import numpy as np
from number_generator import helpers
def test_calculate_binary_image_contents_bbox():
# create an empty image
empty_image = np.zeros((28, 28), dtype=np.uint8)
bbox = helpers.calculate_binary_image_contents_bbox(empty_image)
# bbox of empty image (background only) should be all zero... | 1,836 | 638 |
from django.urls import path
from . import views
from rest_framework.urlpatterns import format_suffix_patterns
urlpatterns = [
# path('', views.products_list),
# path('<int:pk>/', views.product_detail),
path('', views.ProductList.as_view()),
path('<int:pk>/', views.ProductDetail.as_view())
]
urlpatter... | 360 | 120 |
"""
Models shared between locomotive modules.
"""
from .board import BoardEntry
from .journey import Journey, Proposal, Segment, Transport
from .passenger import Passenger
from .station import Station
| 202 | 55 |
# Author: btjanaka (Bryon Tjanaka)
# Problem: (UVa) 452
# Title: Project Scheduling
# Link: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=393
# Idea: Shortest path algorithm in a DAG - find topological ordering then go
# through and relax all edges - O(E) tim... | 1,538 | 547 |
from django import forms
class PiazzaAuthForm(forms.Form):
# User Info
user_id = forms.CharField()
lis_person_contact_email_primary = forms.CharField()
#lis_person_name_given = forms.CharField()
#lis_person_name_family = forms.CharField()
lis_person_name_full = forms.CharField()
lis_person_... | 1,186 | 358 |
from utils import (
read_data,
input_setup,
imsave,
merge
)
import time
import os
import numpy as np
import tensorflow as tf
from math import ceil
class RECONNET(object):
def __init__(self,
sess,
image_size=33,
label_size=33,
... | 6,563 | 2,659 |
#!/usr/bin/env python3
__all__ = ['test_ClientConnections', 'test_websock_server']
| 84 | 31 |
class ValueTypeError(Exception):
description: str = 'Occurs when type does not match'
def __str__(self):
return "Value type does not match"
| 157 | 43 |
__all__ = ['basic', 'expiry', 'stats', 'advanced', 'startup', '64bit']
| 71 | 29 |
#!/usr/bin/python
########################################################################################################################
#
# Copyright (c) 2014, Regents of the University of California
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permi... | 2,024 | 646 |
# CamJam EduKit 2 - Sensors (GPIO Zero)
# Worksheet 5 - Movement
# Import Python header files
from gpiozero import MotionSensor
import time
# Set a variable to hold the GPIO Pin identity
pir = MotionSensor(17)
print("Waiting for PIR to settle")
pir.wait_for_no_motion()
print("PIR Module Test (CTRL-C to exit)")
# V... | 1,035 | 303 |
import sys, random, math, time, json
from datetime import date, timedelta
import threading
from models.model import db, User, Scard, cache
import mysql.connector
from app import app, mysql_host, mysql_user, mysql_password, mysql_database
db.__init__(app)
'''
測試區
'''
start_time = time.time()
today = date.today()
yest... | 5,014 | 2,117 |
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 23 16:16:20 2018
@author: clementsw
"""
from setuptools import setup
def readme():
with open('README.rst') as f:
return f.read()
setup(name='interferometer',
version='0.1',
description='Algorithms for universal interferometers',
long_descr... | 1,067 | 334 |
import click
import os
from github_releaser import GithubReleaser
@click.command(name="upload-assets", help="Upload assets to a existent release")
@click.option("--account", "--a", required=True, help="Account")
@click.option("--repository", "--r", required=True, help="Repository")
@click.option("--token", help="Git... | 825 | 262 |
##
# Gain Calculation
# for implementing decision trees
#
# @author antriksh
# Version 1: 09/16/2017
from Dataset import Dataset
import pandas as pd
import numpy as np
import random
class Gain():
def __init__(self):
pass
def entropy(self, dataset):
"""
Find the degree of rando... | 2,355 | 689 |
import unittest
from getnet.services.token import CardNumber
class CardNumberTest(unittest.TestCase):
def testInvalidCardNumber(self):
with self.assertRaises(AttributeError):
CardNumber("123", "123")
def testInvalidCustomerId(self):
with self.assertRaises(AttributeError):
... | 667 | 250 |
import sys
import json
import argparse
import sys
def _initialize():
parser = argparse.ArgumentParser(
description="General config loader."
)
parser.add_argument(
"-c",
"--config_file",
help="Address of the config file."
)
return parser
def _get_options(parser, arg... | 935 | 269 |
import time
import gym
import numpy as np
import pybullet
from trifinger_simulation import TriFingerPlatform, visual_objects
from trifinger_simulation.tasks import move_cube_on_trajectory as task
from three_wolves.envs.base_cube_env import ActionType, BaseCubeTrajectoryEnv
from three_wolves.envs.utilities.env_utils i... | 12,703 | 3,816 |
from django.urls import path
from . import permissions
from . import utils
class ItemViewSetPermissionMixin:
def has_access(self):
permissions.user_can_access_item_type(
self.get_request_user(),
self.get_project_id(),
self.get_item_type()
)
class UtilsViewSe... | 1,220 | 397 |
import os
from setuptools import Extension, setup
try:
from Cython.Build import cythonize
except ImportError:
cythonize = None
def ALL_C(folder, exclude=[]):
return [
'/'.join([folder, f])
for f in os.listdir(folder)
if f[-2:] == '.c' and f not in exclude
]
extensions = [
... | 599 | 194 |
# 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 ... import _utilities
import typing
# Export this package's modules as members:
from ._enums import *
from .certificate import *
from .certificate... | 2,967 | 932 |
from flask import render_template,redirect,url_for,abort,request,flash
from app.main import main
from .forms import UpdateProfile,CreateBlog
from flask_login import login_required,current_user
from ..email import mail_message
from app.models import User,Blog,Comment,Follower
from ..import db
from app.requests import ge... | 4,976 | 1,564 |
import os
from debufftracker import screen_tools
current_dir = os.path.dirname( os.path.abspath(__file__))
project_dir = os.path.join(current_dir, os.path.pardir)
# set project source folder as working directory
os.chdir(project_dir)
if __name__ == "__main__":
screentracker = screen_tools.ScreenTracker()
scr... | 380 | 132 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
setup(
cmdclass={'build_ext':build_ext},
ext_modules=[
Extension("dezing",["dezing.pyx"],
libraries=["dezing"])
]
)
| 279 | 83 |
"""
Runtime: 3284 ms, faster than 74.29% of Python3 online submissions for Count of Smaller Numbers After Self.
Memory Usage: 33.2 MB, less than 76.39% of Python3 online submissions for Count of Smaller Numbers After Self.
"""
from typing import List
from typing import Optional
class Solution:
def countSmaller(sel... | 1,231 | 406 |
import inspect
from singleton.AboutViewSingleton import AboutViewSingle
def is_num(num):
try:
float(num)
return True
except BaseException:
return False
def colname_to_colnum(colname):
if type(colname) is not str:
return colname
col = 0
power = 1
for i in rang... | 1,130 | 411 |
# Implementation of Dropdown in tkinter
from tkinter import *
root = Tk()
root.title("Dropdown Implementation")
root.geometry("200x50")
def response():
print("Button clicked.")
# create a menubar
menubar = Menu(root)
# configure root to use that menubar
# display the menu
root.config(menu=menubar)
# Add items... | 696 | 228 |
print((:(:7:):))
a = (: [[lua string]] :)
b = (: x .. y :)
c = (: 1 + (: (: (yield 1) :) * 2 :) ^ -6 :)
| 106 | 54 |
"""Utility functions for RCA API endpoints."""
import logging
from datetime import date, datetime, timedelta
from typing import List
from chaos_genius.databases.models.anomaly_data_model import AnomalyDataOutput
from chaos_genius.extensions import db
from chaos_genius.controllers.kpi_controller import get_kpi_data_fro... | 11,031 | 3,461 |
# Package "stundenzettel_generator", Strategy abstract class
# (c) 2015 Sven K., GPL
# Python batteries
import re
from datetime import datetime, timedelta, date
from os import path
# adopt this to your needs
freedays_file = path.join(path.dirname(__file__), 'feier-brueckentage2015.txt')
# abstract class
class Strat... | 4,027 | 1,191 |
from app.Clients.serializers import ClientSchema
from app.Clients.models import Client
class TestClientSchema(object):
def test_init(self, app, db, session):
johnClient = Client.create(name='john the client')
client_schema = ClientSchema()
result = client_schema.dump(johnClient).data
... | 410 | 118 |
"""Duolingo API."""
from dataclasses import dataclass
from datetime import datetime
import dacite
import requests
from .base import BaseApi, BaseApiConfig
from .types.duolingo import DuolingoStats
@dataclass
class DuolingoApiConfig(BaseApiConfig):
"""DuolingoApiConfig."""
login: str = ""
password: str... | 5,696 | 1,893 |
from django.test import TestCase
from django.conf import settings
from .. import fields
from models import *
from datetime import date
incoming_markdown = "**bold**, *italic*"
gen_html = "<p><strong>bold</strong>, <em>italic</em></p>"
class AutoMarkdownTests(TestCase):
def setUp(self):
self.m = TestAutoD... | 4,157 | 1,525 |
# -*- coding: utf-8; -*-
from __future__ import absolute_import, unicode_literals
import os
import six
from tests import unittest, mock
from freight_forwarder.registry.registry import V1
from freight_forwarder.container.host_config import HostConfig
from freight_forwarder.container.config import Config as ContainerCo... | 14,804 | 4,320 |
from diagrams import Diagram
from diagrams.aws.compute import EC2
from diagrams.aws.database import RDS
from diagrams.aws.network import ELB
with Diagram("Grouped Workers",show=True,direction="TB"):
ELB("lb") >> [EC2("node1"),
EC2("node2"),
EC2("node3"),
... | 386 | 119 |
__author__ = 'Linwei'
import numpy as np
import os, json, sys, re
import _cymlda
from settings import H, E, alpha, beta, gamma, docDir, outputDir, iter_max, run_num, dictionary, docset
PY2 = sys.version_info[0] == 2
if PY2:
range = xrange
def n2s(counts):
"""convert a counts vector to corresponding samples"... | 7,884 | 3,017 |
# Generated by Django 2.2.6 on 2019-11-01 18:25
import datetime
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='config',
fie... | 8,223 | 2,439 |
from typing import Dict, Any
from xml.dom import minidom
from xml.dom.minidom import Element, Document, Text
from datetime import datetime
MIME_XML = "text/xml"
MIME_ATOM_XML = "application/atom+xml"
MIME_UIX = "application/uix"
MIME_JPG = "image/jpeg"
def set_element_value(element: Element, value: str):
content... | 3,176 | 1,015 |
import numpy as np
X = np.random.random((10,5))
y = np.array(['M','M','F','F','M','F','M','M','F','F','F'])
X[X < 0.7] = 0
#use model selection to split our data
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)
| 290 | 119 |
from django.db import models
from cyder.base.eav.constants import (ATTRIBUTE_TYPES, ATTRIBUTE_INVENTORY,
ATTRIBUTE_OPTION, ATTRIBUTE_STATEMENT)
from cyder.base.eav.fields import AttributeValueTypeField, EAVValueField
from cyder.base.eav.utils import is_hex_byte_sequence
from cyder... | 3,296 | 1,013 |
# -*- coding: utf-8 -*-
import subprocess
import os
"""
Resize a PDF icon to to all icon sizes possibly required for Android,
Uses OS X’s scriptable image processing system command line utility.
http://straylink.wordpress.com/2009/01/24/os-x-command-line-image-manipulation/
On Linux, Ghostscript is your best bet!
... | 982 | 332 |
import re
import pathlib
import subprocess
import collections
from clldutils.text import split_text
from clldutils.misc import slug
from cldfbench import Dataset as BaseDataset, CLDFSpec
import errata
# The following variables go into LanguageTable, we want to be able to identify these by ID:
MD = {
'Latitude': ... | 12,071 | 4,171 |
import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class TestNavBar(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
self.driver.get("http://gamingdb.info")
def test_hit_site(self):
self.assertIn("gamingdb", ... | 1,908 | 622 |
#Framework for FeatureData
#Defines and controls Feature objects that can be placed on the Display
#from Updater import Updater
'''
Feature List
Eye(style,x,y,[c1,c2])
8bit
wink
'''
class Feature():
def __init__(self,Display,style,x,y,c):
self.display = Display
self.style = style
self.x = x
self.y = y
... | 4,724 | 2,148 |
from django.db import models
# Create your models here.
class Artist(models.Model):
name = models.CharField(max_length=200)
list_display = ('name')
def __str__(self):
return self.name
class ListField(models.TextField):
__metaclass__ = models.SubfieldBase
description = "Stores a python li... | 1,390 | 428 |
import torch
import math
import threading
import Tkinter as tk
import mushr_rhc.utils as utils
class BlockPush:
def __init__(
self, params, logger, dtype, map, world_rep, value_fn, viz_rollouts_fn
):
self.params = params
self.logger = logger
self.dtype = dtype
self.map ... | 12,365 | 4,430 |
"""
-*- test-case-name: PyHouse.src.Modules.communication.test.test_bluetooth -*-
@name: PyHouse/src/Modules/communication/bluteooth.py
@author: D. Brian Kimmel
@contact: D.BrianKimmel@gmail.com
@copyright: (c) 2013-2016 by D. Brian Kimmel
@note: Created on Nov 18, 2013
@license: MIT License
@summary:... | 935 | 355 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
from page_objects import PageObject, PageElement
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By
delay_mi... | 1,438 | 427 |
"""
Implementation of a language model class.
TODO: write more documentation
"""
__docformat__ = 'restructedtext en'
__authors__ = ("Razvan Pascanu "
"KyungHyun Cho "
"Caglar Gulcehre ")
__contact__ = "Razvan Pascanu <r.pascanu@gmail>"
import numpy
import itertools
import logging
impo... | 9,629 | 2,748 |