text stringlengths 957 885k |
|---|
import errno
import logging
import stat
from pathlib import PurePosixPath
from types import TracebackType
from typing import Any, cast, Generator, Iterable, Optional
import paramiko
from cerulean.file_system import FileSystem
from cerulean.file_system_impl import FileSystemImpl
from cerulean.path import AbstractPath, ... |
<filename>crypto/algorithms/purersa.py<gh_stars>1-10
__author__ = 'bsoer'
from crypto.algorithms.algorithminterface import AlgorithmInterface
from tools.argparcer import ArgParcer
import tools.rsatools as RSATools
import math
import sys
class PureRSA(AlgorithmInterface):
n = None
totient = None
e = None
... |
<filename>qroute/models/graph_dual.py
import typing
import numpy as np
import torch
import torch_geometric
from ..environment.device import DeviceTopology
from ..environment.state import CircuitStateDQN
class NormActivation(torch.nn.Module):
def __init__(self, dim=-1):
super().__init__()
self.d... |
<reponame>jhnphm/boar<gh_stars>0
# -*- coding: utf-8 -*-
# Copyright 2011 <NAME>
#
# 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... |
<reponame>marcosherreroa/Aplicaciones-de-los-algoritmos-bandidos
# -*- coding: utf-8 -*-
"""""
Bandidos estocásticos: introducción, algoritmos y experimentos
TFG Informática
Sección 7.2.9
Figura 14
Autor: <NAME>
"""
import math
import random
import scipy.stats as stats
import matplotlib.pyplot as plt
im... |
<reponame>ztq1521367/APA
import numpy as np
import matplotlib.pyplot as plt
from scipy import linalg
import math
import time
from threading import Thread
import pdb
import random
import copy
import re
"""
输入:车位宽度,车辆起始点,最小停车位宽度,车距离车位的最短距离和最长距离(这个可以根据具体车型事先计算好)
输出:计算避障点坐标,终止点坐标,以及每个控制点的航向角,避障点可以有多个:驶离车位时右前角,驶出车位时右... |
import json
import logging
from pathlib import Path
from textwrap import dedent
import chevron
import yaml
import users
from spec import Cube, Query, MeasureType, Spec
class CubeCompiler:
def __init__(self, name: str, cube: Cube):
self.name = name
self.cube = cube
def compile(self, query: Q... |
"""url builder"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from es_downloader.config import IMAGO_DOC_URL, \
IMAGO_LIVE_VIDEO_URL, \
DOWNLOAD_TYPE_DOC, DOWNLOAD_TYPE_LIVE_IMG, \
DOWNLOAD_TYPE_LIVE_VID, IMAGO_LIVE_PHOTOS_URL, \
IMAGO_DO... |
<gh_stars>0
# requires numpy, tested on python 2.7
from __future__ import print_function
import cmath
import csv
import math
import random
import numpy as np
'''this module provides the classes to simulate a set of bodies subject to gravity.
All calculations are made in the plan, and positions are coded with complex... |
<reponame>drjdlarson/gncpy<filename>gncpy/sensors.py
import abc
import io
import numpy as np
import gncpy.wgs84 as wgs84
from gncpy.orbital_mechanics import ecc_anom_from_mean, true_anom_from_ecc, \
correct_lon_ascend, ecef_from_orbit
from gncpy.coordinate_transforms import ecef_to_NED
"""
----------------------... |
<filename>ParameterTuning/RandomSearch.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 10/03/2018
@author: <NAME>
"""
from ParameterTuning.AbstractClassSearch import AbstractClassSearch, DictionaryKeys, writeLog
from functools import partial
import traceback, pickle
import os, gc, math
import multip... |
import numpy as np
import cmath
import string
from src.quantum_phase_estimation.quantumdecomp.quantum_decomp import matrix_to_qasm
from src.quantum_phase_estimation.quantumdecomp.quantum_decomp import U_to_CU
from src.quantum_phase_estimation.util_functions import change_domain
def get_unitary_operators_array(operato... |
<filename>polygon/invoice/migrations/0001_initial.py
# Generated by Django 3.0.6 on 2020-06-22 10:25
import django.contrib.postgres.fields.jsonb
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models
import polygon.core.utils.json_serial... |
<reponame>aleattene/python-codewars-challenges
import unittest
from solution_pokemon_specials_contest import pk_special_winner
class PokemonSpecialsContest(unittest.TestCase):
def test_solution(self):
self.assertEqual(pk_special_winner(4, 14), 4)
self.assertEqual(pk_special_winner(71, 54), 71)
... |
#!/usr/bin/env python
"""
hp_schedule.py
Optimizer hyperparameter scheduler
!! Most of the schedulers could be reimplemented as compound schedules (prod or cat)
"""
from __future__ import print_function, division
import sys
import copy
import warnings
import numpy as np
from tqdm import tqdm
import to... |
<filename>tests/datasets/test_cowc.py
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import os
import shutil
from pathlib import Path
from typing import Generator
import pytest
import torch
from _pytest.fixtures import SubRequest
from _pytest.monkeypatch import MonkeyPat... |
<reponame>cx1027/coinrun_twoobjects<gh_stars>0
"""
Train an agent using a PPO2 based on OpenAI Baselines.
"""
import time
from mpi4py import MPI
import random
from coinrun import setup_utils, make
import tensorflow as tf
from baselines.common import set_global_seeds
import coinrun.main_utils as utils
# from coinrun.im... |
<reponame>invenia/mailer
"""
The Mailer class provides a simple way to send emails.
"""
from __future__ import absolute_import
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import os
from smtplib import SMTP
import six
_ENCODING =... |
<filename>Code_Python/ch3_1_4_norm.py
### ch3.1.4 Lpノルムの作図
#%%
# 3.1.4項で利用するライブラリ
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
#%%
## Lpノルムの作図
# 値を指定
p = 1
# wの値を指定
w_vals = np.arange(-10.0, 10.1, 0.1)
# 作図用のwの点を作成
W1, W2 = np.meshgrid(w_vals, w_vals)
# Lpのノル... |
<filename>ansible/venv/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_interfaces.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#############################################
# ... |
<filename>server/rpi_cam/server.py
from aiohttp import web
from aiohttp_index import IndexMiddleware
import logging
import socketio
from rpi_cam.tools import get_logger, CLIENT_BUILD_DIR, CAM_DATA_DIR
from rpi_cam.capture import get_frame_manager, Drivers
from rpi_cam.capture.frame_manager import ImageError, DEFAULT_P... |
<reponame>360ls/360ls-stitcher
"""
This module encapsulates the Stitcher class to enable stitching of images/frames.
"""
from __future__ import absolute_import, division, print_function
import numpy as np
import imutils
import cv2
class Stitcher(object):
""" Creates a single stitched frame from two frames """
... |
##################################################
# PUG_services.py
# generated by ZSI.generate.wsdl2python
##################################################
from PUG_services_types import *
import urlparse, types
from ZSI.TCcompound import ComplexType, Struct
from ZSI import client
import ZSI
from ZSI.generate.p... |
import json
from dug.utils import biolink_snake_case
class MissingNodeReferenceError(BaseException):
pass
class MissingEdgeReferenceError(BaseException):
pass
class QueryKG:
def __init__(self, kg_json):
self.kg = kg_json["message"]
self.answers = self.kg.get("results", [])
self... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making GameAISDK available.
This source code file is licensed under the GNU General Public License Version 3.
For full details, please refer to the file "LICENSE.txt" which is provided as part of this source code package.
Copyright... |
# Copyright 2017 The TensorFlow Authors 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 required by appl... |
<filename>mtools/test/test_util_logline.py
import sys
from nose.tools import *
from mtools.util.logline import LogLine
import time
line_ctime_pre24 = "Sat Aug 3 21:52:05 [initandlisten] db version v2.2.4, pdfile version 4.5"
line_ctime = "Sat Aug 3 21:52:05.995 [initandlisten] db version v2.4.5"
line_iso8601_local =... |
<filename>infoblox_netmri/api/broker/v3_8_0/vlan_member_broker.py
from ..broker import Broker
class VlanMemberBroker(Broker):
controller = "vlan_members"
def show(self, **kwargs):
"""Shows the details for the specified vlan member.
**Inputs**
| ``api version min:`` None
... |
import argparse
import os
from collections import defaultdict
import numpy as np
import pandas as pd
import torch
import torch.optim as optim
import torchsummary
from torch.optim import lr_scheduler
from torch.utils.data import DataLoader
from torchvision import datasets, models, transforms
from tqdm import tqdm
from ... |
import os, argparse, math
import pickle as pkl
import numpy as np
import matplotlib
from matplotlib import rc
import matplotlib.pyplot as plt
from scipy import misc
import tensorflow as tf
from utils import reordering
matplotlib.rcParams['text.latex.unicode']=True
rc('font', **{'family': 'serif', 'serif': ['Computer M... |
<reponame>yumauri/kings_and_pigs
import pygame
from .sight_line import SightLine
from .states import Idle, Patrol
class Agent:
def __init__(self, width, height, enemy, hero):
self.view_width = width
self.view_height = height
self.enemy = enemy
self.hero = hero
self.sights =... |
<filename>facebook_ads/migrations/0009_auto__add_adstatistic__add_field_adgroup_creative__chg_field_adgroup_t.py
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding ... |
import math
import numpy as np
import torch
from mimic.evaluation.divergence_measures.mm_div import alpha_poe
from mimic.utils import utils
from mimic import log
LOG2PI = float(np.log(2.0 * math.pi))
def get_latent_samples(flags, latents, n_imp_samples, mod_names=None):
l_c = latents['content']
l_s = laten... |
"""
Prediction of GH7 subtypes (CBH/EG) with machine learning (ML)
"""
# Imports
#===========#
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import pydot_ng as pydot
from imblearn.under_sampling import RandomUnderSampler
from sklearn.preprocessing import StandardScaler
from sklearn.metr... |
# -*- coding: utf-8 -*-
"""
Printer.py
A library to interface with the Form 1 and Form 1+ over USB
Copyright 2016-2017 Formlabs
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.apac... |
<reponame>jsiloto/adaptive-cob
import argparse
import datetime
import time
import os
import sys
import numpy as np
import torch
from torch import nn
from models import load_ckpt, get_model, save_ckpt
from myutils.common import file_util, yaml_util
from utils import data_util, main_util, misc_util
from models.slimmable.... |
<reponame>marieBvr/virAnnot
# to allow code to work with Python 2 and 3
from __future__ import print_function # print is a function in python3
from __future__ import unicode_literals # avoid adding "u" to each string
from __future__ import division # avoid writing float(x) when dividing by x
import os.path
import lo... |
# -------------------------------------
# Project: Learning to Compare: Relation Network for Few-Shot Learning
# Date: 2017.9.21
# Author: <NAME>
# All Rights Reserved
# -------------------------------------
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from to... |
'''Utilities
=============
'''
from kivy.compat import PY2
from kivy.utils import get_color_from_hex
from kivy.properties import StringProperty, ObservableDict, ObservableList
from kivy.factory import Factory
from kivy.event import EventDispatcher
from kivy.weakproxy import WeakProxy
import json
from io impor... |
<filename>python/utir/deserializer/__init__.py<gh_stars>1-10
from utir import ast
from utir.exception import InvalidFileFormatError
class ASTDeserializer:
def deserialize(self, object):
if 'Version' not in object.keys():
raise InvalidFileFormatError("Key of 'Version' dose not exist.")
... |
<gh_stars>100-1000
import time
import numpy as np
import sys
from sandbox.gkahn.gcg.envs.rccar.panda3d_camera_sensor import Panda3dCameraSensor
from direct.showbase.DirectObject import DirectObject
from direct.showbase.ShowBase import ShowBase
from panda3d.core import loadPrcFileData
from panda3d.core import AmbientLig... |
# Author: <NAME> <<EMAIL>>
# A core-attachment based method to detect protein complexes in PPI networks
# <NAME>, Kwoh, Ng (2009)
# http://www.biomedcentral.com/1471-2105/10/169
from collections import defaultdict
from itertools import combinations
import functools
# return average degree and density for a graph
de... |
import os
from django.core import management
from django.core.exceptions import ImproperlyConfigured
from django.test import TransactionTestCase
from django.test.utils import override_settings
try:
from unittest import skipIf
except ImportError:
# Python 2.6 doesn't include skipIf, but Django 1.6 has a copy
... |
import threading
import time
from concurrent.futures import as_completed
from altfe.interface.cloud import interCloud
from app.lib.core.aliyundrive.aliyundrive import AliyunDrive
@interCloud.bind("cloud_aliyundrive", "LIB_CORE")
class CoreAliyunDrive(interCloud):
def __init__(self):
super().__init__()
... |
# Copyright (c) 2019-2022 ThatRedKite and contributors
import discord
import aioredis
from discord.ext import commands, tasks
from discord.ext.commands.errors import CommandInvokeError
from thatkitebot.backend.util import errormsg
from thatkitebot.backend import cache
class ListenerCog(commands.Cog):
"""
Th... |
<gh_stars>0
import socket
import time
import getopt
import sys
import mysql.connector
import signal
import os
from sys import argv
from prettytable import PrettyTable
from random import randint, choice
from string import hexdigits
ip = "localhost"
port = 80
timeout = 1
retry = 1
_range = 10
delay = 0
verbose = False
... |
<gh_stars>100-1000
import unittest
import errno
import logging
import socket
from testfixtures import log_capture
import slimta.logging.socket
from slimta.logging import getSocketLogger
class FakeSocket(object):
def __init__(self, fd, peer=None):
self.fd = fd
self.peer = peer
def fileno(se... |
<filename>python/BinarySearch/4_median_of_two_sorted_arrays.py
# !/usr/bin/env python
# coding: utf-8
'''
Description:
There are two sorted arrays nums1 and nums2 of size m and n respectively.
Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).
Example 1:
... |
<gh_stars>0
# coding: utf-8
from datetime import date, datetime
from typing import List, Dict, Type
from openapi_server.models.base_model_ import Model
from openapi_server.models.all_view import AllView
from openapi_server.models.free_style_project import FreeStyleProject
from openapi_server.models.hudsonassigned_la... |
# Cross-platform asynchronous version of subprocess.Popen
#
# Copyright (c) 2011-2012
# <NAME>
# anatoly techtonik
#
# 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, inclu... |
<gh_stars>0
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2010 Anso Labs, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); y... |
import cv2
import csv
import os
import keyboard
videoPath = "C:\\Users\\82104\\Desktop\\차도가 아닌곳\\"
actionlist = os.listdir(videoPath)
action = 0
play = True
while action < len(actionlist):
v = actionlist[action].split(".")[-1]
print(v)
if v=='mp4':
try:
if play==True:
fla... |
from __future__ import unicode_literals
from future.builtins import str
from datetime import datetime, timedelta
import re
from time import timezone
try:
from urllib.parse import quote
except ImportError: # Python 2
from urllib import quote
from django.db import models
from django.utils.encoding import py... |
<reponame>cheng-chi/cinebot_mini
import ikpy
import numpy as np
from ete3 import Tree
from cinebot_mini.web_utils.blender_client import *
from cinebot_mini.geometry_utils.closed_form_ik import inverse_kinematics_closed_form
class TransformationTree:
def __init__(self):
"""A dictionary containing children ... |
import torch
import torch.nn as nn
import torchvision.transforms as transforms
from torch.utils.data import DataLoader
from models import ConvAutoencoder, ImgDataset
import argparse
import time
import os
def ensure_folder(folder):
if not os.path.exists(folder):
os.makedirs(folder)
def time_msec():
r... |
import time,sys,getopt,os
def bl8_jun_filter(bl8_format,junfile,genefile,criterion_len,prefix,gap_j):
fr_jun_bl8 = [r1.strip().split("\t") for r1 in open(bl8_format).readlines()]
fr_jun_type1 = [r2.strip().split("\t") for r2 in open(junfile).readlines()]
fr_genebody=[r3.strip().split("\t") for r3 in open(... |
import os
from app.core import config
from app.notifications.utils import Utils
from app.notifications.text_service import TextSerivce
from app.notifications.combox_client import ComboxClient
import logging
class NotificationsFactory(object):
def __init__(self):
self.text_service = TextSerivce()
... |
from wagtail.api.v2.endpoints import BaseAPIEndpoint, PagesAPIEndpoint
from wagtail.api.v2.filters import (FieldsFilter, OrderingFilter, SearchFilter)
from wagtail.api.v2.utils import BadRequestError
from rest_framework.renderers import BrowsableAPIRenderer
from djangorestframework_camel_case.render import CamelCas... |
import json
import logging
from typing import Any, Dict, List, Optional, Set, Tuple, Type
from dbcat.catalog import Catalog, CatColumn, CatSource, CatTable
from pglast import Node
from pglast.ast import IntoClause
from pglast.visitors import Ancestor, Continue, Skip, Visitor
from data_lineage import ColumnNotFound, S... |
import os
import pandas as pd
def parse_annotations_with_concentration_template(annotations, premise):
"""Parse annotations with the concentration template.
Args:
annotations (pd.DataFrame): Annotations.
premise (str): Premise.
Returns:
annotations_aggregated: List of parsed ann... |
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket 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 applicab... |
<reponame>chaoyan1037/Re-balanced-VAE<filename>data/molecule_iterator.py<gh_stars>1-10
import os
import pickle
import re
import torchtext
from torchtext.data import Example, Field, Dataset
from torchtext.data import BucketIterator
pattern = "(\[[^\]]+]|Br?|Cl?|N|O|S|P|F|I|b|c|n|o|s|p|\(|\)|\.|=|#|-|\+|\\\\|\/|:|~|@|\... |
<reponame>tony/django-docutils
from docutils import nodes, utils
from ..utils import split_explicit_title
def generic_url_role(name, text, url_handler_fn, innernodeclass=nodes.Text):
"""This cleans up a lot of code we had to repeat over and over.
This generic role also handles explicit titles (:role:`yata y... |
<reponame>JKBehrens/STAAMS-Solver
#!/usr/bin/env python
"""
Copyright (c) 2018 Robert Bosch GmbH
All rights reserved.
This source code is licensed under the BSD-3-Clause license found in the
LICENSE file in the root directory of this source tree.
@author: <NAME>
"""
import rospy
from roadmap_planning_common_msgs.srv... |
import numpy as np # type: ignore
import nptyping as npt # type: ignore
from typing import Any, Optional, Tuple
import matplotlib.pyplot as plt # type: ignore
from astropy.constants import codata2018 as ac # type: ignore
import astropy.units as u # type: ignore
from astropy.visualization import quantity_support # typ... |
<gh_stars>0
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np
class FlowlinePath(pg.PlotDataItem):
def __init__(self):
# Index of point being dragged
self.drag_index = None
# How far to translate dragged point from original position
self.drag_offset =... |
<gh_stars>10-100
import unittest
import torch
from pyscf import gto
from torch import nn
from torch.autograd import Variable, grad
import numpy as np
from qmctorch.scf import Molecule
from qmctorch.wavefunction.orbitals.backflow.kernels import BackFlowKernelBase
from qmctorch.wavefunction.jastrows.distance.electron_e... |
<filename>tests.py<gh_stars>0
import unittest
from io import StringIO
from ostream import OStream, endl, ends
from ostream.precisions import DefaultPrecision, FixedPrecision
from iomanip import setprecision, setfill, setw
class TestOStream(unittest.TestCase):
def setUp(self):
self.output_stream = Strin... |
<filename>uiclasses/collections.py
# Copyright (c) 2020 NewStore GmbH
# 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, c... |
import sessionFuncs as sf
import dataProcessing as dp
import numpy as np
import scipy.stats as stats
import matplotlib as mpl
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
from types import *
class PSCCompAnal... |
<reponame>triton-inference-server/model_navigator<gh_stars>10-100
# Copyright (c) 2021, NVIDIA 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:/... |
<gh_stars>10-100
from abc import ABCMeta
from logging import getLogger
from re import sub
from warnings import warn
from sqlite_dissect.constants import BASE_VERSION_NUMBER
from sqlite_dissect.constants import LOGGER_NAME
from sqlite_dissect.constants import MASTER_SCHEMA_ROW_TYPE
from sqlite_dissect.constants import P... |
<filename>pydefect/analyzer/dash_components/main.py
# coding: utf-8
# Copyright (c) 2020 Kumagai group.
import argparse
import sys
from pathlib import Path
import crystal_toolkit.components as ctc
from crystal_toolkit.helpers.layouts import *
from dash import Dash
from pydefect.analyzer.calc_results import CalcResult... |
########################################################
#### Packages ####
import datetime
import time
import sys
from itertools import combinations
start = time.time()
########################################################
#### Prepare RF-result and 2 inputs ####
input = sys.argv
input1 = input[1]
input2 = inp... |
<filename>transform/bcc_labkey/treatment.py<gh_stars>1-10
"""A transformer for gen3 project,reads treatments bcc, writes to DEFAULT_OUTPUT_DIR."""
import hashlib
import os
import json
from gen3_etl.utils.ioutils import reader
from defaults import DEFAULT_OUTPUT_DIR, DEFAULT_EXPERIMENT_CODE, DEFAULT_PROJECT_ID, defaul... |
<filename>functions/initialize.py
import tcod
from typing import Dict, Tuple
from components.entity import Entity
from components.equipment import Equipment
from components.equippable import Equippable
from components.fighter import Fighter
from components.inventory import Inventory
from components.level import Level
... |
import os
from django.shortcuts import render
# from django.contrib.auth.models import User
# from django.contrib.auth import login, authenticate
# from .forms import SignupForm
# from django.db import models
from fintech import settings
from messenger.forms import *
from django.contrib.auth.decorators import login_req... |
<filename>tests/functional/test_adcm_upgrade.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 agre... |
<filename>pychess/widgets/gamenanny.py
""" This module intends to work as glue between the gamemodel and the gamewidget
taking care of stuff that is neither very offscreen nor very onscreen
like bringing up dialogs and """
import math
from collections import defaultdict
from gi.repository import Gtk
from pyc... |
<gh_stars>0
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2020 - 2021
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 ... |
import re,argparse,sys,os
from argparse import RawDescriptionHelpFormatter
from colorprint.printer import uprint
from colorprint.unicolor import FOREGROUND_GREEN,FOREGROUND_RED,FOREGROUND_PINK
'''
--color 用颜色显示出来
-v 条件取反
-i 忽略大小写
-c 统计匹配的行数
-q 静默,无任何输出,一般用于检测。如果$?是0说明有匹配,否则没有
-n 显... |
# SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved.
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# Author: <NAME> (@agsolino)
#
# Description:
# [MS-RPRN] Interface impleme... |
<gh_stars>1-10
import numpy as np
from kernellib.kernel_approximation import RandomizedNystrom, RandomFourierFeatures, FastFood
from sklearn.base import BaseEstimator, RegressorMixin
from sklearn.kernel_approximation import Nystroem, RBFSampler
from sklearn.utils import check_array, check_X_y, check_random_state
from s... |
# coding: utf-8
"""
EXACT - API
API to interact with the EXACT Server # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
from enum import Enum, IntEnum
import six
class Image(object):
"""NOTE... |
<filename>src/repair/guided_inference.py
import logging
import numpy as np
import scipy as sc
import pymc3 as pm
import os
from symbolic_inference import SymbolicInferrer
from os.path import join
from os import mkdir
import time
import statistics
import json
import subprocess
from runtime import Trace, TraceItem
from f... |
atom_attrs = ['name',
'atomic_num',
'bond_degree_no_Hs',
'bond_degree_with_Hs',
'total_bond_degree',
'explicit_valence',
'implicit_valence',
'total_valence',
'formal_charge',
'hybridization',
... |
<gh_stars>1-10
import sys
from heapq import heappush, heappop
import time
# class which representing a single game board
class GameBoard:
def __init__(self, gameState):
self.gameState = gameState
# return the coordinate of certain value
def findCord(self, value):
goalState = [... |
#!/usr/bin/env python3
#
# Python module of support vector classification with random matrix for CPU.
######################################### SOURCE START ########################################
import numpy as np
import torch
from .rfflearn_gpu_common import Base
### This class provides the RFF based SVC classif... |
#!/usr/bin/python
## Python Launcher
import platform
import sys
from subprocess import call
import subprocess
import logging
class Config(object):
def __init__(self, requiredOSs, requiredArchs):
self.requiredOSs = requiredOSs
self.requiredArchs = requiredArchs
# Arch can be { 'arm', 'ia32',... |
<gh_stars>1-10
from transx2gtfs.data import get_path
import pytest
@pytest.fixture
def test_tfl_data():
return get_path('test_tfl_format')
@pytest.fixture
def test_txc21_data():
return get_path('test_txc21_format')
@pytest.fixture
def test_naptan_data():
return get_path('naptan_stops')
def test_calen... |
<gh_stars>0
"""Platforms.
Utilities dealing with platform specifics: signals, daemonization,
users, groups, and so on.
"""
import atexit
import errno
import math
import numbers
import os
import platform as _platform
import signal as _signal
import sys
import warnings
from collections import namedtuple
from contextlib... |
# copyright (c) 2020 paddlepaddle authors. 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 required by app... |
<reponame>PRX/Infrastructure<filename>secrets/lambdas/secrets-s3-update/lambda_function.py
# Invoked by: S3 Object Change
# Returns: Error or status message
#
# Environment variables for applications are stored in encrypted s3 files.
# When those files are updated, the env config file should be updated with the
# curre... |
# pylint: disable=C0103,C0111,W0614,W0401,C0200,C0325
from Tkinter import *
import tkMessageBox
import tkFileDialog
import tkFont
import csv
##
# CSV GUI Editor written in python using tkinter
# - A lightweight csv editor
# - (c) 2017 <NAME> <EMAIL>
##
##
# TODO: Add + / - buttons to create/remove rows & coloumns
#... |
<filename>compare_results.py
import os
import sys
import random
import time
from random import seed, randint
import argparse
import platform
from datetime import datetime
import imp
import numpy as np
import fileinput
from itertools import product
import pandas as pd
from scipy.interpolate import griddata
from scipy.in... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import sys, os, re
from BAClangUtils.ShellUtil import ShellUtil
class RawTokenUtil(object):
def __init__(self):
super(RawTokenUtil, self).__init__()
def __resolveLine(self, lineContent):
if lineContent == None or isinstance(lineContent, str) == Fa... |
import bootstrap
import numpy as np
from igakit.igalib import bsp
def test_crv_ki(PLOT=0):
p = 2
U = np.asarray([0,0,0, 1,1,1], dtype=float)
n = len(U)-1-(p+1)
Pw = np.zeros((n+1,3))
Pw[0,:] = [0.0, 1.0, 1.0]
Pw[1,:] = [1.0, 1.0, 1.0]
Pw[2,:] = [1.0, 0.0, 1.0]
Pw[1,:] *= np.sqrt(2)/2
... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Operations on genomic intervals stored in GTF file
note:
- all the exons of a gene should be on the same strand. Genes with exons trans-
spliced from the other strand, like mod(mdg4) in D. melanogaster, should be
excluded (before or after).
- stop codon is not part of the CD... |
import json
import logging
import sys
import os
import torch
from typing import Dict, Iterable, List, Any, Optional, Union
from pytorch_lightning import LightningDataModule
from torch.utils.data import Dataset
from lightning_modules.models.seq2seq_model_util import get_model, left_pad_sequences
from transformers im... |
"""
<NAME> (2011) Columbia University
<EMAIL>
This code contains functions to normalize an artist name,
and possibly a song title.
This is intended to do metadata matching.
It is mostly an elaborate hack, I never did an extensive search of
all problematic name matches.
Code developed using Python 2.6 on a Ubuntu mach... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.