id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
2719
<reponame>Qfabiolous/QuanGuru<gh_stars>0 # TODO turn prints into actual error raise, they are print for testing def qSystemInitErrors(init): def newFunction(obj, **kwargs): init(obj, **kwargs) if obj._genericQSys__dimension is None: className = obj.__class__.__name__ print(c...
StarcoderdataPython
3585921
# -*- coding: utf-8 -*- import os import sys from setuptools import setup project_dir = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(project_dir, 'README.md'), 'r') as f: long_description = f.read() setup( name='gooee-pyutils', version='0.1.0', packages=['gooee_utils'], packa...
StarcoderdataPython
1685319
from cdstarcat.catalog import Object, Bitstream def test_split_ids(): from pydictionaria.util import split_ids assert split_ids('c, b; b, a.') == ['a.', 'b', 'c'] def test_MediaCatalog(tmpdir): from pydictionaria.util import MediaCatalog with MediaCatalog(str(tmpdir)) as mcat: assert 'md5'...
StarcoderdataPython
6450537
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
StarcoderdataPython
8172996
<filename>tests/test_options_in_viewfunc.py # -*- coding: utf-8 -*- # @Author : llc # @Time : 2022/5/15 14:19 import pytest from flask_openapi3 import APIBlueprint, OpenAPI app = OpenAPI(__name__) app.config["TESTING"] = True api = APIBlueprint( '/book', __name__, url_prefix='/api', ) @pytest.fixt...
StarcoderdataPython
5051695
import test_setup # noqa import StringIO import rabbit_droppings import unittest class TestReaderWriter(unittest.TestCase): def test_round_trip(self): path = test_setup.make_temp_path() output = open(path, "w") file_writer = rabbit_droppings.Writer(output) file_writer.write(self...
StarcoderdataPython
151720
<reponame>rohitit09/store_app<filename>storeapp/apps/store/models.py from django.db import models from apps.user.models import StoreUser # Create your models here. class Category(models.Model): name=models.CharField(max_length=255) def __str__(self): return self.name class Meta: verbose_na...
StarcoderdataPython
1860038
from django.conf.urls import include, url urlpatterns = [ url(r"^", include("pinax.referrals.urls", namespace="pinax_referrals")), ]
StarcoderdataPython
365070
<reponame>fancent/PHY407 """ This file takes the height data of Hawaii and perform gradient calcualtion and plotting the result in a contour graph. Note that this file takes the code given in lab 3 solution and we did grouping and modification to gurantee correctness. """ import matplotlib.pyplot as plt import n...
StarcoderdataPython
8025880
import os from getjson import getjson from microprediction import MicroWriter write_key = os.environ.get('WRITE_KEY') or os.environ.get('write_key') # GitHub action needs to set env variable. You need to create a GitHub secret called WRITE_KEY mw = MicroWriter(write_key=write_key) assert mw.key_difficulty(mw.write_...
StarcoderdataPython
8158230
import kineticfun import autotst.species import autotst.reaction import autotst.calculator.gaussian N = kineticfun.get_num_reactions() h_abstractions = [] for reaction_index in range(0, N): reaction_smiles = kineticfun.reaction_index2smiles(reaction_index) if "[C-]#[O+]" in reaction_smiles: # might be able ...
StarcoderdataPython
1862696
<filename>src/CycleGAN/models_modified.py ''' Deprecated. Need tune parameter for interpolation + conv Based on original CycleGAN model defined in models.py Modifications are made: 1. Tansconv -> upsample + conv 2. Use dim_lst to define channel numbers. ''' import torch.nn as nn import torch.nn.functional as F class...
StarcoderdataPython
5138572
<gh_stars>0 print("Uma imagem de um cachorro...") print(" 0____ ") print(" |||| ") print(''' Uma imagem de um cachorro... 0____ |||| ''')
StarcoderdataPython
236514
<gh_stars>0 # Se quiser uma contagem de 6: 0 a 6 ou 1 a 7 ou 2 a 8, pois conta do 0 ao 5 e no 6 para for c in range(1, 7): print(c) print('FIM') print('-=-'*10) # -1 serve para contar ao contrário for c in range(6, 0, -1): print(c) print('FIM') print('-=-'*10) # O terceiro valor resulta é o salto ou manipulaç...
StarcoderdataPython
4971389
<filename>backend/apps/clients/viewsets.py # Rest Framework from rest_framework import viewsets from rest_framework.response import Response from rest_framework.permissions import IsAuthenticated # Client models from apps.clients.models import ClientModel # Client serializers from apps.clients.serializers import Clie...
StarcoderdataPython
352071
""" Filename: fix_argo.py Author: <NAME>, <EMAIL> Description: Take the Scripps Institution of Oceanography gridded argo temperature or salinity data (from http://www.argo.ucsd.edu/Gridded_fields.html) and make the file attributes more consistent with CMIP5 """ # Import general P...
StarcoderdataPython
6498640
import logging import builtins import json def decode(encoded_data): """Decode an ESON string to the original object""" data = json.loads(encoded_data) return __decode_types(data) def __decode_types(data): if isinstance(data, dict): _data = dict() for encoded_key, encoded_value in da...
StarcoderdataPython
3261303
# -*- coding: utf-8 -*- """Dokumentation. Beschreibung """ from __future__ import annotations import numpy as np from thermd.core import ( BaseStateClass, # BaseSignalClass, MediumBase, MediumHumidAir, ) from thermd.fluid.core import ( BaseFluidOneInletTwoOutlets, BaseFluidOneInletThreeOutl...
StarcoderdataPython
94864
<reponame>proteneer/timemachine import sympy as sp x0, y0, z0, w0 = sp.symbols("x0 y0 z0 w0") x1, y1, z1, w1 = sp.symbols("x1 y1 z1 w1") x2, y2, z2, w2 = sp.symbols("x2 y2 z2 w2") x3, y3, z3, w3 = sp.symbols("x3 y3 z3 w3") NDIMS = 4 def get_dim(arg): if arg[0] == "x": return str(0) elif arg[0] == "y...
StarcoderdataPython
1603104
from django.shortcuts import render from website.models import Cadavre from django.views import generic from website.forms import SendCadavrePartForm from django.views.decorators.http import require_http_methods from django.shortcuts import get_object_or_404 from django.http import HttpResponseRedirect from django.urls...
StarcoderdataPython
11269544
import os.path import re from c_analyzer_common import DATA_DIR from c_analyzer_common.info import ID from c_analyzer_common.util import read_tsv, write_tsv IGNORED_FILE = os.path.join(DATA_DIR, 'ignored.tsv') IGNORED_COLUMNS = ('filename', 'funcname', 'name', 'kind', 'reason') IGNORED_HEADER = '\t'.join(IGNORED_CO...
StarcoderdataPython
1624517
# View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg # Youku video tutorial: http://i.youku.com/pythontutorial import time print(time.localtime()) import time as t print(t.localtime()) from time import localtime, t...
StarcoderdataPython
66885
# 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, Sequence, Union from . import _utilities...
StarcoderdataPython
11320643
<filename>sys_simulator/channels/__init__.py import numpy as np import scipy from scipy.stats import nakagami, rayleigh from scipy import constants class Channel: def __init__(self, *kwargs): pass def large_scale(self, *kwargs): pass def pathloss(self, *kwargs): pass def sma...
StarcoderdataPython
5029306
<reponame>bulbaME/ConGL import sys import PIL.Image as Img from tkinter import * from tkinter import filedialog as FD FG_RED = 0x0004 FG_GREEN = 0x0002 FG_BLUE = 0x0001 BG_RED = 0x0040 BG_GREEN = 0x0020 BG_BLUE = 0x0010 def fileWrite(path, code): file = open(path, 'wb') file.seek(0) file.write(code.encod...
StarcoderdataPython
6686245
<reponame>JorgeCeja/posenet-pytorch from posenet.converter.tfjs2pytorch import * from posenet.converter.wget import *
StarcoderdataPython
1882479
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2019-05-11 21:24 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('image', '0002_location'), ] operations = [ ...
StarcoderdataPython
6531561
import ida_bytes import ida_bytes import ida_bytes # # scripts/find_virtual_method_overrides.py # <NAME> # # Use ida_kernelcache to find classes that override a virtual method. # def kernelcache_find_virtual_method_overrides(classname=None, method=None): import idc import idaapi import ida_kernelcache as k...
StarcoderdataPython
9629428
from ovos_utils import create_daemon from ovos_utils.messagebus import Message from jarbas_hive_mind.slave.terminal import HiveMindTerminalProtocol, HiveMindTerminal from ovos_utils.log import LOG from mattermost_bridge.mmost import MMostBot import asyncio platform = "JarbasMattermostBridgeV0.1" class JarbasMatterm...
StarcoderdataPython
206538
def Setup(Settings,DefaultModel): # set1-test_of_models_against_datasets/models_30m_640px.py Settings["experiment_name"] = "set1c_Models_Test_30m_640px" Settings["graph_histories"] = ['together', [0,1], [1,2], [0,2]] n=0 # 5556x_minlen30_640px 5556x_minlen20_640px 5556x_reslen20_299px 5556x_resle...
StarcoderdataPython
6400719
import tensorflow as tf input_size = 224 def one_hot_encode(image, label, num_classes: int): return image, tf.one_hot(label, num_classes) def load_img(filename: str, label, size: int): image_string = tf.io.read_file(filename) image_decoded = tf.image.decode_jpeg(image_string, channels=3) image = tf...
StarcoderdataPython
11376095
<gh_stars>0 #py3.7 #https://docs.python.org/2/library/struct.html import struct with open('mplus-2p-medium.ttf', 'rb') as fp: fontCont = memoryview(fp.read()) header = fontCont[:12] print(bytes(header)) fmt = '>HHHHHH' #> because TTF is big endian #https://docs.python.org/2/library/struct.html#format-characters ...
StarcoderdataPython
11341917
<filename>graph_dist.py import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec data_arr = [ 'R352_D993.dat', 'R555_D529.dat','D1168_R851.dat','E873_R933.dat'] color_arr = ['blue'] * 4 legend_arr = [ 'R352_D993.dat', 'R555_D529.dat','D1168_R851.dat','E873_R933.dat'] plt.figure(figs...
StarcoderdataPython
211588
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-04-04 00:28 from __future__ import unicode_literals from __future__ import absolute_import from django.db import migrations from corehq.apps.hqadmin.management.commands.cchq_prbac_bootstrap import cchq_prbac_bootstrap class Migration(migrations.Migration...
StarcoderdataPython
3418025
<filename>day5/量化系统--入门.py '#######################################################################################################################' """ 趋势跟踪与均值回复 趋势跟踪与均值回复是很多量化策略的理论基础 1、趋势跟踪: 趋势跟踪模型里,假设之前的价格的上涨预示着之后一段时间内也会上涨,很多交易策略都是围绕着趋势跟踪模型,比如各种向上突破信号、分批 跟随趋势建仓策略等交易策略。使用趋势跟踪一定要做好止损,保护好资金,要认识到趋势跟踪策略将导致胜率降低,即亏...
StarcoderdataPython
5056778
import inspect import os import pytest rootdir = os.path.dirname(__file__) def pytest_pycollect_makeitem(collector, name, obj): if (inspect.isclass(obj) and obj.__name__ == 'Solution' and hasattr(obj, 'tests')): # The solution will be the only defined method on the class attrname, _ =...
StarcoderdataPython
9673318
#!/usr/bin/python3 from PIL import Image import json import os import re import sys # Getting palette # /absolute/path/to/Pxls convertpath = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../..')) # /absolute/path/to/Pxls/pxls.conf configpath = convertpath + '\\pxls.conf' tr...
StarcoderdataPython
11205730
<reponame>pramttl/adaptive-flashcards-algorithm """ 2 cards are randomly drawn without replacement (sampled) from the set of cards Let's say the user takes 10 attempts to learn the first card and 5 seconds to learn the second card. The simulation will print the cards generated, mle """ MAX_ATTEMPTS_CARD1 = 10 MAX_ATT...
StarcoderdataPython
88215
import numpy as np # from scp import SCP from main_komo import run_komo_standalone from utils_motion_primitives import sort_primitives, visualize_motion, plot_stats import robots import yaml import msgpack import multiprocessing as mp import tqdm import itertools import argparse import subprocess import tempfile from p...
StarcoderdataPython
3225418
<gh_stars>0 from .baby_robot_env_v0 import BabyRobotEnv_v0 from .baby_robot_env_v1 import BabyRobotEnv_v1 from .baby_robot_env_v2 import BabyRobotEnv_v2 from .baby_robot_env_v3 import BabyRobotEnv_v3 from .baby_robot_env_v4 import BabyRobotEnv_v4 from .baby_robot_env_v5 import BabyRobotEnv_v5 from .baby_robot_env_v6 im...
StarcoderdataPython
257424
<gh_stars>1-10 from __future__ import absolute_import, division, print_function, unicode_literals import json from .models import BenchmarkResult def store_result(data): logs = json.loads(data['logs']) for log in logs: store_single_entry(log) return {"status": "success", "count": len(logs)} ...
StarcoderdataPython
3557712
<reponame>Cookie-YY/cooshow<filename>utils/parse_compute.py from datetime import datetime, timedelta import re def parse_date_add_or_sub(now, operator, content): now = datetime.strptime(now, "%Y/%m/%d") if operator == "+": if "m" in content: content = content.replace("m", "") r...
StarcoderdataPython
3353235
<reponame>jpoweseas/oh-queue<filename>oh_queue/views.py<gh_stars>0 import datetime import functools import collections import pytz from flask import render_template, url_for from flask_login import current_user from flask_socketio import emit from oh_queue import app, db, socketio from oh_queue.auth import refresh_us...
StarcoderdataPython
5109439
<reponame>Envinorma/envinorma-data from envinorma.models.text_elements import Table, Title from envinorma.structure import _build_enriched_alineas, _extract_highest_title_level, build_structured_text def test_build_enriched_alineas(): assert _build_enriched_alineas(['Hello'])[0][0].text == 'Hello' assert _bui...
StarcoderdataPython
11254963
#!/usr/bin/python3 import datetime import pandas as pd from scipy import stats from alpha_vantage.timeseries import TimeSeries from currency_converter import CurrencyConverter API_KEY = "<KEY>" symbols = ["UBER"] class Data: def __init__(self, key, symbol): """Initialize variables and Alpha Vantage AP...
StarcoderdataPython
64881
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- 'a login model' __author__='<NAME>219' from selenium import webdriver; login_url='https://www.itjuzi.com/user/login' def login(Explorer,flag):#flag表示是否是第一次调用 if flag==False: Explorer.find_element_by_id('loginurl').click() pass; else...
StarcoderdataPython
3372516
# This script parses epa data for the mlbozone project # Importing required modules import pandas as pd import zipfile import glob from geopy.distance import geodesic # Defining username + filpeath username = '' filepath = 'C:/Users/' + username + '/Documents/Data/mlbozone/' # Create a list of all fi...
StarcoderdataPython
75220
import re import pymel.core as pm from cleanfreak.checker import Checker class MayaSelectMixin(object): def select(self): if self.selection: pm.select(self.selection) class References(MayaSelectMixin, Checker): full_name = "References" description = "Checks for references, we want ...
StarcoderdataPython
1846008
# Generated by Django 2.2.4 on 2019-08-30 06:29 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('telweb', '0008_auto_20190829_1035'), ] operations = [ migrations.AlterField( model_name='cabine...
StarcoderdataPython
1665728
<gh_stars>0 import math import numpy as np class myPyClass: def __init__(self, x, y): self.x = x self.y = y def euclength(self): return math.sqrt(self.x*self.x + self.y*self.y) def translate(self, deltaX, deltaY): self.x += deltaX self.y += deltaY def arra...
StarcoderdataPython
11318940
<reponame>jgasteiz/javiman<filename>javiman/urls.py from django.conf.urls import include, url import session_csrf session_csrf.monkeypatch() urlpatterns = [ url(r'^_ah/', include('djangae.urls')), url(r'^csp/', include('cspreports.urls')), url(r'^auth/', include('djangae.contrib.gauth.urls', namespace='lo...
StarcoderdataPython
8048975
""" Prime digit replacements Problem 51 By replacing the 1st digit of the 2-digit number *3, it turns out that six of the nine possible values: 13, 23, 43, 53, 73, and 83, are all prime. By replacing the 3rd and 4th digits of 56**3 with the same digit, this 5-digit number is the first example having seven primes...
StarcoderdataPython
8001464
import re import os import sys import readline from nltk.corpus import stopwords class bcolors: CRED = '\33[31m' OKCYAN = '\033[96m' CBLINK = '\33[5m' OKGREEN = '\033[92m' CYELLOW = '\33[93m' ENDC = '\033[0m' DIM = '\033[90m' OKBLUE = '\033[94m' MAGENTA = '\033[35m' def moveu...
StarcoderdataPython
1967323
# -*- coding: utf-8 -*- # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 import time,traceback import re import sys, os import csv import pprint import optparse from django.core.management.base import BaseCommand from django.conf import settings from django.utils.text import slugify from filmfestival.models im...
StarcoderdataPython
9778270
# -*- coding: utf-8 -*- #! \file ./tests/test_support/test_errors.py #! \author <NAME>, <<EMAIL>> #! \stamp 2015-02-20 20:31:35 (UTC+01:00, DST+00:00) #! \project DoIt!: Tools and Libraries for Building DSLs #! \license MIT #! \version 0.0.0 #! \fdesc @pyf...
StarcoderdataPython
4614
<filename>population_estimator/curses_io.py #!/usr/bin/env python """ Module for painting output on and obtaining input from a text-based terminal window using the curses library. """ import curses import textwrap def display_string(screen, a_string, output_line): # Paints a string on a text-based terminal wind...
StarcoderdataPython
11229945
<gh_stars>1-10 # lpsrelu2.py """ Created on Fri Jun 1 23:52:11 2018 @author: <NAME> """ #import ipdb from collections import OrderedDict import torch as tc from ..utils.data import OrderedDataset from ..utils.helper import copy_params_in, to_Param, get_keys_vals from ..utils.methods import pre_weights, init_weights f...
StarcoderdataPython
6650634
<reponame>michaeldimchuk/pyvial import pytest from vial.types import LambdaContext @pytest.fixture def context() -> LambdaContext: return LambdaContext("vial-test", "1", "arn:vial-test", 128, "1", "vial-test-log", "vial-test-log")
StarcoderdataPython
8077090
<gh_stars>1-10 import os import pickle from datetime import datetime, timedelta import webbrowser import json import urllib2 import urlparse fileDir = os.path.dirname(os.path.realpath(__file__)) APP_ID = '5712831' # file, where auth data is saved AUTH_FILE = '.auth_data' def get_saved_auth_params(): access_tok...
StarcoderdataPython
11360918
# -*- coding: utf-8 -*- # # # """synth_toggle.py Yet another toggle button class Todo: """ import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gdk import cairo import math ###################################################################### class Toggle(Gtk.EventBox): def __...
StarcoderdataPython
8187985
import os import time import re FIFO = '/opt/chromis.pipe' while True: print("Opening FIFO...") filename = time.strftime("%Y%m%d-%H%M%S") outfile = open('/opt/json/' + filename + '.txt','w') with open(FIFO) as fifo: print("FIFO opened") while True: data = fifo.read() ...
StarcoderdataPython
5012323
from snipslms.shared.request_object import InvalidRequestObject, ValidRequestObject class VolumeUpRequestObject(ValidRequestObject): def __init__(self, volume_increase=None): self.volume_increase = volume_increase @classmethod def from_dict(cls, a_dictionary): invalid_request = InvalidRe...
StarcoderdataPython
12858815
import pytest from pytest_mock import MockerFixture from pystratis.api.balances import Balances from pystratis.core.types import Address from pystratis.core.networks import CirrusMain def test_all_strax_endpoints_implemented(strax_swagger_json): paths = [key.lower() for key in strax_swagger_json['paths']] for...
StarcoderdataPython
8006232
<reponame>hpi-bp1819-naumann/shift-detector from copy import deepcopy from shift_detector.precalculations.low_cardinality_precalculation import LowCardinalityPrecalculation from shift_detector.precalculations.precalculation import Precalculation from shift_detector.precalculations.text_metadata import TextMetadata fro...
StarcoderdataPython
5151578
<filename>examples/gb1/egcn.py<gh_stars>0 """Train 3D-Embedded Graph Convolution Network (EGCN) oracle. NOTE: This model is not recommened to be run on CPU as the model performs convolutional kernels computations over a large amount of 3D graphical data. Thus, it requires a lot of compute. """ import multiprocessing ...
StarcoderdataPython
6678411
# Copyright 2016 Euclidean Technologies Management LLC 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 requi...
StarcoderdataPython
4817715
<reponame>PacktPublishing/Applied-Computational-Thinking-with-Python # Import seaborn import seaborn as sns sns.set_style('darkgrid') # Load an example dataset flights = sns.load_dataset("flights") #Create the plot sns.pairplot( data=flights, )
StarcoderdataPython
8112820
<reponame>LeiSoft/CueObserve import argparse from pylint.lint import Run # list all the files that changed for the current PR # changedFilesCommand = """git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD development)""" parser = argparse.ArgumentParser(prog="LINT") parser.add_argument( "-p",...
StarcoderdataPython
11335204
<reponame>beforeuwait/myLintCode<gh_stars>0 # coding=utf-8 """ 分割回文串 描述:给定字符串 s, 需要将它分割成一些子串, 使得每个子串都是回文串. 返回所有可能的分割方案. 思路: 要注意深拷贝和浅拷贝的区别 选定一个然后开始切,是回文就继续切,直到不能切 就换下一个了 """ class Solution: """ @param: s: A string @return: A list of lists of string """ def partition(self, s): # write your...
StarcoderdataPython
99613
# coding: utf-8 # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
StarcoderdataPython
3240337
<gh_stars>10-100 """Add a video URL to talks. Revision ID: 55a2c1bad7 Revises: <PASSWORD> Create Date: 2014-08-17 11:45:59.088303 """ # revision identifiers, used by Alembic. revision = '55a2c1bad7' down_revision = '141c85333cb' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto g...
StarcoderdataPython
1610696
import json import tests import turing import pytest from urllib3_mock import Responses responses = Responses('requests.packages.urllib3') @responses.activate @pytest.mark.parametrize('num_projects', [10]) def test_list_projects(turing_api, projects, use_google_oauth): responses.add( method="GET", ...
StarcoderdataPython
3308685
#!/usr/bin/python ''' Generate Figure plot input, including promoter class occupancy ''' import numpy as np np.random.seed(9) import os import sys import glob import pandas as pd from itertools import combinations from sklearn.mixture import GaussianMixture #------------------------------------------------------------...
StarcoderdataPython
6572891
<gh_stars>0 ''' http://jsonapi.org/format/#content-negotiation-servers Server Responsibilities Servers MUST send all JSON API data in response documents with the header "Content-Type: application/vnd.api+json" without any media type parameters. Servers MUST respond with a 415 Unsupported Media Type status code if a r...
StarcoderdataPython
6583725
from jocasta.collector import setup_connectors from jocasta.command_line.setup import setup_config from pathlib import Path from jocasta.connectors.file_system import FileSystemConnector from jocasta.connectors.influx import InfluxDBConnector from jocasta.connectors.io_adafruit import IOAdafruitConnector INI_FILE = ...
StarcoderdataPython
11379832
from numpy import array, testing from luga import languages def test_sentences(text_examples): responses = languages(text_examples["text"]) pred_langs = [response.name for response in responses] pred_scores = [response.score > 0.5 for response in responses] assert pred_langs == text_examples["lang"]...
StarcoderdataPython
3252800
from django.contrib import admin # Register your models here. from .models import GarageSaleModel admin.site.register(GarageSaleModel)
StarcoderdataPython
6560228
#!/usr/bin/env python3 """ Custom request from our Director on High to provide a script which generates a PowerPoint slide set based on a specific input convention in a text file. INPUT: - Spaces at the beginning of a line (0-2) are header levels - Content is composed entirely of bulleted lists - List elements star...
StarcoderdataPython
356975
<gh_stars>0 #! /usr/bin/env python # MIT License # # Copyright (c) 2018 <NAME> # # 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 right...
StarcoderdataPython
3495744
<filename>recurrent_ics/alarm/none.py from recurrent_ics.alarm.base import BaseAlarm from recurrent_ics.serializers.alarm_serializer import NoneAlarmSerializer from recurrent_ics.parsers.alarm_parser import NoneAlarmParser class NoneAlarm(BaseAlarm): """ A calendar event VALARM with NONE option. """ ...
StarcoderdataPython
9795224
<gh_stars>10-100 # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
StarcoderdataPython
5113840
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from sys import stdout, stderr, argv import requests class Protocol: cookies = {} def __init__(self, base_url): self.base_url = base_url; def get_url(self): return self.base_url + "/export/exchange1c.php" def checkauth(self, username, ...
StarcoderdataPython
11377871
# -*- coding: utf-8 -*- """ Created on Thu Aug 18 11:47:18 2016 @author: sebalander """ # %% IMPORTS from matplotlib.pyplot import plot, imshow, legend, show, figure, gcf, imread from matplotlib.pyplot import xlabel, ylabel from cv2 import Rodrigues # , homogr2pose from numpy import max, zeros, array, sqrt, roots, d...
StarcoderdataPython
5190612
import secrets def _get_header(token): return f''' rule utils_tertiary_structure_search_{token}:''' def _get_benchmark(benchmark_out): return f''' benchmark: "{benchmark_out}"''' def _get_main(fasta_in, classes_in, fasta_sec_out, classes_sec_out, fasta_ter_out, classes_ter_out, pdb_dir, profil...
StarcoderdataPython
45725
# -------------------------------- # Name: CEBatchFBXExport.py # Purpose: Batch export of CE layers to game engine importable FBXs. # Current Owner: <NAME> # Last Modified: 7/12/2017 # Copyright: (c) Co-Adaptive # CityEngine Vs: 2017 # Python Version: 2.7 # License # Copyright 2015 <NAME> # # Licensed under the Apa...
StarcoderdataPython
1949577
<reponame>ktbyers/nornir_test<filename>nornir_test/napalm_examples/case7_mix_netmiko_napalm/napalm_netmiko_x.py from nornir import InitNornir from nornir.plugins.tasks.networking import napalm_get from nornir.plugins.tasks.networking import netmiko_send_command from nornir.core.filter import F from nornir_test.nornir_...
StarcoderdataPython
1907612
<reponame>ma6yu/Kratos<filename>applications/CoSimulationApplication/tests/co_sim_io_py_exposure_aux_files/connect_disconnect.py from KratosMultiphysics.CoSimulationApplication import CoSimIO connection_settings = CoSimIO.Info() connection_settings.SetString("connection_name", "c_d_test") connection_settings.SetInt("e...
StarcoderdataPython
217696
<gh_stars>0 begin_unit comment|'# Copyright 2012 IBM Corp.' nl|'\n' comment|'#' nl|'\n' comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may' nl|'\n' comment|'# not use this file except in compliance with the License. You may obtain' nl|'\n' comment|'# a copy of the License at' nl...
StarcoderdataPython
91753
from io import BytesIO from tds.tokens import SQLBatchStream from .base import Request class SQLBatchRequest(Request): def __init__(self, buf): """ :param BytesIO buf: """ super(SQLBatchRequest, self).__init__() self.stream = stream = SQLBatchStream() ...
StarcoderdataPython
5169918
from utils import convert_to_bags, load_data import numpy as np def get_data(folder, dataset, rep, fold): train, test = load_data(folder=folder, dataset=dataset, rep=rep, fold=fold) bags_train, labels_train = convert_to_bags(t...
StarcoderdataPython
6620609
# encoding: utf-8 from __future__ import absolute_import import logging import os from PIL import Image as PILImage, ImageFile as PILImageFile, ExifTags from datetime import datetime import exifread import imagehash import json import pytz import requests try: DEBUG = settings.DEBUG except NameError: DEBUG =...
StarcoderdataPython
1817632
from django.utils.functional import Promise from django.utils.encoding import force_text def resolve_promise(o): if isinstance(o, dict): for k, v in o.items(): o[k] = resolve_promise(v) elif isinstance(o, (list, tuple)): o = [resolve_promise(x) for x in o] elif isinstance(o, Pr...
StarcoderdataPython
377129
""" Bloomfilters are a memory efficient way of checking if an element is part of a set or not here is a pretty decent tutorial http://billmill.org/bloomfilter-tutorial/ """ from bitarray import bitarray import mmh3 class BloomFilter: def __init__(self): self.HASH_SIZE = 1000 self.bits = bitarra...
StarcoderdataPython
8190629
import os import re import sys from os.path import join from codecs import open from setuptools import setup, Extension tlsh_256 = "-DBUCKETS_256" tlsh_128 = "-DBUCKETS_128" tlsh_3b = "-DCHECKSUM_3B" here = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(here, "README.md"), encoding="utf-8") as f:...
StarcoderdataPython
3402395
<gh_stars>0 #Print MOD file events import csv import sys #Input MOD file as argument MOD = sys.argv[1] reader_mod = csv.reader(open(MOD), delimiter=' ', skipinitialspace = 1) #Range of events in input MOD file to print events_to_print = range(4972,4978) event_counter = 0 row = next(reader_mod) row_counter = 1 #Lo...
StarcoderdataPython
1817550
<reponame>SdgJlbl/ml-workshop rf_cv_scores = cross_val_score(RandomForestClassifier(), X, y, cv=10) dt_cv_scores = cross_val_score(DecisionTreeClassifier(), X, y, cv=10) print(f'Average accuracy for Decision Trees {dt_cv_scores.mean()} with a standard deviation of {dt_cv_scores.std()}') print(f'Average accuracy for R...
StarcoderdataPython
9753311
import math import point import numpy as np import time class TimeGrid(object): def __init__(self, width, height, problem): self.problem = problem self.scaling_factor = 10 self.width = width / self.scaling_factor self.height = height / self.scaling_factor self.grid = np.z...
StarcoderdataPython
1838383
# Copyright Amazon.com, Inc. or its affiliates. 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 appli...
StarcoderdataPython
6486418
<filename>positions/urls.py<gh_stars>1-10 from django.conf.urls import include, url from django.contrib import admin from rest_framework import routers from positions.views import PositionsViewSet from positions.views_generics import (PositionsEditView, PositionsListView, ...
StarcoderdataPython
5018290
<filename>Google/benchmarks/mask/implementations/tpu-v3-32-mask/mask_rcnn/eval_multiprocess.py # Copyright 2018 Google. 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 # ...
StarcoderdataPython