content stringlengths 5 1.05M |
|---|
from datetime import datetime, date, timedelta
import csv
import srqi
import srdata
import os
def get_output_directory():
return os.path.join(os.path.abspath(srqi.__path__[0]), 'output')
def get_data_directory():
return os.path.join(os.path.abspath(srqi.__path__[0]),'Data')
_dir = os.pa... |
import re
from typing import List, Set, Union
def filter(items: List[str], query: Union[str, List[str]]) -> Set[str]:
"""Filter items in list.
Filters items in list using full match, substring match and regex match.
Args:
items (List[str]): Input list.
query (Union[str, List[str]]): Filt... |
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 30 11:04:35 2020
@author: Mei
"""
import unittest
from gyms import Gyms
class GymTests(unittest.TestCase):
def setUp(self):
self.gyms = Gyms('gyms.csv')
def test_gym_not_found(self):
self.assertEqual(len(self.gyms.find('asdf')), 0)
def tes... |
import mqtt_kube.binding.association
class Patcher(mqtt_kube.binding.association.Association):
def __init__(self, locus, mqtt, topic, valuemap):
super().__init__(mqtt, topic, valuemap)
self._locus = locus
def open(self):
self._mqtt.subscribe(self._topic, self._on_payload)
def _on... |
#!/usr/bin/python
# ccn-lite/test/py/nfnproxy-test.py
# demo for invoking named functions ("labeled Results")
# the user-defined functions are in ccn-lite/src/py/pubfunc/
import cStringIO
import os
import sys
import time
sys.path.append('../../src/py')
import ccnlite.client
import ccnlite.ndn2013 as ndn
# -------... |
'''
Multiple time series slices (1)
You can easily slice subsets corresponding to different time intervals from a time series. In particular, you can use strings like '2001:2005', '2011-03:2011-12', or '2010-04-19:2010-04-30' to extract data from time intervals of length 5 years, 10 months, or 12 days respectively.
U... |
"""A small package for sending and recieving commands per tcp
commands: connect() connects to the server
send() sends a message/command to the server
recieve() recieves a message/command from the server
"""
import socket
import sys
class telnet():
def __init__(self, ip, port=23):
... |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from openapi_server.models.base_model_ import Model
from openapi_server.models.stats_ledger_version import StatsLedgerVersion
from openapi_server import util
from open... |
import os
import mysql.connector
class Orders:
def __init__(self, products_dac=None):
self.connection_string = eval(os.getenv('CONNECTION_STRING'))
self.products_dac = products_dac
if products_dac is not None:
self.products_dac.orders_dac = self
def insert(self,... |
"""
`gef` command test module
"""
from tests.utils import gdb_run_cmd, GefUnitTestGeneric
class GefCommand(GefUnitTestGeneric):
"""`gef` command test module"""
def test_cmd_gef(self):
res = gdb_run_cmd("gef")
self.assertNoException(res)
self.assertIn("GEF - GDB Enhanced Features", ... |
import sys
import os
import zipfile
from histdatacom.concurrency import get_pool_cpu_count
from histdatacom.concurrency import ProcessPool
from rich import print
class _CSVs:
def __init__(self, args_, records_current_, records_next_):
# setting relationship to global outer parent
self.args = args_... |
import zipfile
import io
import requests
inventory_to_FRS_pgm_acronymn = {"NEI":"EIS","TRI":"TRIS","eGRID":"EGRID","GHGRP":"E-GGRT","RCRAInfo":"RCRAINFO","DMR":"NPDES"}
def download_extract_FRS_combined_national(FRSpath):
url = 'https://www3.epa.gov/enviro/html/fii/downloads/state_files/national_combined.zip'
... |
import numpy as np
from core.model import Model
from layers.input import Input
from layers.dense import Dense
from util.cost_functions import L2
if __name__ == '__main__':
# demo MLP
data_x = np.array([1, 2])
data_y = np.array([0.2, 0.4])
train_x = np.reshape(data_x, (len(data_x), 1, 1))
train_y = np.reshape(dat... |
'''
@author: Dirk Rother
@contact: dirrot@web.de
@license: GPL
@version: 0.1
'''
class TradingPair(object):
'''
This is a model for a TradingPair object.
'''
def __init__(self, id = "", price = "", price_before_24h = "", volume_first = "", volume_second = "", volume_btc = "", best_market = ""... |
#encoding:utf-8
#!/usr/bin/env python
import os
COV = None
if os.environ.get('FLASK_COVERAGE'):
import coverage
COV = coverage.coverage(branch=True, include='app/*')
COV.start()
if os.path.exists('.env'):
print('Importing environment from .env...')
for line in open('.env'):
var = line.strip... |
from keras.models import Sequential, Model
from keras.layers import Dense, Dropout, Flatten, Activation, Input, UpSampling2D
from keras.layers import Conv2D, MaxPooling2D, BatchNormalization
from keras import regularizers
def get_VGG_model(input_shape, labels=10):
"""
A VGG model for CIFAR.
"""
weight... |
from google.appengine.ext import db
def DerivedProperty(func=None, *args, **kwargs): # noqa: D401
"""Derived datastore property.
Derived properties are not set directly, but are instead generated by a
function when required. They are useful to provide fields in the datastore
that can be used for filtering o... |
import itertools
import logging
import os
import sys
import typing
from ._types import URL, Origin
_LOGGER_INITIALIZED = False
TRACE_LOG_LEVEL = 5
DEFAULT_PORTS = {b"http": 80, b"https": 443}
class Logger(logging.Logger):
# Stub for type checkers.
def trace(self, message: str, *args: typing.Any, **kwargs: t... |
import time
class ContextTimer(object):
def __enter__(self):
self.t = time.time()
def __exit__(self, type, value, traceback):
print('time elapsed: {:.8f}'.format(time.time() - self.t)) |
from typing import List
import os
import sys
from modules.models.sao import Sao
def record_sao_log(patent_number: str, description_text: str, sentences: List[str], saos: List[Sao], filePath: str):
try:
with open(filePath, 'a', encoding="utf-8") as file:
file.write(patent_number + '\n')
... |
import os
from lib.loaddata import DataSet
class PoliceData(DataSet):
'''
List of street crimes which are all geolocated
'''
NAME = 'police'
BOTTOM = 0.05
MIDDLE = 0.15
def load(self):
directory = './data/street_crime/'
for file in os.listdir(directory):
... |
import logging
import os
from openpyxl import load_workbook
from django.conf import settings
from django.core.management.base import BaseCommand
from django.db import connection, transaction
from dmd.models import DMDProduct
from gcutils.bigquery import Client
class Command(BaseCommand):
help = ('Parse BNF->dm+... |
# try and friends
<stmt>try:
p<body>ass
e<ex1>xcept ArithmeticError, e:
pass
e<ex2>xcept:
pass
e<else>lse:
pass
f<finally>inally:
pass
|
# Copyright (c) 2017, John Skinner
import unittest
import unittest.mock as mock
import os
import time
import yaml
import arvet.config.global_configuration as global_conf
class TestGlobalConfiguration(unittest.TestCase):
def test_save_global_config_writes_to_file(self):
mock_open = mock.mock_open()
... |
from ipdb import set_trace as st
from sklearn.datasets import load_iris
def load_dataset():
iris = load_iris()
return iris.data, iris.target
|
"""MPD output parsing utilities."""
import re
from typing import Callable, Iterable, List, Tuple, Type, TypeVar, Union, overload
from .errors import CommandError, ErrorCode, get_error_constructor
from .types import Song
from .util import from_json_like, split_on
__all__ = [
'normalize',
'split_item',
'fro... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-11-29 16:04
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('discount', '0005_auto_20170919_0839'),
]
operations = [
migrations.AlterModelOption... |
from sklearn import tree
#[height, weight, shoe size]
x = [[165, 80, 44], [177, 70, 43], [160, 60, 38], [154, 54, 37], [166,65,40], [190,90,47], [175,64,38], [177,70,40],[159,55,37],[171,75,42],[181,85,43]]
y= ['male', 'female', 'female', 'female', 'male','male','male','female','male', 'female','male',]
clf = tree.... |
class Gym:
def __init__(self):
self.customers = []
self.trainers = []
self.equipment = []
self.plans = []
self.subscriptions = []
def add_customer(self, customer):
if customer in self.customers:
return
self.customers.append(customer)
def... |
# Copyright (C) 2013 Google Inc.
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later vers... |
from tkinter import Tk,Spinbox
master = Tk()
w = Spinbox(master, from_=0, to=10)
w.pack()
master.mainloop() |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 17 21:49:47 2021
@author: Yerke
"""
#import necessary libraries
import json
import pandas as pd
import re
from tqdm import tqdm
from textblob import TextBlob
import plotly.express as px
from langdetect import detect
# Opening JSON file
f = open('result.... |
import random
import string
from time import time
def gen_device_data():
client_uuid = "".join(random.sample(string.digits * 2, 15))
serial_number = "".join(random.sample(string.digits + "abcdef", 16))
openudid = "".join(random.sample(string.digits * 2, 16))
data = {"time_sync": {"local_time": str(int(... |
# -*- coding: utf-8 -*-
"""
This module contains a class to load the step and terrain files
"""
import os
import sys
import fnmatch
from . import utils
def load_modules(location):
"""
Loads all modules in the `location` folder
"""
location = os.path.expanduser(os.path.expandvars(location))
... |
"""
#########################################################################
# Copyright (c) Davar Lab @ Hikvision Research Institute. All rights reserved.
# Filename : mask_rcnn_r50.py
# Abstract : Model settings for mask-rcnn-based detector on Total-Text
# Current Version: 1.0.0
# Date ... |
import datastorage
def prompt_for_action():
while True:
print()
print("Action?")
print()
print(" A = add item to inventory")
print(" R = remove item from inventory")
print(" C = report current inventory")
print(" O = report re-order inventory")
print(" Q = quit")
print()
action = input("> ").strip... |
import numbers
class BackpropNode:
def diveritive(self):
raise Exception("BackpropNode: need to implement diveritive")
def compute(self):
raise Exception("BackpropNode: need to implement compute")
def forward(self):
raise Exception("BackpropNode: need to implement forward")
d... |
from PySide2.QtWidgets import *
from PySide2.QtCore import *
from PySide2.QtGui import *
import sys
from ..functions import *
class settingsButton(QPushButton):
def __init__(self,text,icon):
super().__init__()
self.setWindowFlags(Qt.FramelessWindowHint)
self.setObjectName(u"widgetset")
... |
from .suite import Suite
|
from .validator import Validator
from ..logger import getLogger
logger = getLogger(__name__)
class StringValidator(Validator):
def __init__(self, name):
super().__init__(name)
def validate(self, value):
if value is None or (type(value) == str and len(value) == 0):
return ""
... |
import numpy as np
import pandas as pd
import os
from classes.handlers.ParamsHandler import ParamsHandler
class PIDExtractor:
def __init__(self, mode: str, extraction_method: str, pid_file_paths: dict, dataset_name: str):
self.__dataset_name = dataset_name
supp_datasets = ["canary", "dementia_ban... |
# Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
# STIX TAGS
TAG_STIX_PACKAGE = "{http://stix.mitre.org/stix-1}STIX_Package"
|
# Copyright 2021 portfolio-robustfpm-framework Authors
# Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
# http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
# http://opensource.org/licenses/MIT>, at your option. This file may not be
# copied, modified, or distributed except ... |
# encoding: utf-8
from __future__ import unicode_literals
import unittest
import spotify
from spotify import compat
from spotify.playlist import _PlaylistCallbacks
import tests
from tests import mock
@mock.patch('spotify.playlist.lib', spec=spotify.lib)
class PlaylistTest(unittest.TestCase):
def setUp(self):... |
# Copyright (c) 2011 Martin Ueding <dev@martin-ueding.de>
from camelot.view.art import Icon
from camelot.admin.application_admin import ApplicationAdmin
from camelot.admin.section import Section
from gettext import gettext
class MyApplicationAdmin(ApplicationAdmin):
def get_sections(self):
from ca... |
#
# @lc app=leetcode id=740 lang=python3
#
# [740] Delete and Earn
#
# @lc code=start
from collections import Counter
class Solution:
def deleteAndEarn(self, nums: list[int]) -> int:
counter, prev, cur = Counter(nums), 0, 0
for i in range(min(nums), max(nums) + 1):
prev, cur = cur, ma... |
# api/urls.py
from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from . import views
from rest_framework_jwt.views import obtain_jwt_token
app_name="user"
urlpatterns = [
<<<<<<< HEAD
path('user/', views.UserCreate.as_view()),
path('user/<int:pk>/', views.UserProfile.as_... |
#!/usr/bin/env python
# This program generates a line/table with all Atom-Atom contributions to the Lennard Jones Energy between two fragments
#
# The atom order for each fragment is read from the .rtf file
# The Atom types are obtained either from the .rtf file or from the .lpun file
# The number of fragments and the ... |
# -*- coding: utf-8 -*-
# file: rule_base_keywords_extraction.py
# date: 2022-02-25
import os
import textwrap
import keytext4py
from typing import List, Tuple
from functools import reduce
from keytext4py import corenlp_helper
from keytext4py import utils
#from keytext4py_ext_cpp import keywords_by_pos
from keytext4p... |
from django.db import models
from utils.basemodel import BaseModel
# Create your models here.
class People(models.Model):
name = models.CharField(max_length=20)
age = models.IntegerField()
class Projects(BaseModel):
# unique = True 指定当前字段为唯一约束
# null = True 指定数据库中当前字段可以值为空 null, ORM默认是NOT NULL 非空
... |
import pyautogui
while(True):
pyautogui.moveTo(255,255)
pyautogui.moveTo(0,0)
|
# Copyright (c) 2016-2021 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.
from ..config import as_bool, as_list
from .call_decorator import ... |
import pandas as pd
from .config import *
from cadCAD.engine import ExecutionMode, ExecutionContext, Executor
def run():
'''
Definition:
Run simulation
'''
# Single
exec_mode = ExecutionMode()
local_mode_ctx = ExecutionContext(context=exec_mode.local_mode)
simulation = Executor(exec_c... |
class TagHelper(object):
"""
An helper on tag operations
"""
@staticmethod
def list(tutorial, priority=False):
"""
Return a list of tutorial tags
"""
if not tutorial:
return []
tags = {}
tags_list = []
priority_tag = None
... |
import os
import imp
import sys
import time
import threading
import subprocess
# usb or sd card
user_dir = os.getenv("USER_DIR", "/usbdrive")
fw_dir = os.getenv("FW_DIR")
# imports
current_dir = os.path.dirname(os.path.abspath(__file__))
og = imp.load_source('og', current_dir + '/og.py')
wifi = imp.load_source('wifi_... |
from flask import current_app, request
from flask_restful import Resource, reqparse
from app.helpers import helpers, validator
from app.middlewares import auth
from app.models import model
from app.vendors.rest import response
class GetUserData(Resource):
@auth.auth_required
def get(self):
try:
... |
"""Backwards compatibility for old IDs
"""
def legacy_ids(study_ids):
"""Handle legacy study IDs, returning the new format
Parameters:
study_ids: List of study IDs (new or old)
Returns:
result: List of new study IDs
"""
legacy_id_subs = {
"UKB-a:": "ukb-a-",
"UKB... |
#! /usr/bin/env python
from momo import sys, np, osio, endl, flush
from __qmshell__ import e_xyz_from_xyz
from __molecules__ import Atom, Molecule
osio.Connect()
osio.AddArg('file', typ=str, default=None, help='Input xyz-file')
osio.AddArg('molname', typ=str, default='UNSCRAMBLED', help='Molecule name')
... |
import sys
import numpy as np
import matplotlib.pyplot as plt
from numpy.core.numeric import Inf
from tensorboardX import SummaryWriter
from rlcontrol.agents.base import Agent
from rlcontrol.systems.base_systems.base_env import ENV
from rlcontrol.logger.logger import Logger
np.random.seed(59)
#TODO : Rename
class O... |
from locustio.common_utils import read_input_file
from util.project_paths import BAMBOO_USERS, BAMBOO_BUILD_PLANS
class Login:
action_name = 'jmeter_login_and_view_all_builds'
atl_token_pattern = r'name="atlassian-token" content="(.+?)">'
login_body = {
'os_username': '',
'os_password': ''... |
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return "Hello Flask Test on Docker"
@app.route('/foo')
def foo():
return "Endpoint is Foo"
|
#!/usr/bin/env python
"""
Created on Thu Jul 17 11:44:35 2014
Author: Oren Freifeld
Email: freifeld@csail.mit.edu
"""
from cpab.cpa3d.CpaSpace import CpaSpace
from cpab.cpa3d.Multiscale import Multiscale
from cpab.distributions.CpaCovs import CpaCovs
#from cpab.prob_and_stats.cpa_simple_mean import cpa_simple_mean... |
# -*- mode: python -*-
# =============================================================================
# @@-COPYRIGHT-START-@@
#
# Copyright (c) 2021-2022, Qualcomm Innovation Center, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provi... |
import sys
sys.stdout = open("out.txt", "w")
def xyz():
print("test")
xyz()
sys.stdout.close() |
import collections, os
import re
def parse():
files = os.listdir("/Users/kaladhar/Desktop/casey/")
contents = ""
for file in files:
f = open("/Users/kaladhar/Desktop/casey/" + file, "r")
contents = contents + f.read()
newContents = contents.replace("\r\n", " ")
pattern = re.compile(... |
import os
import unittest
from pathlib import Path
import paramak
import pytest
class TestShape(unittest.TestCase):
def test_shape_default_properties(self):
"""Creates a Shape object and checks that the points attribute has
a default of None."""
test_shape = paramak.Shape()
as... |
# from dcor import distance_correlation as dc
import numpy as np
import dcor
def distance_corr(X, Y):
"""
Computes the distance correlation between X and Y.
Taken from pypi package dcor based on the paper:
*Measuring and testing dependence by correlation of distances*
by Gábor et Al (2007)
Par... |
import re
from typing import List, Union
camel_to_snake_regex = re.compile(r'(?<!^)(?=[A-Z])')
def camel_to_snake(word: str) -> str:
return camel_to_snake_regex.sub('_', word).lower()
def find_z_value_entries(lines: List[str]) -> List[int]:
"""Find the strings which contains a z-value entry.
"""
z_... |
# Copyright (C) 2019 Greenweaves Software Limited
# This is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This software is distribut... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2017 theloop, 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 req... |
# Copyright (c) 2015 Pontianak
"""
9.4 Write a program to read through the mbox-short.txt and figure out who has the sent the greatest number of mail messages. The program looks for 'From ' lines and takes the second word of those lines as the person who sent the mail. The program creates a Python dictionary that maps... |
import logging
import os
import sys
import tempfile
from mrjob.util import log_to_stream
from samplecdxjob import SampleCDXJob
from seqfileutils import make_text_null_seq
SEQ_FILE = 'splits.seq'
SPL_FILE = 'splits.txt'
LOG = logging.getLogger('SampleCDXJob')
LOG_FORMAT = "%(asctime)s %(levelname)s %(name)s: %(messa... |
from core import db_conn, db_log
from psycopg2 import DatabaseError
from core.exceptions import DBException, NotExistingEntityException
import json
def insert_va_quota_status(kubeconfig, vertical_application_slice_id: str):
# Create a new entry <uuid, kubeconfig> in the DB for a vertical application quota
com... |
t=input()
print(t) |
from .version import __version__
from .openapi import OpenAPI
from .loader import FileSystemLoader
from .errors import SpecError, ReferenceResolutionError, HTTPError, HTTPStatusError, ContentTypeError
__all__ = [
"__version__",
"OpenAPI",
"FileSystemLoader",
"SpecError",
"ReferenceResolutionError"... |
from typing import final
import pandas as pd
from utils.PUMA_helpers import clean_PUMAs
from internal_review.set_internal_review_file import set_internal_review_files
year_map = {"2000": "00", "0812": "10", "1519": "20"}
def load_decennial_census_001020() -> pd.DataFrame:
"""Load in the xlsx file, fill the missi... |
from models import User
from templates import TextTemplate
from utilities import send_message
def send_campaign():
message = TextTemplate(text="NEW FEATURE: SUBSCRIPTIONS \n\n"+
"Hi there, this week a new feature is coming out and that is SUBSCRIPTIONS.\n\n"+
... |
import numpy as np
from .base_model import BaseModel
from .data_utils import minibatches, pad_sequences
from .general_utils import Progbar
np.set_printoptions(threshold=np.nan)
from modelFood import NlabelCell
import os
import math
import joblib
import argparse
import numpy as np
import tensorflow as tf
parser = ... |
from textcritical.default_settings import *
DATABASE_ROUTERS = [] |
from random import randint
from django import forms
from care.groupaccount.models import GroupAccount, GroupSetting
from care.userprofile.models import NotificationInterval
class NewGroupAccountForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fie... |
# http://poynton.ca/ColorFAQ.html
# https://www.cambridgeincolour.com/tutorials/color-spaces.htm
# 颜色空间(HSV/HSB与HLS)的区别 https://blog.csdn.net/u010712012/article/details/85240100
"""
YIQ,是NTSC(National Television Standards Committee)电视系统标准。
Y是提供黑白电视及彩色电视的亮度信号(Luminance),即亮度(Brightness),
I代表In-phase,色彩从橙色到青色,
Q代表Quadratu... |
# Copyright (c) 2022 Exograd SAS.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WA... |
# Generated by Django 3.0.10 on 2020-09-19 23:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='user',
name='interest_arts',
... |
"""
------------------------------------------------------
This file is part of RobustGaussianFittingLibrary,
a free library WITHOUT ANY WARRANTY
Copyright: 2017-2020 LaTrobe University Melbourne,
2019-2020 Deutsches Elektronen-Synchrotron
------------------------------------------------------
"""
import Ro... |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser , BaseUserManager , PermissionsMixin
from django.conf import settings
class UserManager(BaseUserManager) :
def create_user(self , email , password = None ,**extra_fields ):
if not email :
raise ValueE... |
# -*-coding:utf-8 -*-
#Reference:**********************************************
# @Time : 2019-09-27 22:55
# @Author : Fabrice LI
# @File : 382_triangle_count.py
# @User : liyihao
# @Software: PyCharm
# @Description: Given an array of integers, how many three numbers can be found in the array,
# ... |
import pytest
import sys
import os
try:
import _clippy
except ImportError:
sys.stderr.write('''these tests need to be run with the _clippy C extension
module available. Try running "clippy runtests.py ...".
''')
sys.exit(1)
os.chdir(os.path.dirname(os.path.abspath(__file__)))
raise SystemExit(pytest.main... |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from collect.download_excel import ExcelDownload
from collect.import_excel import ExcelImport
urlpatterns = [
url(r'^download$', ExcelDownload.as_view()),
url(r'^import$', ExcelImport.as_view()),
]
|
"""Pending deprecation file.
To view the actual content, go to: flow/networks/minicity.py
"""
from flow.utils.flow_warnings import deprecated
from flow.networks.minicity import MiniCityNetwork
@deprecated('flow.scenarios.minicity',
'flow.networks.minicity.MiniCityNetwork')
class MiniCityScenario(MiniCity... |
from __future__ import print_function
class Empty(Exception):
""" Error attempting to access an element from an empty container. """
pass
class ArrayStack:
""" LIFO Stack implementation using a Python list as underlying storage. """
def __init__(self):
""" Create an empty stack. """
... |
import os
import shutil
import time
from template import Template, TemplateException
from template.test import TestCase, main
def append_file(path, text):
time.sleep(2) # Ensure file time stamps are different.
fh = open(path, "a")
fh.write(text)
fh.close()
class CompileTest(TestCase):
def testCompile(se... |
import audioop
import numpy as np
import pyaudio
import wave
CHUNK_SIZE = 1024
class Music:
def __init__(self, path = "./stereo.wav"):
self.path = path
self.wf = wave.open(path, 'rb')
self.width = self.wf.getsampwidth()
self.pa = pyaudio.PyAudio()
self.stream = self.pa.ope... |
import torch.nn as nn
import torch.nn.functional as F
from pygcn.layers import GraphConvolution1
class GCN(nn.Module):
def __init__(self, nfeat, nhid, nclass, dropout):
super(GCN, self).__init__()
self.gc1 = GraphConvolution1(nfeat, nhid)
self.gc3 = GraphConvolution1(nhid, nhid)
s... |
import json
import os
import shutil
from datetime import datetime
from typing import List, Dict, Any, Union
from ruamel import yaml
from data_tools.wrappers.analyses import get_analysis
from data_tools.wrappers.users import is_read_permitted, is_write_permitted, get_all_read_permitted_records
from data_tools.db_model... |
import Common as common
from Common import opencv
class Camera(object):
def __init__(self):
# Initialize the camera capture
self.camera_capture = opencv.VideoCapture(0)
def capture_frame(self, ignore_first_frame):
# Get frame, ignore the first one if needed
if(igno... |
from .base import Filth
class OrganizationFilth(Filth):
type = 'organization'
|
from kivy.uix.widget import Widget
from kivy.graphics import Rectangle, Color
from kivy.app import App
from kivy.config import Config
from random import randint
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.button import Button
class CornerRectangleWidget(Widget):
... |
import os
import numpy as np
import random
from skimage import io
from scipy.ndimage import zoom
import matplotlib.pyplot as plt
from tqdm import tqdm as tqdm
from pandas import read_csv
from math import floor, ceil, sqrt, exp
from IPython import display
import time
from itertools import chain
import warnings
from ppri... |
#! /usr/bin/env python3
import struct
import sys
mappers = ["NROM", "MMC1", "UxROM", "CNROM", "MMC3", "MMC5", "FFE F4xxx", "AxROM", "FFE F3xxx", "MMC2", "MMC4"]
def main():
dump = False
for arg in sys.argv[1:]:
if arg[0] == '-':
if arg == '-d':
dump = True
el... |
from django.urls import path
from .views import get_products, searchProducts, get_topSales, get_product
from .views import get_orders, post_orders, refund_order, orderCalculateTotal
from .views import get_categories
from .views import check_promoCode
from .views import get_carrouselPromos
from .views import postReview
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.