id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
43402 | <reponame>The-Kristina/CellComp
# TODO: Find out if you can reconstruct chopped trees from the tracker:
import sys
sys.path.append("../")
from Cell_IDs_Analysis.Plotter_Lineage_Trees import PlotLineageTree
raw_file = "/Volumes/lowegrp/Data/Kristina/MDCK_90WT_10Sc_NoComp/17_07_24/pos13/analysis/channel_RFP/cellIDdeta... | StarcoderdataPython |
43202 | <filename>project/admin.py
from django.contrib import admin
from project.models import Code
admin.site.register(Code)
| StarcoderdataPython |
1754976 | <reponame>sunjinbo/hipython
lst = [6, 7, 3, 0, 4, 8, 15, 4]
# 冒泡排序算法
def bubbleSort(arr):
sum = len(arr)
for i in range(sum - 1):
for j in range(sum - i - 1):
if arr[j] < arr[j + 1]:
temp = arr[j + 1]
arr[j + 1] = arr[j]
arr[j] = temp
# 插入排... | StarcoderdataPython |
3211483 | <reponame>Cronologium/secretsanta
import random
import sys
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization, hashes
from cryptography.hazmat.primitives.asymmetric import padding
from cryptography.hazmat.primitives.asymmetric import rsa
PEOPLE_FILE = 'pe... | StarcoderdataPython |
1789000 | from statistics import mean
import sys
import matplotlib.pyplot as plot
import numpy
filenames = \
[ "data/run_1"
, "data/run_2"
, "data/run_3"
, "data/run_4"
, "data/run_5"
, "data/run_6"
]
data = []
i = 0
for filename in filenames:
data_y = []
data_x = []
file = open(filen... | StarcoderdataPython |
129005 | <reponame>DarwishMenna/pathways-backend
import logging
from django.utils import translation
from django.contrib.gis.geos import Point
from human_services.locations.models import Location, ServiceAtLocation, LocationAddress
from human_services.organizations.models import Organization
from human_services.services.models ... | StarcoderdataPython |
3272883 | <filename>gym_gui_environments/pyside_gui_environments/src/backend/car_configurator.py
from PySide6.QtCore import Slot
from PySide6.QtWidgets import QFrame, QComboBox, QPushButton
from gym_gui_environments.pyside_gui_environments.src.utils.alert_dialogs import WarningDialog
from gym_gui_environments.pyside_gui_environ... | StarcoderdataPython |
3362681 | <reponame>PhilR8/regulations-site
from unittest import TestCase
from django.urls import reverse
class UrlTests(TestCase):
def test_chrome_section_url(self):
r = reverse('reader_view', args=('201', '2', '2012-1123'))
self.assertEqual(r, '/201/2/2012-1123/')
r = reverse(
'reader... | StarcoderdataPython |
31466 | <filename>traceback_test.py
import traceback
class A:
def __init__(self):
pass
def tb(self):
es = traceback.extract_stack()
print(es)
fs = es[-2]
print(fs.name)
print(fs.locals)
def another_function():
lumberstack(A())
lumberstack(A())
def lumberstac... | StarcoderdataPython |
1705109 | # import bagpy
from bagpy import bagreader
import pandas as pd
import numpy as np
import pickle as pkl
import os
import rosbag
class RobotTraj():
def __init__(self) -> None:
self.desired_topic = '/anna/end_effector/states'
self.other_topics = ['/anna/joint/states', '/anna/keyframe/states']
... | StarcoderdataPython |
4800446 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Copyright [2009-2020] EMBL-European Bioinformatics Institute
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
Unl... | StarcoderdataPython |
119629 | from aiohttp import web
from redbull import Manager
mg = Manager(web.Application())
@mg.api()
async def say_hi(name: str, please: bool):
"Says hi if you say please"
if please:
return 'hi ' + name
return 'um hmm'
mg.run()
| StarcoderdataPython |
3333615 | import requests
import json
from math import ceil
from sync_dl_ytapi.helpers import getHttpErr
import sync_dl.config as cfg
def getItemIds(credJson,plId):
requestURL = "https://youtube.googleapis.com/youtube/v3/playlistItems?part=contentDetails&maxResults=25&pageToken={pageToken}&playlistId={plId}"
... | StarcoderdataPython |
3292725 | <filename>bot/commands/advice_cmd.py
import discord, datetime, random, time
from bot.commands.command import Command
class AdviceCMD(Command):
async def run(self, message, raw_args):
allInfo = False
args = []
for rarg in raw_args.split('-'):
arg = rarg.split(' ')
f... | StarcoderdataPython |
1655337 | import io
import functools
import PIL.Image
import numpy as np
from fastapi import FastAPI
from pydantic import BaseModel
from fastapi.responses import JSONResponse
from starlette.responses import StreamingResponse
import uvicorn
from fastapi.middleware.cors import CORSMiddleware
from sm.browser import utils
from sm.... | StarcoderdataPython |
3370373 | # Copyright (c) OpenMMLab. All rights reserved.
import logging
import os.path as osp
import pytest
import torch
import torch.nn as nn
from mmcv.runner import build_runner
from mmcv.runner.fp16_utils import auto_fp16
from mmcv.utils import IS_IPU_AVAILABLE
if IS_IPU_AVAILABLE:
from mmcv.device.ipu.hook_wrapper im... | StarcoderdataPython |
3258073 | <gh_stars>10-100
# coding: utf-8
'''
__init__ file'''
| StarcoderdataPython |
4801427 | <gh_stars>1-10
import unittest
from spacer.yama import z3_dict_to_cli, z3_yaml_to_cli, z3_yaml_to_name
class Z3DictCliTest(unittest.TestCase):
def test_dict(self):
opts = {
'fixedpoint': {
'xform': {
'slice': False,
'inline_linear': Fals... | StarcoderdataPython |
41157 | <gh_stars>0
# -*- coding: utf-8 -*-
# (c) 2020 <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from units.compat.mock import MagicMock
import pytest
from ansible.module... | StarcoderdataPython |
3285372 | from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
from django import forms
from users.models import User
class InviteUserForm(forms.Form):
email = forms.CharField()
def clean(self):
cleaned_data = super().clean()
email = cleaned_data["email"]
# check if emai... | StarcoderdataPython |
3282994 | # Import a dataset
from sklearn import datasets
iris = datasets.load_iris()
X = iris.data
y = iris.target
# Split the data for train and for test from the datasets using the train_test_split method
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size... | StarcoderdataPython |
1687817 | """
Created on Jan 29, 2021
@file: runner.py
@desc: Run experiments given set of hyperparameters for the unmixing problem.
@author: laugh12321
@contact: <EMAIL>
"""
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
import tensorflow as tf
from config.get_config import get_config
from src.model import enums
from src... | StarcoderdataPython |
1741462 | <filename>openhab_creator/output/__init__.py
from openhab_creator.output.color import Color
| StarcoderdataPython |
3209589 | <filename>video_to_gif.py
import numpy as np
import cv2
def mse(imageA, imageB):
# the 'Mean Squared Error' between the two images is the
# sum of the squared difference between the two images;
# NOTE: the two images must have the same dimension
err = np.sum((imageA.astype("float") - imageB.astype("flo... | StarcoderdataPython |
3242587 | <reponame>gengxf0505/pxt
for i in range(5):
pass
for i in range(5):
i = i + 7 # WRONG
i = i - (1 + i)
for t in range(2 + 7 * 3 / 1 % 7 - 9):
pass
for t in range(2 + 7 * 3 / 1 % 7 - 9 + 1):
pass | StarcoderdataPython |
1624258 | <gh_stars>0
import pytest
import unittest
from src.gmaillabelcreate.gmaillabel import (define_label, VALUE_ERROR_DEFINE_LABEL_TEXT,
VALUE_ERROR_DEFINE_LABEL_COLOR_TEXT)
def test_define_label():
color_dict = {
'pending':{'textColor': '#ffffff', 'backgroundColor': '#c2c2c2'},
}
correct_out = {
... | StarcoderdataPython |
1760175 | import sys
from datetime import datetime
LOG_FILE = None
ERROR_CB = None
TIME_CBS = {}
def start_timer(tname):
TIME_CBS[tname] = datetime.now()
def end_timer(tname, msg=""):
diff = datetime.now() - TIME_CBS[tname]
log("[timer] Completed in %s |%s| %s"%(diff, msg, tname), important=True)
def set_log(fnam... | StarcoderdataPython |
129802 | #!/usr/bin/env python
#
# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/
# Written by <NAME> <<EMAIL>>
#
import argparse
import os
from os import path
from keras import backend as K
from keras.losses import get as get_loss
from keras.utils.generic_utils import Progbar
import numpy as np
from impor... | StarcoderdataPython |
1767966 | <reponame>Ortus-Team/Moim
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-01-02 21:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('tag', '0001_i... | StarcoderdataPython |
1648546 | import pytest
from cognite import config
from tests.conftest import TEST_API_KEY, TEST_PROJECT
MOCK_URL = 'http://another.url/'
NUM_OF_RETRIES = 5
@pytest.fixture
def change_url():
config.set_base_url(MOCK_URL)
yield
config.set_base_url()
@pytest.fixture
def change_number_of_retries():
config.set_... | StarcoderdataPython |
3373039 | <gh_stars>100-1000
# Licensed to the StackStorm, Inc ('StackStorm') 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 License, Version 2.0
# (the "License");... | StarcoderdataPython |
1748620 | <reponame>eabase/pyreadline3
# -*- coding: UTF-8 -*-
# Example snippet to use in a PYTHONSTARTUP file
from __future__ import absolute_import, print_function, unicode_literals
try:
import atexit
# pyreadline3.rlmain.config_path=r"c:\xxx\pyreadlineconfig.ini"
import readline
import pyreadline3.rlmain
... | StarcoderdataPython |
1652974 | <reponame>u93/multa-metrics-collector
from aws_cdk import core
from multacdkrecipies import (
AwsApiGatewayLambdaFanOutBE,
AwsApiGatewayLambdaPipes,
AwsIotAnalyticsSimplePipeline,
AwsLambdaFunctionsCluster,
AwsLambdaLayerVenv,
AwsS3BucketsCluster,
AwsSsmString,
AwsUserServerlessBackend,
... | StarcoderdataPython |
177104 | <filename>Streamlit/dataViewer/dataViewer.py<gh_stars>1-10
# !/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Bruce_H_Cottman"
__license__ = "MIT License"
import streamlit as st
import pandas as pd
from pydataset import data
df_data = data().sort_values('dataset_id').reset_index(drop=True)
st.dataframe(df... | StarcoderdataPython |
33991 | """Top-level package for sta-etl."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.0'
#from sta_etl import *
| StarcoderdataPython |
137734 | <filename>CursoEmVideo/pythonProject/ex025.py<gh_stars>0
import itertools
nome = str(input('Digite seu nome completo: '))
nome = nome.lower()
s = nome.find('silva')
if s < 0:
print('Você não tem Silva no seu nome!')
elif s >=0 :
print('Você tem Silva no seu nome!')
| StarcoderdataPython |
4839359 | import unittest
from .recorder import Recorder
class TestRecorder(unittest.TestCase):
def setUp(self):
pass
def test_sorts_correctly(self):
records = [
{'test_score': 0.8410596026490066,
'params': {'n_estimators': 260,
'subsample': 0.7800000000000002,
... | StarcoderdataPython |
1667115 | import json
import requests
from requests.auth import HTTPBasicAuth
def auth(username='mark', email='<EMAIL>', password='<PASSWORD>'):
data = {
"username": username,
"email": email,
"password": password
}
response = requests.post('https://pcuav.pythonanywhere.com/auth/... | StarcoderdataPython |
1762285 | <filename>src/jupyrest/jupyrest/executors.py<gh_stars>0
from abc import ABC, abstractmethod
from datetime import datetime
from dataclasses import dataclass
from nbformat.notebooknode import NotebookNode
from typing import Optional
from nbclient.client import NotebookClient
from nbclient.exceptions import CellExecutionE... | StarcoderdataPython |
129964 | __all__ = ['BaseController']
import json
from pyramid.renderers import render
from pyramid.view import view_config
from horus.views import BaseController
@view_config(http_cache=(0, {'must-revalidate': True}),
renderer='templates/embed.txt', route_name='embed')
def embed(request, standalone=True):
... | StarcoderdataPython |
3266396 | import tradius.models.accounting
import tradius.models.ippool
import tradius.models.groups
import tradius.models.group_attrs
import tradius.models.virtual
import tradius.models.nas
import tradius.models.users
import tradius.models.user_attrs
import tradius.models.user_groups
| StarcoderdataPython |
4800106 | '''setup for GameOfLife
'''
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
long_description = '''
GameOfLife is a python3 package that provides two classes
that together implement Conway's Game of Life.
Install the GameOfLife pac... | StarcoderdataPython |
1657186 | <gh_stars>1-10
#!/usr/bin/env python3
# Written by jack @ nyi
# Licensed under FreeBSD's 3 clause BSD license. see LICENSE
'''This class calls the system's "ping" command and stores the results'''
class sys_ping:
'''this class is a python wrapper for UNIX system ping command, subclass ping does the work, last sto... | StarcoderdataPython |
1710173 | <filename>PitchForMajorParties.py
def pitch(iSupport, iOppose, ThirdPartyCandidates, heOrShe):
for peep in ThirdPartyCandidates:
print "It does not matter that", peep, "is not", iOppose, "\b."
print "What matters is that", iSupport, "is not", iOppose, "\b!"
print"Therefore you must support", iSupport, "\b!"
print... | StarcoderdataPython |
3277609 | <reponame>DavideGalilei/paymentbot
from typing import Dict, List
from pyrogram import Client, ContinuePropagation
from pyrogram.types import Update, User, Chat
from pyrogram.raw.types import UpdateBotShippingQuery, UpdateBotPrecheckoutQuery
_on_shipping_query_handlers: List[callable] = []
_on_checkout_query_handlers:... | StarcoderdataPython |
1663570 | from car import Car
my_new_car = Car('toyota', 'corolla', 2014)
print(my_new_car.get_descriptive_name())
my_new_car.odometer_reading = 23
my_new_car.read_odometer()
| StarcoderdataPython |
3341755 | <reponame>mgb4/wdisp
import os.path
address = "http://localhost"
port = 4300
def wwwroot():
return os.path.dirname(__file__) + "/wwwroot"
def root_url():
return address + ":" + str(port) + "/"
def url_for(path):
return address + ":" + str(port) + "/api" + path
| StarcoderdataPython |
3345912 | import cv2
import torch
import numpy as np
import BboxToolkit as bt
PI = np.pi
def regular_theta(theta, mode='180', start=-PI/2):
assert mode in ['360', '180']
cycle = 2 * PI if mode == '360' else PI
theta = theta - start
theta = theta % cycle
return theta + start
def mintheta_obb(rbox):
x, ... | StarcoderdataPython |
3257484 | import os
import math
from pygears import gear
from pygears.typing import Fixp, Tuple
from pygears_vivado.vivmod import SVVivModuleInst
from pygears.core.gear import InSig
# TODO: Make it work properly with widths that are not multiple of 8
@gear(hdl={'hdlgen_cls': SVVivModuleInst},
sigmap={'aclk': 'clk'},
... | StarcoderdataPython |
156932 | import tweepy
import os
from utilities.time_management import *
from utilities.config import *
import django
os.environ["DJANGO_SETTINGS_MODULE"] = "portal.settings"
django.setup()
from details.models import Entities, Topic
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_TOKEN, ... | StarcoderdataPython |
50093 | <reponame>resteasy/examples
import http.client, urllib.parse
from M2Crypto import BIO, SMIME, X509
conn = http.client.HTTPConnection("localhost:9095")
conn.request("GET", "/smime/encrypted")
res = conn.getresponse()
if res.status != 200:
print((res.status))
raise Exception("Failed to connect")
contentType = res... | StarcoderdataPython |
3331066 | <filename>src/sudoku_solver.py
from __future__ import division
import pyomo.environ as pyo
from data_maker import DataMaker
class SudokuSolver:
def __init__(self):
self.dataMaker = DataMaker()
self.model = pyo.AbstractModel()
self.initialize_model()
@staticmethod
def obj_expressi... | StarcoderdataPython |
1794621 | __all__ = ["Log", "Progbar", "RandomSeeds", "ModelParamStore", "DefaultDict", "Visualize"]
| StarcoderdataPython |
3335867 | import random
from typing import Optional
from fastapi import WebSocket
from starlette.responses import HTMLResponse
from starlette.websockets import WebSocketDisconnect
from app.ws.schema import BroadcastMsgReq
from app.ws import manager
from app.ws.ws import html
async def ws_view(
websocket: WebSocket, clien... | StarcoderdataPython |
1642731 | import os
from flask import Flask
from flask_jwt import JWT
from .utils.errors import APIError
def create_app(test_config=None):
# create and configure the app
app = Flask(__name__)
if test_config is None:
# load the instance config, if it exists, when not testing
app.config.from_pyfile('... | StarcoderdataPython |
65881 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | StarcoderdataPython |
176307 | <reponame>PullRequest-Agent/paramak
"""
This python script demonstrates the creation of a breeder blanket from points
"""
import paramak
def main(filename="blanket_from_points.stp"):
blanket = paramak.RotateMixedShape(
rotation_angle=180,
points=[
(538, 305, "straight"),
... | StarcoderdataPython |
53257 | <filename>keras/datasets/sin.py
# -*- coding: utf-8 -*-
import cPickle
import sys, os
import numpy as np
# written by zhaowuxia @ 2015/5/30
# used for generate linear datasets
def generate_data(sz, T, diff_start, diff_T):
data = []
for i in range(sz):
start = 0
if diff_start:
start ... | StarcoderdataPython |
4816752 | <filename>randomizer/v_randomizer.py
import argparse, sys
import string
import random
#--------------#
# Argument #
#--------------#
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument('-o', '--output',dest="output", help='Path of the output file to be created')
parser.add_... | StarcoderdataPython |
3244344 | <gh_stars>1-10
#!/usr/bin/python2.4
# encoding: utf-8
"""
db.py
High-level functions for interacting with the ddG database.
Created by <NAME> 2012.
Copyright (c) 2012 __UCSF__. All rights reserved.
"""
import sys
import os
import string
import glob
import traceback
import random
import datetime
import zipfile
import ... | StarcoderdataPython |
4843110 | <reponame>aliborji/ShapeDefence
from __future__ import print_function
import argparse
from lib import *
from config import *
from model import model_dispatcher
from utils import *
import os
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
########... | StarcoderdataPython |
3232412 |
class Node:
def __init__(self, value = None, left = None, right = None):
self.value = value
self.left = left
self.right = right
class K_aryTree:
def __init__(self, root = None):
self.root = root
def pre_order(self):
list = []
def traverse(root):
... | StarcoderdataPython |
4835459 | # -*- coding: utf-8 -*-
"""
walle-web
:copyright: © 2015-2019 walle-web.io
:created time: 2018-11-24 07:12:13
:author: <EMAIL>
"""
from datetime import datetime
from sqlalchemy import String, Integer, Text, DateTime
from walle import model
from walle.model.database import SurrogatePK, db, Model
from w... | StarcoderdataPython |
10514 | <reponame>gillins/pyshepseg
#Copyright 2021 <NAME> and <NAME>. All rights reserved.
#
#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 ri... | StarcoderdataPython |
118738 | # Generated by Django 2.2 on 2019-08-06 15:18
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('commun... | StarcoderdataPython |
1783624 | <reponame>jyotti/backlog-toolbox<filename>backlog_toolbox/__init__.py
# coding:utf-8
__author__ = '<NAME>'
| StarcoderdataPython |
4834682 | <reponame>carlosjpc/panditas<gh_stars>1-10
from panditas.models import DataFlow, DataSet, MergeMultipleRule, MergeRule
from panditas.transformation_rules import ConstantColumn
def test_data_set_dependencies():
data_flow = DataFlow(
name="Test Dependent Data Sets",
steps=[
DataSet(df_pa... | StarcoderdataPython |
16951 | <reponame>zhiyuli/HydroLearn<filename>src/apps/core/migrations/0005_auto_20180417_1219.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-04-17 17:19
from __future__ import unicode_literals
from django.db import migrations
import django_extensions.db.fields
class Migration(migrations.Migration):
de... | StarcoderdataPython |
1748708 | <reponame>Izacht13/pyCML<gh_stars>0
"""
pyCasual
"""
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name="pycasual",
version="0.0.3",
url="http://github.com/izacht13/pyCasual/",
license="MIT",
author="<NAME>",
author_email="<EMAIL>",
d... | StarcoderdataPython |
1769255 | <reponame>qgerome/openhexa-app
# Generated by Django 3.2.7 on 2021-09-30 09:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("connector_dhis2", "0018_dataset"),
]
operations = [
migrations.AlterField(
model_name="instance",... | StarcoderdataPython |
3200981 | <reponame>ZhangFly/MUISeverSourceCode
import numpy as np
from scipy import signal
from scipy import fftpack
def execute(context):
if not context.data is None:
context.data = np.sqrt(context.data**2 + fftpack.hilbert(context.data)**2)
context.prev = __name__ | StarcoderdataPython |
1667238 | <filename>noxfile.py
# Copyright (c) 2020 <NAME>, <NAME>. All rights
# reserved.
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>
"""Nox test automation file."""
from typing import List
import nox
requirements: List[str] = ["-r", "requirements.txt"]
t... | StarcoderdataPython |
1794462 | class CRMSystemError(Exception):
def __init__(self, errorCode, errorMessage, *args, **kwargs):
super().__init__(errorMessage, *args, **kwargs)
self.errorCode = errorCode
self.errorMessage = errorMessage
def __str__(self):
return "{} - {}".format(self.errorCode, self.errorMessage... | StarcoderdataPython |
132909 | <filename>loaner/web_app/backend/actions/request_shelf_audit_test.py
# Copyright 2018 Google Inc. 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.apach... | StarcoderdataPython |
92482 | import numpy as np
from .. import inf
from ... import blm
from . import learning
from .prior import prior
class model:
def __init__(self, lik, mean, cov, inf='exact'):
self.lik = lik
self.prior = prior(mean=mean, cov=cov)
self.inf = inf
self.num_params = self.lik.num_params + self.... | StarcoderdataPython |
4835151 | """
Handle labels
"""
from lib.amech_io import parser
from routines.pf.models.typ import need_fake_wells
def make_pes_label_dct(rxn_lst, pes_idx, spc_dct, spc_model_dct):
""" Builds a dictionary that matches the mechanism name to the labels used
in the MESS input and output files for the whole PES
... | StarcoderdataPython |
3311276 | import os
import sys
import sqlite3
# This is the Windows Path
PathName = os.getenv('localappdata') + '\\Google\\Chrome\\User Data\\Default\\'
if (os.path.isdir(PathName) == False):
print('[!] Chrome Doesn\'t exists')
sys.exit(0)
def DownloadsHash():
hash_file = open('downloadhash.txt', 'w', encod... | StarcoderdataPython |
111790 | <reponame>JackTriton/OoT-Randomizer
import importlib.util
import os
import ListE
from Utils import data_path as dataPath
def getLang(world, set, name=None):
if world.settings.language_selection == "extra":
Path = world.settings.lang_path
dan = os.path.join(Path, "ListX.py")
data = os... | StarcoderdataPython |
1703543 | <gh_stars>1-10
# Copyright (c) Aetheros, Inc. See COPYRIGHT
#!/usr/bin/env python
import os, sys, json, time
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from client.onem2m.OneM2MPrimitive import OneM2MPrimitive
from client.onem2m.resource.Subscription import Subscription
from clien... | StarcoderdataPython |
1672068 | headers = {
'Cookie': '316558|dbebe0ac7c8cf0185517814d52954e37cb8eb2f7"',
'Host':'www.zhihu.com',
'Referer':'http://www.zhihu.com/',
'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
'Accept-En... | StarcoderdataPython |
3297348 | <reponame>inbo/speciesbim
from helpers import get_database_connection, get_config, setup_log_file, execute_sql_from_jinja_string, \
insert_or_get_scientificnameid
from csv import reader
import time
import logging
FIELDS_ANNEXSCIENTIFICNAME = ('scientificNameId', 'scientificNameInAnnex', 'isScientificName', 'annexC... | StarcoderdataPython |
22255 | <gh_stars>0
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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... | StarcoderdataPython |
3268160 | <filename>schdst.py
import os,subprocess
from tkinter import *
from tkinter.ttk import *
import tkinter as tk
from tkinter import filedialog
root = Tk()
root.wm_iconbitmap('@/home/s2/Documents/hds/favicon.xbm')
root.wm_title("X=10Hrs to 22Hrs <::Set Schedule::> Y=0Mins to 59Mins")
root.geometry('1175x650')
global do... | StarcoderdataPython |
1799415 | <filename>catkin_ws/src/00-infrastructure/duckietown/include/duckietown_utils/image_conversions.py<gh_stars>1-10
class ImageConversions():
# We only instantiate the bridge once
bridge = None
def get_cv_bridge():
if ImageConversions.bridge is None:
from cv_bridge import CvBridge # @Unresolve... | StarcoderdataPython |
3337919 | <gh_stars>0
import importlib
import numpy as np
import tensorflow as tf
from keras.layers import Activation, Dense, Input
from keras.models import Model, Sequential
class VAE(object):
"""
Variational Autoencoder
This object is composed of an Encoder and a Decoder object
"""
def __init__(self, inp... | StarcoderdataPython |
55415 | <filename>google_fanyi/fanyi.py<gh_stars>0
from winreg import REG_QWORD
import requests
from fake_useragent import UserAgent
import random
import urllib.parse
import time
class GoogleFanyi():
def __init__(self, query):
form_data = f'[[["MkEWBc","[[\"{query}\",\"zh-CN\",\"en\",true],[null]]",null,"... | StarcoderdataPython |
102111 | <reponame>leucinw/leucinwChemTools
#===================================
# <NAME> #
# <EMAIL> #
# University of Texas at Austin #
#===================================
''' Usage: python matchTXYZ.py template.txyz dealwith.(t)xyz
# Assign the atom types of the template.txyz file ... | StarcoderdataPython |
154774 | # Generated by Django 2.0 on 2018-02-27 02:10
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('events', '0010_userprofile_send_notifications'),
]
operations = [
migrations.CreateModel(
name='C... | StarcoderdataPython |
3282044 | <reponame>cocoaaa/vision
import os
import shutil
import tempfile
import contextlib
import unittest
import argparse
import sys
import torch
import errno
import __main__
@contextlib.contextmanager
def get_tmp_dir(src=None, **kwargs):
tmp_dir = tempfile.mkdtemp(**kwargs)
if src is not None:
os.rmdir(tmp_... | StarcoderdataPython |
3248941 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2016 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this ... | StarcoderdataPython |
41801 | import pyeccodes.accessors as _
def load(h):
if (h.get_l('class') == 8):
h.alias('mars.origin', 'centre')
| StarcoderdataPython |
1643676 | <reponame>Zirkuit/statistico<gh_stars>0
from http.server import HTTPServer, BaseHTTPRequestHandler
import subprocess
import os
class Serv(BaseHTTPRequestHandler):
def do_GET(self):
if os.path.exists("/index.html"):
os.remove("/index.html")
f = open("index.html", "w")
f.write('... | StarcoderdataPython |
748 | <filename>scripts/run_rbf_comparison_car_air_top5.py
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 19 16:26:35 2019
@author: Administrator
"""
# Forked from run_rbf_comparison.py
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicod... | StarcoderdataPython |
160854 | import tensorflow as tf
from tfLego.model.Model import Model
class NeuralNetwork(Model):
def __init__(self, *args, **kwargs):
super().__init__(loss=tf.losses.mean_squared_error, *args, **kwargs)
| StarcoderdataPython |
135744 | <reponame>al-arz/the-tale<gh_stars>10-100
import smart_imports
smart_imports.all()
urlpatterns = [django_urls.url(r'^tokens/', django_urls.include((old_views.resource_patterns(views.TokensResource), 'tokens')))]
| StarcoderdataPython |
1678368 | <reponame>oferbaharav/lambdata
import unittest
import pandas as pd
from df_utils import check_dataframe_na
class TestDfUtils(unittest.TestCase):
def test_check_dataframe_na(self):
df = pd.DataFrame({'a': [0,1,2], 'b': [1,1,1]})
self.assertFalse(check_dataframe_na(df))
df = pd.DataFrame({'... | StarcoderdataPython |
4802456 | <filename>quizmake/__init__.py<gh_stars>1-10
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Initiate the file."""
__author__ = "jnguyen1098"
__copyright__ = "Copyright 2020, jnguyen1098"
__credits__ = ["jnguyen1098"]
__license__ = "MIT"
__maintainer__ = "jnguyen1098"
__status__ = "Planning"
__version__ = "0.1.6"
... | StarcoderdataPython |
145420 | <reponame>headstrongsolutions/Jarvis_Screen
import RPi.GPIO as GPIO
class transistor_switch:
# describes the type
typeDescription = 'Transistor Switch on pin 13 - initally set to on'
def __init__(self):
self.switch_pin = 13
self.switch_state = True
GPIO.setmode(GPIO.BCM)
GP... | StarcoderdataPython |
4822562 | <filename>introduction-to-data-visualization-in-python/1. Customizing plots/script_8.py
import pandas as pd
percent_bachelors_degrees_women_usa = pd.read_csv('datasets/percent-bachelors-degrees-women-usa.csv')
year = percent_bachelors_degrees_women_usa['Year']
physical_sciences = percent_bachelors_degrees_wome... | StarcoderdataPython |
1717204 | # -*- coding: utf-8 -*-
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__version__ = '0.1.0'
from .h5shelve import open
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.