text stringlengths 957 885k |
|---|
#-*- coding:utf-8 _*-
"""
@author:charlesXu
@file: question_answering.py
@desc: 问答实现
@time: 2019/01/26
"""
import random
import re
from django.shortcuts import render
from Chatbot_KG.toolkit.pre_load import pre_load_thu
from Chatbot_KG.toolkit.pre_load import neo_con
city_list = []
filePath = 'F:\project\Agric... |
# This is where the classes and objects are defined
import random
class Game:
def __init__(self, difficulty, length, cave_map):
self.cave_map = cave_map
self.difficulty = difficulty
self.length = length
class Condition:
def __init__(self, name, damage, ac_reduction, dura... |
<reponame>savannahghi/mle
"""Test for the common views."""
import random
import shutil
import uuid
from functools import partial
from os import path
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
from django.test import TestCase
from django.urls import reverse
from fak... |
<reponame>pigera/scxcore<filename>installer/generate_scxcore_scripts.py
import sys
import os
def Get_sh_path(PF):
if PF == "SunOS" or PF == "HPUX":
return '#!/usr/bin/sh'
else:
return '#!/bin/sh'
def GenerateSetupScriptFile():
shfile = open(os.path.join(outputDir, 'scx_setup.sh'), 'w')
... |
<filename>Google/benchmarks/unet3d/implementations/unet3d-preview-JAX-tpu-v4-128/models/losses.py
"""JAX implementation of losses in 3DUnet.
https://github.com/mmarcinkiewicz/training/blob/Add_unet3d/image_segmentation/unet3d/model/losses.py
"""
from __future__ import absolute_import
from __future__ import division
f... |
<filename>src/engine/SCons/Tool/msvsTests.py
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, m... |
import sys
import gui
from PyQt5 import QtWidgets, QtGui, QtCore
from PyQt5.QtGui import QPixmap, QImage, QDoubleValidator, QIntValidator
from PyQt5.QtWidgets import QApplication, QDialog
from PyQt5.QtCore import QThread, pyqtSignal, QEventLoop, QTimer
import os
import time
import eval as eval_script
import train as tr... |
<filename>pipeline/_column_transformer.py
import pandas as pd
import numpy as np
from sklearn.utils.metaestimators import _BaseComposition
from sklearn.base import TransformerMixin, clone
from sklearn.pipeline import _name_estimators
from ..preprocessing import Identity, ColumnSelector
__all__ = ['ColumnTransforme... |
from django.core.mail import send_mail
from django.shortcuts import get_object_or_404, redirect, render
from django.template.loader import render_to_string
from django.urls import reverse, reverse_lazy
from django.utils.translation import ugettext_lazy as _
from django.views.generic import DeleteView, FormView, Templat... |
<filename>jasy/core/Project.py
#
# Jasy - Web Tooling Framework
# Copyright 2010-2012 Zynga Inc.
#
import os, re
import jasy.core.Cache
import jasy.core.Config as Config
import jasy.core.File as File
import jasy.core.Console as Console
import jasy.core.Util as Util
import jasy.vcs.Repository as Repository
import ja... |
<reponame>splunk-soar-connectors/ciscoesa<gh_stars>0
# File: ciscoesa_connector.py
#
# Copyright (c) 2017-2022 Splunk 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.a... |
<filename>b2flow/python/tools/handler.py
import json
import pandas as pd
import numpy as np
import datetime
import pickle as pk
class Metadata:
@staticmethod
def encode(data: dict):
return json.dumps(data)
@staticmethod
def decode(data: bytes):
return json.loads(data)
class Handler:... |
import ap_simulator as ap
import mcmc_setup as ms
import numpy as np
import numpy.random as npr
import matplotlib.pyplot as plt
import time
import sys
model = int(sys.argv[1])
protocol = 1
c_seed = 1
noise_sd = 0.25
original_gs, g_parameters = ms.get_original_params(model) # list, list
chain_file, figs_dir = ms.synt... |
<reponame>clach04/bitbucket-_tools
#!/usr/bin/env python
# -*- coding: us-ascii -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
#
# export Mercurial (and git) projects on bitbucket.org to local disk
# Python 3 or Python 2
# Attempts to dump meta data
# pretty much hard coded to username and password - doesn't atte... |
# Copyright 2015 Google 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 law or agreed to in writing, ... |
#! python
# -*- coding: utf-8 -*-
# Author: kun
# @Time: 2019-07-23 14:25
import os
import numpy as np
import argparse
import torch
import time
import librosa
import pickle
import preprocess
from trainingDataset import trainingDataset
from model_tf import Generator, Discriminator
from tqdm import tqdm
import soundfil... |
<reponame>defNotTrendy/secureLogin
#!/usr/bin/env python3
"""
WPA2 cracking
Automation of MitM Attack on WiFi Networks
Bachelor's Thesis UIFS FIT VUT
<NAME>
2016
#Implementation notes
- Airodump-ng writes its Text User Interface to stderr, stdout is empty.
- Aircrack-ng does not flush when stdout is redirected to fil... |
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
import torch_optimizer as optim
import copy
def checkNoneGradient(model):
for name, param in model.named_parameters():
if param.requires_grad and param.grad is None:
print("Warning: detected parameter with no gra... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # s_hi... |
<reponame>aktivkohle/youtube-curation
import sys
from userInteraction import askTheUser
import requests
import config
import dateutil.parser
import dateutil.parser
import datetime
from dateutil.relativedelta import relativedelta
import time
import pprint
import pymysql.cursors
import re
def printUnixTimestampNicely(Ts... |
# Copyright 2017 AT&T Corporation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... |
<filename>Python/python2_version/klampt/io/html.py
from klampt import *
from klampt.model import trajectory
from klampt import robotsim
import json
_title_id = '__TITLE__'
_scene_id = '__SCENE_JSON__'
_path_id = '__PATH_JSON__'
_rpc_id = '__RPC_JSON__'
_compressed_id = '__COMPRESSED__'
_dt_id = '__TIMESTEP__'
def mak... |
<filename>key_meter_estimation/key_estimation.py
import numpy as np
import partitura
from scipy.stats import mode
from hmm import HMM, ConstantTransitionModel, ObservationModel
from key_profiles import build_key_profile_matrix, KEYS
class KeyProfileObservationModel(ObservationModel):
"""
Use Key Profiles (p... |
<reponame>geijt/python-plugwise<filename>plugwise/nodes/__init__.py
"""Plugwise nodes."""
from datetime import datetime
import logging
from ..constants import (
FEATURE_AVAILABLE,
FEATURE_PING,
FEATURE_RELAY,
FEATURE_RSSI_IN,
FEATURE_RSSI_OUT,
PRIORITY_LOW,
UTF8_DECODE,
)
from ..messages.re... |
from os.path import join as jj
from typing import List
from workflow.utility import ensure_path, expand_basenames, expand_target_files, touch, unlink
TEST_DUMMY_FILENAMES = [
'prot-200708--13',
'prot-200001--37',
'prot-198485--141',
'prot-197576--121',
'prot-199697--42',
'prot-1944-höst-fk--28... |
import os
import shutil
from xml.dom.minidom import parse
from shutil import copyfile
import random
import re
print('total image num = ', len(os.listdir(os.path.join('../../data/original_data', "images"))))
wo_num = 0
w_num = 0
wo_image_num = 0
w_image_num = 0
for dirname, _, filenames in os.walk('../... |
from data_generation.real_data.collect import Collector
config = dict()
config["data_config"] = dict()
# 0.6, -0.6, 0.0
config["turtlebot_config"] = dict()
################################################################################
# Important Parameters
#########################################################... |
<reponame>nmbr73/Fetch-n-Fuse
#!/usr/bin/env python3
import os
import sys
import pathlib
import io
import re
import requests
import json
import yaml
import argparse
from dotenv import load_dotenv
CONVERSIONS_PATH = './Conversions/'
VERBOSE = False
NOASSETS = False
MEDIAMAP = {
"/media/a/52d2a8f514c4fd2d9866587f4... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %% [markdown]
# # **Assignment 6** #
# **Delivery Instructions**: Similar to previous assignments. See this [**Canvas announcement**](https://njit.instructure.com/courses/11882/discuss... |
import numpy as np
class environment():
# this class defines what actions are available, what they do, and how they modify the environment
# this class keeps track of the agents attributes including loss
def __init__(self, agent_position, agent_direction, environment_shape):
# position is a 2 elem... |
from django.contrib.auth import authenticate, login, logout
from django.db import IntegrityError
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse
from django.contrib.auth.decorators import login_required
from django.core.paginator import Pagi... |
<filename>s3_library.py
'''Library to encapsulate interactions with AWS S3.
'''
import boto
import fnmatch
import os
import pickle
import sys
from tempfile import NamedTemporaryFile
##with open(os.path.join(os.path.dirname(__file__), 's3_credentials.txt')) as creds:
#with open('/home/ec2-user/code_parallel_stochastic... |
from .common import *
from partname_resolver.components.resistor import Resistor
from partname_resolver.units.resistanceTolerance import Tolerance
from ..units.temperature import TemperatureRange
import re
from decimal import Decimal
series = {'CAT16': 'Concave Terminations',
'CAY16': 'Convex Terminations',
... |
<gh_stars>100-1000
#=======================================================================
# arith.py
#=======================================================================
'''Collection of translatable arithmetic components.'''
from pymtl import *
#-----------------------------------------------------------------... |
from geomagio.algorithm import SqDistAlgorithm as sq
import numpy as np
from numpy.testing import (
assert_allclose,
assert_almost_equal,
assert_array_less,
assert_equal,
)
def test_sqdistalgorithm_additive1():
"""SqDistAlgorithm_test.test_sqdistalgorithm_additive1()
Uses a simple 12 point da... |
#=======================================================================
# isa.py
#=======================================================================
# Check if importing softfloat will succeed. If it's not built, then
# softfloat._abi will not exist and throw and ImportError
try:
import softfloat
ENABLE_FP ... |
<gh_stars>1-10
# Copyright 2018 IBM Corporation
#
# 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 ... |
# -*- coding: utf-8 -*-
from odoo import api, fields, models, _
from odoo.exceptions import UserError, ValidationError
from datetime import date
class AccountPartialReconcile(models.Model):
_name = "account.partial.reconcile"
_description = "Partial Reconcile"
_rec_name = "id"
# ==== Reconciliation ... |
import os
import time
import json
import boto3
from botocore.client import Config
import botocore
from config import config
from db import db
db = db.Database()
env = config.GetEnvObj()
PBOX_AWS_KEY = env("PBOX_AWS_KEY") if env("PBOX_AWS_KEY") else os.getenv("PBOX_AWS_KEY", None)
PBOX_AWS_SECRET = env("PBOX_AWS_SECR... |
# -*- coding: utf-8 -*-
""" Test for USA address parser """
import re
import pytest
from pyap import utils
from pyap.packages import six
import pyap.source_US.data as data_us
def execute_matching_test(input, expected, pattern):
match = utils.match(pattern, input, re.VERBOSE)
is_found = match is not None
... |
# Various preprocessing techniques and n_topics for LDA to optimize Similarity score
# Author: <NAME>
# Last edited: 2022-02-21
#
#%%
import os, sys, re
from nltk.chunk import ne_chunk
import pandas as pd
import numpy as np
from os import path
from argparse import ArgumentParser
from stages.utils.utils import parseArg... |
import _pickle
import os
import numpy as np
DEFAULT_PADDING_LABEL = '<pad>' # dict index = 0
DEFAULT_UNKNOWN_LABEL = '<unk>' # dict index = 1
DEFAULT_RESERVED_LABEL = ['<reserved-2>',
'<reserved-3>',
'<reserved-4>'] # dict index = 2~4
DEFAULT_WORD_TO_INDEX = {DE... |
import unittest
from ospacial.officegraph import OfficeGraph
class TestOfficeGraph(unittest.TestCase):
def setUp(self):
# rank = 10
self.og10 = OfficeGraph(10)
# rank = 5
self.og5 = OfficeGraph(5)
# id of node representing food truck
def test_target_id(self):
# t... |
<filename>users/migrations/0001_initial.py
# Generated by Django 2.1.7 on 2019-03-05 14:22
from django.db import migrations, models
import django.db.models.deletion
import users.models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0009_alter_user_last_name_max_len... |
import os
import tensorflow as tf
from tensorflow.keras import layers, models
import matplotlib.pyplot as plt
import numpy as np
class CNN_B1(object):
def __init__(self):
model = models.Sequential()
model.add(layers.Conv2D(32, (5,5), activation='relu', input_shape=(100, 100, 3) ))
model.a... |
<filename>highway_env/road/road.py
import numpy as np
import pandas as pd
import logging
from typing import List, Tuple, Dict, TYPE_CHECKING, Optional
from highway_env.logger import Loggable
from highway_env.road.lane import LineType, StraightLane, AbstractLane
if TYPE_CHECKING:
from highway_env.vehicle import ki... |
# -*- coding: utf-8 -*-
# Import Python Libs
from __future__ import absolute_import
# Import Salt Testing Libs
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.unit import TestCase, skipIf
from tests.support.mock import (
Mock,
MagicMock,
patch,
NO_MOCK,
NO_MOCK_REASON
)
... |
# Copyright 2008-2018 Univa Corporation
#
# 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... |
from storage import operation_primitives
import example_logic_tier as base
import rdf_json
from rdf_json import URI
import logging
import utils
import os, urlparse
from base_constants import CE, AC, RDF, AC_ALL, LDP, ADMIN_USER
from base_constants import URL_POLICY as url_policy
logging.basicConfig(level=logging.D... |
from data_processing import _in_list
import pandas as pd, numpy as np
def stacked_series_flatten(ser):
'''
flatten a series containing 1-D list-like items
Parameters
----------
ser : Series
Returns
-------
sser : Series
series item with all items flatten
Example
-----... |
# Copyright 2017--2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not
# use this file except in compliance with the License. A copy of the License
# is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fi... |
<filename>programs/maya/scripts/data/curve.py<gh_stars>0
import maya.cmds as cmds
CURVE_POINTS = {
'square': [(-1, 0, -1), (1, 0, -1), (1, 0, 1), (-1, 0, 1)],
'triangle': [(-1, 0, 1), (0, 0, -1), (1, 0, 1)],
'box': [
(0.5, 0.5, 0.5), (-0.5, 0.5, 0.5), (-0.5, 0.5, -0.5), (0.5, 0.5, -0.5,), (0.5, 0.... |
<filename>lib/googlecloudsdk/command_lib/database_migration/connection_profiles/cloudsql_flags.py
# -*- coding: utf-8 -*- #
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may o... |
# coding: utf-8
"""
Experimental Looker API 3.1 Preview
This API 3.1 is in active development. Breaking changes are likely to occur to some API functions in future Looker releases until API 3.1 is officially launched and upgraded to beta status. If you have time and interest to experiment with new or modifie... |
<gh_stars>10-100
from PIL import Image, ImageDraw, ImageStat
states = 'vmu'
bitmap2fill = {
'v':'white',
'm':'blue',
'u':'orange',
}
bitmap2fill2 = {
'v': (255, 255, 255, 255),
'm': (0, 0, 255, 255),
'u': (255, 165, 0, 255),
}
fill2bitmap = {
(255... |
<filename>troposphere/elasticloadbalancingv2.py
# Copyright (c) 2012-2013, <NAME> <<EMAIL>>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty, If, Tags
from .validators import (
elb_name, exactly_one, network_port,
tg_healthcheck_port, integer,
one_of
)
cl... |
<reponame>jrrpanix/ML9
import sys
import os
from matplotlib.dates import DateFormatter
import datetime
import matplotlib.pyplot as plt
import numpy as np
class RateDecision:
def __init__(self, d0, d1, r0, r1, dec, d, dr):
self.date0 = d0
self.date1 = d1
self.rate0 = r0
self.rate1 ... |
"""Kaifa tests."""
# pylint: disable = no-self-use
from __future__ import annotations
from datetime import datetime, timezone, timedelta
from pprint import pprint
import construct
from han import kaifa
from tests.assert_utils import (
assert_apdu,
assert_obis_element,
)
no_list_1 = bytes.fromhex(
"e6e70... |
import requests
import json
from PIL import Image, ImageDraw
# https://console.faceplusplus.com.cn/documents/4888373
#调用旷视科技的人脸识别api,返回人脸的属性
def face_detect(filepath):
http_url = 'https://api-cn.faceplusplus.com/facepp/v3/detect'
key = '<KEY>'
secret = '<KEY>'
#filepath = '2.jpg'
data = {'ap... |
import subprocess
from PyQt5 import QtWidgets
from rujaion import util
class TestDialog(QtWidgets.QDialog):
def __init__(self, *args, compiled_file: str, settings):
super().__init__(*args)
self.console = self.parent().console
self.compiled_file = compiled_file
# self.is_interacti... |
<filename>lib/pwiki/DocPagePresenter.py<gh_stars>10-100
## import hotshot
## _prof = hotshot.Profile("hotshot.prf")
import traceback
import wx
import wx.xrc as xrc
from WikiExceptions import *
from wxHelper import getAccelPairFromKeyDown, copyTextToClipboard, GUI_ID
from .MiscEvent import ProxyMiscEven... |
'''
it is design to all layer pass
'''
import numpy as np
import os
import shutil
def set_dir(filepath, file):
if not os.path.exists(filepath):
os.mkdir(filepath)
# else:
# shutil.rmtree(filepath)
# os.mkdir(filepath)
PATH = str(filepath) + '/' + str(file)
with open(PATH, 'w') ... |
<reponame>Muhazerin/desktop-battery-notifier<filename>desktopBatteryNotifier.py
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import (QThread, pyqtSignal, pyqtSlot)
from PyQt5.QtWidgets import (QApplication, QDialog, QSystemTrayIcon,
QMenu, QVBoxLayout, QAction, QMessageBox)
from PyQt5.Qt... |
import os
import torch
import numpy as np
from PIL import Image
import torch.nn as nn
from torch.utils import data
from network import *
from dataset.zurich_night_dataset import zurich_night_DataSet
from dataset.acdc_dataset import acdc_dataset
from configs.test_config import get_arguments
import torch.nn.functional ... |
<reponame>jppgks/kfp-tekton
# Copyright 2020 kubeflow.org
#
# 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... |
<filename>socceraction/vaep/base.py
# -*- coding: utf-8 -*-
"""Implements the VAEP framework.
Attributes
----------
xfns_default : list(callable)
The default VAEP features.
"""
import math
from typing import Any, Callable, Dict, List, Optional, Tuple
import numpy as np
import pandas as pd
from sklearn.exceptions... |
import os
import pytest
from datetime import date
import time
from fleetio.fleetio import Fleetio
from fleetio.request import Request, RequestPurchaseOrderID, RequestEquipmentID, RequestVehicleID
today = date.today().strftime("%m_%d_%Y")
api_key = os.environ.get('FLEETIO_API_KEY')
account_token = os.environ.get('FLEE... |
<gh_stars>0
# -*- coding: utf-8 -*-
#!/usr/bin/env python3
#
# Copyright (C) <NAME> 2019
#
import sqlite3
from FileTools import *
class FileServerDatabase:
_databaseFile = ":memory"
_connection = None
_cursor = None
def __init__(self):
self._databaseFile = "fileStore.db"
self._connec... |
<filename>rrd/utils/graph_urls.py
#-*- coding:utf-8 -*-
# Copyright 2017 Xiaomi, 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
#
# Un... |
import random
import string
from telegram.ext import CommandHandler
from bot.helper.mirror_utils.upload_utils.gdriveTools import GoogleDriveHelper
from bot.helper.telegram_helper.message_utils import sendMessage, sendMarkup, deleteMessage, delete_all_messages, update_all_messages, sendStatusMessage
from bot.helper.te... |
from __future__ import unicode_literals
import math
import frappe
from frappe.utils import cstr, add_days, date_diff, getdate, format_date
from frappe import _, bold
from frappe.utils.csvutils import UnicodeWriter, read_csv_content
from frappe.utils.data import format_date
from frappe.utils.file_manager import get_file... |
<gh_stars>0
#!/usr/bin/env python
# <NAME>
# 3-Jul-2020 16:01
import os
import sys
import re
from os import listdir
import shutil
import glob
from PIL import Image
import imageio
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchsummary import summary
import torch.utils.data as data_utils
f... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##
## Whabapp - A Web application microframework
##
## usage: $ python app.py -s localhost 8080
##
import sys
import re
import cgi
import os.path
import sqlite3
# quote HTML metacharacters.
def q(s):
assert isinstance(s, basestring), s
return (s.
repl... |
# Copyright 2020 Google LLC
#
# 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, ... |
from crum import get_current_user
from django.db.models import Exists, OuterRef, Q
from dojo.models import Product, Product_Member, Product_Type_Member, App_Analysis, \
DojoMeta, Product_Group, Product_Type_Group, Languages, Engagement_Presets, \
Product_API_Scan_Configuration
from dojo.authorization.authorizat... |
from tkinter import BOTH, Menu
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
from tanager_feeder.plotter.sample import Sample
from tanager_feeder.plotter.plot import Plot
from tanager_feeder.plotter.hemisphere_plotter import... |
<filename>mkt/cmds.py
import argparse
import ConfigParser as configparser
import functools
import os
import re
import sha
import shutil
import socket
import subprocess
import sys
import tempfile
import textwrap
from collections import namedtuple
from contextlib import contextmanager
from decimal import Decimal
from ppr... |
<filename>pixels.py
# Utility classes to communicate with pixels dices
# Standard lib
from enum import IntEnum, unique
import time
import asyncio
import threading
import traceback
import sys
import signal
from queue import Queue
# Our types
from utils import integer_to_bytes, Event
from color import Color32
from anim... |
# -*- coding: utf-8 -*-
"""Classes for extinction calculation"""
from addict import Dict
from copy import deepcopy
from ELDAmwl.bases.factory import BaseOperation
from ELDAmwl.bases.factory import BaseOperationFactory
from ELDAmwl.component.interface import IExtOp
from ELDAmwl.component.interface import IMonteCarlo
fro... |
<reponame>tizon9804/SS2017<gh_stars>0
"""
++++++++++
+ CFDMSH +
++++++++++
Python Library for CFD Meshing with Salome Platform
Author: <NAME>. (www.tougeron-cfd.com)
Licence: GNU General Public License
"""
version = "4.0"
import salome, salome.geom.geomtools
import GEOM
from salome.geom import geomBuilder
geomp... |
"""
Django settings for hitchike project.
Generated by 'django-admin startproject' using Django 1.9.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
... |
<gh_stars>0
#!/usr/bin/env python
"""
File Name : combine_reads_MB.py
Author : <NAME>, <EMAIL>
Created On : 2016-03-28
Last Modified: 2016-03-28
Description : This program will combine read files of the same sample
obtained from multiple sequencing runs
Dependencies:
Usage: combine_re... |
from collections import defaultdict, Counter, deque
from functools import cache
from itertools import product, pairwise
from multiprocessing import Pool
import math
import re
non_digits = re.compile('[^0-9]+')
def sign(a, b, step=1):
return int(math.copysign(step, b-a))
def autorange(a,b, step=1):
if a == b:re... |
<gh_stars>10-100
# Credit to https://github.com/BertrandBordage for initial implementation
import copy
from collections import OrderedDict
from wagtail.contrib.forms.models import AbstractForm
from hypha.apply.funds.blocks import ApplicationMustIncludeFieldBlock
from .blocks import (
FormFieldBlock,
GroupTog... |
import graphene
import time
import string
import random
import logging
from lingvodoc.schema.gql_holders import (
LingvodocObjectType,
CompositeIdHolder,
AdditionalMetadata,
CreatedAt,
MarkedForDeletion,
Relationship,
MovedTo,
fetch_object,
client_id_check,
del_object,
acl_c... |
#!/usr/bin/env python
# coding: utf-8
import argparse
from fastai.vision import *
from tqdm import tqdm
from pathlib import Path
import pandas as pd
import os
import sys
from fastai.callbacks import CSVLogger
# suppress anoying and irrelevant warning, see https://forums.fast.ai/t/warnings-when-trying-to-make-an-imag... |
"""
tablib.dictionary.sbtab_dict
~~~~~~~~~~~~~
A wrapper object for handling an SBtab with multiple tables using
a dictionary.
Also, includes methods for I/O between SQLite and SBtab.
"""
# -*- coding: utf-8 -*-
import misc
from SBtab import SBtabTable, SBtabError
import tablib
import tablibIO
import sqlite3
class SBt... |
"""Provides specific NEB provider implementations (e.g. GULP and VASP), freeing users from such complexities.
"""
import os
import subprocess as sb # run()
from PyLib.TinyParser import TinyParser
from Errors import AppError
class GulpNEBProvider:
class GinFileTemplate:
"""After initialisation with a model GULP .gi... |
<gh_stars>0
import itertools
import os
import subprocess
import numpy as np
import time
import datetime
from hyperopt import hp
import pandas as pd
HomeDir = os.environ.get('HOME')
# os.chdir(os.path.join(HomeDir,"CS3244/DrQA"))
os.chdir(os.path.join(HomeDir,"DrQA"))
# print(os.getcwd())
top10_result = "validation/top... |
<gh_stars>0
import socket
from django.utils.translation import ugettext as _
from djblets.util.humanize import humanize_list
class SCMError(Exception):
def __init__(self, msg):
Exception.__init__(self, msg)
class ChangeSetError(SCMError):
pass
class InvalidChangeNumberError(ChangeSetError):
d... |
<filename>plots/plots_simulation_main.py
#! /usr/bin/env python3
import numpy as np
from scipy.stats import gaussian_kde as kde
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'serif','serif':['Times']})
rc('text', usetex=True)
import argparse
parser = argparse.ArgumentParser()
parser.a... |
import glob
import os
import pathlib
import argparse
import torch
from lib.pl_utils import UnNormalize
from model_define import StyleTransfer
import torchvision.transforms as transforms
from PIL import Image
import clip
import torchvision.utils as vutils
# Testing settings
parser = argparse.ArgumentParser(description... |
#!/usr/bin/env python3
# ----------------------------------------------------------------------------
# Copyright 2019 Drunella
#
# 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:/... |
<filename>coil/test/test_link.py<gh_stars>1-10
"""Tests for coil.struct.Link"""
import unittest
from coil import errors
from coil.struct import Node, Link
class BasicTestCase(unittest.TestCase):
def setUp(self):
self.r = Node()
self.a = Node(None, self.r, "a")
self.b = Node(None, self.a, ... |
#!python
import string
# Hint: Use these string constants to encode/decode hexadecimal digits and more
# string.digits is '0123456789'
# string.hexdigits is '0123456789abcdefABCDEF'
# string.ascii_lowercase is 'abcdefghijklmnopqrstuvwxyz'
# string.ascii_uppercase is 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
# string.ascii_letters ... |
import argparse
import asyncio
import json
import logging
import os
import ssl
import uuid
import weakref
from datetime import datetime, timedelta
from io import BytesIO
from threading import Thread
import aiohttp
import aiohttp_cors
import av
import requests
from aiohttp import web
from aiortc import MediaStreamTrack... |
""" Test the examples directory to keep them in working order.
NOTE: If you make any changes to this file, you must make the corresponding
change to the example file.
"""
import unittest
from six.moves import cStringIO
import numpy as np
from openmdao.api import Problem, Group, IndepVarComp, ExecComp, ScipyOp... |
from __future__ import print_function,division
from builtins import range
from six import iteritems
from ..spaces.objective import ObjectiveFunction
from ..spaces.sets import Set
from ..spaces.controlspace import ControlSpace
from ..spaces.configurationspace import ConfigurationSpace
import math
import numpy as np
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from src.models.ll_model import LifelongLearningModel
class PNNLinearBlock(nn.Module):
def __init__(self, in_sizes, out_size, scalar_mult=1.0, split_v=False):
super(PNNLinearBlock, self).__init__()
assert isinstance(in_sizes, (lis... |
import base64
import csv
import getpass
try:
import lxml
except Exception:
print 'library lxml not supported. WikiPathways and LineageProfiler visualization will not work. Please install with pip install lxml.'
from lxml import etree as ET
from lxml import _elementpath
import re
try: import requests
except Exce... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.