id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
8092952
from caffe.proto import caffe_pb2 import google.protobuf as pb from caffe import layers as L from caffe import params as P import caffe import sys sys.path.append('../netbuilder') def test_image_data_lego(): from lego.data import ImageDataLego n = caffe.NetSpec() params = dict(name='data', source='tmp' , ...
StarcoderdataPython
1629045
from encoder_ui.api.views import app as blueprint_api
StarcoderdataPython
3583699
import os import sys import argparse import pickle from xml.dom import minidom import numpy from nltk.tokenize.casual import casual_tokenize from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer from sklearn.ensemble import GradientBoostingClassifier, RandomForestClassifier from sklearn import s...
StarcoderdataPython
3390767
<reponame>Ivan7111/Kolkhoz # -*- coding: utf-8 -*- import tornado.web from . import base import decorators @decorators.class_logging class MainHandler(base.BaseHandler): @tornado.web.asynchronous def get(self): first_time = self.get_cookie("first_time", "!") self.set_cookie("first_time", "0")...
StarcoderdataPython
3503163
# coding: utf-8 import re import six from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization class CreateSubCustomerReqV2: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The...
StarcoderdataPython
25377
import torch def reparametrize(mu, log_var, device): """ Reparametrize based on input mean and log variance Parameters ---------- mu : torch.tensor The mean. log_var : torch.tensor The log variance. device : str The device on which to put the data. Returns ...
StarcoderdataPython
1877236
# coding: utf-8 # # Copyright © 2012-2015 Ejwa Software. All rights reserved. # # This file is part of gitinspector. # # gitinspector 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 3 of the Lic...
StarcoderdataPython
11337841
from datetime import timedelta from flask import Flask, render_template, request, redirect, url_for, session, flash from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.secret_key = "abcd" """ If SQLALCHEMY_DATABASE_URI is a relative path then we should use 3 slashes for the uri otherwise 4 slashes. """ a...
StarcoderdataPython
8195963
<gh_stars>0 import weakref from typing import Optional, Callable import OpenGL.GL as gl import glfw from glip.gl.input import Keyboard, Mouse _glfw_is_initialised = False def initialise_glfw(): global _glfw_is_initialised if _glfw_is_initialised: return if not glfw.init(): raise RuntimeEr...
StarcoderdataPython
5092940
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ Created on Sun Feb 4 12:51:20 2018 @author:glauberrleite lfelipev """ from FirstOrderMethods import * from SecondOrderMethods import * from ClosedLoopMethods import * from LeastSquares import * import numpy import matplotlib.pyplot as pyplot import matplotlib....
StarcoderdataPython
11273033
from utils import * from lothar import * class colorsorter1: power = 50 def __init__(self, conn): self._dispenser = motor(conn, OUTPUT_B) self._control = sensor(conn, INPUT_1, SENSOR_SWITCH) def run(self): while True: self.step() def step(self): self.nextb...
StarcoderdataPython
4894688
# Copyright (C) <NAME> 2021. # Distributed under the MIT License (see the accompanying README.md and LICENSE files). import argparse import numpy as np import time import tensorflow as tf import json import algorithms.PLRank as plr import algorithms.pairwise as pw import algorithms.lambdaloss as ll import algorithms....
StarcoderdataPython
6520188
from django import template from django.conf import settings from django.utils.safestring import mark_safe register = template.Library() # settings value @register.simple_tag def setting(name): return mark_safe(getattr(settings, name, ""))
StarcoderdataPython
225353
import sys a=input("Give first number\t") b=input("Give second number\t") c=input("Give third number\t") if(a>c) & (a>b): print("Biggest number is",a) elif(c>a) & (c>b): print("Biggest number is",c) else: print("Biggest number is",b)
StarcoderdataPython
1844250
# def dfs(Node cur, Node target, Set<Node> visited): # return True if cur is target # for i in cur.neighbor: # if i not in visited: # visited.append(i) # return True if dfs(i, target, visited) == True # return False def countIsland(grid): if grid is None or grid == []...
StarcoderdataPython
4850321
<gh_stars>0 from AnimusLog import AnimusLog from AnimusAuthLog import AnimusAuthLog from AnimusHttpLog import AnimusHttpLog from AnimusGenericLog import AnimusGenericLog from AnimusExceptions import AnimusException, AnimusAPIUnavailable, AnimusLogParsingException
StarcoderdataPython
40515
<filename>src/uwds3_simulation/underworlds_simulation.py import rospy import pybullet as p import numpy as np from proprioception.joint_states_listener import JointStatesListener from estimation.perspective_estimator import PerspectiveEstimator import tf2_ros import message_filters from sensor_msgs.msg import Image fro...
StarcoderdataPython
6511360
from abc import ABC, abstractmethod class StudentTaxes(ABC): def __init__(self, name, semester_tax, average_grade): self.name = name self.semester_tax = semester_tax self.average_grade = average_grade @abstractmethod def get_discount(self): pass class ExcellentStudent(St...
StarcoderdataPython
146292
<filename>main.py #!/usr/bin/env python import argparse import importlib import sys from typing import Union import requests as req from urllib.parse import urljoin import os from termcolor import colored """ Usage example of this tool: ./main.py -w wordlist.txt http://10.10.10.248/documents/ -n jpg -d output ./mai...
StarcoderdataPython
4990726
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "<NAME>" __doc__ = r""" Created on 11-03-2021 """ __all__ = [ "round_tight_bbox", "opaque_round_tight_bbox", "semi_opaque_round_tight_bbox", "lt_ann_transform", "lb_ann_transform", "rt_ann_transform", "rb_an...
StarcoderdataPython
1978274
<reponame>Cataldir/koalixcrm<gh_stars>100-1000 # -*- coding: utf-8 -*- import datetime from django.http import HttpResponseRedirect, Http404 from django.contrib import messages from django.shortcuts import render from django.utils.translation import ugettext as _ from django.template.context_processors import csrf fro...
StarcoderdataPython
3283461
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """Coordinate frames inter-operable with Astropy frames. Users shouldn't use this module directly, but rather import from the `astropy.coordinates` module. While it is likely to exist for the long-term, the existence of this pack...
StarcoderdataPython
3557248
# Copyright © 2019 Province of British Columbia # # 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 agr...
StarcoderdataPython
9666470
import unittest import qteasy as qt import pandas as pd from pandas import Timestamp import numpy as np import math from numpy import int64 import itertools import datetime from qteasy.utilfuncs import list_to_str_format, regulate_date_format, time_str_format, str_to_list from qteasy.utilfuncs import maybe_trade_day, ...
StarcoderdataPython
4869399
#!/usr/bin/env python import argparse import logging import os import sys from fontTools.ttLib import TTFont def ProcessTable(table): found = set() for rec in table.ScriptList.ScriptRecord: if rec.ScriptTag == "DFLT" and rec.Script.LangSysCount != 0: tags = [r.LangSysTag for r in rec.Sc...
StarcoderdataPython
1935388
<filename>EggFinder.py from Map import Map from Egg import Egg import numpy as np from PIL import Image from mss.windows import MSS as mss import time import json GOLDEGGFULLARRAY = np.asarray(Image.open("res\\GoldEggFull.png")) BLUEEGGFULLARRAY = np.asarray(Image.open("res\\BlueEggFull.png")) maps=[{'name':"BQK", 'i...
StarcoderdataPython
4817178
<reponame>acharal/tensorflow import tensorflow as tf from tensorflow.python.framework import function cluster = tf.train.ClusterSpec({"local": ["localhost:2222", "localhost:2223"]}) @function.Defun(tf.int32, tf.int32) def MyFunc(x, y): with tf.device("/job:local/replica:0/task:1/device:CPU:0"): add1 = x + y re...
StarcoderdataPython
3562940
import part2predict as P import sys if len(sys.argv)==5: P.TestPreprocessPKL(GPU_Device_ID=1, Dataset=int(sys.argv[1]), Module=int(sys.argv[2]), NetworkType=int(sys.argv[3]), TrainDataset=int(sys.argv[4])) elif len(sys.argv)==6: P.TestPreprocessPKL(GPU_...
StarcoderdataPython
1794198
<filename>tesla-check-token.py #!/usr/bin/env python3 # # Import all necessary libraries # import argparse import json import datetime # # Define some global constants # VERSION= '0.0.6' KEY_TOKEN= 'access_token' KEY_TOKEN_CREATION= 'created_at' KEY_TOKEN_EXPIRATION= 'expires_in' KEY_TOKEN_TYPE= 'token_type' KEY...
StarcoderdataPython
8045451
<reponame>ehabkost/busmap import env import re, urllib from busmap.urbsweb import * NORMAL='n' ESPECIAL='e' def url_itinerario(cod, nome): return "http://urbs-web.curitiba.pr.gov.br/centro/lista_ruas.asp?l=%s&nl=%s" % (cod, urllib.quote(nome)) re_rua = re.compile("""<option value='(.*?)'>(.*?)</option>""") def g...
StarcoderdataPython
5094882
# -*- coding: utf-8 -*- """run.py: Get data from MariaDB and send to AWS S3. author: <NAME> date: 09-08-2018 """ import threading import sys import csv import os import boto3 import MySQLdb # MariaDB parameters db_host = "YOUR_MARIADB_HOST" db_user = "YOUR_MARIADB_USER" db_password = "<PASSWORD>" db_name = "YOUR_MARIA...
StarcoderdataPython
9614487
<filename>src/rosdiscover/recover/call.py # -*- coding: utf-8 -*- __all__ = ( "DeleteParam", "HasParam", "Publisher", "ReadParam", "ReadParamWithDefault", "RosInit", "ServiceCaller", "ServiceProvider", "Subscriber", "SymbolicRosApiCall", "WriteParam", ) import abc import typ...
StarcoderdataPython
5172615
import datetime from company.models import Company from django.contrib.auth.decorators import login_required from django.http import HttpResponseRedirect, request from django.shortcuts import get_object_or_404, render from django.urls import reverse from django.views.generic import ListView, DetailView from .forms im...
StarcoderdataPython
126940
<gh_stars>1-10 # from bitfurnace.autotools import Autotools # class Recipe(Autotools): # def get_configure_args(self): # return self.configure_args + ["--static"] # def __init__(self): # self.cflags += ['-fPIC'] # self.cxxflags += ['-fPIC'] from bitfurnace.cmake import CMake from bitfurnace.util import vari...
StarcoderdataPython
4981748
<filename>tests/integration/test_es_indexer.py from nboost.indexers.cli import main import subprocess import unittest import requests import time class TestESIndexer(unittest.TestCase): def test_travel_tutorial(self): subprocess.call('docker pull elasticsearch:7.4.2', shell=True) subprocess.call("d...
StarcoderdataPython
4988641
<reponame>zhaojiejoe/django-friendly-response from PIL import Image, ImageDraw, ImageFont, ImageFilter import random from io import BytesIO import pathlib TTF_PATH = pathlib.PurePath(__file__).parent class ValidationCodeImageService(): """ default width:200, height:38px; default background color white; ...
StarcoderdataPython
1798166
# -------------------------------------------------------- # TAFSSL # Copyright (c) 2019 IBM Corp # Licensed under The Apache-2.0 License [see LICENSE for details] # -------------------------------------------------------- import numpy as np from utils.proto_msp import ProtoMSP import time import pickle from utils.mis...
StarcoderdataPython
3281125
<reponame>cumttang/ray<gh_stars>1-10 # coding: utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function import unittest import ray from ray.rllib import _register_all from ray.tune import Trainable from ray.tune.ray_trial_executor import RayTrialExecutor from ...
StarcoderdataPython
9786529
from .analytic import * from .flr import * from .nmf import *
StarcoderdataPython
11238637
# -*- coding: utf-8 -*- import os.path import mfr from mfr import config as core_config, RenderResult from mfr.core import get_assets_from_list from IPython.nbformat import current as nbformat from IPython.config import Config from IPython.nbconvert.exporters import HTMLExporter HERE = os.path.dirname(os.path.abspath...
StarcoderdataPython
9771278
# Generated by Django 2.2.1 on 2019-05-31 08:44 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone import mdeditor.fields class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_...
StarcoderdataPython
8045382
<filename>pixel_decoder.py # Copyright (c) Facebook, Inc. and its affiliates. import logging from typing import Callable, Dict, List, Optional, Tuple, Union import fvcore.nn.weight_init as weight_init from torch import nn from torch.nn import functional as F from detectron2.config import configurable from detectron2....
StarcoderdataPython
4817022
import apex.amp as amp import argparse import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from tqdm import tqdm from adv.pgd import attack from adv.pgd_clever import projected_gradient_descent from cifar_data import mean, std, get_no_norm_trans, get_datasets from model_preproc import...
StarcoderdataPython
5147292
# coding=utf-8 # Copyright 2018 The Tensor2Tensor 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...
StarcoderdataPython
3236030
<gh_stars>10-100 from floem import * class add2(CallableSegment): def configure(self): self.inp = Input(Int) self.out = Output(Int) def impl(self): inc1 = Inc('inc1', configure=[Int]) inc2 = Inc('inc2', configure=[Int]) self.inp >> inc1 >> inc2 >> self.out add2('add2')...
StarcoderdataPython
4846400
<filename>Experts/ResolutionExperts.py #!/usr/bin/env python # ResolutionExperts.py # # Copyright (C) 2008 STFC, <NAME> # # This code is distributed under the BSD license, a copy of which is # included in the root directory of this package. # # A couple of classes to assist with resolution calculations - these # ...
StarcoderdataPython
11346379
<gh_stars>0 """ Copyright 2013 <NAME> This file is part of CVXPY. CVXPY 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 3 of the License, or (at your option) any later version. CVXPY is distribut...
StarcoderdataPython
1726915
"""implementation of PythonLogger class """ import logging from ._log_level_convertion import to_python_log_level from .._mprpc_cpp import PythonLoggerHelper, LogLevel class PythonLogger(PythonLoggerHelper): # pylint: disable=too-few-public-methods """class to write logs using Python's logging module Para...
StarcoderdataPython
8092665
import bokeh.plotting import bokeh.models figure = bokeh.plotting.figure() glyph = bokeh.models.Patches(xs="xs", ys="ys") source = bokeh.models.ColumnDataSource({ "xs": [[0, 0.1, 0.1, 0], [0.3, 0.4, 0.4, 0.3]], "ys": [[0, 0, 0.1, 0.1], [0.3, 0.3, 0.4, 0.4]], }) figure.add_glyph(source, glyph) document = bokeh....
StarcoderdataPython
9642784
<reponame>DarkStarSword/miasmata-fixes<gh_stars>1-10 #!/usr/bin/env python import struct import sys import rs5file def parse_nlst_header(f): (num_entries, u2) = struct.unpack('<H2s', f.read(4)) assert(u2 == '\0'*2) return num_entries def parse_markers(chunks): nlst = chunks['NLST'] mlst = chunks['MLST'] f = ...
StarcoderdataPython
362681
<filename>Updater/updater.py import os import time keys = "000000000128384000010400f344ac4f82f000000000000000000000000000000000000000000000000" print("Type version ID to update to") ver = input() + print("Type " + ver + " update key") key = input() if key in keys: print("Valid update key. Generating manifest dat...
StarcoderdataPython
1689030
<reponame>intellineers/django-bridger from channels.sessions import CookieMiddleware from bridger.websockets.middleware import JWTAuthMiddleware def JWTAuthMiddlewareStack(inner): return CookieMiddleware(JWTAuthMiddleware(inner))
StarcoderdataPython
4997485
<filename>stix_shifter_modules/msatp/stix_translation/data_mapper.py from os import path from stix_shifter_utils.modules.base.stix_translation.base_data_mapper import BaseDataMapper class DataMapper(BaseDataMapper): pass
StarcoderdataPython
6628335
import importlib import itertools import random from sqlalchemy import and_ from sqlalchemy import Boolean from sqlalchemy import case from sqlalchemy import cast from sqlalchemy import Column from sqlalchemy import column from sqlalchemy import dialects from sqlalchemy import exists from sqlalchemy import extract fro...
StarcoderdataPython
148567
<reponame>hodgesds/solnado from __future__ import print_function from functools import partial from tornado import gen from tornado import ioloop from solnado.client import SolrClient import os def solnado_cmd(subparsers): status_subparser = subparsers.add_parser('status') status_subparser.set_defaults(func=ma...
StarcoderdataPython
6418064
<gh_stars>0 import sys; sys.path.append('..') from tsv import * from frame import * if __name__=="__main__": from time import time t0=time() itr = tsv_iter('../data/__all__.txt',encoding=None) f = frame_from_iter(itr,['col','id','text']) print(f['col'][0],f['id'][0],f['text'][0]) print(time()-t0) f = frame_fr...
StarcoderdataPython
117320
<gh_stars>0 #Author : <NAME> #codename : thzou import os import numpy as np import pandas as pd import pickle import quandl import datetime import statsmodels.api as sm from scipy import stats import time import matplotlib.pyplot as plt import seaborn as sns; sns.set() import sys import io from itertools import prod...
StarcoderdataPython
3357554
from typing import Dict from discord.ext.commands import Context, Cog from discord.ext import commands from .trivia import RegularTrivia class TriviaCog(Cog): """This cog sets the rules to start a new game, supevising what channels can games be started in, and how many can be played concurrently.""" def ...
StarcoderdataPython
1660202
#!/usr/bin/env python import sys import pysam from ragtag_utilities.utilities import reverse_complement # Only one argument: FASTA file x = pysam.FastaFile(sys.argv[1]) for i in x.references: print(">" + i) s1 = x.fetch(i) s2 = reverse_complement(s1) if s1 < s2: print(s1) else: ...
StarcoderdataPython
1929614
from django.db import models from django.contrib.auth.models import User from django.dispatch import receiver from django.db.models.signals import post_save class Neighborhood (models.Model): ''' We want to narrow down to Neighborhoods so Users can recieve relevant information ''' name = models.CharFi...
StarcoderdataPython
3350317
<reponame>riyabhatia26/Python-Programming from sys import argv import sys script, filename = argv val = False prompt ="-->" # Creating file objects for writing and reading file_obj_read = open(filename) print("_________________________________") print("This is old content in your file") print(file_obj_read.read()) pr...
StarcoderdataPython
4989038
"""Test Run integration tests against a real platform.""" from typing import List import pytest import tests.config as cfg from iov42.core import Asset from iov42.core import AssetType from iov42.core import Client from iov42.core import CryptoProtocol from iov42.core import hashed_claim from iov42.core import Privat...
StarcoderdataPython
80776
# Generated by Django 4.0 on 2021-12-28 23:15 from django.db import migrations, models import django.db.models.deletion import uuid class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Question', field...
StarcoderdataPython
12800439
lugares = ["Tokio", "New York", "San Francisco", "Monterrey", "Las Vegas"] print(lugares) print(sorted(lugares)) print(lugares) lugares.reverse() print(lugares) lugares.reverse() print(lugares) lugares.sort() print(lugares) lugares.sort(reverse=True) print(lugares)
StarcoderdataPython
11289512
# -*- coding: utf-8 -*- """ Created on Sat Feb 13 13:21:28 2021 @author: Farrokh """ import os import shutil import requests output_path = "/home/karimi/tmp/outputs" if os.path.exists(output_path): shutil.rmtree(output_path) # processor could be 'cpu' or 'cuda' for gpu input_json_string = """ ...
StarcoderdataPython
6482137
<reponame>JureGrubisic/ZadacaP2 #Funkciju iz prethodne zadaće učitati kao funkciju modula u novi program i pozvati je nakon traženja unosa #od korisnika. import zadaca6 zadaca6.obrnuto("kaktus")
StarcoderdataPython
6419502
<gh_stars>1-10 # -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-05-29 11:22 import django.contrib.postgres.fields.jsonb from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("shop", "0015_coinifyapiinvoice_coinifycallback")] operations = [ migr...
StarcoderdataPython
1625313
<gh_stars>1-10 try: import cPickle as pickle except ImportError: import pickle import zlib import time import MySQLdb as mysqldb from sga import GeneticAlg class MySQLGeneticAlg(GeneticAlg): def __init__(self, servername, username, password, database, *args, **kwargs): #connect to ...
StarcoderdataPython
5182797
# Generated by Django 3.0 on 2020-01-28 08:04 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('log', '0003_auto_20190703_1651'), ] operations = [ migrations.AddField( model_name='log', name='scheduled', ...
StarcoderdataPython
3214159
<filename>projects/vdk-control-cli/src/vdk/internal/control/command_groups/job/execute.py # Copyright 2021 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 import json import logging import operator import os import sys import webbrowser from enum import Enum from enum import unique from typing import Optional impor...
StarcoderdataPython
4913844
<gh_stars>0 import numpy as np import pandas as pd from sklearn import metrics, cross_validation, linear_model import IPython import viz from viz.format import quantiles from viz.geom import hist from tsa import logging from tsa.lib.itertools import sig_enumerate from tsa.models import Source, Document, create_session...
StarcoderdataPython
178748
<gh_stars>0 import requests result_switch = { 200: "OK", 404: "NOT FOUND", } result = requests.get("https://example.com/") status_code = result.status_code status = result_switch.get(status_code) if status != None: print(status) else: print("UH OHH")
StarcoderdataPython
11231483
# Generated by Django 2.2.3 on 2019-12-16 22:40 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("shop", "0059_auto_20190718_2051"), ] operations = [ migrations.AddField( model_name="productcategory", name="weight"...
StarcoderdataPython
5135780
import scrapy from jedeschule.utils import cleanjoin from scrapy.shell import inspect_response class KlimaschutzSchulenAtlasSpider(scrapy.Spider): name = "klimaschutzschulenatlas" start_urls = ['https://www.klimaschutzschulenatlas.de/der-atlas'] def parse(self, response): #inspect_response(respon...
StarcoderdataPython
6501231
import os, sys, logging, subprocess log = logging.getLogger('recd') from sys_utils import SysUtils kernel_folder = '/opt/MassTransit/kernel' class KernelModule(object): def __init__(self, module, args=''): self.module = module self.args = args self.last_output = None def installed(self)...
StarcoderdataPython
9772748
<filename>netensorflow/ann/macro_layer/layer_structure/layers/SoftmaxLayer.py import json import os import tensorflow as tf import uuid from netensorflow.ann.ANNGlobals import register_netensorflow_class from netensorflow.ann.macro_layer.layer_structure.LayerStructure import LayerTypeToString, StringToLayerType from ...
StarcoderdataPython
4958905
<filename>taobao-tianmao/Qimen/top/api/rest/ServiceHeartbeatRequest.py ''' Created by auto_sdk on 2019.10.29 ''' from top.api.base import RestApi class ServiceHeartbeatRequest(RestApi): def __init__(self, domain='gw.api.taobao.com', port=80): RestApi.__init__(self, domain, port) self.seri...
StarcoderdataPython
5087821
<gh_stars>0 import MySQLdb from mysql_config import Config as config def connect_db(): db=MySQLdb.connect(host=config.MYSQL_HOST, user=config.MYSQL_USER, passwd=config.MYSQL_PASSWD, db=config.MYSQL_DB) return db def db_init(): db=connec...
StarcoderdataPython
3382012
<filename>observations/r/klein.py # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import csv import numpy as np import os import sys from observations.util import maybe_download_and_extract def klein(path): """Klein's Model I ...
StarcoderdataPython
100897
<reponame>angelvillar96/super-resolution-noisy-images """ Creating an experiment, setting up the network and training the model Denoising_in_superresolution/src @author: <NAME> """ import os from config import CONFIG import lib.utils as utils import lib.arguments as arguments def create_experiement(): """ ...
StarcoderdataPython
1978418
''' Created on Feb 20, 2022 @author: biplavs ''' def demoWithoutException (data, index): print ("STATUS: Printing without any precaution"); print ("Character at index = ", index, ", value = ", data[index], "\n") def demoWithException (data, index): print ("STATUS: Printing with try/ catch") ...
StarcoderdataPython
3550395
import enum import logging from functools import partial from typing import TYPE_CHECKING, Optional import numpy as np from magicgui.widgets import create_widget from napari.qt import thread_worker from pybasic import BaSiC from qtpy.QtCore import QEvent from qtpy.QtWidgets import QFormLayout, QGroupBox, QPushButton, ...
StarcoderdataPython
6542070
#!/usr/bin/python # -*- coding: utf-8 -*- import re from json import loads, dumps from datetime import datetime import base64 from uuid import uuid4 from cow.server import Server import tornado.web import tornado.websocket from tornado.httpclient import AsyncHTTPClient from tornado_redis_sentinel import SentinelClien...
StarcoderdataPython
9603136
import datetime import random import string import uuid from decimal import Decimal from functools import wraps from flask import jsonify from passlib.context import CryptContext from insta_backend.auth.auth import decode_auth_token from insta_backend.models.user.user import User, Entity, UserMethods pwd_context = Cry...
StarcoderdataPython
367468
from .gaussian import Gaussian from .multivariateGaussian import MultivariateGaussian from .ringLike import Ring2d,Ring2dNoMomentum from .harmonicChain import HarmonicChain from .source import Source
StarcoderdataPython
3588684
<reponame>omarcostahamido/py-js<filename>source/py/builder/core.py """builder: a builder of py-js max externals A pure python builder without any dependencies except the standard library. Python Project ShellCmd Settings Product Recipe Builder Bzip2Builder OpensslBuilder XzBuilder PythonBuilder ...
StarcoderdataPython
9667958
# @author <NAME> # @copyright Copyright (c) 2008-2015, <NAME> aka LONGMAN (<EMAIL>) # @link http://longman.me # @license The MIT License (MIT) import re import vbscriptbeautifier class VbscriptFormatter: def __init__(self, formatter): self.formatter = formatter ...
StarcoderdataPython
8035002
# version code 988 # Please fill out this stencil and submit using the provided submission script. import random from GF2 import one from independence import is_independent from vecutil import list2vec from itertools import combinations ## Problem 1 def randGF2(): return random.randint(0,1)*one a0 = list2vec([one,...
StarcoderdataPython
5081123
if False: from lib.Processing3 import * def setup(): size(800, 600) arc(90, 60, 80, 80, 0, radians(90)) arc(190, 60, 80, 80, 0, radians(270)) arc(290, 60, 80, 80, radians(180), radians(450)) arc(390, 60, 80, 80, radians(45), radians(225))
StarcoderdataPython
8037089
import matplotlib.pyplot as plt import numpy as np def generate_data(n): e_values = [] for i in range(n): e = np.random.randn() e_values.append(e) return e_values data = generate_data(300) plt.plot(data) plt.show()
StarcoderdataPython
8100421
def factorial(num): assert num>=0 and int(num) == num, "num must be a positive integer" if num in [0,1]: return 1 return num * factorial(num-1) print(factorial(3))
StarcoderdataPython
4876324
<gh_stars>0 import os import pytest from scrapli.helper import resolve_ssh_config from nornir import InitNornir from nornir_scrapli.exceptions import NornirScrapliInvalidPlatform def test_connection_core_setup(nornir, monkeypatch): from scrapli.driver.driver import Scrape def mock_open(cls): pass ...
StarcoderdataPython
4925923
<reponame>mgharvey/misc_python<filename>bin/STRUCTURE/structure_from_genotypes.py #!/usr/bin/env python """ Name: structure_from_genotypes.py Author: <NAME> Date: 12 July 2013 Convert genotype probabilities file output by Tom White's post-UNEAK processing scripts to input file for STRUCTURE (Pritchard et al. 2000...
StarcoderdataPython
1926229
from django.test import TestCase from .models import Profile, Image, Comment from django.contrib.auth.models import User # Create your tests here. class ProfileTestClass(TestCase): #set up method def setUp(self): self.ojijo = Profile(user = 'ojijo',user_name='yvonne',bio = 'this is true',profile_image...
StarcoderdataPython
11389070
from examples.pursuit.environment.Pursuit import Pursuit
StarcoderdataPython
6436644
<gh_stars>10-100 from flask import url_for, g, session, redirect, request, abort from auth import app from models import User import functools import urlparse def static(path): root = app.config.get('STATIC_ROOT') if root is None: return url_for('static', filename=path) else: return urlpars...
StarcoderdataPython
11382975
<gh_stars>0 """Experimental SDFILE Writer No support for fields like M CHG M STY and the like """ import os # float format #xxxxx.xxxx class SDFloat: """Class to print out a float in the format the sd file expects""" def __init__(self, f): self.f = f def __str__(self): f = self.f ...
StarcoderdataPython
8003374
""" stanCode Breakout Project Adapted from <NAME>'s Breakout by <NAME>, <NAME>, <NAME>, and <NAME> YOUR DESCRIPTION HERE """ from campy.graphics.gwindow import GWindow from campy.graphics.gobjects import GOval, GRect, GLabel from campy.gui.events.mouse import onmouseclicked, onmousemoved import random BRICK_SPACING ...
StarcoderdataPython
1993929
# Copyright (c) 2009-2018 The Regents of the University of Michigan # This file is part of the HOOMD-blue project, released under the BSD 3-Clause License. # Maintainer: mphoward R""" MPCD streaming methods An MPCD streaming method is required to update the particle positions over time. It is meant to be used in con...
StarcoderdataPython
1986377
<filename>summarize.py # -*- coding: utf-8 -*- import numpy as np import cv2 import torch from torchvision import models from torchvision import transforms import torch.nn as nn from PIL import Image from PolicyGradient import PolicyNet preprocess = transforms.Compose( [ transforms.Resize(256), tra...
StarcoderdataPython