text string | size int64 | token_count int64 |
|---|---|---|
from litex.soc.cores.code_8b10b import Decoder
from transmitter32b import Transmitter32b
from alignment_corrector import Alignment_Corrector
from migen.genlib.fifo import *
from migen import *
class RX(Module):
def __init__(self):
self.data_in=Signal(40)
self.rx_init_done = rx_init_done = Signal()
self.pll_lock ... | 2,069 | 1,071 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 1,232 | 331 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2018-08-03 08:53
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Educat... | 2,152 | 612 |
""" ANACONDA: To open anaconda use the command line $ anaconda-navigator
ANACONDA: And the in Pycharm you can activate your Environtments, in this case is on terminal:
$ source activate pycoin
ANACONDA: Now it will change to (pycoin) at the beginning of the user. For instance, (pycoin) w11@w11: path$
"""
# I... | 13,141 | 3,547 |
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import tensorflow as tf
# TODO: It would be great if we could maintain the example.tensorflow_custom_op package prefix for
# this python_dist()!
from wrap_lib.wrap_zero_out_op import zero_... | 477 | 156 |
from typing import List, Optional, Sequence, Union
from abc import abstractmethod, ABC
from copy import deepcopy
from sys import _getframe as get_stack
from frozen_box.exception import FrozenException, FrozenKeyError, FrozenValueError
QueryableItem = Union[str, int, slice]
Queryable = Union[QueryableItem, Sequence[Qu... | 7,221 | 2,126 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import unittest
from telemetry.core import exceptions
from telemetry.unittest import gtest_progress_reporter
from telemetry.unittest import simpl... | 3,902 | 1,330 |
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
"""Create the home page of the web app.
Link to the second page.
"""
return """
<html>
<head>
<title>Hello world</title>
</head>
<body>
Hello world!
<br>
... | 1,057 | 340 |
import re, time, requests
from bs4 import BeautifulSoup
from openpyxl import workbook
from openpyxl import load_workbook
from src.Scrape_Index import Scrape_Index
from src.Database_Maker import Database_Maker, Sorted_Database
def Export_Database(portfolio,Selected_Stocks):
StartTime = time.time()
In... | 6,932 | 3,311 |
from dataclasses import dataclass, asdict
from typing import Optional
from ace.data_model import ApiKeyModel
@dataclass
class ApiKey:
# the api key value
api_key: str
# the unique name of the api key
name: str
# optional description of the api key
description: Optional[str] = None
# is t... | 1,148 | 357 |
from sys import setrecursionlimit
setrecursionlimit(10**7)
N, Q = [int(x) for x in input().split()]
to = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = [int(x) - 1 for x in input().split()]
to[a].append(b)
to[b].append(a)
depth = [-1] * N
def dfs(v, p, d):
depth[v] = d
for u in to[v]:
... | 528 | 243 |
# Generated by Django 2.1.13 on 2019-11-03 14:05
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
]
... | 35,248 | 9,638 |
#!/usr/bin/env python3
# coding: utf-8
# ______ __
# / __/ /____ ___ / /
# ____\ \/ __/ -_) -_) / __ _
# / _____/\__/\__/\__/_/_ ____/ /_(_)__ ___
# / /__/ _ \/ _ \/ _ \/ -_) __/ __/ / _ \/ _ \
# \___/\___/_//_/_//_/\__/\__/\__/_/\___/_//_/
#
# SteelConnection
# Simplify access t... | 1,966 | 689 |
#Viability test
from garnets import generate_stellar_system, random_star
from enviroment import BreathabilityPhrase
breathableair = False
moon = False
attempts = 0
# while breathableair is False or attempts <= 35000:
# try:
# stellar_system = generate_stellar_system(random_star())
# for i in range... | 1,620 | 532 |
from django.contrib.auth.views import LogoutView
from django.urls import path
from django.contrib.auth.views import LogoutView
from .views import UserRegisterView, UserLoginView, ProfileDetailView, ProfileUpdateView
app_name = 'account'
urlpatterns = [
path('', UserLoginView.as_view(), name='login'),
path('a... | 625 | 187 |
__version__ = '1.12.1-LL'
__build__ = '' # set by the build server
| 68 | 29 |
"""
Virtualenv bootstrap script, borrowed from:
http://www.caktusgroup.com/blog/2010/04/22/basic-django-deployment-with-virtualenv-fabric-pip-and-rsync/
"""
import os
import subprocess
if "VIRTUAL_ENV" not in os.environ:
sys.stderr.write("$VIRTUAL_ENV not found.\n\n")
parser.print_usage()
sys.exit(-1)
virt... | 531 | 202 |
#!/usr/bin/env python
"""
Created by howie.hu.
"""
import re
import aiohttp
import async_timeout
from bs4 import BeautifulSoup
from aiocache.serializers import PickleSerializer,JsonSerializer
from urllib.parse import urlparse, parse_qs, urljoin
from owllook.database.mongodb import MotorBase
from owllook.fetcher.de... | 10,145 | 2,854 |
"""A two-layer configuration for the action/proposition network w/ h-add
teacher & probabilistic evaluation (hence "_pe" at end of name)."""
# use defaults from actprop_2l
from .actprop_2l_h_add import * # noqa F401
# stochastic evaluation!
DET_EVAL = False
EVAL_ROUNDS = 30
| 278 | 99 |
import pytest
import os
from shutil import copy
from test_hdf5zarr import HDF5ZarrBase
def pytest_addoption(parser):
parser.addoption(
"--hdf5files",
action="append",
type=str,
default=[],
help="list of hdf5 files to test",
)
parser.addoption(
"--numfiles",
... | 4,368 | 1,482 |
a=list(input().split(','))
st,num=[],[]
for i in a:
s1,n=i.split(':')
st.append(s1)
num.append(n)
print(st)
print(num)
for i in range(len(num)):
for j in range(i):
print(st[j])
| 218 | 102 |
"""
Discussion:
Because we have a facilitatory synapses, as the input rate increases synaptic
resources released per spike also increase. Therefore, we expect that the synaptic
conductance will increase with input rate. However, total synaptic resources are
finite. And they recover in a finite time. Therefore, at... | 599 | 151 |
import random
class MT19937Recover:
"""Reverses the Mersenne Twister based on 624 observed outputs.
The internal state of a Mersenne Twister can be recovered by observing
624 generated outputs of it. However, if those are not directly
observed following a twist, another output is required to restore ... | 3,063 | 974 |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 5,134 | 1,576 |
import numpy as np
from nlpaug.model.audio import Audio
class Normalization(Audio):
def manipulate(self, data, method, start_pos, end_pos):
aug_data = data.copy()
if method == 'minmax':
new_data = self._min_max(aug_data[start_pos:end_pos])
elif method == 'max':
new_data = self._max(aug_data[start_pos:en... | 804 | 325 |
from __future__ import print_function, division
import numpy as np
weights = np.transpose(np.load('w0.npy'))
print(weights.shape)
feature_names = ["" for i in range(125)]
prev = 0
prev_name = ''
for line in open('feature_names.txt'):
if line.startswith('#'):
continue
words = line.split()
index = ... | 836 | 293 |
"""
Some utility functions for handling the geometries given with Sentinel files.
ESA have done a fairly minimal job with their footprint geometries. The routines in this
file are mostly aimed at providing a bit more support beyond that, mostly for things like
crossing the International Date Line.
It is assumed tha... | 11,570 | 3,654 |
import os, json, matplotlib
matplotlib.use('Agg')
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
READ = 'rb'
directory = json.load(open('directory.json',READ))
filename = os.path.join(directory['data-prefix'],'test-similarity-matrix.npy')
data = np.load(filename).a... | 780 | 292 |
GitHubTarballPackage ('mono', 'mono-basic', '3.0', 'a74642af7f72d1012c87d82d7a12ac04a17858d5',
configure = './configure --prefix="%{prefix}"',
override_properties = { 'make': 'make' }
)
| 188 | 92 |
import sys
def main():
#idade para abilitação
ipa = int(input("Quantos anos você tinha quando se inscreveu para tirar a habilitação? "))
if ipa < 18:
print()
print("Opa, tem algo errado! Você precisa de pelo menos 18 anos para tirar a carteira")
sys.exit()
#datas de renovaçao
... | 628 | 237 |
from run import db
import sqlalchemy
import os, uuid, base62
DB_HOST = "mysql-skp"
DB_USER = "root"
DB_PW = os.environ['MYSQL_ROOT_PASSWORD']
DB_NAME = "flask_skp"
DB_ENGINE_URI = "mysql://{}:{}@{}".format(DB_USER, DB_PW, DB_HOST)
engine = sqlalchemy.create_engine(DB_ENGINE_URI)
try:
engine.execute("DROP DATABA... | 497 | 200 |
from http import HTTPStatus
from unittest.mock import patch
from django.test.testcases import TestCase
from django.urls import reverse
from euphro_auth.models import User
from ...views import UserCompleteAccountView
class PartialMock:
kwargs = {
"user": User(
id=1,
email="test@t... | 2,007 | 568 |
import pathlib
from typing import Callable, Dict, Sequence, Optional
import conductor.context as c # pylint: disable=unused-import
import conductor.filename as f
from conductor.task_identifier import TaskIdentifier
from conductor.utils.output_handler import OutputHandler
class TaskType:
def __init__(
se... | 5,255 | 1,430 |
# Generated by Django 2.1.3 on 2019-01-07 12:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0007_auto_20190107_1750'),
]
operations = [
migrations.RemoveField(
model_name='postpick',
name='user',
... | 585 | 194 |
# Description
# 中文
# English
# Given an array of integers, remove the duplicate numbers in it.
# You should:
# Do it in place in the array.
# Move the unique numbers to the front of the array.
# Return the total number of the unique numbers.
# You don't need to keep the original order of the integers.
# Have you met... | 2,624 | 1,032 |
"""
Generate and save maps for each template.
"""
import random
import numpy as np
from scipy import stats
import healpy as hp
import matplotlib.pyplot as plt
import os
import pickle
from .data_utils import get_fermi_pdf_sampler, masked_to_full
from .utils import multipage, auto_garbage_collect
import ray
import time
i... | 16,962 | 5,277 |
import os
import sys
sys.path.append(os.getcwd())
import torch
from manager_torch import torchGPUmanager
def test_tf_auto_choice():
t = torchGPUmanager()
with t.choice():
x = torch.Tensor(8, 42)
x = x.cuda()
print(x)
if __name__ == "__main__":
test_tf_auto_choice() | 305 | 118 |
# Asking for height and weight input
height = float(input("What is your height in meters: "))
weight = float(input("What is your weight in kilograms: "))
# Calculating BMI (formula is weight/height^2)
bmi = str(round(weight/(height ** 2), 2))
# Printing BMI
print("Your BMI is " + bmi)
| 299 | 107 |
import datetime
import io
import json
import jsonlines
import logging
import os
import pytz
import shutil
import sys
import tempfile
from flask import Request
from google.cloud import exceptions
from google.cloud import storage
from google.cloud import pubsub_v1
from google.api_core.exceptions import AlreadyExists
from... | 11,068 | 3,550 |
# Imported before anything else to overwrite env vars!
import os
import sys
"""
There are several options:
1) running in pycharm
second argument is "test"
2) running pytest at the CLI
first argument is the path to pytest and ends pytest
3) running pytest using the script at /bin/tests
first ar... | 1,400 | 373 |
from bluepy.btle import UUID, Peripheral
from VestDeviceBase import VestDevice
class BleVestDevice(VestDevice):
def __init__(self, deviceAddr):
try:
self._peripheral = Peripheral(deviceAddr)
serviceUUID = UUID("713d0000-503e-4c75-ba94-3148f18d941e")
characteristicUUID = ... | 2,295 | 750 |
import requests
from .config.pushover import PushoverConfigFile
def notify(message, title=None, priority=None):
c = PushoverConfigFile()
payload = {
'user': c.user,
'token': c.token,
'message': message,
}
if title:
payload['title'] = title
if priority:
p... | 448 | 140 |
#!/usr/bin/env python3
import collections
import itertools
import json
import logging
import os
import requests
import time
import zign.api
from unittest.mock import MagicMock
ALL_ORGANIZATION_MEMBERS_TEAM = 'All Organization Members'
github_base_url = "https://api.github.com/"
logger = logging.getLogger('app')
s... | 10,667 | 3,247 |
from collections import namedtuple
from itertools import groupby
import itertools
from django.db.models import Q
from casexml.apps.case.const import UNOWNED_EXTENSION_OWNER_ID, CASE_INDEX_EXTENSION
from casexml.apps.case.signals import cases_received
from casexml.apps.case.util import validate_phone_datetime, prune_pr... | 9,964 | 2,905 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('adverts', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name=... | 1,715 | 511 |
# Copyright 2021 The Private Cardinality Estimation Framework 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 b... | 1,999 | 508 |
from typing import Annotated
import flow_py_sdk.cadence as cadence
from flow_py_sdk.signer import AccountKey
from flow_py_sdk.tx import Tx, ProposalKey
def create_account_template(
*,
keys: list[AccountKey],
reference_block_id: bytes = None,
payer: cadence.Address = None,
proposal_key: ProposalKe... | 1,780 | 524 |
# Copyright 2021 AI Redefined Inc. <dev+cogment@ai-r.com>
#
# 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 l... | 6,800 | 2,037 |
import datetime
import pytest
@pytest.mark.parametrize(
"val,expected",
[
(datetime.datetime(1986, 12, 24, 15, 0, 4), "1986-12-24T15:00:04"),
(None, AttributeError),
("A", AttributeError),
],
)
def test_scalar_datetime_coerce_output(val, expected):
from tartiflette.scalar.buil... | 1,125 | 410 |
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
def send(text, html, email, name, cc):
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
me = "ElDorado@FreeGold.Biz"
you = email
COMMASPACE =... | 1,202 | 407 |
# -*- coding: utf-8 -*-
import os
import cv2
import xml.etree.ElementTree as ET
import config
import numpy as np
cfg = config.Config()
def get_data(input_path):
all_imgs = []
classes_count = {}
class_mapping = {}
bird_classes_count ={}
bird_class_mapping = {}
visualise = False
data_path = '/media/e813/E/dat... | 4,484 | 2,041 |
# IMAGES #
# UI NAVIGATION #
img_addFriend = "add_friend.png"
img_allow = "allow.png"
img_allowFlash = "enableflash_0.png"
img_allowFlash1 = "enableflash_1.png"
img_allowFlash2 = "enableflash_2.png"
img_alreadyStarted = "alreadystarted.png"
img_alreadyStarted1 = "alreadystarted1.png"
img_backButton = "back_button.png... | 3,342 | 1,509 |
../catalogs_a/catalog_3.py | 26 | 12 |
from unittest import TestCase
from tests import get_data
from pytezos.michelson.micheline import michelson_to_micheline
from pytezos.michelson.formatter import micheline_to_michelson
class MichelsonCodingTestKT1Ki9(TestCase):
def setUp(self):
self.maxDiff = None
def test_michelson_parse_code_KT... | 2,273 | 1,008 |
from typing import List
from rasa.shared.nlu.state_machine.conditions import (
IntentCondition,
OnEntryCondition,
SlotEqualsCondition,
)
from rasa.shared.nlu.state_machine.state_machine_models import (
BooleanSlot,
IntentWithExamples,
TextSlot,
Utterance,
ActionName,
)
from rasa.shared.... | 12,671 | 3,655 |
#!/usr/bin/env python3
from itertools import groupby
inp = "1113222113"
for i in range(40):
next_str = "".join(str(len(list(v))) + k for k, v in groupby(inp))
inp = next_str
print(len(inp))
| 203 | 94 |
# 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... | 1,947 | 631 |
from typing import Iterable, Callable, Optional, Any
# TODO check the same helper in standard lib
# TODO test
def search_first_in_iterable(
it: Iterable, cond: Callable, not_found_default=None
) -> Optional[Any]:
return next((el for el in it if cond(el)), not_found_default)
| 285 | 88 |
from django.db.models.signals import pre_save
from django.dispatch import receiver
import random
import fractions
import humanize
# from derbot.names.tasks import generate_number
from derbot.names.models import DerbyName
@receiver(pre_save, sender=DerbyName)
def generate_number(sender, instance, **kwargs):
if in... | 694 | 217 |
import modeli as modeli
from bottle import *
from datetime import datetime
from collections import defaultdict
import hashlib
glavniMenuAktivniGumb=""
glavniMenuTemplate = '''<li><a {gumbRezervacija} href="/izbiraDestinacije" >Rezervacija leta</a></li>
<li><a {gumbReferencna} href="/referencna">Informacije o r... | 11,812 | 4,276 |
import sys
import collections
from asyncio import wait_for
from dataclasses import dataclass
from datetime import datetime
from functools import wraps
from typing import Optional
from dazl import AIOPartyClient
from ..api import IntegrationResponse
from .log import LOG
@dataclass(frozen=True)
class IntegrationQu... | 2,544 | 712 |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="py-senertec",
version="0.2.2",
author="Kleinrotti",
author_email="",
package_dir={"": "src"},
packages=setuptools.find_packages("src"),
description="Senertec energy system gen2 int... | 896 | 313 |
"""
Some simple coordinate transformations with SunPy
Adapted from https://github.com/sunpy/sunpy/blob/master/examples/units_and_coordinates/AltAz_Coordinate_transform.py
"""
from astropy.coordinates import EarthLocation, AltAz, SkyCoord
from astropy.time import Time
from sunpy.coordinates import frames, get_sunearth_d... | 1,084 | 447 |
import io
from typing import Any, List, Set
from src.types.sized_bytes import bytes32
from src.util.clvm import run_program, sexp_from_stream, sexp_to_stream
from clvm import SExp
from src.util.hash import std_hash
from clvm_tools.curry import curry
class Program(SExp): # type: ignore # noqa
"""
A thin wra... | 2,136 | 700 |
import cv2
import pandas as pd
import numpy as np
import os
from pathlib import Path
from keras.applications.densenet import preprocess_input, DenseNet121
from keras.models import Model
from keras.layers import GlobalAveragePooling2D, Input, Lambda, AveragePooling1D
import keras.backend as K
def resize_to_square(im):
... | 3,813 | 1,435 |
#!/usr/bin/env python3
"""
Hyphenation file checker
Copyright (C) 2016 Elie Roux
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 limit... | 2,250 | 732 |
#!/usr/bin/env python3
import scheduler
from systemCall import *
import threading
import socket, time, random
def handleClient(client, address):
print('>>> client connect[%s:%s]' % address)
while True:
data = yield sockRecv(client, 1024)
if not data:
break
pr... | 1,522 | 549 |
# This code is based on the SOM class library.
#
# Copyright (c) 2001-2021 see AUTHORS.md file
#
# 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 limitat... | 2,816 | 979 |
from datetime import date, datetime, time
from typing import cast
from sqlalchemy.engine.reflection import Inspector
from sqlalchemy.sql.type_api import TypeEngine
from tqdm import tqdm
from panoramic.cli.connection import Connection
from panoramic.cli.husky.core.taxonomy.enums import ValidationType
from panoramic.cl... | 2,467 | 674 |
class EfficiencyMeasurement():
# input_voltage = None
# input_current = None
# output_voltage = None
# output_current = None
# input_power = None
# output_power = None
# loss_power = None
# efficiency = None
def __init__(self, input_voltage: float, input_current: float,
... | 1,092 | 344 |
from pyspark.sql import SparkSession
import pyspark.sql.functions as F
from pyspark.sql.types import *
from AnomalyDetection import *
from NeoDatabase import *
import pyspark
import time as tm
import numpy as np
# region NeoSaprk Analyzer Class
class NeoSparkAnalyzer:
"""
Class that represent the main Analyz... | 3,576 | 1,151 |
import json
from pprint import pprint
from urllib.request import urlopen
import csv
class Task:
def __init__(self, taskId, duration, gcTime, executorId):
self.taskId = int(taskId)
self.duration = int(duration)
self.gcTime = int(gcTime)
self.executorId = int(executorId)
def __st... | 2,822 | 1,265 |
from logging import getLogger
from typing import Any, Dict, Optional
from fastapi import APIRouter, Response
from pydantic import Field
from starlette import status
from starlette.responses import PlainTextResponse
from heksher.api.v1.util import ORJSONModel, application
from heksher.api.v1.validation import Metadata... | 4,427 | 1,308 |
class Y:
def __init__(self, v0):
self.v0 = v0
self.g = 9.81
def value(self, t):
return self.v0*t - 0.5*self.g*t**2
def formula(self):
return "v0*t - 0.5*g*t**2; v0=%g" % self.v0
| 224 | 106 |
#Array In Python
from array import array
numbers = array("i",[1,2,3])
numbers[0] = 0
print(list(numbers))
| 108 | 42 |
#!/usr/bin/env python3
from collections import deque
inp = 3005290
l = deque()
r = deque()
for i in range(1, inp+1):
if i <= inp // 2:
l.append(i)
else:
r.appendleft(i)
while l and r:
if len(l) > len(r):
l.pop()
else:
r.pop()
r.appendleft(l.popleft())
l.appen... | 344 | 154 |
import os
### For PS items stored with this value, we will auto-clean them up from our audit table. Used for automated E2E testing.
DELETE_ME_VALUE = 'DELETE_ME' ### <-- use this for ALL VALUES
MFA_USER_ENV_KEY = 'MFA_USER'
MFA_SECRET_ENV_KEY = 'MFA_SECRET'
# Env vars
GOOGLE_SSO_USER = 'GOOGLE_SSO_USER'
GOOGLE_SSO_P... | 1,479 | 641 |
from collections import deque, namedtuple
from random import randint
import pyxel
Point = namedtuple("Point", ["x", "y"])
BACKGRD_COL = 3
WIDTH = 200
HEIGHT = 200
UP = Point(0, -3)
DOWN = Point(0, 3)
RIGHT = Point(3, 0)
LEFT = Point(-3, 0)
START = Point(125, 125)
class Cat:
def __init__(self):
self.cat ... | 7,956 | 3,204 |
# Contains helper functions for your apps!
from os import listdir, remove
# If the io following files are in the current directory, remove them!
# 1. 'currency_pair.txt'
# 2. 'currency_pair_history.csv'
# 3. 'trade_order.p'
def check_for_and_del_io_files():
# Your code goes here.
file_list = ['currency_pair.t... | 632 | 198 |
try:
import ujson as json
except ModuleNotFoundError:
# https://github.com/python/mypy/issues/1153 (mypy bug with try/except conditional imports)
import json # type: ignore
try:
import msgpack
except ModuleNotFoundError:
pass
class Serializer:
pass
class StringSerializer(Serializer):
d... | 884 | 268 |
from logging_tqdm import tqdm
import time
print("Testing tqdm-logging:")
for i in tqdm(range(100)):
time.sleep(.02)
print("\n\n\n")
print("Testing tqdm-logging with exception:")
try:
for i in tqdm(range(100)):
if i == 75:
raise Exception("Some Exception")
time.sleep(.02)
except:
... | 939 | 351 |
from typing import List, Tuple
COMMONTAIL_CONTENT_STREAM_PAGE_BODY_BLOCK: str = 'commontail.blocks.ContentStreamBlock'
COMMONTAIL_LINK_ICON_DOCUMENT_DEFAULT = 'far fa-file'
COMMONTAIL_LINK_ICON_EXTERNAL = 'fas fa-globe'
COMMONTAIL_NAMED_URL_CACHE_KEY_PREFIX: str = 'named_url_'
COMMONTAIL_NAMED_URL_CACHE_LIFETIME: in... | 1,448 | 693 |
"""
* Problem Description
*Suppose you are a university student and you need to pay 1536 dollars as a tuition fee.
*The college is offering a 10% discount on the early payment. How much money do you have to pay if you make an early payment?
*Task
*Create a variable named fee and assign 1536 to it.
*Create another ... | 618 | 208 |
import numpy as np
from numpy.testing import assert_allclose
from robogym.envs.rearrange.common.utils import (
get_mesh_bounding_box,
make_block,
make_blocks_and_targets,
)
from robogym.envs.rearrange.simulation.composer import RandomMeshComposer
from robogym.mujoco.mujoco_xml import MujocoXML
def _get_d... | 1,888 | 702 |
from cipherpy.base import create_grid, playfair_digram_encode
import numpy as np
import pytest
alphabet = "abcdefghiklmnopqrstuvwxyz" # j has been removed
inv_alph = "zyxwvutsrqponmlkihgfedcba" # j has been removed
grid = np.array([
["a","b","c","d","e"],
["f","g","h","i","k"],
["l","m","n","o","p"],
[... | 1,910 | 712 |
"""
PASSENGERS
"""
numPassengers = 19216
passenger_arriving = (
(7, 4, 4, 3, 2, 1, 4, 2, 4, 2, 0, 0, 0, 7, 5, 8, 3, 7, 1, 3, 0, 1, 2, 1, 1, 0), # 0
(4, 7, 2, 3, 3, 1, 2, 5, 2, 1, 1, 0, 0, 6, 4, 4, 3, 2, 1, 5, 1, 1, 1, 0, 1, 0), # 1
(6, 4, 5, 6, 2, 1, 2, 4, 1, 1, 0, 0, 0, 11, 3, 6, 7, 7, 0, 3, 2, 1, 2, 0, 0, 0),... | 258,420 | 255,476 |
#standard imports
import arcpy
import os
from dnppy import core
from landsat_metadata import landsat_metadata
if arcpy.CheckExtension('Spatial')=='Available':
arcpy.CheckOutExtension('Spatial')
arcpy.env.overwriteOutput = True
__all__=['atsat_bright_temp_8', # complete
'atsat_bright_temp_457'] ... | 7,675 | 2,543 |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 9 09:42:00 2021
@author: barraly
"""
import sabs_pkpd
import numpy as np
import matplotlib.pyplot as plt
import os
# Select the folder in which this repo is downloaded in the line below
os.chdir('The/location/of/the/root/folder/of/this/repo')
# In[Loa... | 10,669 | 4,837 |
import sys
import argparse
import numpy as np
import tensorflow as tf
from tensorflow import keras
class SampleModel(keras.Model):
def __init__(self, num_classes=10):
super(SampleModel, self).__init__(name='my_model')
self.num_classes = num_classes
# Define your layers here.
s... | 3,973 | 1,201 |
from instr.instruments import *
from instr.effects import *
s = Sqr().bind(tremolo(), echo(0.4, 0.8)).loop(2, [(244, 1), (289, 1), (365, 2)]).loop(4, [(244, 0.1), (289, 0.1), (365, 0.1), (1, 0.1), (237, 0.1), (1, 0.1)]).save('tests/instr.wav')
| 245 | 145 |
# Copyright 2018 - Extreme Networks, 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 l... | 1,593 | 431 |
# Dungeon Crawler
import asciiart
import level1
import level2
import time # timer
import hero
#def test():
# print(asciiart.baby_dragon())
# print(asciiart.big_skull())
# print(asciiart.dragon())
# print(asciiart.samurai())
# print(asciiart.skull_cross())
# print(asciiart.warrior())
# print(as... | 2,049 | 720 |
# getTotalCount.py
# 3/1/14
# Gets total count for all ChIP-seq reads
import csv, sys, fileinput
csv.register_dialect("textdialect", delimiter='\t')
if len(sys.argv) > 1:
fn = sys.argv[1]
ifile = open(fn, 'r')
reader = csv.reader(ifile, 'textdialect')
total = 0
counter = 0
for row in reader:
... | 804 | 369 |
# 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... | 4,210 | 1,270 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from logging.handlers import TimedRotatingFileHandler
from logging import Formatter, getLogger
import os
from socutils import mail
from responder_commons.report_maker import IncidentReportMaker, logger as responder_commons_logger
from responder_commons.mailreporter_clien... | 8,499 | 2,365 |
"""Column factory functions relating to columns."""
import typing
import sqlalchemy
from open_alchemy import exceptions
from open_alchemy import helpers
from open_alchemy import types
def handle_column(
*,
schema: types.Schema,
schemas: typing.Optional[types.Schemas] = None,
required: typing.Option... | 9,787 | 2,765 |
from .planar_separator import PlanarSeparator
from . import separation_class
| 77 | 21 |
"""AWS CDK module to create ECS infrastructure"""
from aws_cdk import (core, aws_ecs as ecs, aws_ecr as ecr, aws_ec2 as ec2, aws_iam as iam)
class EcsDevopsSandboxCdkStack(core.Stack):
def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
# Cr... | 2,593 | 689 |
from enum import Enum
class OrderStatus(object):
"""
Order Status
"""
NEW = "NEW"
PARTIALLY_FILLED = "PARTIALLY_FILLED"
FILLED = "FILLED"
CANCELED = "CANCELED"
PENDING_CANCEL = "PENDING_CANCEL"
REJECTED = "REJECTED"
EXPIRED = "EXPIRED"
class OrderType(Enum):
"""
Order ... | 970 | 454 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from django.conf import settings
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.utils.text import slugify
from django.utils.safestring import mark_safe
try:
from sortedm2m_filter_horizontal_widget.f... | 2,780 | 837 |