id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
3298309
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
StarcoderdataPython
1613109
#!/usr/bin/env python # # @file createNewPackage.py # @brief Create package object to pass to functions # @author <NAME> # import sys def createSed(): m0 = dict({'name': 'SedDocument', 'typecode': 'SEDML_DOCUMENT'}) m1 = dict({'name': 'Model', 'typecode': 'SEDML_MODEL', 'isSedListOf': True}) c1 = dict({'name...
StarcoderdataPython
1780896
<filename>src/annalist_root/annalist/tests/entity_testsitedata.py """ This module contains definitions intended to reflect the site-wide data used by all Annalist installations. Test cases should use values returned by this module so that additions to the site data can be updated here, in just one place. """ from __...
StarcoderdataPython
1655642
<gh_stars>10-100 import threading import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt import matplotlib.image as mpimg import matplotlib.patches as patches from matplotlib.collections import PatchCollection import numpy as np import time from pylab import * import simulator import Util from geom...
StarcoderdataPython
105968
import torch import torchvision import torchvision.transforms as transforms import torch.nn.functional as F from torch import nn import os import matplotlib.pyplot as plt import sys import numpy as np sys.path.append('./') from args import opt sys.path.append('./lib/') from dataset import FruitFlyNeuronDataset from cv2...
StarcoderdataPython
1712985
<filename>my_university_api/application/api/mongodb/routes.py # This file contain all routes of mongodb #################################################################### # import #################################################################### from flask_restx import Resource, reqpa...
StarcoderdataPython
3210610
<gh_stars>0 from abc import ABC, abstractmethod class Parser(ABC): def __init__(self): self.delimiters={} pass @classmethod @abstractmethod def getParserInstance(cls): pass @abstractmethod def setDelimitersUsingDictionary(self, delimitersPurposeMappedToDelimiter:...
StarcoderdataPython
3276101
<gh_stars>0 from flask import Flask, jsonify, request, abort, session, redirect, url_for, escape, send_file from flask_cors import CORS import os import bcrypt from pymongo import MongoClient from bson.objectid import ObjectId import bson.errors from jsonschema import validate, exceptions import datetime import pandas ...
StarcoderdataPython
3225915
<reponame>pulumi/pulumi-alicloud # coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequenc...
StarcoderdataPython
3371368
<reponame>AI4SIM/model-collection """This module proposes a test suite for the inferer module.""" # 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-...
StarcoderdataPython
3270437
#This file will generate an html file with pothole coodinates #Here will define the templet of stsarting portion of the HTML file head = """ <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <title>Google Maps - g...
StarcoderdataPython
69900
"""Views related to the statistics module""" from datetime import date, timedelta # pylint: disable=redefined-builtin from requests.exceptions import ConnectionError, InvalidURL from django.contrib import messages from django.contrib.auth.decorators import login_required from django.shortcuts import render, redirect ...
StarcoderdataPython
82427
import os import argparse from multiprocessing import Lock, Process, Queue import subprocess import traceback from ytauth import YtAuth from ytchat import YtChat from twitchchat import TwitchChat SECRET_FILE = 'client_secret.json' def start_yt(prefix, vid_id, tts_queue, ytauth): # TODO: Search for YouTube events...
StarcoderdataPython
92092
<reponame>divmain/lightyear import re from collections import OrderedDict from parsimonious.grammar import Grammar from parsimonious.exceptions import IncompleteParseError from .errors import IndentError, LyError, LySyntaxError, UnsupportedCommaNesting from .globals import BLK_OPEN, BLK_CLOSE, INDENT_SIZE, COMMENT_OP...
StarcoderdataPython
1766349
<reponame>ujjwalsb/liveProject # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Form', fields=[ ...
StarcoderdataPython
62870
from telethon import events import asyncio from userbot.utils import admin_cmd @borg.on(admin_cmd("mc")) async def _(event): if event.fwd_from: return animation_interval = 0.3 animation_ttl = range(0, 5) await event.edit("mein") animation_chars = [ "madarchod", "Hu...
StarcoderdataPython
3284177
<reponame>2dongheee/Udacity-CarND-Behavioral-Cloning-P3<gh_stars>1-10 from utils import * from model import load_model import cv2 import numpy as np import pandas as pd batch_size = 32 data_frame = pd.read_csv('data/driving_log.csv', usecols=[0, 1, 2, 3]) data_frame = data_frame.sample(frac=1).reset_index(drop=True...
StarcoderdataPython
3369760
import math import random import numpy as np N_CLASSES = 10 N_AMOSTRAS = 100 TEMPO_ENTRE_CHEGADA = 5 TEMPO_ENTRE_SERVICO = 5 TAMANHO_MAX_FILA = 10 def gera_amostras_exponencial(tam, param_lambda): amostras = [] for i in range(0, tam): amostras.append(math.floor(np.random.exponential(param_lambda))) ...
StarcoderdataPython
3200927
import os import mysql.connector as mariadb def createDBConnection(): mydb = mariadb.connect( host = str(os.getenv('DBHOST', '0')), user = str(os.getenv('DBUSER', '0')), password = str(os.getenv('DBPWD', '0')), database = str(os.getenv('DBNAME', '0')) ) r...
StarcoderdataPython
1675260
# -*- coding: utf-8 -*- """ Presenters for API data. """ import collections import copy from pyramid import security class AnnotationBasePresenter(object): def __init__(self, annotation_resource): self.annotation_resource = annotation_resource self.annotation = annotation_resource.annotation ...
StarcoderdataPython
24912
""" Tests for Day 22 """ from day22.module import part_1, part_2, \ FULL_INPUT_FILE, TEST_INPUT_FILE_1, TEST_INPUT_FILE_2, TEST_INPUT_FILE_3 def test_part_1_1(): result = part_1(TEST_INPUT_FILE_1) assert result == 39 def test_part_1_2(): result = part_1(TEST_INPUT_FILE_2) assert result == 59078...
StarcoderdataPython
7284
<reponame>maya2250/nova<gh_stars>0 # 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 ag...
StarcoderdataPython
154259
from .client import client_decorator class Webapps: def __init__(self, client): self.client = client @client_decorator(op="webapps") def get(self): "List all webapps" @client_decorator(op="webapps") def post(self, domain_name, python_version): """ Create a new web...
StarcoderdataPython
3288236
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
StarcoderdataPython
1775643
<reponame>flyliu2017/bert<filename>sequential_tag_processor.py import os import csv import tensorflow as tf import tokenization from data_processor import DataProcessor, InputExample, InputFeatures from model_fn import create_sequential_tagging_model class SequentialTagProcessor(DataProcessor): """Base class for...
StarcoderdataPython
166479
from django.contrib.auth.models import User from django.db.models import Q from django.test import TestCase, Client, RequestFactory from ..models import Report # Create your tests here. class SearchTest(TestCase): def setUp(self): self.client = Client() self.client.post('/report/user_register/'...
StarcoderdataPython
4826409
<reponame>kazuki-cho/data_maintenance_tools import os import sys import glob import pickle import numpy as np import scipy.io as sio COVAREP_DIR = 'segmented_covarep/' OUTPUT = 'cmumosi_audio_noalign.pkl' def main(): data = {} mat_files = glob.glob(COVAREP_DIR + '*.mat') for mat_file in mat_files: ...
StarcoderdataPython
1606198
""" Finetune model. """ import argparse from lib.LayoutLM import LayoutLM from lib.LayoutLMv2 import LayoutLMv2 from lib.path_utils import existing_directory def get_parser() -> argparse.ArgumentParser: parser = argparse.ArgumentParser() parser.add_argument( "model", choices=[ "fi...
StarcoderdataPython
164222
""" Contains possible interactions with the Chado Features """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import csv import hashlib import operator import re import time from functools import reduce from BCBio im...
StarcoderdataPython
66984
from django.views.generic import CreateView, TemplateView from django.contrib.messages.views import SuccessMessageMixin from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.forms import UserCreationForm from django.views.generic import DetailView, ListView, FormView, TemplateView, View fro...
StarcoderdataPython
3348583
# pylint: skip-file # -*- coding: utf-8 -*- # Module: LibraryExporter # Created on: 13.01.2017 import os import re import time import threading import xbmc import xbmcgui import xbmcvfs import requests from utils import noop from KodiHelper import KodiHelper try: import cPickle as pickle except: import pickle ...
StarcoderdataPython
1690874
#!python3 # -*- coding:utf-8 -*- # author: difosschan # __all__ = ( 'run_shell', 'get_file_info', 'using' ) import os from typing import * ## Improved from <https://github.com/difosschan/difoss-pybase.git> from subprocess import Popen, PIPE import platform # @return return_code, stdout, stderr def run_she...
StarcoderdataPython
3319704
<filename>test/acoustics/3d/acoustics.py #!/usr/bin/env python # encoding: utf-8 import numpy as np def acoustics3D(iplot=False,htmlplot=False,use_petsc=False,outdir='./_output',solver_type='classic',test='hom'): """ Example python script for solving the 3d acoustics equations. """ if use_petsc: ...
StarcoderdataPython
96969
<gh_stars>1-10 #!/usr/bin/env python # -*- coding:utf-8 -*- # *********************************************************# # @@ScriptName: mongo.py # @@Author: Fang.Li<<EMAIL>> # @@Create Date: 2013-07-10 10:16:52 # @@Modify Date: 2014-03-13 18:44:40 # @@Function: # ******************************************************...
StarcoderdataPython
10553
<reponame>dongyan1024/overtime<filename>tfl_data.py<gh_stars>1-10 import overtime as ot times = ['14:00','14:05', '14:10', '14:15', '14:20', '14:25', '14:30', '14:35', '14:40', '14:45', '14:50', '14:55'] tfl_data = ot.TflInput(['victoria', 'central', 'bakerloo', 'piccadilly'], ['inbound', 'outbound'], times)
StarcoderdataPython
3317183
<gh_stars>10-100 import struct import typing import collections.abc from .etc import TypeSignature, EncodeError encoders = {} def register(input_type: collections.abc.Sequence) -> typing.Callable: """ simple decorator for type dispatch """ def decorator(function): if input_type in encoders:...
StarcoderdataPython
3347692
<gh_stars>1-10 # automatically generated by the FlatBuffers compiler, do not modify # namespace: gdf import flatbuffers class gdf_column(object): __slots__ = ['_tab'] @classmethod def GetRootAsgdf_column(cls, buf, offset): n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) ...
StarcoderdataPython
1600117
<reponame>y0-causal-inference/y0 # -*- coding: utf-8 -*- """A parser for causaleffect probability expressions based on :mod:`pyparsing`.""" from pyparsing import ( Group, Optional, ParseResults, Suppress, Word, alphanums, alphas, delimitedList, nums, ) from ..craig.utils import _m...
StarcoderdataPython
4838912
<filename>inversion/DataIO.py import json import os import random import warnings import numpy as np from inversion.optimizators.optimizations import optimizers_dict from objects.seismic.seismogram import Seismogram, Trace from obspy_edited import segy parameters_invers_1 = [ 'Km', 'Gm', 'rho_m', 'K...
StarcoderdataPython
1730441
#!/usr/bin/env python # Name: utils.py # Time:9/27/16 2:57 PM # Author:luo1fly from xml.etree.ElementTree import ElementTree, ElementTree, Element, SubElement, tostring from PIL import Image import subprocess import os import time # import custom modules above ROOT_PATH = '/www/htdocs' def generate_xml_by_sku(sku_...
StarcoderdataPython
3237004
<reponame>hazelcast-incubator/hazelcast-python-client __author__ = 'jonathanbrodie' import ctypes ''' Helper module to be used with codecs to make sure Python stuff gets explicitly converted to certain data types ''' def encodeboolean(bool): if bool is False: return bytearray(ctypes.c_uint8(0)) else:...
StarcoderdataPython
156658
<gh_stars>0 def diff_tests(input_files): tests = [] updates = [] for input_file in input_files: genrule_name = "gen_{}.actual".format(input_file) actual_file = "{}.actual".format(input_file) native.genrule( name = genrule_name, srcs = [input_file], ...
StarcoderdataPython
151521
import scipy.misc as misc import torch import copy import torchvision.models as models import numpy as np import torch.nn as nn import torch.nn.functional as F # FCN Net model class for semantic segmentation ##############################################This is a standart FCN with the lat layer split into prediction o...
StarcoderdataPython
1623556
import taco.common.exceptions class AutoScalerWrapperException(taco.common.exceptions.DataDictException): pass # --- Table --- class TargetRegistrationException(AutoScalerWrapperException): def __init__(self, service_namespace, resource_id, exc): super().__init__('Failed to register auto scaler', ...
StarcoderdataPython
3378094
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.utils.timezone from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('coding', '00...
StarcoderdataPython
131459
<reponame>flyinactor91/AVWX-Engine<gh_stars>10-100 """ """ # pylint: skip-file # mypy: ignore-errors # stdlib from datetime import date from typing import List # module from avwx.current.base import Reports from avwx.parsing import sanitization from avwx.structs import AirepData def parse(report: str, issued: date...
StarcoderdataPython
3280695
<gh_stars>1-10 # Copyright (C) 2017 Beijing Didi Infinity Technology and Development Co.,Ltd. # 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....
StarcoderdataPython
1680241
"""Module that contains helpers related to pagination in the REST API.""" from flask_restplus import fields from medtagger.api import api PAGINATION = { 'pagination': fields.Nested(api.model('Pagination', { 'page': fields.Integer(description='Page number'), 'per_page': fields.Integer(description=...
StarcoderdataPython
3346246
import urllib import os import json from bson import ObjectId from flask import Flask, jsonify, request, Response from flask_cors import CORS from dotenv import load_dotenv from pymongo import MongoClient from better_profanity import profanity # Load environment variables from our .env file load_dotenv() # Declare a...
StarcoderdataPython
111650
# -*- coding: utf-8 -*- # Generated by Django 1.11.27 on 2020-01-23 07:02 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('icds_reports', '0163_update_agg_awc_monthly_view'), ] operations = [ migra...
StarcoderdataPython
3295657
# MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ import frappe.sessions from response import build_response,report_error import api_handler import json from rest_api_methods import create_customer def handle(): try: frappe.response['X_ERROR_CODE'] = "02" f...
StarcoderdataPython
1720841
<filename>mogan/scheduler/filter_scheduler.py # Copyright (c) 2011 OpenStack Foundation # 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....
StarcoderdataPython
1628924
<filename>tools/BuiltinFilesToC.py import os def every_file_in_dir(dir): result = [] for root, dirs, files in os.walk(dir): for file in files: result.append(os.path.join(root, file)) return result def builtin_files_to_c(localDir, hostedPrefix): out = [] out.append("// This...
StarcoderdataPython
3259030
r""" Extending `py-fmas` by `optfrog` spectrograms ============================================= This examples shows how to use the `py-fmas` library code in conjunction with the optFrog spectrogram tool. In particular, the example details a numerical experiment performing pulse propagation in terms of the simplified...
StarcoderdataPython
99892
<reponame>jingwangian/aiven import psutil import json import logging import psycopg2 from datetime import datetime from dataclasses import dataclass logger = logging.getLogger(__name__) @dataclass class CPUMetric: name = 'cpu_metric' machine_id: int user: float nice: float system: float idle...
StarcoderdataPython
165498
#TODO: Write and run tests of regression and classification
StarcoderdataPython
1673417
import os import time import shutil from collections import deque from datetime import timedelta, datetime from math import floor import numpy as np import scipy.misc import tensorflow as tf TF_VERSION = list(map(int, tf.__version__.split('.')[:2])) class DenseNet: # ------------------------------------------...
StarcoderdataPython
1763688
length = 2 breadth = 5 area = length*breadth print("area is " + str(area)) print ('perimeter is ' + str(2 * (length + breadth)))
StarcoderdataPython
3334900
<reponame>jlangdev/falconpy """ _______ __ _______ __ __ __ | _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----. |. 1___| _| _ | | | | _ | 1___| _| _| | <| -__| |. |___|__| |_____|________|_____|____ |____|__| |__|__|__|_____| |: 1 | ...
StarcoderdataPython
4804475
#!/usr/bin/python # -*- coding: utf-8 -*- # --------------------------------------------------------------------- # Copyright (c) 2012 <NAME>. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # ...
StarcoderdataPython
1773347
<gh_stars>0 #!/usr/bin/env python3 import re import os import argparse from glob import glob from utils import sync from bmt import Bmt class Iozone(Bmt): def __init__(self, size='64M', record='1M', threads=4, **kwargs): super().__init__(**kwargs) self.name = 'IOZONE' s...
StarcoderdataPython
98430
import pytest from django.core.cache import cache from rest_framework.test import APIClient from environments.identities.models import Identity from environments.identities.traits.models import Trait from environments.models import Environment from features.feature_types import MULTIVARIATE from features.models import...
StarcoderdataPython
51493
<reponame>mesnardo/cuIBM """ Calls VisIt in batch mode to generate .png files of the 2D field contour. cli: visit -nowin -cli -s plotField2dVisIt.py <arguments> """ import os import sys import math import argparse sys.path.append(os.environ['SNAKE']) from snake import miscellaneous def parse_command_line(): """ ...
StarcoderdataPython
1797901
import logging from maxosc.sender import Sender class OscLogHandler(logging.Handler): def __init__(self, sender: Sender, log_level: int = logging.INFO, log_format: str = '%(levelname)s %(message)s'): super().__init__() self.sender: Sender = sender self.setLevel(log_level) self.set...
StarcoderdataPython
3235168
import pygame, sys, math, random, time from pygame.locals import* pygame.init() FPS = 25 fpsClock = pygame.time.Clock() #set up window windowX = 1080 windowY = 720 DISPLAYSURF = pygame.display.set_mode((windowX,windowY)) pygame.display.set_caption('graphs') font = pygame.font.SysFont('consolas',20) #set up...
StarcoderdataPython
1689463
import unittest import torch import torch_testing as tt from all import nn from all.core import StateArray from all.approximation import VNetwork, FeatureNetwork from all.memory import NStepAdvantageBuffer class NStepAdvantageBufferTest(unittest.TestCase): def setUp(self): torch.manual_seed(1) sel...
StarcoderdataPython
4820223
'''METHOD TO FIND THE TEMPLATE ON THE LARGE IMAGE''' import cv2 as cv import numpy as np import matplotlib.pyplot as plt img = cv.imread('bird.jpg',0) #'''IMAGE''' frame = img[345:678,266:466] #'''TEMPLATE''' h,w = frame.shape res = cv.matchTemplate(img,frame,cv.TM_CCOEFF_NORMED) loc = np.where(res>=0.97)...
StarcoderdataPython
29477
#!/cm/shared/languages/python-3.3.2/bin/python # submit script for submission of mizuRoute simualtions # <NAME> Oct 29 2019 # # call this script from 'run_mizuRoute_templated_mswep050calib.py which creates a qsub job to submit to the HPC queue # This script is actually called from 'call_pythonscript.sh' (which is need...
StarcoderdataPython
3342672
from __future__ import division import itertools as it import os import utils as ut keys = "<KEY> Hs-Mm Hs-Nv Hs-Sp Hs-Sc Hs_uni-Ce_uni Ce-Dm Ce-Mm Ce-Nv Ce-Sp Sp-Dm Sp-Mm Sp-Nv Mm-Dm Dm-Nv Hs-Xl Hs-X2 Hs-X3 Hs-Pf Hs-Tg".split() def odict(from_sp, to_sp): """ Load a dict from file, eg: {HsProt1: set([CePr...
StarcoderdataPython
152930
<gh_stars>0 from __future__ import annotations import logging import math from typing import Union, Optional class Node: def __init__(self): self.parent: Union[Node, None] = None self.left: Union[Node, None] = None self.right: Union[Node, None] = None def explode(self, depth=0) -> b...
StarcoderdataPython
1654537
<filename>bleson/beacons/mesh.py from bleson.core.roles import Advertiser from bleson.core.types import Advertisement from bleson.interfaces.adapter import Adapter from bleson.logger import log class MeshBeacon(Advertiser): def __init__(self, adapter, beacon_type: bytes, data: bytes): super().__init__(ada...
StarcoderdataPython
114554
out_data = b"\x1c\x91\x73\x94\xba\xfb\x3c\x30" + \ b"\x3c\x30\xac\x26\x62\x09\x74\x65" + \ b"\x73\x74\x31\x2e\x74\x78\x74\x5e" + \ b"\xc5\xf7\x32\x4c\x69\x76\x65\x20" + \ b"\x66\x72\x65\x65\x20\x6f\x72\x20" + \ b"\x64\x69\x65\x20\x68\x61\x72\x64" + \ ...
StarcoderdataPython
3337365
import os import sys import argparse import importlib import numpy as np import tensorflow as tf import pdb BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(BASE_DIR) sys.path.append(os.path.join(BASE_DIR, '..')) sys.path.append(os.path.join(BASE_DIR, '../utils')) import provider import provider_ri...
StarcoderdataPython
1697106
import urllib2 from config import * #off bmc p = urllib2.HTTPPasswordMgrWithDefaultRealm() p.add_password(None, url, username, password) handler = urllib2.HTTPDigestAuthHandler(p) opener = urllib2.build_opener(handler) urllib2.install_opener(opener) page = urllib2.urlopen(url).read() #time.sleep(1) #page = urllib2....
StarcoderdataPython
198035
<gh_stars>1-10 # ##### 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 pro...
StarcoderdataPython
3340827
import csv import json import re import sys, os import requests from biorun import utils from biorun.libs import placlib as plac logger = utils.logger # SRR numbers: SRR5260547 SRR = re.compile(r'(ERR|SRR|DRR)\d+') # Bioproject numbers: PRJNA374918 PRJ = re.compile(r'PRJ([A-Z])+\d+') # Genbank accessions: NC_0455...
StarcoderdataPython
167052
#Three character NHGIS codes to postal abbreviations state_codes = { '530':'WA', '100':'DE', '110':'DC', '550':'WI', '540':'WV', '150':'HI', '120':'FL', '560':'WY', '720':'PR', '340':'NJ', '350':'NM', '480':'TX', '220':'LA', '370':'NC', '380':'ND', '310':'NE', '470':'TN', '360':'NY', '420':'PA', '02...
StarcoderdataPython
1635945
<reponame>dshea89/luminoth import numpy as np import tensorflow.compat.v1 as tf from luminoth.utils.bbox_overlap import bbox_overlap_tf, bbox_overlap class BBoxOverlapTest(tf.test.TestCase): """Tests for bbox_overlap bbox_overlap has a TensorFlow and a Numpy implementation. We test both at the same time...
StarcoderdataPython
3326550
import os,sys,time from unittest_find import unittest import array import numpy as np import chroma.api as api api.use_cuda() #api.use_opencl() from chroma.sim import Simulation from chroma.event import Photons import chroma.event as event from chroma.geometry import Surface from chroma.uboone.uboonedet import ubooneDe...
StarcoderdataPython
32971
<reponame>ondewo/ondewo-csi-client-python<filename>examples/multi_client_example.py #!/usr/bin/env python # coding: utf-8 # # Copyright 2021 ONDEWO GmbH # # 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 Lic...
StarcoderdataPython
1600988
# -*- coding: utf-8 -*- import requests from urllib.parse import urljoin def make_url(base, part): """ Helper method for URL consistency. Ensures a trailing slash is present. """ url = urljoin(base, part) if not url.endswith('/'): url += '/' return url class Person: resource_url...
StarcoderdataPython
3393607
<reponame>bintulab/storm-analysis #!/usr/bin/env python """ Simple Python interface to fft_fit.c. Hazen 10/17 """ import ctypes import numpy from numpy.ctypeslib import ndpointer import os import sys import storm_analysis.sa_library.ia_utilities_c as utilC import storm_analysis.sa_library.loadclib as loadclib import...
StarcoderdataPython
172460
import os import pytest from pathlib import Path from pydantic import ValidationError from BALSAMIC.utils.models import ( VCFAttributes, VarCallerFilter, QCModel, VarcallerAttribute, AnalysisModel, SampleInstanceModel, ReferenceUrlsModel, ReferenceMeta, UMIworkflowConfig, UMIParamsCommon, UMIParamsUMIextr...
StarcoderdataPython
123154
<reponame>ZhuofanXie/Copulas from functools import partial import numpy as np from scipy.optimize import brentq from scipy.special import ndtr from scipy.stats import gaussian_kde from copulas import EPSILON, scalarize, store_args from copulas.univariate.base import BoundedType, ParametricType, ScipyModel class Gau...
StarcoderdataPython
1776971
from textblob import TextBlob from textblob.sentiments import NaiveBayesAnalyzer def analyze(query): sentiments = [] text = query['text'] general_score = { "polarity": 0, "subjectivity": 0 } blob = TextBlob(text) for sentence in blob.sentences: sentiments.append({ ...
StarcoderdataPython
1642160
from os import path from unittest.mock import MagicMock from piu.cli import validate_ssh_key, check_ssh_key def test_validate_ssh_fallback(monkeypatch): mock_exit = MagicMock() monkeypatch.setattr("sys.exit", mock_exit) fallback_path = path.join(path.abspath(path.dirname(__file__)), "resources/id_rsa_fal...
StarcoderdataPython
159222
#!/usr/bin/env python # -*- encoding: utf-8 -*- # 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...
StarcoderdataPython
1737082
<reponame>dssantos/Cloud-Energy-Saver<gh_stars>0 #coding: utf-8 import subprocess, mac from subprocess import Popen, PIPE, STDOUT def wake(host): mac_list = mac.get(host) mac_address = '' for mac_address in mac_list: command = "sudo etherwake -i eno1 %s" %mac_address output = subprocess.check_output(command, ...
StarcoderdataPython
3219048
import numpy as np from ..normalizations import minmax_normalization from ..distance_metrics import euclidean from .mcda_method import MCDA_method class TOPSIS(MCDA_method): def __init__(self, normalization_method = minmax_normalization, distance_metric = euclidean): """ Create the TOPSIS method o...
StarcoderdataPython
1658828
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright 2019 SAP SE or an SAP affiliate company. All rights reserved # ============================================================================ """ Abstract Writer """ from __future__ import absolute_import from __future__ import division from __future__ import print_...
StarcoderdataPython
4831101
#Ref: <NAME> """ Code tested on Tensorflow: 2.2.0 Keras: 2.4.3 dataset: https://finance.yahoo.com/quote/GE/history/ Also try S&P: https://finance.yahoo.com/quote/%5EGSPC/history?p=%5EGSPC """ import numpy as np from keras.models import Sequential from keras.layers import LSTM from keras.layers import Dense, Dro...
StarcoderdataPython
1706311
<gh_stars>100-1000 """ This file defines general utility functions and classes. """ import math import numpy as np # import sys # # sys.path.append('/home/rkojcev/ros_python3/devel/lib') import PyKDL as kdl class BundleType(): """ This class bundles many fields, similar to a record or a mutable namedtuple...
StarcoderdataPython
4823088
<gh_stars>1-10 from utils import tab_printer from gpn import GPNTrainer from parser import parameter_parser from fine_tune import finetune_GPN import networkx as nx def main(): """ Parsing command line parameters, reading data, fitting and scoring a GPN model. """ args = parameter_parser() tab_prin...
StarcoderdataPython
82632
# -*- coding: utf-8 -*- ''' Created on 1983. 08. 09. @author: <NAME>, CMBU Specialist in Korea, VMware [<EMAIL>] ''' name = 'Project' # custom resource name sdk = 'vra' # imported SDK at common directory inputs = { 'create': { 'VraManager': 'constant' }, 'read': { }, 'upda...
StarcoderdataPython
3392830
<filename>tests/conftest.py import pytest import sys import logging from grpc_server.common.utils import (get_current_time) sys.path.append('.') @pytest.fixture(scope='session') def snappiserver(): """Demonstrates creating Mock Snappi Servers. """ from .snappiserver import SnappiServer pytest.snappise...
StarcoderdataPython
1699460
<reponame>senadkurtisi/ml-tracking-ops<filename>setup.py import os import io from setuptools import setup def read(path, encoding="utf-8"): path = os.path.join(os.path.dirname(__file__), path) with io.open(path, encoding=encoding) as fp: return fp.read() NAME = "ml_tracking_ops" AUTHOR = "<NAME>" V...
StarcoderdataPython
142317
from unittest import TestCase from datetime import datetime import django from django.urls import reverse from django.utils import timezone from faker import Faker from rest_framework.test import APIClient from rest_framework import status from core.models import WatchListModel from watchlist_app.api.serializers impo...
StarcoderdataPython
4820501
# def number_increment(numbers): # def increase(): # nonlocal numbers # numbers = [x + 1 for x in numbers] # # def get(): # return numbers # # return { # 'increase': increase, # 'get': get, # } # # operations = number_increment([1, 2, 3]) # operation...
StarcoderdataPython
1709341
import os import numpy as np from array import array from sklearn.metrics import mean_absolute_error from skmultiflow.data import RegressionGenerator from skmultiflow.trees import HoeffdingTreeRegressor from difflib import SequenceMatcher def test_hoeffding_tree_regressor(): stream = RegressionGenerator(n_samples...
StarcoderdataPython
3254881
import os import pandas as pd import sandy __author__ = "<NAME>" __all__ = [ "ELEMENTS", "METASTATES", "NATURAL_ABUNDANCE", "abundance_per_element", "expand_za", "expand_za", "za2latex", "zam2latex", ] pd.options.display.float_format = '{:.5e}...
StarcoderdataPython