text string | size int64 | token_count int64 |
|---|---|---|
try:
import streamlit as st
except ImportError:
print(
"(!) The code inside `autogoal.contrib.streamlit` requires `streamlit>=0.55`."
)
print("(!) Fix it by running `pip install autogoal[streamlit]`.")
raise
from autogoal.search import Logger
class StreamlitLogger(Logger):
... | 1,815 | 611 |
# Copyright (c) 2011, 2012, 2013 Marek Sapota
#
# 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, p... | 3,179 | 884 |
# Generated by Django 3.1.7 on 2021-08-27 14:52
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dm_page', '0028_contact_is_facilitator'),
]
operations = [
migrations.AlterField(
model_name='c... | 1,701 | 532 |
#
# Copyright (c) 2009-2015, Jack Poulson
# All rights reserved.
#
# This file is part of Elemental and is under the BSD 2-Clause License,
# which can be found in the LICENSE file in the root directory, or at
# http://opensource.org/licenses/BSD-2-Clause
#
import El
import time
m = 4000
n = 2000
display = True
... | 2,414 | 1,037 |
__version__ = '0.0.4'
def phi(n: int) -> int:
"""Euler function
Parameters:
n (int): Number
Returns:
int: Result
"""
res, i = n, 2
while i * i <= n:
if n % i == 0:
while n % i == 0:
n //= i
res -= res // i
i += 1
if n >... | 1,062 | 417 |
import time
import datetime
class TimeMeter(object):
def __init__(self, max_iter):
self.iter = 0
self.max_iter = max_iter
self.st = time.time()
self.global_st = self.st
self.curr = self.st
def update(self):
self.iter += 1
def get(self):
self.curr ... | 1,016 | 352 |
from glife import *
import golly as g
s1 = g.getstring("Enter stack size:", "233")
s2 = g.getstring("Enter stdin buffer starting address:", "290")
s3 = g.getstring("Enter stdout buffer starting address:", "790")
# calc.c
RAM_NEGATIVE_BUFFER_SIZE = int(s1)
QFTASM_RAMSTDIN_BUF_STARTPOSITION = int(s2) + RAM_NEGATIVE_BU... | 6,556 | 2,788 |
from app.meda_sync_search.models.model import Model
class Equipment(Model):
def __init__(self, *,
description='',
hcpcs='',
average_cost=0,
category='',
modifier=''):
super().__init__(description=description)
sel... | 844 | 225 |
import tensorflow as tf
cluster = tf.train.ClusterSpec({
"worker": [
"localhost:2223",
],
"ps": [
"152.19.32.251:2222"
]})
server = tf.train.Server(cluster, job_name='worker', task_index=0)
with tf.device("/job:ps/task:0"):
image = tf.get_variable("images", shape=[5,5], dt... | 1,649 | 643 |
import json
import os.path
from hashlib import sha256
from os import listdir
from os.path import join, isdir
from pprint import pprint
import pytest
import requests
from pydantic import ValidationError
from aleph_message.models import MessagesResponse, Message, ProgramMessage, ForgetMessage, \
PostContent
from al... | 5,780 | 2,165 |
#!/usr/bin/env python3
from io import StringIO
from itertools import groupby, permutations, product
from math import cos, sin, radians
from sys import argv
import numpy as np
INTERSECTION_SIZE = 12
MATCHING_DIST_COUNT = (INTERSECTION_SIZE * (INTERSECTION_SIZE - 1)) / 2
SIN_90 = sin(radians(90))
COS_90 = cos(radians... | 3,767 | 1,432 |
from androidframer.framer import Framer | 39 | 12 |
#!/usr/bin/python
# This file includes test cases for calendar
# author:makdon
#
#
#
#
# Life is short, i use Python.
import unittest
import json
import copy
from .util import get_status_code_by_request
from .util import get_login_cookie
from .util import get_response
from .util import get_a_calendarId
from .util impo... | 1,024 | 326 |
PC1 = [57, 49, 41, 33, 25, 17, 9,
1, 58, 50, 42, 34, 26, 18,
10, 2, 59, 51, 43, 35, 27,
19, 11, 3, 60, 52, 44, 36,
63, 55, 47, 39, 31, 23, 15,
7, 62, 54, 46, 38, 30, 22,
14, 6, 61, 53, 45, 37, 29,
21, 13, 5, 28, 20, 12, 4]
PC2 = [14, 17, 11, 24, 1, 5,
3, 28, 15, ... | 7,487 | 4,724 |
from xml.dom import minidom
import xml.etree.ElementTree as Et
class SplitXMLFormat(object):
def __init__(self, data, output_file):
self.data = data
self.output_file = output_file
@staticmethod
def __prettify(elements):
"""Return a pretty-printed XML string for the Element.
... | 1,518 | 441 |
import graphene
from graphql import GraphQLError
from app.People.models import Person
from .service import SearchService
from app.People.graphql_types import PersonType
from .graphql_types import SearchType, SearchResultType
service = SearchService()
class SearchQuery(graphene.ObjectType):
'''Search Query,
... | 1,510 | 447 |
# Generated by Django 2.2.3 on 2019-08-12 16:17
# import django.contrib.gis.db.models.fields
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | 7,463 | 2,176 |
'''
MATPOWER
Copyright (c) 1996-2016 by Power System Engineering Research Center (PSERC) by Ray Zimmerman, PSERC Cornell
This code follows part of MATPOWER.
See http://www.pserc.cornell.edu/matpower/ for more info.
Modified by Oak Ridge National Laboratory (Byungkwon Park) to be used in the parareal algorithm.
'''
imp... | 1,180 | 489 |
# Generated by Django 3.1.5 on 2021-03-14 07:14
import ckeditor.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blogapp', '0005_auto_20210313_1746'),
]
operations = [
migrations.AlterField(
model_name='post',
... | 437 | 169 |
"""Object Oriented wrapper to Python SRB Interface.
Description: Object Oriented wrapper to Python SRB Interface
Author: Rob Sanderson (azaroth@liv.ac.uk)
Date: 2005-05-12
Version: 0.8
Copyright: (c) University of Liverpool
Licence: GPL
"""
import srb
import types
import socket
import atexit
... | 10,431 | 3,103 |
import logging
import os
from slack_log_handler import SlackLogHandler
STOP_LOG = 100
def make_root_logger(console_loglevel: int = logging.DEBUG, file_loglevel: int = STOP_LOG,
slack_loglevel: int = STOP_LOG, log_file_path: str = None) -> logging.Logger:
"""Generate the root logger, includi... | 2,599 | 782 |
# coding: utf-8
import numpy as np
import torchvision
import time
import os
import copy
import pdb
import time
import argparse
from PIL import Image
import sys
import cv2
import torch
from torch.utils.data import Dataset, DataLoader
from torchvision import datasets, models, transforms
from retinanet.dataloader impo... | 9,820 | 3,814 |
import torch
import torch.optim as optim
import torch.nn.functional as F
import numpy as np
import random
import math
import copy
import time
from collections import namedtuple
from itertools import count, compress
from tensorboardX import SummaryWriter
from prop.buffers.priority_replay_buffer import PrioritizedReplay... | 13,424 | 3,820 |
# https://docs.ansible.com/ansible/latest/dev_guide/developing_plugins.html#lookup-plugins
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
lookup: kube
author: Jose Montoya <jmontoya@ms3-inc.com>
version_added: "0.6.0"
short_description: Looku... | 3,631 | 969 |
# -*- coding: utf-8 -*-
import unittest
from datetime import timedelta
import jenkins
from cabot.cabotapp import jenkins as cabot_jenkins
from cabot.cabotapp.models import JenkinsConfig
from cabot.cabotapp.models.jenkins_check_plugin import JenkinsStatusCheck
from django.utils import timezone
from freezegun import fr... | 6,289 | 2,087 |
# Simple Linear Regression Model
# Data Preprocessing Template
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Salary_Data.csv')
X = dataset.iloc[:, :-1].values
Y = dataset.iloc[:, 1].values
# Splitting the Dataset into ... | 2,101 | 675 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-08-14 08:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('logger', '0033_auto_20170705_0159'),
]
operations = [
migrations.AddField(
... | 1,062 | 306 |
from django.urls import path
from . import views
app_name = "your_health"
urlpatterns = [
path("add_data", views.UserDataCreateView.as_view(), name="add_data"),
path("edit_data", views.UserDataUpdateView.as_view(), name="edit_data"),
]
| 248 | 86 |
import math
import time
from rlbot.agents.base_agent import BaseAgent, SimpleControllerState
from rlbot.utils.structures.game_data_struct import GameTickPacket
from utils.vec3 import vec3
SIN45 = math.sin(0.785398)
def normalize_location(location: vec3):
"""
take any location and normalize it to be within ... | 10,265 | 3,244 |
import os
import argparse
import numpy as np
import shutil
class CrossValSplitter:
def __init__(self, num_folds, data_dir, output_dir):
self.num_folds = num_folds
self.data_dir = data_dir
self.output_dir = output_dir
def split_dataset(self):
# Creamos los directorios
... | 3,969 | 1,169 |
# Generated by Django 2.1.15 on 2021-04-14 18:29
import core.services
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Song',
fields=[
('id'... | 686 | 207 |
#!/usr/bin/env python
"""
# Author: Shrad Shukla
# coding: utf-8
#Author: Shrad Shukla
#Usage: This is a module for the BCSD code.
#This module bias corrects a forecasts following
#probability mapping approach as described in Wood et al. 2002
#Date: August 06, 2015
# In[28]:
"""
from __future__ import division
#import... | 7,697 | 3,130 |
import unittest
from siginfo import siginfoclass as si
import sys
OLD_OUT = sys.stdout
class MockOutput(object):
def __init__(self):
self.lines = []
def write(self, line):
self.lines.append(line)
def flush(self):
pass
class MockSignal(object):
def __init__(self, info=True,... | 10,472 | 3,601 |
import sys
from ast import literal_eval
import nltk
#below function requires a run flag (runf) (1-4) for the four folds, and tf is flag for feature combination (1-17)
def getr(runf,tf):
f1=open('classification_tweets/run'+str(runf)+'/test_sents.txt','r')
f2=open('classification_tweets/run'+str(runf)+'/test_tar... | 3,775 | 1,367 |
class BinaryCounter:
def __init__(self, led4, led3, led2, led1):
self.__led1 = led1
self.__led2 = led2
self.__led3 = led3
self.__led4 = led4
def asBinary(self):
return str(self.__led4) + " " + str(self.__led3) + " " + str(self.__led2) + " " + str(self.__led1)
d... | 1,108 | 357 |
import dataclasses
import enum
import re
from typing import Tuple, Mapping, List, Optional, Set, Iterable
from icontract import require, ensure
# crosshair: on
@require(lambda i, height: 0 <= i <= height)
@require(lambda j, width: 0 <= j <= width)
@ensure(
lambda height, width, result: all(
0 <= i <= h... | 4,678 | 1,565 |
import datetime, re, subprocess
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
TODAY = datetime.datetime.today()
WF_REGEX = re.compile( r""".*working directory: (?P<wd>[\w/.]+), workflowVersion: (?P<version>[\w/.=\s\-]+)""" )
GIT_RE = re.compile( r"""git branch\s+=\s+(?P<branch>[\w\... | 30,086 | 8,024 |
import sys
import time
import argparse
import os
import uuid
import hashlib
from pathlib import Path
import requests
import yaml
from google.cloud import storage
from .validator import ConfigValidator
from .utils import (
process_messages,
load_ctf_config,
load_config_or_exit,
get_ctf_config_path,
... | 15,973 | 4,791 |
#!/usr/bin/env python3
'''
Script to check for price movements of desired stocks and sent a price notification
'''
import argparse
def main():
'''Main entrypoint for the script'''
parser = argparse.ArgumentParser(
description='Check stocks for price movements',
epilog='example usage: ./main.p... | 861 | 268 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 1,375 | 396 |
from __future__ import print_function
import time
from sr.robot import *
a_th = 2.0
""" float: Threshold for the control of the orientation"""
d_th = 0.4
""" float: Threshold for the control of the linear distance"""
d_min = 1.0
""" float: Threshold for the minimum distance from the golden token"""
angl2 = 0.0
"""F... | 3,977 | 1,386 |
# -*- coding: utf-8 -*-
import os
import subprocess
from pcnaDeep.data.annotate import relabel_trackID, label_by_track, get_lineage_txt, break_track, save_seq
class pcna_ctcEvaluator:
def __init__(self, root, dt_id, digit_num=3, t_base=0, path_ctc_software=None, init_dir=True):
"""Evaluation of tracking ... | 4,587 | 1,565 |
"""
Methods common to all TCP transports.
"""
from enum import Enum
from warnings import warn
from datetime import datetime
from wampnado.serializer import JSON_PROTOCOL, BINARY_PROTOCOL, NONE_PROTOCOL
from wampnado.messages import Message
class HandshakeError(Enum):
NoError=0
SerializerUnsupported=1
Mess... | 3,065 | 946 |
"""This Submodules contains the definition of the expected configuration
to setup to use kvcd.
The main configuration is handled by `environ-config` module.
"""
import environ
import logging
from kvcd import _available_modules
logger = logging.getLogger(__name__)
@environ.config(prefix="KVCD")
class KvcdConfig:
... | 2,008 | 523 |
# -*- coding: utf-8 -*-
from pony.orm import *
from datetime import datetime
from model.group import Group
from model.myuser import MyUser
from pymysql.converters import decoders
class ORMFixture:
db = Database()
class ORMGroup(db.Entity):
_table_ = 'group_list'
id = PrimaryKey(int, column='g... | 3,078 | 970 |
'''
This function implements the memoization
approach in the searchTree algorithm in
knapSackSearchTree.py
To use the implementation below the list should be
a list of objects with following functions.
- getValue() -----> this function will be maximized for all the elements in the ... | 1,316 | 397 |
import cv2
image_path = '../../images/person.jpg'
cascade_path = '../../resources/haarcascade_frontalface_default.xml'
def main():
clf = cv2.CascadeClassifier(cascade_path)
img = cv2.imread(image_path)
faces = clf.detectMultiScale(img, 1.3, 10)
for (x, y, h, w) in faces:
cv2.rectangle(img, (x... | 574 | 263 |
#!/usr/bin/env python3
# pipe input from benchmark binary into this script to plot throughput vs. compression ratio
import csv
import sys
from collections import defaultdict
from operator import itemgetter
from argparse import ArgumentParser
from math import floor, ceil, log10
import numpy as np
import scipy.stats a... | 9,714 | 3,277 |
from .version import get_version
from .mapper import Record, fieldmapper, RecordError
from .repository import Repository, RepositoryError
from .dbgrid import DbGrid
| 165 | 42 |
'''
Description: Given an array nums and a value val, remove all instances of
that value in-place and return the new length.
Do not allocate extra space for another array, you must do this by
modifying the input array in-place with O(1) extra memory.
eg.
Input: [3,2,2,3], val = 3
Output: 2
and array = [2, 2]
Written b... | 1,558 | 606 |
import re
from openpyxl.cell.cell import Cell
from .exceptions import InvalidTemplateParameter
from .utils import get_and_validate_cell
class Parameter:
TYPES = (STRING, NUMBER, LIST, MAP, BOOLEAN) = (
"String",
"Number",
"CommaDelimitedList",
"Json",
"Boolean",
)
... | 3,885 | 1,048 |
import email.message as e
import smtplib
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import configs
import communication
def send_notifications(result):
"""
Function that will send by e-mail a notification of the state of the testing and compiling process
:param result: communication-object (see commu... | 3,730 | 952 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
spyder.plugins.maininterpreter
==============================
Main interpreter Plugin.
"""
from spyder.plugins.maininterpreter.plugin import MainInterpreter
# ... | 428 | 138 |
import torch
from torch.utils.data import Dataset
import os
from image import *
import random
import time
import torch
from config import args
from torchvision import datasets, transforms
import numpy as np
from PIL import Image, ImageEnhance
import numbers
from torch.multiprocessing import Pool, Process,... | 8,909 | 3,206 |
# Copyright (C) 2018 Zhixian MA <zx@mazhixian.me>
# MIT liscence
# Argument for setup()
__pkgname__ = "rescvae"
__version__ = "0.1.0"
__author__ = "Zhixian MA"
__author_email__ = "zx@mazhixian.me"
__license__ = "MIT"
__keywords__ = "ResCVAE: residual conditional variational autoencoder"
__copyright__ = "Copyright (C) ... | 482 | 190 |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
SECRET_KEY = os.environ.get("SECRET_KEY","Notsecret")
QR_FOLDER = os.path.join(basedir, "generatedqrs")
if not os.path.exists(QR_FOLDER):
os.mkdir(QR_FOLDER)
DEBUG= os.environ.get("DEBUG", False) | 306 | 123 |
# pylint: disable=unused-import,missing-docstring
from deepr.config.base import parse_config, from_config
from deepr.config.macros import ismacro, fill_macros, find_macro_params, assert_no_macros
from deepr.config.references import isreference, fill_references
import deepr.config.experimental
| 295 | 95 |
text = """
//------------------------------------------------------------------------------
// Explicit instantiation.
//------------------------------------------------------------------------------
#include "Utilities/iterateIdealH.cc"
#include "Geometry/Dimension.hh"
namespace Spheral {
template void iterateIdeal... | 880 | 208 |
import tensorflow as tf
from VisualEncoder import ConvAsFcEncoder
# from vgg16 import vgg16
import numpy as np
class Agnostic_Speaker:
@property
def message(self):
return self.message_
@property
def log_prob(self):
return self.log_prob_
def __init__(self, encode_type, input_len, d... | 7,407 | 2,552 |
from abc import abstractmethod
from scripts.src.analyze_reports import AnalyzerReport
class Parser:
ANALYZER_NAME: str
SOURCE_PATH: str
REPORT_PATH: str
@abstractmethod
def parse(self) -> AnalyzerReport:
raise NotImplementedError()
| 263 | 86 |
from load import get_image
from Preprocessing import bw
import process_manage
import testProcess
import argparse
def menu(args):
if args.option == 1:
res = process_manage.process(get_image(args.path), args.order)
res.show()
elif args.option == 2:
process_manage.show_rate(args.path, arg... | 1,704 | 529 |
#!/usr/bin/python3
import sys
import json
from urllib.request import urljoin
GH_PAGES_PREFIX = "https://anonykagamine.github.io"
OUTPUT_FILENAME = "index.json"
def main():
index_list = []
for filename in sys.stdin.readlines():
filename = filename.strip("\n")
with open(filename, "r") as f:
... | 872 | 281 |
# -*- coding: utf-8 -*-
"""
How do plugins work? There are a few patterns we use to "register" plugins with the core app.
1. All plugins should use entry_points in the setup, pointing to "pioreactor.plugins"
2. Automations are defined by a subclassing the respective XXXAutomationContrib. There is a hook in
this pa... | 869 | 239 |
import librosa
import numpy as np
from scipy.signal import lfilter, butter
import sigproc
import constants as c
def load_wav(filename, sample_rate):
audio, sr = librosa.load(filename, sr=sample_rate, mono=True)
audio = audio.flatten()
return audio
def normalize_frames(m,epsilon=1e-12):
return np.array([(v - np... | 1,480 | 652 |
from .base_command import DatalogControl
from .base_command import GetInfo
from .base_command import MemoryControl
from .base_command import CommControl
from .base_command import UserCommand
from .base_command import DummyCommand | 229 | 56 |
class rules(object):
spaces = [" ", "\t"]
reserved = ["pass", "break", "continue", \
"global", "nonlocal", \
"assert", "del", "import", \
"from", "as", "if", "elif", "else", "while", "for", "in", \
"with", "try", "except", "finally", "return", "raise", \
"def", "class", ... | 822 | 333 |
#!/usr/bin/env python
import argparse
import random
import os
import sys
import pandas as pd
import colored_traceback
# This script is supposed to be executed from the project's top-level directory
sys.path.append(os.path.abspath(os.curdir))
from src.utils.io import load_or_create
from src.corpus.lang import Lang
i... | 4,393 | 1,612 |
def print_multiples(n, high):
for i in range(1, high+1):
print(n * i, end=" ")
print()
def print_mult_table(high):
for i in range(1, high+1):
print_multiples(i, high)
print_mult_table(5) | 218 | 85 |
import pandas as pd
from recommender_functions import format_df, create_user_item_matrix, \
get_top_articles, user_user_recs_part2, make_content_recs, tokenize
class Recommender():
'''
This class implements a recommender system for the best ibm articles for
each specific user.
At this class you ca... | 2,136 | 632 |
import os
from PIL import Image
import cv2
import numpy as np
from scipy.ndimage import gaussian_filter
def join_path(*dirs):
if len(dirs) == 0:
return ''
path = dirs[0]
for d in dirs[1:]:
path = os.path.join(path, d)
return path
def make_filepath(fpath, dir_name=None, ext_name=None,... | 5,910 | 2,371 |
# Copyright (c) 2021, ifitwala and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
import frappe.share
from frappe import _
from frappe.utils import cstr, now_datetime, cint, flt, get_time, get_datetime, get_link_to_form, date_diff, nowdate
def ... | 739 | 261 |
from .main import *
engine = create_engine('postgresql+psycopg2://' + POSTGRES_USER + ':' + POSTGRES_PASSWORD + '@' + POSTGRES_HOST + ':' + POSTGRES_PORT + '/' + POSTGRES_DB, pool_size=num_fetch_threads+num_fetch_threads_agg, convert_unicode=True)
# Create database if it does not exist.
if not database_exists(engine.u... | 20,638 | 6,564 |
import logging
from spaceone.core.manager import BaseManager
from spaceone.board.model import Post
_LOGGER = logging.getLogger(__name__)
class PostManager(BaseManager):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.post_model: Post = self.locator.get_model('Post')
... | 1,829 | 605 |
def textRepeater(name):
return name + ' called something inside a function \n'
print(textRepeater('Seyi') * 4)
| 117 | 42 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2020-03-22 13:34
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("tickets", "0004_merge"),
]
operations = [
mig... | 1,125 | 328 |
"""Provides GraphQL root types.
- `query`
- `mutation`
- `subscription`
And custom scalars :
- `datetime_scalar`
- `date_scalar`
- `json_scalar`
!!! info
The base app is always loaded, as it should be needed by any other app
wanting to bind resolvers to the GraphQL schema.
"""
from .resolvers.root_types im... | 410 | 140 |
import sys
for line in sys.stdin:
sys.stdout.write(line)
sys.stdout.write("x\n")
| 97 | 40 |
import logging
from mqtt_panel.web.widget.widget import Widget
class Light(Widget):
widget_type = 'light'
def __init__(self, *args, **kwargs):
super(Light, self).__init__(*args, **kwargs)
# self._value = self._c['values'][0].get('payload')
self._payload_map = {}
for blob in se... | 2,620 | 792 |
# Copyright 2014 OpenStack Foundation
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# 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/LICENS... | 8,464 | 2,593 |
#!/usr/bin/env python
'''
Copyright (C) 2020, WAFW00F Developers.
See the LICENSE file for copying permission.
'''
NAME = 'Viettel (Cloudrity)'
def is_waf(self):
schemes = [
self.matchContent(r"Access Denied.{0,10}?Viettel WAF"),
self.matchContent(r"cloudrity\.com\.(vn)?/"),
self.matchCon... | 422 | 161 |
from project import db
from project.com.vo.CropTypeVO import CropTypeVO
from project.com.vo.CropVO import CropVO
from project.com.vo.ImageVO import ImageVO
from project.com.vo.MedicineVO import MedicineVO
class MedicineDAO:
def insertMedicine(self, MedicineVO):
db.session.add(MedicineVO)
db.sessio... | 1,458 | 490 |
# -*- coding: utf-8 -*-
# Owlready2
# Copyright (C) 2013-2019 Jean-Baptiste LAMY
# LIMICS (Laboratoire d'informatique médicale et d'ingénierie des connaissances en santé), UMR_S 1142
# University Paris 13, Sorbonne paris-Cité, Bobigny, France
# This program is free software: you can redistribute it and/or modify
# it ... | 18,182 | 5,502 |
"""Unit test package for django_impala_backend."""
| 51 | 15 |
#!/usr/bin/env python
# coding: UTF-8
from pymatbridge import Matlab
mlab = Matlab(executable='/Applications/MATLAB_R2014a.app/bin/matlab')
mlab.start()
results = mlab.run_code('a=1;')
var = mlab.get_variable('a')
print var
mlab.stop() | 240 | 103 |
from fastapi import FastAPI
from tortoise.contrib.fastapi import register_tortoise
from models.base import model_list
from config.secrets import db_url
def register(app: FastAPI):
register_tortoise(
app, db_url=db_url,
modules={'models': model_list},
generate_schemas=True,
add_exc... | 347 | 110 |
#!/bin/python
from bitfeeds.storage.zeromq import ZmqStorage
from bitfeeds.storage.file import FileStorage
from bitfeeds.market import L2Depth, Trade, Snapshot
from datetime import datetime
from threading import Lock
class ExchangeGateway:
#########################################################################... | 7,965 | 1,956 |
import serial
import math
import numpy as np
import time
with serial.Serial("COM15", 9600) as ser:
period = 120;
while True:
for x in np.arange(1, 2*math.pi, 2*math.pi/period):
s = "%.1f\n\n" % (math.sin(x) * 80 + 100);
print s;
ser.write(s);
... | 467 | 171 |
from django.db import models
from django.utils import timezone
class Summary(models.Model):
author = models.ForeignKey('auth.User', on_delete=models.CASCADE)
section_name = models.CharField(max_length=1000, null=True)
category_name = models.CharField(max_length=1000, null=True)
summary_name = models.... | 831 | 276 |
#!/usr/bin/env python3
import redis
import argparse
import random
import string
import sys
import time
from utils import string_generator, number_generator
from dyno_node import DynoNode
from redis_node import RedisNode
from dyno_cluster import DynoCluster
from dual_run import dual_run, ResultMismatchError
def parse_a... | 6,468 | 2,427 |
import time
import zipfile
from io import BytesIO
from flask import Blueprint, send_file, request
from mongolia import ID_KEY
from backend.admin_portal.common_helpers import validate_cohort, validate_user, raise_404_error
from backend.admin_portal.download_data_helpers import (generate_messages_csv,
gene... | 7,212 | 2,417 |
# Copyright 2014 Netflix, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 4,819 | 1,370 |
import pytest
from sentiment import api
def test_that_the_explainer_availability_check_works(mocker):
mocker.patch.object(api, 'EXPLAINERS', ["existing"])
good_exp_req = api.ExplanationRequest(text="some text",
target=3,
met... | 715 | 206 |
# -*- coding: utf-8 -*-
"""Implements Atomic-SPADL and the Atomic-VAEP framework."""
| 85 | 35 |
# !/usr/bin/env python
# encoding: utf-8
#
# This file is part of ckanext-nhm
# Created by the Natural History Museum in London, UK
import ckanext.nhm.views as nhm_views
def resource_view_get_view(resource):
'''Retrieve the controller for a resource. Try and match on resource ID, or on
format so we can provi... | 1,199 | 352 |
import unittest
from dalpy.queues import Queue, QueueUnderflowError
class QueueTest(unittest.TestCase):
def test_init(self):
q = Queue()
self.assertTrue(q.is_empty())
self.assertEqual(q.size(), 0)
def test_empty_ops(self):
q = Queue()
self.assertRaises(QueueUnderflowE... | 1,157 | 406 |
import ast
from pathlib import Path
from flakehell.parsers import MarkdownParser
GIVEN = """
# Example
This is example of markdown file
```python
a = 1
print('oh hi mark')
```
Emphasized:
```python hl_lines="1"
emphasized_imaginary_function()
```
PyCon:
```pycon
>>> print("Hello")
'Hello'
>>> banana = "banana"
... | 1,138 | 434 |
import json
import pandas as pd
import pytest
import redcap
from redcap_bridge.server_interface import (upload_datadict, download_records,
download_datadict)
from redcap_bridge.test_redcap.test_utils import (test_directory,
... | 4,298 | 1,208 |
#!/usr/bin/env python3
# Detect repos of user en GIT
# %%%%%%%%%%% Libraries %%%%%%%%%%%#
import json
import urllib.request
from auxiliar_functions.globals import url_git_user
# %%%%%%%%%%% Functions %%%%%%%%%%%#
def git_user(username):
try:
user_info = json.loads(urllib.request.urlopen(url_git_user... | 961 | 298 |
__version__="v.0.0.1"
def main():
print("I'm an app")
| 57 | 28 |
# setup.py
from distutils.core import setup
import glob
import py2exe
setup(
name="msp430-jtag",
scripts=["jtag.py"],
) | 132 | 51 |