text string | size int64 | token_count int64 |
|---|---|---|
import unittest
from app.models import User,Post,Comments
from app import db
class PostTest(unittest.TestCase):
def setUp(self):
"""
Set up method that will run before every Test
"""
self.post= Post(category='Product', content='Yes we can!')
self.user_Derrick = User(userna... | 1,085 | 336 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2017 Alex Forencich
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... | 4,335 | 1,335 |
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
ret = NodeLis... | 2,650 | 991 |
import SessionState
import base64
import streamlit as st
import pyperclip
# The input stores the string that is in text_area
# The output stores the conversion with the input
# This storage is needed because textarea comes before the button
session_state = SessionState.get(input='', output='', key=0)
# Function use... | 3,313 | 1,033 |
#!_PYTHONLOC
#
# (C) COPYRIGHT 2020-2021 Ahasuerus
# ALL RIGHTS RESERVED
#
# The copyright notice above does not evidence any actual or
# intended publication of such source code.
#
# Version: $Revision: 571 $
# Date: $Date: 2020-11-19 15:53:08 -0500 (Thu, 19 Nov 2020) $
from isfdb impor... | 3,474 | 1,085 |
import os
import yaml
from extended_uva_judge import errors
def get_problem_directory(app_config):
"""Gets the directory containing the problem configs.
:return: The path to the problem configs.
:rtype: str
"""
problem_directory = app_config['problem_directory']
if not problem_directory:
... | 1,523 | 434 |
"""
The following classes are defined:
L2NormPoolingNeuron
L2NormPoolingLayer
"""
from math import sqrt
from ..utils.validate import *
from ..utils.flatten import *
class L2NormPoolingNeuron:
"""
Construct a new l2norm pooling neuron. The output takes on the square root
of the sum of the squares ... | 2,729 | 783 |
from sisy import ui
if __name__ == "__main__":
ui()
| 57 | 23 |
#!/usr/bin/python
import rospy
import actionlib
import numpy as np
import argparse
import copy
from copy import deepcopy
import rosservice
import sys
import re
from std_msgs.msg import Float64MultiArray, Float32MultiArray
from control_msgs.msg import FollowJointTrajectoryAction, FollowJointTrajectoryGoal, JointTolera... | 18,885 | 8,057 |
"""Tests for certbot_dns_corenetworks.dns_corenetworks."""
import unittest
import mock
from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util
API_USER = "my_user"
API_PASSWORD ... | 2,936 | 967 |
# -*- encoding:utf-8 -*-
from kscore.session import get_session
import json
if __name__ == "__main__":
s = get_session()
client = s.create_client("monitor", "cn-beijing-6", use_ssl=True)
clientv2 = s.create_client("monitorv2", "cn-beijing-6", use_ssl=True)
'''
通用产品线,不包含容器(docker)
'''
#Lis... | 5,068 | 2,121 |
import os
import sys
import lightgbm as lgb
import numpy as np
from malware_rl.envs.utils.ember import PEFeatureExtractor
module_path = os.path.split(os.path.abspath(sys.modules[__name__].__file__))[0]
try:
model_path = os.path.join(module_path, "sorel.model")
except ValueError:
print("The model path provid... | 787 | 272 |
from hummingbot.client.config.config_var import ConfigVar
from hummingbot.client.config.config_methods import using_exchange
CENTRALIZED = True
EXAMPLE_PAIR = "ZRX-ETH"
DEFAULT_FEES = [0.25, 0.25]
KEYS = {
"bittrex_api_key":
ConfigVar(key="bittrex_api_key",
prompt="Enter your Bittrex ... | 732 | 247 |
import datetime
from github.GithubException import UnknownObjectException
from lib.base import BaseGithubAction
from lib.formatters import user_to_dict
__all__ = [
'ListMembersAction'
]
class ListMembersAction(BaseGithubAction):
def run(self, user, base_url, filter=None, role=None, limit=20):
kwarg... | 1,142 | 312 |
import numpy as np
class RegularizeOrthogonal(object):
"""
Orthogonal
"""
def __init__(self, coeff_lambda=0.0):
self.coeff_lambda = coeff_lambda
def cost(self, layers):
c = 0.0
for layer in layers:
wt = layer.w.transpose()
for j in range(layer.outp... | 1,405 | 483 |
import sys, bisect
from collections import defaultdict
from itertools import islice, izip
import numpy as np
from scipy.misc import logsumexp
from scipy.spatial import distance
import Levenshtein
PUNCTUATION = set(("'", '"', ',', '.', '!', '?', ';', ':', '-', '--', '(', ')',
'/', '_', '\\', '+', '<... | 7,839 | 2,760 |
import pandas as pd
file = r'8_calculate_spacer_len.csv'
with open(file, 'r') as f:
data = pd.read_csv(f)
for i in data.index:
box_motif = data.at[i, 'box motif']
if '[' in box_motif:
data.at[i, 'Upstream mismatch'] = data.at[i, 'Upstream mismatch'] + 0.5
data.at[i, 'Downstream... | 485 | 190 |
# Generated by Django 3.1.3 on 2020-11-30 21:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0005_auto_20201130_1450'),
]
operations = [
migrations.AddField(
model_name='order',
name='note',
... | 845 | 274 |
# answer = 5
# print("please guess number between 1 and 10: ")
# guess = int(input())
#
# if guess < answer:
# print("Please guess higher")
# elif guess > answer:
# print ( "Please guess lower")
# else:
# print("You got it first time")
answer = 5
print ("Please guess number between 1 and 10: ")
guess = in... | 647 | 202 |
import numpy as np
import pandas as pd
from pandas.util import testing as pdt
import pytest
from spandex import TableFrame
from spandex.io import db_to_df, df_to_db
def test_tableframe(loader):
table = loader.tables.sample.hf_bg
for cache in [False, True]:
tf = TableFrame(table, index_col='gid', cach... | 2,820 | 939 |
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class VserverNetworkInterface(object):
"""Implementation of the 'Vserver Network Interface.' model.
Specifies information about a logical network interface on a
NetApp Vserver. The interface's IP address is the mount point for a
specific data pr... | 2,471 | 621 |
"""
Client for the xmlrpc API of a wordpress blog.
.. note::
we ignore blog_id altogether, see
http://joseph.randomnetworks.com/archives/2008/06/10/\
blog-id-in-wordpress-and-xml-rpc-blog-apis/
thus, rely on identifying the appropriate blog by xmlrpc endpoint.
"""
import re
import xmlrpclib
import re... | 4,877 | 1,461 |
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.getcwd())))
from training_structures.MFM import train_MFM,test_MFM
from fusions.common_fusions import Concat
from unimodals.MVAE import LeNetEncoder,DeLeNet
from unimodals.common_models import MLP
from torch import nn
import torch
from objective_fu... | 1,370 | 587 |
import json
import os
from pygoogletranslation import Translator
JY_PATH = os.path.expanduser('~') + '/Movies/JianyingPro/videocut/'
def get_video_texts(filename):
"""
Get all text content from video
:param filename: file name
:return: all subtitle in list format
"""
f = open(filename, encod... | 2,327 | 830 |
#!/usr/bin/python3
# By Joseph Pitts
import sys
import random
import pygame
from pygame.locals import *
class Colours:
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
AQUA = (0, 255, 255)
GREY = (128, 128, 128)
NAVY = (0, 0, 128)
SILVER = (192, 192 ,192)
GREEN = (0, 128, 0)
... | 1,352 | 622 |
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def isPalindrome(self, head):
"""
:type head: ListNode
:rtype: bool
"""
if not head or not head.next:
... | 799 | 219 |
import torch
from torch.utils.data import Dataset
from PIL import Image
import os
import glob
class UCMayo4(Dataset):
"""Ulcerative Colitis dataset grouped according to Endoscopic Mayo scoring system"""
def __init__(self, root_dir, transform=None):
"""
root_dir (string): Path to parent folder... | 3,336 | 932 |
print("linear search")
si=int(input("\nEnter the size:"))
data=list()
for i in range(0,si):
n=int(input())
data.append(n)
cot=0
print("\nEnter the number you want to search:")
val=int(input())
for i in range(0,len(data)):
if(data[i]==val):
break;
else:
cot=co... | 698 | 275 |
try:
import unzip_requirements
except ImportError:
pass
import json
import os
import tarfile
import boto3
import tensorflow as tf
import numpy as np
import census_data
import logging
logger = logging.getLogger()
logger.setLevel(logging.WARNING)
FILE_DIR = '/tmp/'
BUCKET = os.environ['BUCKET']
import queue
im... | 6,240 | 1,809 |
from time import time
import rclpy
from rclpy.node import Node
import json
from std_msgs.msg import String, Float32, Int8, Int16
import sailbot.autonomous.p2p as p2p
from collections import deque
class ControlSystem(Node): # Gathers data from some nodes and distributes it to others
def __init__(self):
s... | 11,282 | 3,456 |
import os
# stop pwnlib from doing fancy things
os.environ["PWNLIB_NOTERM"] = "1"
from pwnlib.elf.corefile import Coredump, Mapping # noqa: E402
from pwnlib.elf.elf import ELF # noqa: E402
| 192 | 80 |
import django
from django.contrib.gis import admin
from .models import Address
# from https://djangosnippets.org/snippets/2593/
from django.contrib.admin.options import IncorrectLookupParameters
from django.contrib.admin.views.main import ChangeList
from django.core.paginator import InvalidPage, Paginator
from djan... | 4,609 | 1,273 |
from __future__ import annotations
from typing import Callable
import stk
def test_with_ids(
bond: stk.Bond,
get_id_map: Callable[[stk.Bond], dict[int, int]],
) -> None:
"""
Test :meth:`.Bond.with_ids`.
Parameters:
bond : :class:`.Bond`
The bond to test.
get_id_map... | 1,083 | 376 |
from dataclasses import dataclass
from app import crud
from app.schemas import UserCreate, SlackEventHook
from app.settings import REACTION_LIST, DAY_MAX_REACTION
# about reaction
REMOVED_REACTION = 'reaction_removed'
ADDED_REACTION = 'reaction_added'
APP_MENTION_REACTION = 'app_mention'
# about command
CREATE_USER... | 4,131 | 1,563 |
"""
Creates files for end-to-end tests
python util/build_tests.py
"""
# stdlib
import json
from dataclasses import asdict
# module
import avwx
def make_metar_test(station: str) -> dict:
"""
Builds METAR test file for station
"""
m = avwx.Metar(station)
m.update()
# Clear timestamp due to pa... | 2,010 | 679 |
from ex111.utilidadescev import moeda,dado | 42 | 17 |
# -*- coding: UTF-8 -*-
"""
Project Seele
@author : Rinka
@date : 2019/12/17
"""
from pyseele.workitem import Workitem
class ResourcingContext:
"""
Resourcing Context maintains all org.rinka.seele.server.resource service principals that guide RS
to handle the workitem.
"""
def __init__(self):
... | 830 | 259 |
import math
import fvh2, fvh
import supercircle
masterCircleSet=set()
circlecalled = 0
checkcirclescalled = 0
MINOFFSET=5
class Circle():
def __init__(self,x,y,r,lm=None, keep=True):
global circlecalled
circlecalled+=1
self.keep = keep
self.center=(x,y)
self.radius=r
self.checkStr... | 34,847 | 12,276 |
from calculations import TemperatureConverter
def testfreezing_fahrenheit():
converter = TemperatureConverter()
actual = converter.to_celsius(32.0)
expected = 0.0
assert abs(expected - actual) < 0.01
def test_freezing_celsius():
converter = TemperatureConverter()
actual = converter.to_fahr... | 392 | 131 |
from __future__ import division
import shutil
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
from matplotlib import cm
from matplotlib.colors import ListedColormap, LinearSegmentedColormap
from path import Path
from collections import OrderedDict
import datetime
epsilon = 1e-... | 12,359 | 5,159 |
from pathlib import Path
from fhir.resources.valueset import ValueSet as _ValueSet
from oops_fhir.utils import ValueSet
from oops_fhir.r4.code_system.v3_participation_type import v3ParticipationType
__all__ = ["ProvenanceActivityType"]
_resource = _ValueSet.parse_file(Path(__file__).with_suffix(".json"))
class... | 966 | 297 |
# SPDX-FileCopyrightText: 2021 Sandy Macdonald, David Glaude, James Carr
# SPDX-License-Identifier: MIT
"""
Example to display a rainbow animation on the 5x5 RGB Matrix Breakout.
Usage:
Rename this file code.py and pop it on your Raspberry Pico's
CIRCUITPY drive.
This example is for use on the Pico Explore... | 3,312 | 1,463 |
from TwoDimLookup_motor import TwoDimLookup_motor
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from scipy import interpolate
import numpy as np
### Input Parameters
# C_F = 27000 # Cornering stiffness front / Schräglaufsteifigkeit vorne [N/rad] - Is already for two wheels !
# C_R = ... | 10,405 | 4,089 |
env = ['prod', 'preprod', 'dev', 'staging', 'test', 'demo', 'int', 'uat', 'oat']
| 81 | 35 |
from micropython import const
ADXL345_ADDRESS = const(0x53) # I2C address of adxl345
ADXL345_DEVICE_ID = const(0xe5) #
ADXL345_DEVID = const(0x00) # Device ID
ADXL345_THESH_TAP = const(0x1d) # Tap threshold
ADXL345_OFSX = const(0x1e) ... | 5,936 | 2,173 |
import random
global_mutation = 0.002
encodings = {'0': '00000', '1': '00001', '2': '00010', '3': '00011', '4': '00100',
'5': '00101', 'A': '00110', 'B': '00111', 'C': '01000', 'D': '01001',
'E': '01010', 'F': '01011', 'G': '01100', 'H': '01101', 'I': '01110',
'J': '01111... | 3,885 | 1,646 |
# SPDX-License-Identifier: BSD-3-Clause
"""Command line interface."""
from argparse import ArgumentParser
from os import getcwd
from typing import List
from urllib.parse import urljoin, urlparse
import logging
from apetest.checker import Accept, PageChecker
from apetest.plugin import (
Plugin,
PluginCollecti... | 4,543 | 1,370 |
# ============================================================================
# FILE: func.py
# AUTHOR: Qiming Zhao <chemzqm@gmail.com>
# License: MIT license
# ============================================================================
# pylint: disable=E0401,C0411
import os
import subprocess
from denite import util... | 3,995 | 1,184 |
"""
Definition of forms.
"""
from django import forms
from django.forms import ModelForm, DateInput, TextInput
from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
from django.contrib.auth.models import User
from app.models import (
Player,
TeamSquad,
Team,
Stage,
Match,
E... | 11,835 | 3,630 |
# coding: -*- utf8 -*-
import os.path
def get_info():
if os.path.exists("map.txt"):
with open("map.txt") as m:
info = m.readline().strip().split(" ")
info[1] = int(info[1])
info[2] = int(info[2])
return info
return None
def update_map_file(r, c, o, m,... | 3,128 | 1,091 |
import logging
from .model.orm import (
Check,
Host,
Instance,
)
from .alerting import (
bootstrap_checks,
check_specs,
)
logger = logging.getLogger(__name__)
def merge_agent_info(session, host_info, instances_info):
"""Update the host, instance and database information with the
data re... | 21,718 | 4,767 |
#!/usr/bin/env python3
#===============================================================================
# Copyright (c) 2020 Brooke Wolford
# Lab of Dr. Cristen Willer and Dr. Mike Boehnke
# University of Michigan
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and asso... | 6,202 | 2,010 |
# encoding: UTF-8
from distutils.core import setup
from Cython.Build import cythonize
import numpy
setup(
name = 'crrCython',
ext_modules = cythonize("crrCython.pyx"),
include_dirs = [numpy.get_include()]
)
| 215 | 79 |
'''
Copyright (c) 2021. IIP Lab, Wuhan University
'''
import os
import numpy as np
import pandas as pd
import tensorflow as tf
import tensorflow.keras.backend as K
from tensorflow.keras import models
from tensorflow.keras import layers
from tensorflow.keras import callbacks
from data import *
from l... | 5,700 | 2,013 |
# coding: utf-8
"""
App Center Client
Microsoft Visual Studio App Center API # noqa: E501
OpenAPI spec version: preview
Contact: benedetto.abbenanti@gmail.com
Project Repository: https://github.com/b3nab/appcenter-sdks
"""
from __future__ import absolute_import
import unittest
import appcente... | 940 | 281 |
from ftplib import FTP
from datetime import *
from tkinter import *
def interval():
now = date.today()
yourDay = int(input("Vous êtes né quel jour ? "))
yourMonth = int(input("Vous êtes né quel mois ? "))
yourYear = int(input("Vous êtes né quelle année ? "))
birthday = date(yourYear, yourMonth, yourDay)
daysPas... | 1,720 | 624 |
import math
import rospy
import numpy as np
import random
from base_action import BaseAction
class SunledAction(BaseAction):
index_to_led_position = {}
def __init__(self,init_angle,device,param,trial_index):
print('sunled action __init__')
super(SunledAction,self).__init__(device,param)
... | 5,032 | 1,485 |
#!/usr/bin/python3
"""
This script is just to clean up Base64 if is has � present in the output.
Example:
$�G�r�o�U�P�P�O�L�i�C�Y�S�E�t�t�I�N�G�s� �=� �[�r�E�F�]�.�A�S�s�e�M�B�L�Y�.�G�E�t�T�y�p�E�
$GroUPPOLiCYSEttINGs = [rEF].ASseMBLY.GEtTypE
"""
with open("./target.txt", "r") as f_obj:
data = f_obj.read()
... | 371 | 208 |
#Pio_prefs
prefsdict = {
###modify or add preferences below
#below are the database preferences.
"sqluser" : "user",
"sqldb" : "database",
"sqlhost" : "127.0.0.1",
#authorization must come from same address - extra security
#valid values yes/no
"staticip" : "no",
#below is to do logging of qrystmts.... | 2,347 | 835 |
#!/usr/bin/env python3
from setuptools import setup
setup(
name="deeplator",
version="0.0.7",
description="Wrapper for DeepL translator.",
long_description="Deeplator is a library enabling translation via the DeepL translator.",
author="uinput",
author_email="uinput@users.noreply.github.com",
... | 742 | 240 |
import sys
import logging as log
from ..common import parsers, helpers, retrievers, data_handlers
from ..common.data_models import Taxon
from typing import List
def run_taiga(infile: str,
email: str,
gb_mode: int = 0,
tid: bool = False,
correction: bool = False,... | 3,737 | 1,037 |
from django.shortcuts import render
def HomeView(request):
return render(request , 'site_home.html')
def AboutView(request):
return render(request, 'about.html') | 171 | 51 |
# Time: O(n)
# Space: O(h)
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
# iterative stack solution
class Solution(object):
def maxAncestorDiff(self, root):
"""
:type root: TreeNode
... | 1,412 | 456 |
# Generated by Django 3.0.6 on 2020-06-01 12:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blogs', '0011_auto_20200531_0915'),
]
operations = [
migrations.RemoveField(
model_name='post',
name='tags',
... | 478 | 164 |
# THE PURPOSE OF THIS SCRIPT IS TO SELECT ASSAYS FROM A LIST OF PRIMER COMBINATIONS, SUCH THAT NO MORE THAN TWO OF THE ASSAYS TARGET EXACTLY APROXIMATELY THE SAME POSITIONS .
import sys
fn = sys.argv[1]
fh = open(fn, 'r')
def plus_or_minus(x,h):
L = []
for i in range(h):
L.append(int(x-i))
L.append(int(x+i))
re... | 1,254 | 569 |
import pandas as pd
import pandas
import numpy as np
#provide local path
testfile='../input/test.csv'
data = open(testfile).readlines()
sequences={} #(key, value) = (id , sequence)
for i in range(1,len(data)):
line=data[i]
line =line.replace('"','')
line = line[:-1].split(',')
id = int(... | 4,741 | 1,815 |
#!/usr/bin/env python
# coding: utf-8
# Copyright 2014 The Crashpad 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/LICEN... | 5,422 | 1,687 |
"""
geoutils.vectortools provides a toolset for working with vector data.
"""
from __future__ import annotations
import warnings
from collections import abc
from numbers import Number
from typing import TypeVar
import geopandas as gpd
import numpy as np
import rasterio as rio
from rasterio import features, warp
from ... | 11,647 | 3,331 |
from setuptools import setup
# with open("../README.md", "r") as fh:
# long_description = fh.read()
setup(name='pulzar-pkg',
version='21.4.1',
author='Mauricio Cleveland',
author_email='mauricio.cleveland@gmail.com',
description='Distributed database and jobs',
# long_description=l... | 753 | 247 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Sample 10^6 particles from anisotropic Hernquist DF.
Created: February 2021
Author: A. P. Naik
"""
import sys
from emcee import EnsembleSampler as Sampler
import numpy as np
sys.path.append("../src")
from constants import G, M_sun, kpc
from hernquist import calc_DF_a... | 3,362 | 1,270 |
"""
Declarations for the .NET SDK Downloads URLs and version
These are the URLs to download the .NET SDKs for each of the supported operating systems. These URLs are accessible from: https://dotnet.microsoft.com/download/dotnet-core.
"""
DOTNET_SDK_VERSION = "3.1.100"
DOTNET_SDK = {
"windows": {
"url": "ht... | 1,205 | 676 |
from tkinter import *
class MinhaGUI:
def __init__(self):
# Criando a janela principal
self.janela_principal = Tk()
# Criando os frames
self.frame_cima = Frame(self.janela_principal)
self.frame_baixo = Frame(self.janela_principal)
# Criando os label... | 798 | 265 |
# Generated by Django 3.0.5 on 2020-05-26 13:58
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='RepositoryDetails',
fields... | 1,435 | 429 |
# coding: utf-8
import os, pickle, csv, json
import subprocess
from typing import NamedTuple, List, TextIO, Tuple, Dict, Optional, Union, Iterable, Hashable
import numpy as np
import pandas as pd
from scipy import stats
from itertools import product, groupby, takewhile
from collections import namedtuple, Counter
impor... | 29,296 | 10,213 |
import os
import tempfile
import shutil
import argparse
import networkx as nx
from tqdm import tqdm
from joblib import Parallel, delayed
from collections import defaultdict, Counter
import math
import numpy as np
from .isvalid import *
from .__init__ import __version__
from .cdhit import run_cdhit
from .clean_network... | 15,604 | 4,798 |
# (c) 2016 Julian Gonggrijp
from .utilities import *
def test_un_camelcase():
assert un_camelcase('CampbellSoupX') == 'campbell_soup_x'
assert un_camelcase('NBOCampbellToets') == 'n_b_o_campbell_toets'
def test_append_to():
__all__ = []
class Example(object):
pass
@append_to(__all__)
... | 1,535 | 584 |
import os
import re
import yaml
for root, dirs, files in os.walk("."):
for file in files:
njk = os.path.join(root, file)
if njk.endswith(".njk"):
with open(njk, "r") as file:
lines = file.read().split("\n")
if not(lines[0].startswith("---")):
... | 1,242 | 352 |
# Generated by Django 2.0.7 on 2018-07-30 21:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_auto_20180730_1451'),
]
operations = [
migrations.AddField(
model_name='resourcescan',
name='redirect_u... | 557 | 188 |
"""servicediscovery module initialization; sets value for base decorator."""
from .models import servicediscovery_backends
from ..core.models import base_decorator
mock_servicediscovery = base_decorator(servicediscovery_backends)
| 231 | 63 |
from datetime import date
from typing import Sequence, Optional, Union, Dict, List, Any
from pydantic import BaseModel, validator, Field
from csr.entity_validation import validate_entity_data
from csr.exceptions import DataException
class Individual(BaseModel):
"""
Individual entity
"""
individual_i... | 4,954 | 1,553 |
from hwtBuildsystem.fileUtils import which
class YosysConfig():
_DEFAULT_LINUX = '/usr/bin/yosys'
@classmethod
def getExec(cls):
exe = "yosys"
if which(exe) is None:
raise Exception('Can find yosys installation')
return exe
if __name__ == "__main__":
print(YosysC... | 337 | 115 |
# Crazy Drawing Example
#
# This example shows off your OpenMV Cam's built-in drawing capabilities. This
# example was originally a test but serves as good reference code. Please put
# your IDE into non-JPEG mode to see the best drawing quality.
import pyb, sensor, image, math
sensor.reset()
sensor.set_framesize(sens... | 5,438 | 2,150 |
"""This module contains tests for the project. Can be split into several files
later"""
from datetime import datetime
import pytest
import pytz
from src.main.pages.get_clock_page import get_time_str
zone = pytz.timezone("Europe/Moscow")
@pytest.mark.parametrize(
('freeze_ts', 'expected_res'),
[
(162... | 607 | 221 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import logging
import datetime
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from django.core.management import setup_environ
from django.core.mail import send_mail
#from django.db import transaction
import settings
setup_environ(settings)
"""
Daily Activi... | 2,007 | 589 |
# */
# * Licensed to the Apache Software Foundation (ASF) under one
# * or more contributor license agreements. See the NOTICE file
# * distributed with this work for additional information
# * regarding copyright ownership. The ASF licenses this file
# * to you under the Apache License, Version 2.0 (the
# * "License... | 3,882 | 1,297 |
"""
Init file for the RPTR Core
""" | 35 | 14 |
"""
mirrors functionality of hexdump(1) and API interface of Python hexdump package.
Usage:
1. Within Python:
from hexdump2 import hexdump, color_always
# Enable or disable color all the time
color_always()
hexdump(bytes-like data)
2. From commandline, run the console scripts hexdump2 or hd2
$ hd2 -h
"""
# Import ... | 433 | 142 |
#!/usr/bin/env python3
import os
import sys
import csv
import json
import glob
import subprocess
import us
import openstates_metadata as metadata
OCD_FIXES = {
"ocd-division/country:us/state:vt/sldu:grand_isle-chittenden": "ocd-division/country:us/state:vt/sldu:grand_isle"
}
SKIPPED_GEOIDS = {
"cd-6098": "Ame... | 5,076 | 1,692 |
import PIL
from rest_framework import serializers
from rest_framework.exceptions import ParseError
from .models import Image
class ImageSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Image
fields = ('pk', 'image', )
| 249 | 71 |
import glob
import os
import re
import pygame
from math import log2, pow
try:
pygame.init() # Throws error in pylint: security issue for C module. Ignore.
except ImportError:
exit("This script requires the pygame module\nInstall with: sudo pip3 install pygame")
BANK = os.path.join(os.path.dirname(__file__), "... | 2,841 | 1,046 |
#!/usr/bin/python3
from botbase import *
_emden_cc = re.compile(r"(?:ha\w+en\swir\s(?:erneut\s)?|Gesundheitsamt)\s*([0-9.]+|\w+)\s+(?:Corona-\s*)?Neuinfektion(?:en)?")
_emden = re.compile(r"([0-9.]+)\s(?:Personen|Infektionen)\s*,\svon\sdenen\s*([0-9.]+)\s(?:\(\+?(-?\s*[0-9.]+)\)\s)?Personen\sgenesen\sund\s([0-9.]+)\s(... | 1,400 | 632 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : fedhf\component\evaluator\__init__.py
# @Time : 2022-05-03 16:00:21
# @Author : Bingjie Yan
# @Email : bj.yan.pa@qq.com
# @License : Apache License 2.0
__all__ = ["Evaluator", "build_evaluator", "evaluator_factory", "BaseEvaluator"]
from .eval... | 632 | 238 |
# project libraries imports:
# instruments:
from GenericScript import TestScript
class Test(TestScript):
def __init__(self):
TestScript.__init__(self)
self.Name = 'Modulated photocurrent frequency spectrum'
self.Description = """Measurement of the modulation frequency spectrum of photocurre... | 11,462 | 3,078 |
#! /usr/bin/env python
import sys
import os
#This script will read in a bed file with both ensemble IDs and NCBI gene IDs merged, and output a translation table of these IDs.
bedfile = sys.argv[1]
outfile = sys.argv[2]
bed = open(bedfile,"r")
output = open(outfile,"w")
output.write("NCBIGeneID\tENSEMBLID\n")
for... | 1,102 | 485 |
from django.conf import settings
from django.contrib.sites.models import Site
from django.db import models
from django.utils.translation import pgettext_lazy
from .constants import REDIRECT_TYPE_CHOICES, REDIRECT_301
from .fields import MultipleChoiceArrayField
__all__ = (
'Redirect',
)
LANGUAGES = getattr(setti... | 3,050 | 972 |
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.2'
# jupytext_version: 0.8.6
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% {"slideshow": {"slide_ty... | 4,330 | 1,764 |
from tests.helper import restricted_exec
def test_RestrictingNodeTransformer__visit_Assert__1():
"""It allows assert statements."""
restricted_exec('assert 1')
| 170 | 49 |
import argparse
import os
import numpy as np
import chainer
from chainer import functions as F
from chainer import iterators
from chainer import optimizers
from chainer import training
from chainer.training import extensions as E
from chainer_chemistry.models.prediction import Classifier
from chainer_chemistry.trainin... | 8,944 | 2,886 |
from django.conf.urls import url, include
from driver import views
# from djgeojson.views import GeoJSONLayerView
# from driver.models import Points
urlpatterns = [
url(r'^new/driver$', views.create_driver_profile, name='new-driver-profile'),
url(r'^new/car$', views.submit_car, name='new-car'),
] | 307 | 102 |
import numpy as np
import tensorflow as tf
from utils import fc_block
from params import*
class Model():
def __init__(self, input_dim=INPUT_DIM, output_dim=OUTPUT_DIM, dim_hidden=DIM_HIDDEN, latent_dim=LATENT_DIM, update_lr=LEARNING_RATE, scope='model'):
self.input_dim = input_dim
self.ou... | 3,456 | 1,228 |