id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
6421823
<reponame>lixinsu/Lion #!/usr/bin/env python # coding: utf-8 from __future__ import (absolute_import, division, print_function, unicode_literals) import os import six import copy import spacy import logging import unicodedata import collections from shutil import copyfile import jieba import ji...
StarcoderdataPython
3385716
<gh_stars>1-10 import csv import re import sendMail ### Configuration # path to logfiles logPath = 'C:/Users/pervasive/Dropbox/<NAME>/logs/' # name of logfile to evaluate logFile = 'logFile.txt' # column to evaluate column = 2 # start counting by 0 by evaluating ### LogFile Overview ### ## 1. ID # 4. Choice ## 2...
StarcoderdataPython
8109727
try: from setuptools import setup from setuptools import Extension except ImportError: from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext import numpy ext = Extension("CyNewtonRaphson",sources=["CyNewtonRaphson.pyx"],include_dirs=[numpy.ge...
StarcoderdataPython
4830714
<reponame>rypaik/PYTHON<filename>modules/tqdm/tqdm_timeit.py import re from time import sleep from timeit import timeit # Simple demo from tqdm import trange for _ in trange(16, leave=True): sleep(0.1) # Profiling/overhead tests #BUG: filter expected str stmts = filter(None, re.split(r'\n\s*#.*?\n', __doc__)) fo...
StarcoderdataPython
3452707
# Copyright 2012 litl, LLC. Licensed under the MIT license. import logging, time from flask import Blueprint, current_app, json, request, Response, abort from werkzeug.exceptions import BadRequest, NotFound from . import github, jenkins base = Blueprint("base", __name__) @base.route("/ping") def ping(): retu...
StarcoderdataPython
1910317
<gh_stars>1-10 from zope.interface import Attribute from zope.interface import implementer from zope.interface import Interface class ISearchDoneEvent(Interface): query = Attribute("The query") total = Attribute("The total amount of results for this query") request = Attribute("Request responsible") ...
StarcoderdataPython
4979511
# Part of Odoo. See LICENSE file for full copyright and licensing details. from . import l10n_latam_identification_type from . import l10n_ar_afip_responsibility_type from . import account_journal from . import account_tax_group from . import account_fiscal_position from . import account_fiscal_position_template from ...
StarcoderdataPython
4939378
<filename>botx/collecting/collectors/mixins/default.py """Definition for mixin with default decorator.""" from functools import partial from typing import Any, Callable, Optional, Sequence, Union, cast from botx.collecting.collectors.mixins.handler import HandlerDecoratorProtocol from botx.collecting.handlers.handler ...
StarcoderdataPython
6621508
import os from time import sleep a ='\033[92m' b ='\033[91m' c ='\033[0m' def setup(): try: os.mkdir('/data/data/com.termux/files/home/.termux') except: pass key = "extra-keys = [['ESC','/','-','HOME','UP','END','PGUP'],['TAB','CTRL','ALT','LEFT','DOWN','RIGHT','PGDN']]" open('/data/d...
StarcoderdataPython
5010367
<reponame>jerrykcode/kkFileView # # This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # This file incorporates work cover...
StarcoderdataPython
37758
<reponame>IMULMUL/symbiotic #!/usr/bin/python import os import sys import re from . transform import SymbioticCC from . verifier import SymbioticVerifier from . options import SymbioticOptions from . utils import err, dbg, print_elapsed_time, restart_counting_time from . utils.utils import print_stdout from . utils.p...
StarcoderdataPython
83428
<gh_stars>1-10 import pygal from plotting.custom_styles import style from plotting.plot import Plot class EnrolmentLiveBirth: def __init__(self, engine): self.engine = engine def plot_wrong_scatter(self): scatter_plot = pygal.XY( stroke=False, style=style, show_legend=False, x_title='Live Birth Ra...
StarcoderdataPython
3256933
<gh_stars>0 # -*- coding: utf-8 -*- # 2, 10, 13, 14, 16, 17, 18, 19, 21, 23, 26, 31, 32, 35 # extra - 27: https://pdfs.semanticscholar.org/3973/ff27eb173412ce532c8684b950f4cd9b0dc8.pdf ################## # 35 - Write a program to implement a brute-force algorithm for discovering word squares, a kind of n × n crossword...
StarcoderdataPython
3337252
# lightly adapted from https://github.com/pyro-ppl/pyro/blob/dev/pyro/nn/auto_reg_nn.py from __future__ import absolute_import, division, print_function import numpy as onp from jax import random import jax.numpy as np from numpyro.contrib.nn.masked_dense import MaskedDense def sample_mask_indices(input_dim, hidd...
StarcoderdataPython
311253
<filename>app/models.py #!/usr/bin/env python3 # Written by <NAME> # https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-iv-database # Imports from app import db class User(db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String()) password = db.Column(db.Str...
StarcoderdataPython
6515602
<reponame>OpenCity1/OpenCityBot import asyncio import json import random import time from typing import Optional import discord from discord.ext import commands from Bot.cogs.utils.checks import is_guild_owner from Bot.cogs.utils.color_builder import color_dict_to_discord_color_list from Bot.cogs.utils.numbers import...
StarcoderdataPython
3367520
<filename>mode/examples/Contributed Libraries in Python/OpenCV/LiveCamTest/LiveCamTest.pyde add_library('video') add_library('opencv_processing') video = None opencv = None show_fps = False def setup(): size(640, 480) video = Capture(this, 640 / 2, 480 / 2) opencv = OpenCV(this, 640 / 2, 480 / 2) open...
StarcoderdataPython
12850472
<gh_stars>10-100 # # COPYRIGHT (C) 2002-2011 <NAME> and modified by <EMAIL> # """ .. module:: preprocess_clinvar :platform: Unix, Windows, MacOSX :synopsis: Transparent opening of compressed and uncompressed files .. moduleauthor:: ; <EMAIL> """ import os, dill, re, argparse from gcn.lib.databases.snpdb import Cli...
StarcoderdataPython
3483854
# Map 整改需要废弃代码的备份,部分功能重新实现将会参考一定原实现的代码 class Map(_GridMap): ''' 用于处理栅格类型游戏的方式,不过如果不需要单位强制栅格化 那么这里的处理也可以简单的当作一种更加规范的单位初始化/地图绘制的方式 ''' DEBUG = False class Map2D: DEFAULT_OBSTRUCT = 1 # 默认阻值 DEFAULT_GAP = 3 def __init__(self, mapw, maph): ''' ...
StarcoderdataPython
11242072
from urllib import request from pathlib import Path from ruamel.yaml import YAML, tokens, error from ruamel.yaml.comments import CommentedMap from WDL.CLI import check as check_wdl from capanno_utils.templates.tool_templates import wdl_templates, snakemake_templates, nextflow_templates from capanno_utils.helpers.get_...
StarcoderdataPython
5068031
<filename>BMI.py import re print("*******************Adult Body Mass Index (BMI) Calculator********************") m = input("Enter weight(kilograms/kg): ") h = input("Enter height(meters/m): ") def bmi(m, h): mass = re.findall(r"\d+", m)[0] height = re.findall(r"\d+", h)[0] BMI = int(mass) / (int(height) ...
StarcoderdataPython
9781673
<filename>NaiveBayes/NaiveBayes.py import numpy as np from statistics import mean, pvariance from math import pi, exp from sklearn.model_selection import train_test_split from sklearn.datasets import load_iris as iris from sklearn.naive_bayes import GaussianNB from sklearn.metrics import accuracy_score class NaiveBay...
StarcoderdataPython
9610411
""" IPython prelude code """ # # Argument parsing imports # Note: to guide animation display since people often do "Run All Cells" # import argparse # # System imports # import os import string import random import warnings from functools import * # # Import display classes/utilities # from IPython.display import dis...
StarcoderdataPython
132317
from datetime import datetime, timedelta, timezone import factory import factory.fuzzy from django.contrib.auth import get_user_model from ..models import Object, ObjectGroup, Participation, Project, Run NOW = datetime.now(tz=timezone.utc) class StaffUserFactory(factory.django.DjangoModelFactory): class Meta: ...
StarcoderdataPython
1959803
<filename>fastrunner/views/run.py import json from loguru import logger import datetime from django.core.exceptions import ObjectDoesNotExist from rest_framework.decorators import api_view, authentication_classes from fastrunner.utils import loader, response from fastrunner import tasks from rest_framework.res...
StarcoderdataPython
3274553
import math import argparse import cv2 import numpy as np def str_2_bool(v): if v.lower() in ('yes', 'true', 't', 'y', '1'): return True elif v.lower() in ('no', 'false', 'f', 'n', '0'): return False else: raise argparse.ArgumentTypeError('Boolean value expected.') def gen_border...
StarcoderdataPython
12842625
# -*- encoding: utf-8 -*- ''' @File : lr_1d.py.py @Modify Time @Author @Desciption ------------ ------- ----------- 2021/7/5 22:51 Jonas None ''' import numpy as np import math import matplotlib.pyplot as plt from scipy.stats import norm train_data = np.loadtxt("lin_reg_tr...
StarcoderdataPython
4979472
def is_notebook(): try: from IPython import get_ipython as _get_ipython if 'IPKernelApp' not in _get_ipython().config: # pragma: no cover raise ImportError("console") except: return False return True # if not is_notebook(): # import matplotlib # matplotlib.u...
StarcoderdataPython
4844718
#!/usr/bin/env python # Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import argparse import errno import json import os import re import sys import urllib import urllib2 # Where all the data lives. R...
StarcoderdataPython
8116596
<filename>tests/test_items.py import unittest from collections import OrderedDict from mbcrawl.itemloaders import ProductLoader, SkuLoader from mbcrawl.items import Product, Sku, BeibeiProduct class TestItemLoader(unittest.TestCase): def test_product_itemloader(self): loader = ProductLoader(Product()) ...
StarcoderdataPython
12837545
<filename>tests/test_utils_transition_rec_levels.py import pytest import numpy as np from covid19sim.distribution_normalization.dist_utils import lp_solve_wasserstein, lp_solution_to_transport_plan,\ get_rec_level_transition_matrix def test_lp_solve_wasserstein(): dist_0 = np.array([0.8, 0.0, 0.0, 0.2]) ...
StarcoderdataPython
11390605
<reponame>rortegaru/WFQC #!/usr/bin/env python # coding: utf-8 # In[1]: # # full_analysis_scoring_for_new_dataset.py # # #%% Imports import pandas as pd import numpy as np import glob import os import cv2 from keras.models import model_from_json # In[2]: current_dir = "/home/roberto/notebooks/WFQC/" model_dir...
StarcoderdataPython
3439662
<filename>sign/views.py from django.shortcuts import render, get_object_or_404 from django.http import HttpResponse, HttpResponseRedirect from django.contrib import auth from django.contrib.auth.decorators import login_required from sign.forms import AddEventForm, AddGuestForm from sign.models import Event, Guest from...
StarcoderdataPython
63124
import os # os.environ['CUDA_VISIBLE_DEVICES'] = '7' import torch from PIL import Image from torchvision import transforms from train_crnn.config import opt from train_crnn.crnn import crnn class resizeNormalize(object): def __init__(self, size, interpolation=Image.BILINEAR): self.size = size self.interpolation ...
StarcoderdataPython
3339200
# coding=utf-8 # Copyright 2022 GradMax Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
StarcoderdataPython
3554305
<gh_stars>1-10 import os from django.shortcuts import render, redirect from django.conf import settings from django.core.files.storage import FileSystemStorage from .forms import ImageUploadForm from .models import ImageUploadModel from .dface import dface from cv2 import cv2 def home(request): return re...
StarcoderdataPython
1670536
<reponame>Risto97/pygears from pygears.core.gear import alternative, gear from pygears.typing import Uint from pygears.util.hof import oper_tree @gear(enablement=b'len(din) == 2') def neq(*din) -> Uint[1]: pass @alternative(neq) @gear def neq_vararg(*din, enablement=b'len(din) > 2') -> Uint[1]: return oper_...
StarcoderdataPython
194531
<reponame>kerwin-cn/erpnext-oob-docker #!/usr/local/bin/python import json import os import time from typing import Any, Type, TypeVar def update_config(**values: Any): fname = "common_site_config.json" if not os.path.exists(fname): with open(fname, "a") as f: json.dump({}, f) with o...
StarcoderdataPython
6420445
<reponame>alphagov/performanceplatform-collector import unittest from performanceplatform.collector.webtrends.reports import(Collector, V3Parser, V2Parser) import performanceplatform import json from ...
StarcoderdataPython
1663429
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions.categorical import Categorical class PolicyGradient(nn.Module): def __init__(self,env): super(PolicyGradient, self).__init__() self.main = nn.Sequential( nn.Linear(env.observa...
StarcoderdataPython
3569093
<filename>skill/forms.py from django import forms from .models import Skill class SkillForm(forms.ModelForm): class Meta: model = Skill fields = ['name', 'persent'] widgets = { 'name': forms.TextInput(attrs={'class': 'form-control'}), 'persent': forms.NumberInput(a...
StarcoderdataPython
337218
#!/usr/bin/env python #------------------------------------------------------------------------------ # MUDserver.py # # 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.apac...
StarcoderdataPython
1673632
<reponame>rainbowbreeze/yellowbutler<filename>bot/src/tests/yellowbot/surfaces/test_telegramsurface.py<gh_stars>0 """ Tests TelegramSurface class """ from unittest import TestCase from yellowbot.surfaces.telegramsurface import TelegramSurface class TestTelegramSurface(TestCase): def setUp(self): self.sur...
StarcoderdataPython
8010029
<filename>src/php-fpm.py #!/usr/bin/python """ PHP FPM check script This file is part of ZTC and distributed under the same license. http://bitbucket.org/rvs/ztc/ Copyright (c) 2011 <NAME> <<EMAIL>> """ from ztc.php.fpm import PHPFPMCheck p = PHPFPMCheck() m = p.args[0] p.get(m, *p.args[1:])
StarcoderdataPython
1738077
# Definition for an interval. # class Interval: # def __init__(self, s=0, e=0): # self.start = s # self.end = e class Solution: def insert(self, intervals, newInterval): """ :type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval] ...
StarcoderdataPython
5013642
__author__ = 'nherbaut' # configuration DATABASE = '/tmp/flaskr.db' DEBUG = True SECRET_KEY = 'development key' USERNAME = 'admin' PASSWORD = '<PASSWORD>' git_microservice_url = "http://networksfuture.eu:8080/api/"
StarcoderdataPython
162373
# SYNCS Hackathon 2020 # jadaj - Circular import numpy as np import matplotlib.pyplot as plt import statsmodels.api as sm import cv2 from PIL import Image import io import base64 # Inputs: # image (2d array-like): Will consider all non-zero entries in array as part of circle # centre ((float, float)) # Outputs: # (i...
StarcoderdataPython
1854847
<reponame>Tunjii10/Conversational-Chatbot<filename>run.py import bot pipeline = bot.chatbot(dir_path = './data/chatbot_nlp/data', enc_dim = 200, lstm_dim = 300, optimizer = 'RMSprop', loss = 'categorical_crossentropy', activation = 'softmax', batch_size = 32, epoch = 150 ) ...
StarcoderdataPython
11353111
<reponame>UTP-project/core-algo import random from . import toolbox def preprocess(parents, xo_prob): real_parents = [] offspring = [] for parent in parents: rand = random.random() if rand <= xo_prob: real_parents.append(parent) else: offspring.append(paren...
StarcoderdataPython
1710437
<gh_stars>0 import unittest from sgftools.diagramgenerators import ProblemsBookGenerator from sgftools.board import Board from sgftools.parser import SgfParser class IntegrationTests(unittest.TestCase): def test_simple_9x9_board(self): parser = SgfParser() actual = parser.load_game('testdata/tes...
StarcoderdataPython
6524353
<gh_stars>100-1000 import os from sys import platform def RemoveWinVlcLogFiles(*args): ''' Removes all VLC log files within pyradio config directory on Windows. Files currently in use will not be deleted. ''' if platform.startswith('win'): adir = args[0] # print('config = ...
StarcoderdataPython
257166
# -*- coding:utf-8 -*- import os import sys class PlayBack(object): def __init__(self, state, action, next_state, reward): self.state = state self.action = action self.next_state = next_state self.reward = reward class PlayBacks(object): def __init__(self): self.__data...
StarcoderdataPython
1921821
<gh_stars>10-100 #!/usr/bin/env python """ Read coachmap.swf and export all coaches to dist/coaches/*.{svg,js}. """ from swf.movie import SWF from swf.export import SVGExporter, SingleShapeSVGExporterMixin, FrameSVGExporterMixin, NamesSVGExporterMixin from swf.tag import TagPlaceObject, TagDefineShape, TagDefineSprit...
StarcoderdataPython
1967641
<filename>scripts_seqModules/scripts_hapmaps/process_hapmap.output_errors.py ## ## Second of two scripts to process Ymap-generated hapmap into final output file. ## # # usage: # python process_hapmap.output_errors.py [raw_hapmap_file] > [errors_only_file] # # The [raw_hapmap_file] is probably "SNPdata_parent.txt" # The...
StarcoderdataPython
9613061
def<caret> f(my=None, *, param): pass f(param=1)
StarcoderdataPython
3323511
def race_numbers(n,m,k): count1=count2=0 n1, m1=n, m for i in range(k): if n1>m1: n1*=2 m1**=2 count1+=1 elif m1>n1: n1**=2 m1*=2 count2+=1 else: return "Draw" return [n, count1-count2] if count1>...
StarcoderdataPython
4837447
<reponame>bdetweiler/chili-time<gh_stars>1-10 import urllib2 import re from datetime import datetime from datetime import date from datetime import timedelta import os days = ['mon', 'tue', 'wed', 'thu', 'fri'] # Back to monday of this week today = datetime.today() monday = today + timedelta(-datetime.today().weekday...
StarcoderdataPython
1652480
# -*- coding: utf-8 -*- """ Created on Sat Feb 22 18:55:58 2020 @author: Robert """ import sklearn as sk #PCA import seaborn as sns #Dataset de ejemplo import scipy as sc #SVD import numpy as np from numpy.linalg import multi_dot as dot #Operaciones matriciales import matplotlib.pyplot as plt # Factorización co...
StarcoderdataPython
259681
# Generated by Django 2.2.7 on 2020-03-28 10:55 import datetime from django.db import migrations, models import django.db.models.deletion from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('home', '0001_initial'), ] operations = [ migrations.A...
StarcoderdataPython
176073
class Solution: def mySqrt(self, x: int) -> int: if x < 2: return x result, value = x, x // 2 while result > value: result, value = value, (value + x // value) // 2 return result test = Solution().mySqrt print(2, test(4)) print(2, test(8)) print(0, test(0)) print(1, tes...
StarcoderdataPython
4918120
<gh_stars>0 import pytest def test_create(modsec): assert modsec is not None def test_whoAmI(modsec): result = modsec.whoAmI() print(result) assert result is not None def test_load_rules(basic_rules): error_msg = basic_rules.getParserError() assert error_msg == '', error_msg def test_tran...
StarcoderdataPython
6646693
<reponame>brumafriend/BrumaGame import random import time import os def start(): us = 1 uk = 1 fr = 1 ge = 1 ru = 1 sp = 1 army = 5000 population = 25000 tension = 10 money = 50000 pol = 1 comm = 0 lib = 0 con = 0 xxx = 100 while True: command = i...
StarcoderdataPython
1773989
<filename>src/command/args/helpers.py """Helper functions to parse. Functions: parse_all: parse a full sequence of arguments. parse_strict_arguments: parse only arguments with a strict space. parse_word_arguments: parse only arguments with a word space. parse_unknown_arguments: parse all arguments not ...
StarcoderdataPython
280555
<filename>raiden/tests/unit/transfer/mediated_transfer/test_mediatorstate_regression.py # pylint: disable=invalid-name,too-many-locals,too-many-arguments,too-many-lines import random from raiden.tests.utils import factories from raiden.tests.utils.events import must_contain_entry from raiden.tests.utils.factories impo...
StarcoderdataPython
8043948
<gh_stars>0 import os.path from setuptools import setup, find_packages __version__ = '0.11' description = ( 'A plugin for making Pylint aware of the fields of protobuf-generated ' 'classes' ) here = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(here, 'README.md')) as f: long_descriptio...
StarcoderdataPython
265079
from analyze_movie import movie_analysis import pytest class TestMovieAnalysis: def test_sql_actor_heading(self): expected_heading = 'actor_1_name' actual_heading = movie_analysis.analyze_profitability("sqlite:///movies.db", 'movie', ...
StarcoderdataPython
6514783
# -*- coding: utf-8 -*- from __future__ import unicode_literals __version__ = '1.4.0.dev4' default_app_config = 'aldryn_newsblog.apps.AldrynNewsBlog'
StarcoderdataPython
1670578
<filename>LearnPythonTheHardWay/ex5.py # #!/usr/bin/env python # encoding: utf-8 my_name = '<NAME>' my_age = 35 # not a lie my_height = 74 # inches # Covert the height to centimeters. my_height_in_cm = my_height * 2.54 my_weight = 180 # lbs # Convert the weight to kilos. my_weight_in_kg = my_weight / 2.205 my_eye...
StarcoderdataPython
5025248
<filename>auto_scripts/move_to_git.py import os import shutil src_folder = "" dest_folder = "../../auto_scripts/auto" file_names = ["auto_convert_darknet.py", "auto_convert_onnx.py", "auto_layer_name_running.py", "copy_model.py", "move_ncnn_model.py", "move_to_git.py"] for file_name in file_names: ...
StarcoderdataPython
1983363
<gh_stars>0 # -*- coding: utf-8 -*- # Form implementation generated from reading ui file '/home/patrick/pksampler-0.3/pksampler/pksequencer/pksequencerform.ui' # # Created: Wed Jun 29 02:39:01 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # # WARNING! All changes made in this file will be lost! imp...
StarcoderdataPython
4855019
import sqlite3 import re # Define DBOperation class to manage all data into the database. # Give a name of your choice to the database class DBOperations: sql_create_table_firsttime = '''CREATE TABLE EmployeeUoB(Title TEXT, Forename TEXT, Surname TEXT, Email_Address TEXT, Salary DOUBLE)''' sql_cr...
StarcoderdataPython
5157790
#!/usr/bin/env python # -*- coding: 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 L...
StarcoderdataPython
3425472
import requests, urllib, time, sys, re, os, logging from lxml import etree from bs4 import BeautifulSoup from tqdm import tqdm from config import config xpath = '//*[@id="super_se_tip"]/div/span/strong[2]' xpath = '/html/body/div[1]/div[3]/div[1]/div[3]/div[1]/div/span/strong[2]' url1 = "&rsv_spt=1&rsv_iqid=0x...
StarcoderdataPython
292239
## Import Module import matplotlib.pyplot as plt import pandas as pd import numpy as np import io from sklearn.ensemble import RandomForestRegressor from sklearn.preprocessing import StandardScaler from sklearn.metrics import r2_score ################################################################ ## This is used to...
StarcoderdataPython
33391
import functools import logging from typing import Callable from logging_context.context.base import BaseContext from .context import get_logging_context def context_logging_factory(record_factory: Callable, context: BaseContext) -> Callable: @functools.wraps(record_factory) def wrapper(*args, **kwargs): ...
StarcoderdataPython
3220453
a = list(map(int,input().split())) a.sort() print(a[1])
StarcoderdataPython
3272210
<reponame>xuweiliang/Codelibrary<gh_stars>0 #__author__ = "Zero" from django.utils.translation import ugettext_lazy as _ import horizon class SpiceProxyPanel(horizon.Panel): name = _("Spice Proxy") slug = 'spice_proxy' permissions = ('openstack.services.network',)
StarcoderdataPython
4808195
def cal_upper(price): offset = price * 0.3 return price + offset def cal_lower(price): offset = price * 0.3 return price - offset author = "Pystock"
StarcoderdataPython
6510684
<reponame>ASoftTech/Py.BusPiratePy3 #!/usr/bin/python3 # TODO # 1. Test # 2. Check the enum values for the baud rate # confirm the midi setting, and that 0b1010 = 115200, also what about other values? # 2. Baud Rate Fixed # 3. Baud Rate Adj from enum import Enum from BusPiratePy.interface.BPBase import ...
StarcoderdataPython
3273613
from torch.nn import functional as F import torch.nn as nn from torch.autograd import Variable import torch import config ############################################################################################################## # Parameters ########################################################################...
StarcoderdataPython
6538182
import requests import ast # ticker of the index ticker_influenced = '^NDX' # tickers of stocks that can influence the index ticker_influencing = ['AAPL', 'FB', 'META', 'GOOGL', 'AMZN', 'MSFT', 'TSLA', 'NVDA', 'NFLX'] # url of request url = "http://127.0.0.1:5000/correlation_live?ticker={}&influencers={}" # reque...
StarcoderdataPython
1804843
<filename>sdk/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/models/_models_py3.py<gh_stars>1000+ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in th...
StarcoderdataPython
3326689
<gh_stars>0 import fractions as fr from scipy import misc # ------------- auxiliary method for the BCH formula ---------------- def fact(n): """ Covers the predefined function factorial from scipy.misc :param n: :return: factorial of n type float """ return float(misc.factorial(n, True)) d...
StarcoderdataPython
4862582
# Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import math from dto.commit_id_range import CommitID from dto.commit_id_range import CommitIDRange from dto.int_range import IntRange from services import g...
StarcoderdataPython
9646370
"""Generate top-level subtree filters for modules. """ import optparse from pyang import plugin from pyang import statements filter_template_full = '''<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101"> <get> <filter> <{NODE} xmlns="{NS}"/> </filter> </get> </rpc>''' filter_templ...
StarcoderdataPython
325502
name = 'tom' name = 'zhangsan'
StarcoderdataPython
4952387
from canoser import RustEnum, Uint64 from libra.transaction.signed_transaction import SignedTransaction from libra.transaction.change_set import ChangeSet from libra.block_metadata import BlockMetadata from libra.hasher import LCSCryptoHash from libra.proto_helper import ProtoHelper Version = Uint64 class ...
StarcoderdataPython
5101637
<reponame>milad621/livehd #!/usr/bin/python def main(): import subprocess nums = [100, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000] for num in nums: f = open("add_" + str(num) + ".v", "w+") f.write("module add_" + str(num) + "(\n") f.write(" input [3:0] a,\n"...
StarcoderdataPython
248455
<reponame>ADaMiller14/Engineering_4_Notebook # By <NAME> # Quadratic Solver import time import math def quadDis(a, b, c): roots = [] d = (math.pow(int(b), 2) - (4 * int(a) * int(c))) if d < 0: return("No real roots") if int(a) == 0: return("Undefined") else: ro...
StarcoderdataPython
9746305
import os import logging from json import dumps, loads import boto3 from purpleair.network import SensorList s3 = boto3.resource("s3") logger = logging.getLogger() logger.setLevel(logging.INFO) # --------------- Start of s3 formatting functions --------------- def grab_ak_data(purple_air_data): ak_data = [] ...
StarcoderdataPython
9752826
""" Module to handle Missing values in the data """ import pandas as pd import numpy as np from sklearn.impute import SimpleImputer from sklearn.preprocessing import OrdinalEncoder from sklearn.experimental import enable_iterative_imputer # noqa # now you can import normally from sklearn.impute from sklearn.impute im...
StarcoderdataPython
8108474
<gh_stars>0 #!/usr/bin/env python import paho.mqtt.client as mqtt import json from gpiozero import DigitalOutputDevice from time import sleep from uuid import getnode as get_mac class Payload(object): def __init__(self, json_def): s = json.loads(json_def) self.id = None if 'id' not in s else s['id'...
StarcoderdataPython
6658700
import os, httpx def get_all_products(): ''' !!!!DEPRECATED!!!! Retrieve all products that are currently in stock by Vinmonopolet. Uses "products/GET accumulated-stock" API endpoint from VMP. Parameters: none Returns: list: List of all products currently in stock at Vinmonopolet in J...
StarcoderdataPython
3201522
import numpy as np from heapq import nlargest def heuralign(alphabet, substitution_matrix, seq1, seq2): # defining parameters ktup = 2 # length of matches cutoff_score = -3 # cutoff score when scoring diagonals width = 29 # width of band for banded DP n = 3 # number of diagonals to run banded DP on # get t...
StarcoderdataPython
1909443
<reponame>Sapphirine/Reddit-Behavioral-Mapping """ IMPORTANT: update path to database. On my setup, I have a NFS mounted at /data that has my database in it. """ DATABASE_PATH = "/data/Reddit2.db" # Tools for sentiment analysis from sentiment import sentiment # Spark stuff from pyspark import SparkConf, SparkContex...
StarcoderdataPython
3401044
from rest_framework import serializers def create_shallow_serializer(cls, view_name, many=False): class LocalSerializer(serializers.HyperlinkedModelSerializer): url = serializers.HyperlinkedIdentityField(view_name=view_name) class Meta: model = cls fields = ('url'...
StarcoderdataPython
5163816
""" Name: XimSecureNetwork.py Purpose: Contains the APIs for creating a Xicato Secure Network over BLE ============================================ Copyright (c) 2015, Xicato Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that...
StarcoderdataPython
48188
import importlib.util import logging import logging.config import os import typing as t from pathlib import Path import yaml import xleapp.globals as g from ..helpers.utils import generate_program_header StrPath = t.Union[str, os.PathLike[str]] class ProcessFileFilter(logging.Filter): def filter(self, recor...
StarcoderdataPython
3290615
<reponame>AlphaGriffin/orbit-node<filename>ag/orbit/node/sync/info.py #!/usr/bin/env python3 # # Copyright (C) 2018 <NAME> # @%@~LICENSE~@%@ from ag.orbit.command import main from ag.orbit.node.config import get_rpc_url from ag.orbit.node.sync import Process def run(args): if args is not None and len(args) > 0: ...
StarcoderdataPython
3427485
<gh_stars>100-1000 #!/usr/bin/env python from pyxl.base import x_base class x_element(x_base): _element = None # render() output cached by _rendered_element() def _get_base_element(self): # Adding classes costs ~10% out = self._rendered_element() # Note: get_class() may return multi...
StarcoderdataPython