text string | size int64 | token_count int64 |
|---|---|---|
# -*- coding: utf-8 -*-
#
# rtk.dao.RTKMatrix.py is part of The RTK Project
#
# All rights reserved.
# Copyright 2007 - 2017 Andrew Rowland andrew.rowland <AT> reliaqual <DOT> com
"""
===============================================================================
The RTKMatrix Table
==============================... | 5,234 | 1,582 |
import os
import shutil
def pull_default(folder=None):
cwd = os.getcwd()
if None == folder:
folder = cwd
for path in os.listdir(folder):
project_path = os.path.join(folder, path)
if os.path.isdir(project_path):
dot_git_folder = os.path.join(project_path, '.git')
... | 614 | 205 |
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^pyogp_webbot/', include('pyogp_webbot.foo.urls')),
# Uncomment the admin/doc line below and add 'django.contrib... | 815 | 311 |
''' code emitters '''
import out, enums as e
class s:
''' state '''
# long_len
# arg_regs, arg_regs_n
# regs
# stack_regs
pass
def init (long_len):
s.long_len = long_len
if long_len == 8:
s.arg_regs = ['%rdi', '%rsi', '%rdx', '%rcx', 'r8', 'r9']
s.arg_regs_n = len(s.arg... | 9,300 | 3,616 |
"""
GravMag: Classic 3D Euler deconvolution of magnetic data using an
expanding window
"""
from fatiando import logger, mesher, gridder, utils, gravmag
from fatiando.vis import mpl, myv
log = logger.get()
log.info(logger.header())
# Make a model
bounds = [-5000, 5000, -5000, 5000, 0, 5000]
model = [
mesher.Prism(... | 2,291 | 961 |
# Generated by Django 2.1.5 on 2019-01-22 09:39
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('popmemes', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_name='Popmemes',
new_name='PopImage',
),
... | 324 | 117 |
# Copyright 2019 The AmpliGraph Authors. All Rights Reserved.
#
# This file is Licensed under the Apache License, Version 2.0.
# A copy of the Licence is available in LICENCE, or at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
from ampligraph.datasets import load_wn18, load_fb15k, load_fb15k_237, load_yago3_10... | 6,434 | 2,891 |
from io import StringIO
from math import atan2, ceil
from typing import Literal, Union, overload
from common import PI, Real, TWOPI, deg, real, reduce_angle
from functions import qbezeir_svg_given_middle
from .circle import CircleBase, FixedCircle
from .point import PointBase, Polar
def check_arc(value: float, /):
... | 5,959 | 2,035 |
import os
COL_SEPARATOR = "\t"
MULTI_SEPARATOR = "$"
for neFile in os.listdir('data/'):
neFile = 'data/' + neFile
out_filename = neFile.replace('.tsv', "_mh.tsv")
if os.path.isfile(out_filename) or '_mh' in neFile or os.path.isdir(neFile):
continue
out_f = open(out_filename, "w")
with open(n... | 1,155 | 417 |
import os
import sys
from pprint import pprint
import click
from pykechain.utils import temp_chdir
from kecpkg.commands.utils import CONTEXT_SETTINGS
from kecpkg.gpg import get_gpg, list_keys, hash_of_file
from kecpkg.settings import SETTINGS_FILENAME, GNUPG_KECPKG_HOME, load_settings, DEFAULT_SETTINGS, ARTIFACTS_FIL... | 13,451 | 4,193 |
import argparse
import random
SIGNATURE = b'\xDE\xAD\xBE\xEF\xC0\xFF\xEE\xAA\xBB\xCC\xDD\xEE\xFF\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA'
# Generate data in chunks of 1024 bytes.
def generate_random_data(size):
data = bytearray()
while len(data) <= size:
data += random.randbytes(1024)
return ... | 954 | 392 |
import datetime
import io
import os
import re
import subprocess
import warnings
from collections import namedtuple
from decimal import Decimal
from pathlib import Path
import six
from PyPDF2 import PdfFileMerger
from reportlab.pdfgen import canvas
class DoctorUnicodeDecodeError(UnicodeDecodeError):
def __init__(... | 10,563 | 3,197 |
import gym
import numpy as np
import os
import random
import matplotlib.pyplot as plt
from atariari.benchmark.wrapper import AtariARIWrapper
# YarsRevenge
#
env_name = "DemonAttackDeterministic-v4"
def print_labels(env_info):
# extract raw features
labels = env_info["labels"]
print(labels)
env = Atar... | 906 | 340 |
# encoding: utf-8
from datetime import datetime
class Table(object):
def config_db(self,pkg):
tbl=pkg.table('question', pkey='id', name_long='!![en]Question', name_plural='!![en]Questions',caption_field='question')
self.sysFields(tbl, draftField=True)
tbl.column('question',name_long='!![en]... | 2,711 | 807 |
import json
import requests
from os import path
class OxfordAPI:
def __init__(self, app_id, app_key, cache_path):
self.app_id = app_id
self.app_key = app_key
self.cache_path = cache_path
def __parse_sense(self, word, sense):
for definition in sense.get('definitions', list()):... | 3,087 | 888 |
class Node:
def __init__(self, data=None):
self.data = data
self.next = None
class LinkedListIndexError(IndexError):
pass
class LinkedList:
def __init__(self):
self.head = Node()
def _get_last_node(self):
pointer = self.head
while pointer.next is not None:
... | 2,568 | 799 |
# -*- coding: utf-8 -*-
'''
Copyright (c) 2016, Virginia Tech
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of condi... | 5,442 | 1,500 |
from html.parser import HTMLParser
class CustomHTMLValidater(HTMLParser):
__SINGLE_TAGS = [
'area','base','br','col','embed',
'hr','img','input','keygen','link',
'meta','param','source','track','wbr'
]
def __init__(self):
HTMLParser.__init__(self)
self.reset(True)
... | 2,768 | 732 |
import logging
import os.path
import bolt
import bolt.about
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
_src_dir = os.path.join(PROJECT_ROOT, 'bolt')
_test_dir = os.path.join(PROJECT_ROOT, 'test')
_output_dir = os.path.join(PROJECT_ROOT, 'output')
_coverage_dir = os.path.join(_output_dir, 'coverage')
... | 1,841 | 656 |
from enum import Enum
from pyxedit.xedit.attribute import XEditAttribute
from pyxedit.xedit.generic import XEditGenericObject
class HeadPartTypes(Enum):
Misc = 'Misc'
Face = 'Face'
Eyes = 'Eyes'
Hair = 'Hair'
FacialHair = 'Facial Hair'
Scar = 'Scar'
Eyebrows = 'Eyebrows'
class XEditHead... | 1,120 | 389 |
#!/usr/bin/env python3
"""
Author : Me <me@foo.com>
Date : today
Purpose: Rock the Casbah
"""
import argparse
import io
import os
import sys
# --------------------------------------------------
def get_args():
"""Get command-line arguments"""
parser = argparse.ArgumentParser(
description='Rock the... | 1,309 | 369 |
#!/usr/bin/env python
import os
import sys
import unittest
from collections import namedtuple
sys.path = [ os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')) ] + sys.path
from pluckit import pluck
class CornerCasesTest(unittest.TestCase):
def test_null_handle(self):
data = [1, 2, 3]
... | 1,040 | 364 |
from albumentations.core.transforms_interface import ImageOnlyTransform
import albumentations.augmentations.functional as F
import random
class CrossDrop(ImageOnlyTransform):
def __init__(self, max_h_cut=0.2, max_w_cut=0.2, fill_value=0, always_apply=False, p=0.5):
super(CrossDrop, self).__init__(always_a... | 1,520 | 539 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import functools
import six
from django.utils.translation import ugettext_lazy as _
from django.template import TemplateDoesNotExist
from django.template.loader import select_template
from cms.plugin_base import CMSPluginBase, CMSPluginBaseMetaclass
from ... | 9,497 | 2,947 |
import pytest
from julia.core import JuliaOptions
# fmt: off
@pytest.mark.parametrize("kwargs, args", [
({}, []),
(dict(compiled_modules=None), []),
(dict(compiled_modules=False), ["--compiled-modules", "no"]),
(dict(compiled_modules="no"), ["--compiled-modules", "no"]),
(dict(depwarn="error"), [... | 1,232 | 442 |
import os
import pathlib
import typing
import pytest
from ext_argparse.parameter import Parameter
from ext_argparse.param_enum import ParameterEnum
from enum import Enum
class RoofMaterial(Enum):
SLATE = 0
METAL = 1
CONCRETE = 2
COMPOSITE = 3
SOLAR = 4
CLAY = 5
SYNTHETIC_BARREL = 6
S... | 1,578 | 584 |
#! /usr/local/bin/Python3.5
import urllib.request
with open("images.csv", 'r') as csv:
i = 0
for line in csv:
line = line.split(',')
if line[1] != '' and line[1] != "\n":
urllib.request.urlretrieve(line[1].encode('utf-8'), ("img_" + str(i) + ".jpg").encode('utf-8'))
pri... | 389 | 143 |
'''
API-related functions in one spot for convenience
Created by NGnius 2019-06-15
'''
from flask import jsonify, request
from threading import Semaphore, RLock
def get_param(param, silent=False):
if request.method == 'GET':
return request.args.get(param)
else:
try:
return request... | 1,031 | 312 |
"""
productporter
~~~~~~~~~~~~~~~~~~~~
helper for uwsgi
:copyright: (c) 2014 by the ProductPorter Team.
:license: BSD, see LICENSE for more details.
"""
from productporter.app import create_app
from productporter.configs.production import ProductionConfig
app = create_app(config=ProductionConfig(... | 323 | 101 |
# BSD 3-Clause License
#
# Copyright (c) 2017 xxxx
# All rights reserved.
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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 th... | 3,968 | 1,543 |
from setuptools import setup, find_packages
__version__ = '1.0.0'
__author__ = 'Takumi Sueda'
__author_email__ = 'puhitaku@gmail.com'
__license__ = 'MIT License'
__classifiers__ = (
'Development Status :: 4 - Beta',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Progra... | 1,012 | 359 |
# Como trabalhar com paths
from os import path
import time
def dadosArquivo():
# Verificar se o arquivo existe
arquivoExiste = path.exists("./03.Trabalhando_com_Arquivos/NovoArquivo.txt")
# Verificar se é diretório
ehDiretorio = path.isdir("./03.Trabalhando_com_Arquivos/NovoArquivo.txt")
# Verifi... | 962 | 389 |
#!/usr/bin/env python3
import os
import colorsys
import cv2
import numpy as np
from scipy.stats import multivariate_normal
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
class ColorPredicate:
def __init__(self, name, images_path, n_max=10):
self.name = name
self._t... | 16,303 | 4,957 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-05-25 15:41
from __future__ import unicode_literals
import app.utils
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('projects', '0001_init... | 2,127 | 543 |
"""
module: basic_train.py - Model fitting methods
docs : https://docs.fast.ai/train.html
"""
import pytest, fastai
from fastai.vision import *
from utils.fakes import *
from utils.text import *
from utils.mem import *
from fastai.utils.mem import *
from math import isclose
torch_preload_mem()
@pytest.fixture(scope... | 4,456 | 1,552 |
# return.none.py
def func():
pass
func() # the return of this call won't be collected. It's lost.
a = func() # the return of this one instead is collected into `a`
print(a) # prints: None
| 196 | 66 |
# -*- coding: utf-8 -*-
__author__ = """Tom Smith"""
__email__ = 'tom@takeontom.com'
__version__ = '0.2.0'
from pyperi.pyperi import Peri # noqa
from pyperi.pyperi import PyPeriConnectionError # noqa
| 204 | 87 |
import numpy as np
import scipy.sparse as sparse
from scipy.integrate import ode
from scipy.interpolate import interp1d
import time
import control
import control.matlab
import numpy.random
import pandas as pd
from ltisim import LinearStateSpaceSystem
from pendulum_model import *
from pyMPC.mpc import MPCController
# R... | 13,454 | 5,996 |
from flask import Blueprint, current_app
main = Blueprint('main', __name__)
@main.route('/')
def home():
return current_app.send_static_file('index.html')
| 163 | 55 |
from enum import Enum
from .dev import Dev
class Collab(Enum):
UNKNOWN = -1
NONE = 0
RAGNAROK_ONLINE = 1
TAIKO_NO_TATSUJIN = 2
EMIL_CHRONICLE_ONLINE = 3
GUNMA_NO_YABOU = 5
CRYSTAL_DEFENDER = 6
FAMITSU = 7
PRINCESS_PUNT_SWEET = 8
ANDROID = 9
SHINRABANSHO_CHOCO = 10
CAPYBA... | 2,221 | 1,233 |
import pandas as pd
from matplotlib.colors import LinearSegmentedColormap
# Dataset
data = pd.read_csv("./hr.csv")
entries = len(data)
bins = 10
# Data analysis
analysis = {
"bins": 10,
"balance_threshold": 0.1
}
# Plot labels
labels = ["satisfaction_level",
"average_montly_hours",
"last_... | 4,923 | 1,645 |
# Author: Vishal Gaur
# Created: 17-01-2021 20:31:34
# function to find GCD using Basic Euclidean Algorithm
def gcdEuclid(a, b):
if a == 0:
return b
else:
return gcdEuclid(b % a, a)
# Driver Code to test above function
a = 14
b = 35
g = gcdEuclid(a, b)
print("GCD of", a, "&", b, "is: ", ... | 397 | 199 |
# modules/InterpolationLayer.py
from torch.nn import Module
from functions.MotionSymmetryLayer import MotionSymmetryLayer
class MotionSymmetryModule(Module):
def __init__(self):
super(MotionSymmetryModule, self).__init__()
self.f = MotionSymmetryLayer()
def forward(self, input1, input2):
... | 437 | 135 |
import numpy
from steer2HarmMtx import steer2HarmMtx
def steer(*args):
''' Steer BASIS to the specfied ANGLE.
function res = steer(basis,angle,harmonics,steermtx)
BASIS should be a matrix whose columns are vectorized rotated copies
of a steerable function, or the responses of a set of s... | 2,997 | 1,026 |
import aiohttp
import asyncio
import os
import zipfile
from pydest.api import API
from pydest.manifest import Manifest
class Pydest:
def __init__(self, api_key, loop=None, client_id=None, client_secret=None):
"""Base class for Pydest
Args:
api_key (str):
Bungie.net A... | 2,057 | 539 |
# Generated by Django 3.2.1 on 2021-05-06 22:30
import django.contrib.gis.db.models.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("core", "0119_populate_source_location_point"),
]
operations = [
migrations.AlterField(
model_... | 784 | 251 |
#!/usr/bin/python
# -*- coding: utf8 -*-
import os
import re
import textwrap
import requests
import unicodedata
from datetime import datetime, timedelta
from flask import Flask, g, request, render_template, abort, make_response
from flask_babel import Babel, gettext
from jinja2 import evalcontextfilter, Markup
app = ... | 29,856 | 10,390 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('group', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('commun... | 2,891 | 765 |
#!/usr/bin/env python
import argparse
import fishact
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='Validate data files.')
parser.add_argument('activity_fname', metavar='activity_file', type=str,
help='Name of activity file.')
parser.add_argument... | 928 | 251 |
#!/usr/bin/env python3
from sys import stdout,stderr,exit
from optparse import OptionParser
from newick_parser import parse_tree_iterator, Branch
from tree_span import calculateSpan
from copy import deepcopy
def rescale_absolute(tree, max_length):
span = calculateSpan(tree)
s = max_length/float(span)
retu... | 1,682 | 523 |
from stable_baselines3 import PPO
import os
from setup_gym_env import SnakeEnv
import time
#models_dir = "./models/1644408901/" + "40000"
#models_dir = "./models/1644462865/" + "120000"
#models_dir = "./models/1644466638/" + "100000"
models_dir = "./models/1644485414/" + "100000"
env = SnakeEnv()
env.reset()
model ... | 743 | 302 |
#!/usr/bin/env python3
import yoda, sys
import h5py
import numpy as np
def chunkIt(seq, num):
avg = len(seq) / float(num)
out = []
last = 0.0
while last < len(seq):
out.append(seq[int(last):int(last + avg)])
last += avg
# Fix size, sometimes there is spillover
# TODO: replac... | 13,105 | 5,170 |
import zipfile
import os
import glob
import sys
# Actual directory that we could find somewhere
class Folder:
def __init__(self, path):
self.path = path
print("Current working folder is: " + self.path)
self.checkForZippedFile()
self.checkForDirectories()
def checkForZip... | 1,703 | 463 |
from functools import partial
from airflow.operators.python_operator import ShortCircuitOperator
def make_control_flow(is_dummy_operator_short_circuit, dag):
control_flow = ShortCircuitOperator(
task_id="dummy-control-flow",
dag=dag,
provide_context=True,
python_callable=partial(e... | 634 | 200 |
# Imports
import pandas as pd
import pickle
from keras.models import load_model
from preprocess import preprocess
from preprocess import prep_text
#Logging
import logging
logging.getLogger().setLevel(logging.INFO)
logging.info('Loading comments to classify...')
# Enter comment to be classified below
comment_to_class... | 1,974 | 614 |
class Solution(object):
def getHint(self, secret, guess):
"""
:type secret: str
:type guess: str
:rtype: str
"""
dic = {}
countA = 0
setA = set()
for i in range(len(secret)):
if secret[i] == guess[i]:
countA += 1
... | 797 | 245 |
from .efficientdet import EfficientDet
def get_efficientdet(num_layers, cfg):
model = EfficientDet(intermediate_channels=cfg.MODEL.INTERMEDIATE_CHANNEL)
return model
| 176 | 59 |
import json
import logging
import boto3
from box import Box
from crhelper import CfnResource
from schema import Optional
import codesmith.common.naming as naming
from codesmith.common.cfn import resource_properties
from codesmith.common.schema import encoded_bool, non_empty_string, tolerant_schema
from codesmith.comm... | 1,566 | 484 |
n = int(input('Digite um número: '))
print('Seu número é {}. O antecessor é {} e seu sucessor é {}'.format(n, n - 1, n + 1))
| 125 | 52 |
# Given two binary trees, check if the first tree is subtree of the second one.
# A subtree of a tree T is a tree S consisting of a node in T and all of its descendants in T.
# The subtree corresponding to the root node is the entire tree; the subtree corresponding to any other node is called a proper subtree.
class... | 1,506 | 632 |
from typing import List, Optional
from papi_sdk.models.search.base_affiliate_response import (
BaseAffiliateSearchData,
BaseAffiliateSearchResponse,
BaseHotel,
BaseRate,
)
from papi_sdk.models.search.base_request import BaseAffiliateRequest
class AffiliateHotelPageRequest(BaseAffiliateRequest):
i... | 619 | 201 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019-01-02 16:44
# @Author : zhangzhen
# @Site :
# @File : torch_neural_networks.py
# @Software: PyCharm
import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init_... | 2,093 | 855 |
from bottle import route, run, template
gitdict = {'po2go':{'https://github.com/cadamswaite/po2go.git:master':'https://github.com/cadamswaite/po2go.git:gh-pages'}}
# Handle http requests to the root address
@route('/')
def index():
return 'Go away.'
@route('/build/<name>')
def greet(name):
if name in gitdict:
r... | 422 | 160 |
"""
Leonard always DRIVES Sheldon (this module is the __main__ driver for Sheldon)
"""
import argparse
import sys
import os
try:
from cooper import Sheldon
except:
from .cooper import Sheldon
# Extensions for python source files
EXTENSIONS = [".py", ".mpy"]
def parse_commandline():
parser = argparse.Argu... | 2,577 | 782 |
# -*- coding: utf-8 -*-
def test_001(settings, finder):
result = finder.change_extension("foo.scss", 'css')
assert result == "foo.css"
def test_002(settings, finder):
result = finder.change_extension("foo.backup.scss", 'css')
assert result == "foo.backup.css"
def test_003(settings, finder):
re... | 705 | 266 |
"""Basic tests for the CherryPy core: request handling."""
from cherrypy.test import test
test.prefer_parent_path()
import cherrypy
from cherrypy import _cptools, tools
from cherrypy.lib import http, static
import types
import os
localDir = os.path.dirname(__file__)
log_file = os.path.join(localDir, "test.log")
log_... | 40,749 | 12,406 |
# Solution 1
def readInputFile(filename):
f = open(filename, "r")
inputString = f.read()
f.close()
return inputString
input = readInputFile("input.txt").strip()
print(input)
lowest = input.split("-")[0]
highest = input.split("-")[1]
current = int(input.split("-")[0])
print(lowest)
print(highest)
def checkNever... | 1,036 | 467 |
#Transactions classes.
from e2e.Classes.Transactions.Transaction import Transaction
from e2e.Classes.Transactions.Transactions import Transactions
#TestError Exception.
from e2e.Tests.Errors import TestError
#RPC class.
from e2e.Meros.RPC import RPC
#Sleep standard function.
from time import sleep
#Verify a Transac... | 763 | 246 |
import pygame
from graphics.component import Component
class GameComponent(Component):
def __init__(self) -> None:
super().__init__()
| 149 | 40 |
import json
import os.path
import logging
import csv
from random import randint
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def get_quote(file):
if os.path.exists(file):
with open(file) as csvfile:
quotes = list(csv.reader(csvfile, delimiter=';'))
max_quotes = len(quo... | 954 | 304 |
from pathlib import Path
import cv2
import json
import math
import numpy as np
from argparse import ArgumentParser
def distance(p1, p2):
return math.sqrt((p2[0] - p1[0])**2 + (p2[1] - p1[1])**2)
def order_points(points):
pts = {}
for x1, y1 in points:
count_x_larger = 0
count_x_smaller =... | 3,142 | 1,100 |
# ***** BEGIN GPL LICENSE BLOCK *****
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distribute... | 14,159 | 4,858 |
#!/usr/bin/env python3
#
# Proxy alerts generated by Prometheus Alertmanager turning them into
# nagios passive alert information.
#
# Copyright 2019-2020, PostgreSQL Infrastructure Team
# Author: Magnus Hagander
#
import argparse
import http.server
import json
import time
import sys
missed_alerts = 0
def send_nag... | 3,613 | 1,093 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# __init__.py
# @Author : wanhanwan (wanshuai_shufe@163.com)
# @Date : 2019/11/25 下午1:20:12
from .filter import llt_filter | 172 | 91 |
def get_n_params(model):
pp=0
for p in list(model.parameters()):
nn=1
for s in list(p.size()):
nn = nn*s
pp += nn
return pp
| 173 | 67 |
import socket
import sys
import os
import optparse
from threading import *
def createServer(ip, port):
# create a TCP socket
sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# bind the socket to the port
server_address = (ip, port)
print("starting up on {} port {}".format(*server_address))
sck.bind(ser... | 1,745 | 666 |
#!/usr/bin/python
# -*- coding: ascii -*-
"""
Byte utilities testing.
:date: 2021
:author: Christian Wiche
:contact: cwichel@gmail.com
:license: The MIT License (MIT)
"""
import unittest
from embutils.utils import bitmask, reverse_bits, reverse_bytes
# -->> Definitions <<------------------
# -->> Tes... | 1,502 | 527 |
# Generated by Django 2.0 on 2018-03-24 02:55
import datetime
import django.db.models.deletion
from django.db import migrations, models
import mptt.fields
class Migration(migrations.Migration):
dependencies = [("events", "0019_add_org_slug")]
operations = [
migrations.CreateModel(
nam... | 2,419 | 632 |
# -*- coding: utf-8 -*-
"""Ant_Algorithm.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1Zjt1SInhoaFEqSmsPjEfWQE7jhugAvZA
# **ANT ALGORITHM BY KELOMPOK 9**
1. Heri Khariono - 18081010002
2. Devan Cakra Mudra Wijaya - 18081010013
3. Ika Nur Habib... | 13,529 | 5,457 |
import numpy as np
from scipy.ndimage import maximum_filter
class AttrDict(dict):
__setattr__ = dict.__setitem__
__getattr__ = dict.__getitem__
def signal2noise(r_map):
""" Compute the signal-to-noise ratio of correlation plane.
w*h*c"""
r = r_map.copy()
max_r = maximum_filter(r_map, (5,5,1)... | 588 | 256 |
import os
import time
import argparse
from tqdm import tqdm
import torch
from torch import optim
from torch import nn
from fastNLP import BucketSampler
from fastNLP import logger
from fastNLP import DataSetIter
from fastNLP import Tester
from fastNLP import cache_results
from bjtunlp.models import BertParser
from b... | 8,584 | 2,853 |
import time
import torch
from torch.autograd import Variable
from torch.utils.data.sampler import SubsetRandomSampler
from archived.elasticache import redis_init
from archived.s3.get_object import get_object
from archived.old_model import LogisticRegression
from data_loader.libsvm_dataset import DenseDatas... | 7,978 | 2,439 |
from enum import Enum
class NeuronTypes(Enum):
"""
Enum class containing neuron types: excitatory and inhibitory.
"""
EX = "excitatory"
IN = "inhibitory"
| 177 | 62 |
from typing import List
from backend.common.cache_clearing import get_affected_queries
from backend.common.manipulators.manipulator_base import ManipulatorBase
from backend.common.models.cached_model import TAffectedReferences
from backend.common.models.team import Team
class TeamManipulator(ManipulatorBase[Team]):
... | 2,346 | 689 |
from django.conf import settings
INFUSIONSOFT_COMPANY = getattr(settings, 'INFUSIONSOFT_COMPANY_ID', None)
INFUSIONSOFT_API_KEY = getattr(settings, 'INFUSIONSOFT_API_KEY', None)
| 179 | 69 |
# MIT License
#
# Copyright (c) 2020 HENSOLDT
#
# 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, modify, merge, pub... | 3,680 | 1,231 |
from pilco.models.pilco import PILCO
import jax.numpy as jnp
import numpy as np
import objax
import os
import oct2py
import logging
oc = oct2py.Oct2Py(logger=oct2py.get_log())
oc.logger = oct2py.get_log("new_log")
oc.logger.setLevel(logging.INFO)
dir_path = os.path.dirname(os.path.realpath("__file__")) + "/tests/Matla... | 2,567 | 1,022 |
from flask import Blueprint, redirect, url_for
from server.utils.core_utils import logger
# Create Blueprint
main = Blueprint("main", __name__)
# redirect when you visit /
@main.route("/")
def index():
logger.info("Base redirect")
return redirect(url_for('keys'))
| 275 | 82 |
# Generated by Django 3.1.7 on 2021-03-07 06:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0002_auto_20210306_1136'),
]
operations = [
migrations.AddField(
model_name='group',
... | 528 | 188 |
from .odefunc import (ODEnet,
ODEfunc)
from .cnf import CNF
from .diffeq_layers import * | 111 | 37 |
import urllib, urllib2, json, time, os
username = "username" #CHANGE
password = "password" #CHANGE
replicaURL = "feature service url/FeatureServer/createReplica" #CHANGE
replicaLayers = [0] ... | 2,042 | 638 |
import re
import textwrap
import yaml
from osc_trino_acl_dsl.dsl2rules import dsl_to_rules
class Table(object):
def __init__(self, catalog: str, schema: str, table: str):
self.catalog: str = str(catalog)
self.schema: str = str(schema)
self.table: str = str(table)
class User(object):
... | 10,980 | 3,432 |
import os
from distutils.command.build import build
from django.core import management
from setuptools import find_packages, setup
try:
with open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
except:
long_description = ''
class CustomBuild... | 1,028 | 354 |
# Copyright 2018, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 2,181 | 745 |
#!/usr/bin/env python3
import logging.handlers
import sys
from sys import argv, modules
from os.path import join
from autonmap import cron_scheduler
from autonmap import launch_client
from autonmap import launch_server
from autonmap.server import server_config as sconfig
"""
This module allows autonmap to interact w... | 3,426 | 982 |
# import random
# from typing import List, Dict
import numpy as np
# import matplotlib.pyplot as plt
def get_info() -> dict:
"""
This controls your Battlesnake appearance and author permissions.
For customization options, see https://docs.battlesnake.com/references/personalization
TIP: If you open you... | 6,166 | 2,352 |
# pdf.244
| 11 | 10 |
import os
import sys
from dataclasses import dataclass, field
from typing import List, Set, Optional
from nuclear.builder.rule import PrimaryOptionRule, ParameterRule, FlagRule, CliRule, SubcommandRule, \
PositionalArgumentRule, ManyArgumentsRule, DictionaryRule, ValueRule
from nuclear.parser.context import RunCon... | 11,836 | 3,714 |
#The MIT License (MIT)
#
#Copyright (c) 2015 Geoffroy Givry
#
#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... | 1,997 | 735 |
"""
`main` is the top level module where AppEngine gets access
to your Flask application.
"""
from app import create_app
from config import config
from os import environ
if environ['SERVER_SOFTWARE'].startswith('Development'):
app_config = config['development']
else:
app_config = config['production']
app ... | 464 | 131 |