text stringlengths 957 885k |
|---|
#Moon Lander, where we try to land in 1 of the 3 landing pads, and keep speed under 2 m/s
import pygame
from pygame.locals import *
import sys
import random
import pygwidgets
import pyghelpers
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
YELLOW = (255, 255, 0)
GREEN = (0, 255, 0)
ORANGE = (255, 100, ... |
<reponame>LimnoTech/ODM2PythonAPI
from __future__ import (absolute_import, division, print_function)
from odm2api.ODMconnection import dbconnection
from odm2api.models import (Methods, Models, People,
ProcessingLevels, RelatedModels, Variables)
from odm2api.services.createService import Cre... |
<reponame>Hatmm/PED-DETR-for-Pedestrian-Detection<gh_stars>10-100
# ------------------------------------------------------------------------
# Modified by <NAME>
# Modified from Deformable-DETR (https://github.com/fundamentalvision/Deformable-DETR)
# Modified from DETR (https://github.com/facebookresearch/detr)
# Copyr... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
'''
In the original paper, AFD is one of components of AFDS.
AFDS: Attention Feature Distillation and Selection
AFD: Attention Fea... |
#-------------------------------------------------------------------------------
# Name: maya_save_fbx.py
# Purpose: run this scriptin maya. Assemble predicted rig (.txt) and obj
# mesh together to a FBX file
# RigNet Copyright 2020 University of Massachusetts
# RigNet is made available under G... |
<gh_stars>1-10
import torch
from pytorch_lightning.metrics import Metric
from torch.nn import functional as F
from analysis.downstream_embeddings import LocalScanDownstreamEmbeddings
from models.pretraining.pretraining_utils import EmbeddingsData
def compute_std_from_sample_vars(sample_means, sample_vars):
retur... |
import numpy as np
import torch
import torch.nn as nn
class NumpyDataAugmentation:
"""
Base class for the data augmentation operations that transform
the intensity of a single image.
Transformation are applied to each channel independently.
The function per_channel_transform must be implemented.
... |
<filename>critiquebrainz/ws/review/test/views_test.py
import json
import uuid
from brainzutils import cache
import critiquebrainz.db.license as db_license
import critiquebrainz.db.review as db_review
import critiquebrainz.db.users as db_users
from critiquebrainz.db.user import User
from critiquebrainz.ws.testing impo... |
<reponame>stephendiadamo/qkd_error_recon
import netsquid as ns
import numpy as np
from netsquid.components import QuantumProgram, SourceStatus
from netsquid.protocols import NodeProtocol, Signals
from qkd.networks import TwoPartyNetwork
class KeyReceiverProtocol(NodeProtocol):
"""
Protocol for the receiver o... |
#!/usr/bin/python
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for chromite.lib.patch."""
import copy
import itertools
import os
import shutil
import sys
import time
sys.path.inser... |
#!/usr/bin/env python3
import yaml
import jinja2
import ipwhois
import subprocess
from ansible.module_utils.basic import AnsibleModule
from ansible.errors import AnsibleError
DOCUMENTATION = """
---
module: dns_sync_arin.py
short_description: Synchronize reverse zones with ARIN
options:
irr:
required: true
... |
<reponame>hiliev/py-zfs-recovery
# Copyright (c) 2017 <NAME> <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, ... |
<filename>main.py
import sys
from PyQt5.QtWidgets import *
from Widgets.color_btns import ColorBtn
from Widgets.connection_handler import ConnectionHandler
from Widgets.sliders import *
from hue import *
from styling import *
class Window(QMainWindow):
def __init__(self, bridge):
super().__init__()
... |
<filename>lophi-automation/lophi_automation/dataconsumers/remotequeue.py
"""
Unused classes for handling remote queues
(c) 2015 Massachusetts Institute of Technology
"""
import socket
import time
import multiprocessing
import lophi.globals as G
import lophi_automation.protobuf.helper as ProtoBuf
class Clien... |
<reponame>sisobus/WebStudio2019
from flask import Flask, request
from flask_restful import Api, Resource
import json
import os
app = Flask(__name__)
api = Api(app)
def get_id(l):
_id = 0
for d in l:
_id = max(d['id'], _id)
return _id + 1
"""
class UserList(Resource):
filename = 'users.json'
... |
# <<BEGIN-copyright>>
# Copyright 2021, Lawrence Livermore National Security, LLC.
# See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
# <<END-copyright>>
"""
Container for all resonance parameters (resolved, unresolved and/or scattering radius)
"""
from pqu import PQU as PQUMod... |
# -*- coding: utf-8 -*-
'''
$Author: michael $
$Revision: 1561 $
$Date: 2020-10-12 15:32:07 +0200 (Mon, 12 Oct 2020) $
$Id: FritzLDIF.py 1561 2020-10-12 13:32:07Z michael $
'''
#
# needs python-ldap for ldif
#
from __future__ import print_function
import ldif, re
try:
from . import normalizePhoneNumber #@UnresolvedIm... |
<gh_stars>1-10
import copy
import math
import os
import random
from pathlib import Path
import numpy as np
import pandas as pd
from hyperopt import Trials, hp, fmin, STATUS_OK, STATUS_FAIL
from hyperopt import tpe
from . import support_utils as sup
from .cli_formatter import print_message, print_subsection
from .comm... |
import numpy as np
import torch
from sepsisSimDiabetes.State import State
feature_names = ["hr_state", "sysbp_state", "glucose_state",
"antibiotic_state", "vaso_state", "vent_state"]
# 'grade_norm' and 'pre' are relatively categorical/discrete
#unused_features = ['inp... |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ListProPricePlansRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): T... |
# -*- coding: utf-8 -*-
import copy
import logging
from pathlib import Path
import click
import matplotlib.pyplot as plt
import torch
from sklearn.manifold import Isomap
from torchvision import datasets, transforms
import torchdrift
from src.models.classifier import Classifier
from torchdrift.detectors.mmd import (Ex... |
import pandas as pd
import numpy as np
import os, sys
import keras
import matplotlib.pyplot as plt
from keras.applications import MobileNet
from keras.preprocessing import image
from keras.applications.mobilenet import preprocess_input
from keras.models import Model
from keras.optimizers import Adam
from keras.preproc... |
<reponame>anhlbt/faceidsys
import dlib_api
from image_utils import brightness, get_onedir, clahe_image, printProgressBar
from enum import Enum
from PIL import Image
import numpy as np
from os.path import join, basename, exists, dirname, realpath
from os import makedirs
import numpy as np
import shutil
import sys, os
im... |
<filename>gcloud/tests/template_base/models/base_template_manager/test_check_templates_subprocess_expired.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited,... |
<reponame>andia10240/cloudbase-init
# Copyright 2012 Cloudbase Solutions Srl
#
# 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
#
... |
<reponame>JeroenDM/acrobotics
import numpy as np
import acrobotics as ab
from numpy.testing import assert_almost_equal
NUM_RANDOM_TESTS = 10
def numeric_jacobian(fun, qi):
fi = fun(qi)
n_in, n_out = len(qi), len(fi)
J = np.zeros((n_out, n_in))
h = 1e-7
Ih = np.eye(n_in) * h
for col in range... |
<reponame>jpodeszwik/jira-burndown-report-generator
#!/usr/bin/env python3
import requests
import sys
from requests.auth import HTTPBasicAuth
from itertools import groupby
import dateutil.parser
from datetime import timedelta
api_root = sys.argv[1]
username = sys.argv[2]
password = sys.argv[3]
name = sys.argv[4]
start... |
"""
Builds a stacked autoencoder.
Author(s): <NAME> (<EMAIL>)
"""
import numpy as np
from keras.models import Sequential
from keras.optimizers import Adagrad, SGD, Adadelta, Adam
from keras.regularizers import l2
from keras.layers import Input, Dense, noise
from keras.models import Model
from keras import backend as ... |
<filename>zvdata/sedes.py
# -*- coding: utf-8 -*-
import inspect
import json
from enum import Enum
import dash_core_components as dcc
import dash_daq as daq
import dash_html_components as html
import pandas as pd
import simplejson
from dash.dependencies import State
from sqlalchemy.ext.declarative import DeclarativeMe... |
import numpy as np
import talib
import math
def get_extreme(array_high_price_result, array_low_price_result):
np_array_high_price_result = np.array(array_high_price_result[:-1])
np_array_low_price_result = np.array(array_low_price_result[:-1])
max_result = np_array_high_price_result.max()
min_result =... |
import os
import enum
import logging
import graphviz
import sd3.cfa.graph
from sd3.disasm.attributes import Attr as CpuAttr
class EdgeAttr(enum.Enum):
true_cond = 1
false_cond = 2
class NodeData:
def __init__(self, addr):
self._start_addr = addr
self._instructions = []
def get_name(... |
from icssploit.clients.s7_client import S7Client
from scapy.all import conf
import threading
from icssploit import (
exploits,
wordlists,
print_status,
print_error,
LockedIterator,
print_success,
print_table,
boolify,
multi,
validators
)
class Exploit(exploits.Exploit):
_... |
<reponame>dmyersturnbull/chembler<filename>tests/model/test_targets_real_data.py<gh_stars>0
from typing import Mapping
import pytest
from mandos.entry.api_singletons import Apis
from mandos.model.apis.chembl_support.chembl_target_graphs import (
ChemblTargetGraphFactory,
TargetEdgeReqs,
TargetNode,
Ta... |
<gh_stars>1-10
import pytest
from basin3d.core.models import AbsoluteCoordinate, AltitudeCoordinate, Coordinate, DepthCoordinate, \
GeographicCoordinate, MeasurementTimeseriesTVPObservation, MonitoringFeature, Observation, ObservedProperty, \
ObservedPropertyVariable, RelatedSamplingFeature, RepresentativeCoor... |
<reponame>SorchaYang/Scopy
# -*- coding: utf-8 -*-
#Created on Mon Jul 8 10:03:32 2019
#
#@Author: <NAME>, <NAME>
#@Institution: CBDD Group, Xiangya School of Pharmaceutical Science, CSU, China,
#@Homepage: http://www.scbdd.com
#@Mail: <EMAIL>; <EMAIL>
#@Blog: https://blog.moyule.me
from multiprocessing import Poo... |
<filename>examples/signac_HPC/project.py
# project.py
import signac
from flow import FlowProject
import os
from simtk import unit
from cg_openmm.cg_model.cgmodel import CGModel
from cg_openmm.parameters.reweight import get_temperature_list
from cg_openmm.simulation.rep_exch import *
from analyze_foldamers.ensembles.cl... |
import re
import sys
import math
import os.path
from time import time
import maya.OpenMaya as om
import maya.cmds as mc
import maya.OpenMayaAnim as omanim
import maya.OpenMayaMPx as OpenMayaMPx
import pymel.core.datatypes
import pyawd
from pyawd.core import *
from pyawd.anim import *
from pyawd.scene import *
from py... |
# Copyright 2022 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, ... |
"""Module with abstraction for databases and tables."""
import os
import pandas as pd
from glob import glob
from typing import List, Optional
from cgnal.core.typing import PathLike
from cgnal.core.utils.fs import create_dir_if_not_exists
from cgnal.core.data.layer import DatabaseABC, TableABC
from cgnal.core.logging.... |
import math
import json
class Slot:
def __init__(self, x, y, size, color=None):
self.x = x
self.y = y
self.size = size
self.color = color
def data(self):
return {'x': int(self.x),
'y': int(self.y),
'size': int(self.size),
... |
# The contents of this file are subject to the MonetDB Public License
# Version 1.1 (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.monetdb.org/Legal/MonetDBLicense
#
# Software distributed under the License is distributed on an "A... |
def findDecision(obj): #obj[0]: Passanger, obj[1]: Weather, obj[2]: Time, obj[3]: Coupon, obj[4]: Coupon_validity, obj[5]: Gender, obj[6]: Age, obj[7]: Maritalstatus, obj[8]: Children, obj[9]: Education, obj[10]: Occupation, obj[11]: Income, obj[12]: Bar, obj[13]: Coffeehouse, obj[14]: Restaurantlessthan20, obj[15]: Re... |
import abc
import logging
from typing import Callable, Optional, Type, TypeVar
import requests
from pydantic import Field
from pydantic.main import BaseModel
from nonbonded.library.config import settings
T = TypeVar("T", bound="BaseREST")
class CollectionMeta(BaseModel):
"""A data model which stores metadata a... |
<reponame>alex-parker/kmao
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
k-means aperture optimization utilities.
see example1.py file for use cases.
'''
import numpy as np
from scipy.signal import convolve2d
from scipy.optimize import fmin, minimize
from scipy.ndimage import shift
from scipy.stats import... |
"""
Testing of callbacks in non-Python input snippets.
"""
from pathlib import Path
import dash.testing.wait as wait
from .helpers import load_jl_app, load_r_app
HERE = Path(__file__).parent
def test_r_input_simple(dashr):
r_app = load_r_app((HERE.parent / "input" / "simple.R"), "text_input")
dashr.start_s... |
import dill
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from sklearn import metrics
def show_results(
predictions,
model_name,
show_plot=True,
save_plot=True,
save_folder="data/processed",
):
binary_classification_results = (
get_binary_classification_res... |
<reponame>philipforget/django-oauth-plus<gh_stars>0
# -*- coding: 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 model 'Nonce'
db.create_table(u'oauth_provider_... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
A module for searching for spectra in a remote archive.
A Simple Spectral Access (SSA) service allows a client to search for
spectra in an archive whose field of view overlaps with a given cone
on the sky. The service responds to a search query with ... |
import numpy as np
from datetime import datetime, timedelta # 记录outputs_time,记录循环用时
from typing import Optional, Tuple, cast
import hydra.utils
import numpy as np
import omegaconf
from omegaconf import dictconfig
import torch
import math
# matplotlib.use('Agg')
#%matplotlib inline
import torch
import omegaconf
from ... |
# coding:utf-8
__author__ = '4ikist'
import re
def retrieve_type(text):
found = re.findall(u"(\!{1,3})", text, re.IGNORECASE)
if found:
groups = found[0]
return len(groups)
return 1
def retrieve_notification_message(text):
found = re.findall(u".*\:\s(.*)", text)
if... |
import sys
sys.path.append('../')
from pathlib import Path
import scipy.signal
import scipy
import pickle
import os
import numpy as np
import h5py
import math
import torch
from torch.utils.data import Dataset, DataLoader
from utils import StandardScaler
from constants import INCLUDED_CHANNELS, FREQUENCY
from data.data_... |
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.keras.layers import Dense, Flatten, Conv2D, Conv2DTranspose, \
Reshape, BatchNormalization, LeakyReLU, Dropout
from tensorflow.keras import Model
LATENT_DIM = 100
NUM_EPOCHS = 50
BATCH_SIZE = 256
LEARNING_RATE = 1e-4
d_tra... |
import numpy as np
import logging
from collections import OrderedDict
import astropy.units as u
logging.basicConfig(format='%(asctime)s: %(message)s', level=logging.INFO)
class SphericalMesh(object):
def __init__(self, **kwargs):
"""
A spherical mesh is initialized with a coordinate grid in (pot,... |
<reponame>wuaipinglab/covSampler
'''
subsampling
'''
import os
import re
import time
import argparse
import pandas as pd
def get_target_ids(file, args, genome_path):
'''
get accession id of sequences in selected range (location, date and variants)
:param file: str, infos file path
:param args: argpa... |
import numpy as np
from shapely.geometry.multipolygon import MultiPolygon
from ocgis.util.helpers import make_poly
def shapely_grid(dim,rtup,ctup,target=None):
row_bounds = np.arange(rtup[0],rtup[1]+dim,dim)
min_row = row_bounds[0:-1]
max_row = row_bounds[1:]
row_bounds = np.hstack((min_row.reshap... |
from django.contrib.auth import login, authenticate, logout
from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.shortcuts import render, redirect
from the_things_I_buy.core.verify_key_word_valid import verify_... |
<reponame>learningequality/sushi-chef-openupresources
#!/usr/bin/env python
import os
import sys
sys.path.append(os.getcwd()) # Handle relative imports
#from utils import data_writer, path_builder # , downloader -- we no longer use downloader due to session issues
from le_utils.constants import licenses, exercises... |
# Copyright 2019 The Shaderc 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 applicable... |
<gh_stars>0
# File: intsights_connector.py
#
# Copyright (c) 2019-2022 IntSights Cyber Intelligence Ltd.
#
# This unpublished material is proprietary to IntSights.
# All rights reserved. The methods and
# techniques described herein are considered trade secrets
# and/or confidential. Reproduction or distribution, in wh... |
<filename>drymass/cli/config.py
import pathlib
from . import definitions
from . import parse_funcs
from .._version import version
#: DryMass configuration file name
FILE_CONFIG = "drymass.cfg"
class ConfigFile(object):
def __init__(self, path):
"""DryMass configuration file management
Manage co... |
from __future__ import print_function
import argparse
from cProfile import label
from dis import dis
import os
import random
from socket import MSG_DONTROUTE
from sklearn import cluster
import torch
import torch.nn.parallel
import torch.optim as optim
import torch.utils.data
from pointnet.dataset import LidarDataset, B... |
from unittest.mock import patch
from tacticalrmm.test import TacticalTestCase
from model_bakery import baker, seq
from itertools import cycle
from agents.models import Agent
from winupdate.models import WinUpdatePolicy
from .serializers import (
PolicyTableSerializer,
PolicySerializer,
PolicyTaskStatusSeri... |
from typing import Tuple, Dict
import torch.multiprocessing as mp
mp.set_start_method('spawn', True)
import sys, os
if os.getcwd() not in sys.path: sys.path.append(os.getcwd())
import copy
import datetime
import logging
import logging.config
from learning.logging_config import logging_config
import numpy as np
np.s... |
# coding: utf-8
"""
Cloudbreak API
Cloudbreak is a powerful left surf that breaks over a coral reef, a mile off southwest the island of Tavarua, Fiji. Cloudbreak is a cloud agnostic Hadoop as a Service API. Abstracts the provisioning and ease management and monitoring of on-demand clusters. SequenceIQ's Cloud... |
import warnings
import numpy as np
import pandas as pd
from scipy.signal import find_peaks, find_peaks_cwt, ricker
from tsfresh.feature_extraction.feature_calculators import set_property, _roll
from tsfresh.feature_extraction.settings import ComprehensiveFCParameters
from tsfresh.utilities.string_manipulation import ... |
<filename>calls/views/weirdness.py
import random
from flask import (
Blueprint,
current_app as app,
redirect,
request,
)
from calls import constants
from calls.models import (
db,
Submission,
Volunteer,
UserCodeConfig,
)
from calls.utils import (
get_gather_times,
parse_sip_add... |
<reponame>jdost/dd-trace-py
import contextlib
import os
import sys
import unittest
import ddtrace
from ..utils.tracer import DummyTracer
from ..utils.span import TestSpanContainer, TestSpan, NO_CHILDREN
class BaseTestCase(unittest.TestCase):
"""
BaseTestCase extends ``unittest.TestCase`` to provide some use... |
<reponame>PatBall1/DeepForestcast
from torchvision.transforms import ToTensor
from PIL import Image
# import rasterio
import numpy as np
import torch
import os.path
def to_Tensor(path, name):
"""
Load Tiff files as tensors
"""
t = Image.open(path + "/" + name)
t = ToTensor()(t)
t = t.squeeze(... |
import logging
import json
import os
from os.path import exists
import time
import shutil
__author__ = "<NAME>"
__copyright__ = "<NAME>"
__license__ = "MIT"
_logger = logging.getLogger(__name__)
generation_types = ['schemas', 'analyzers']
class FileUtility:
@staticmethod
def generate_json_file(database_name... |
<filename>angola_erp/rent_a_car/doctype/ficha_tecnica_da_viatura/ficha_tecnica_da_viatura.py
# -*- coding: utf-8 -*-
# Copyright (c) 2019, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe import throw
from f... |
from pytorch_segnet import *
import sys
import csv
def test(SegNet):
SegNet.load_state_dict(torch.load(WEIGHTS,map_location=torch.device('cpu')))
SegNet.eval()
paths = os.listdir(SAMPLES)
for path in paths:
image_src = cv.imread(SAMPLES + path)
image = cv.resize(imag... |
import time
import pytest
import numpy as np
import flare.gp_algebra
from flare import gp
from flare.env import AtomicEnvironment
from flare.struc import Structure
from flare.kernels.mc_simple import two_plus_three_body_mc, \
two_plus_three_body_mc_grad
from flare.kernels.mc_sephyps import two_plus_three_body_... |
<reponame>usegalaxy-no/usegalaxy<gh_stars>1-10
# -*- coding: utf-8 -*-
# Copyright: (c) 2016-2017, <NAME> <<EMAIL>>
# Copyright: (c) 2017, <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__me... |
<gh_stars>0
from ichnaea.geoip import GeoIPNull
from ichnaea.log import PingableStatsClient
from ichnaea.tests.base import (
_make_db,
_make_redis,
AppTestCase,
)
class TestHeartbeat(AppTestCase):
def test_ok(self):
app = self.app
res = app.get('/__heartbeat__', status=200)
se... |
<gh_stars>0
import glob
import os
import re
import pathlib
import PIL
# next line is to limit tensorflow verbose output
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
import numpy as np
from tensorflow.keras.models import load_model
CONST_MODEL_PATH = 'trained_models/tf2_model_cnn_transfer_learnin... |
"""
=========================================================
Classification statistics on the MUTAG, ENZYMES datasets.
=========================================================
An example plot of :class:`grakel.GraphKernel`
"""
from __future__ import print_function
print(__doc__)
import time
import matplotlib.pyplot... |
import py
from rpython.rlib import streamio
from rpython.rlib.streamio import StreamErrors
from pypy.interpreter.error import OperationError, oefmt
from pypy.interpreter.baseobjspace import ObjSpace, W_Root, CannotHaveLock
from pypy.interpreter.typedef import TypeDef
from pypy.interpreter.gateway import interp2app
fr... |
<filename>test/test_producer_integration.py
import os
import time
import uuid
from six.moves import range
from kafka import (
SimpleProducer, KeyedProducer,
create_message, create_gzip_message, create_snappy_message,
RoundRobinPartitioner, HashedPartitioner
)
from kafka.codec import has_snappy
from kafka.... |
<reponame>awyrough/xsoccer
### Read from F9 files and construct Lineup models
import utils.xmls as xml_utils
import datetime
import os
import time
from teams.models import Team
from games.models import Game
from players.models import Player
from lineups.models import Lineup
from django.core.management.base import Bas... |
# Copyright 2012 Yelp
#
# 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
# ... |
import os
from unittest import TestCase
from bauh.gems.arch import aur
FILE_DIR = os.path.dirname(os.path.abspath(__file__))
class AURModuleTest(TestCase):
def test_map_srcinfo__only_one_pkgname(self):
expected_fields = {
'pkgbase': 'bauh',
'pkgname': 'bauh',
'pkgver... |
<filename>legacy/map_helper.py
import struct
#DEBUG VARS
map_name = 'ca20.map.auto'
OBJECT_IND = 0
PRIM_IND = 1
VB_INDEX = 0
VERTS_ADDED = 6
VERT_LEN = 0xC0
ORIG_IB_LEN = 0x159C8
NEW_IB_LEN = 0x159DA
IB_DIF = NEW_IB_LEN - ORIG_IB_LEN
INDEXES_ADDED = IB_DIF // 2
def main():
with open('%s' % map_name, 'rb+') as... |
<gh_stars>1-10
from django.db import models
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from multiselectfield import MultiSelectField
from django_countries.fields import CountryField
from apps.profiles.models import UserType, UserCreatedGro... |
<reponame>hmabubakar313/admin_panel_theme
XXXXXXXXXXX
XXXXXXXXXXXXXXXX
XXXXXXX
XXXXXXXXXXX
XXXXXXXXXX
XXXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXX... |
import pygame,sys,math
# Color constants
WHITE = 255, 255, 255
BLACK = 0, 0, 0
LIGHT_BLUE = 25, 120, 250
RED = 255, 0, 0
GREEN = 0, 255, 0
rows, cols = 50, 50
tile_size = 12
window_width, window_height = cols*tile_size, rows*tile_size
pygame.init()
win = pygame.display.set_mode((window_width, window_height))
clock =... |
<reponame>giarve/lithops<filename>lithops/serverless/backends/gcp_functions/gcp_functions.py
#
# Copyright Cloudlab URV 2020
#
# 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... |
<gh_stars>0
import sys
import os
import time
import subprocess
from functools import partial
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtCore import pyqtSlot, QThread
from PyQt5.QtCore import Qt
from tools.android.ui.ui_main_connect_adb import Ui_MainWindow
from tools.android.adbWorker import WorkerCheckAdb
from ... |
<gh_stars>1-10
#!/usr/bin/env python
#coding:utf-8
#realtime time log
import time
import redis
import json
import urllib2
import re
import subprocess
rc = redis.Redis(host='192.168.10.4',port=6379,password='<PASSWORD>')
regex = re.compile(r'\\(?![/u"])')
def pat(text):
sub="/"
sub1="ggWeb"
sub2="home"
s... |
# 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 law or agreed to in writing,... |
<reponame>zezip/StackOverflowTagRecommender<gh_stars>0
from pathlib import Path
import pandas as pd
import os
from os import listdir
from get_split import get_split
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.svm import SVC, Linear... |
<filename>Assignment 4/Knapsack/template_knapsack.py
#! /usr/bin/env python3
'''NAMES OF THE AUTHOR(S): <NAME> <<EMAIL>>, <NAME> <<EMAIL>>'''
from search import *
import re
import sys
import os
import copy
import heapq
import time
class Knapsack(Problem):
def __init__(self,initFile):
try:
fil... |
'''
Etant donnée une liste d'accords, les trie par ordre de concordance, consonance, tension et concordance totale,
en affichant en dessous les valeurs. Prend en entrée dans le fichier paramètre deux listes de même taille : partiels,
qui contient l'emplacement des partiels (éventuellement inharmoniques), et amplitude... |
<reponame>M2rsho/PyBot-v5
"""
Black Jack Command
~~~~~~~~~~~~~~~~~
Bruh moment
:copyright: (c) 2021-2021 M2rsho
:license: MIT, see LICENSE for more details.
"""
from discord.ext import commands
import discord
from discord.ext.commands.core import is_owner
import support
from discord.ext.commands import cooldown, Buc... |
import pytest
from flask import url_for
from wtforms.validators import ValidationError
from registry.donor.models import DonorsOverview
from registry.utils import NumericValidator
from .helpers import FakeForm, login
class TestNumericValidator:
def test_length_validation(self):
validator = NumericValida... |
from .. import models
import aiohttp
import asyncio
from django.conf import settings
from django.urls import reverse_lazy
from urllib.parse import urlparse
import uuid
import base64
from django.contrib.auth.models import User
class MixinContext(object):
def get_context_data(self, **kwargs):
c... |
<filename>test_CCAI.py<gh_stars>0
from comet_ml import Experiment
import argparse
import os
import os.path as osp
import pprint
import random
import warnings
from pathlib import Path
import numpy as np
import yaml
import torch
from torch import nn
from advent.model.deeplabv2 import get_deeplab_v2
from te... |
<filename>app/server/server/settings.py
"""
Django settings for server project.
Generated by 'django-admin startproject' using Django 3.2.5.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com... |
<filename>tgap_ng/edge_simplify/visvalingham_whyatt.py
from .. import pqdict
from math import fabs
from operator import itemgetter
from simplegeom.geometry import LineString
from .ontriangle import on_triangle, orient2d
def area(p0, p1, p2):
"""Calculate the area of the triangle formed by three points"""
de... |
<reponame>cariad/edition
from html.parser import HTMLParser
from io import StringIO
from logging import getLogger
from sys import stdout
from typing import IO, Callable, Dict, List, Optional, Tuple
from edition.html import get_css
from edition.metadata import Metadata
TAttribute = Tuple[str, Optional[str]]
class Ed... |
from tests.utils import YAML_EXTENSION
def test_skips_execution_without_arguments(pytester):
arguments = {
"test_class_loading": """
---
- test_module: tests.base_tests.simple_nuts_annotation
test_class: TestKeyValue
"""
}
pytester.makefile(YAML_EXTENSION, **arguments)
result = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.