id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
1630034
<reponame>TwistedCore/external_v8 # Copyright 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. { 'variables': { # Check for presence of harfbuzz-icu library, use it if present. 'harfbuzz_libraries': '...
StarcoderdataPython
82399
# -*- coding: utf-8 -*- # @File : session.py # @Date : 2021/2/25 # @Desc : from Lib.api import data_return from Lib.configs import Session_MSG_ZH, CODE_MSG_ZH, RPC_SESSION_OPER_SHORT_REQ, CODE_MSG_EN, Session_MSG_EN from Lib.log import logger from Lib.method import Method from Lib.notice import Notice from Lib.rpcc...
StarcoderdataPython
3220594
<filename>Gems/AtomLyIntegration/TechnicalArt/DccScriptingInterface/azpy/shared/common/envar_utils.py # coding:utf-8 #!/usr/bin/python # # Copyright (c) Contributors to the Open 3D Engine Project. # For complete copyright and license terms please see the LICENSE at the root of this distribution. # # SPDX-License-Identi...
StarcoderdataPython
3331596
<gh_stars>0 import os import time import numpy as np from sklearn.metrics import roc_auc_score import oneflow as flow from config import get_args from dataloader_utils import OFRecordDataLoader from wide_and_deep_module import WideAndDeep from util import dump_to_npy, save_param_npy from eager_train import prepare_mo...
StarcoderdataPython
155340
# -*-encoding:utf-8-*- from karlooper.utils.encrypt import StrEncryption from karlooper.utils.base64encrypt import Encryption from karlooper.utils.des_encrypt import DES def test_encrypt(): str_encryption = StrEncryption() str_encryption.input_key("test") _str = "make a test" encode_str = str_encrypt...
StarcoderdataPython
1631156
<reponame>ImperialCollegeLondon/sap-quick-audio-demo import sys import os import glob from shutil import copyfile def fileToStr(fileName): """Return a string containing the contents of the named file.""" fin = open(fileName); contents = fin.read(); fin.close() return contents def strToFile(te...
StarcoderdataPython
1636228
<filename>aydin/analysis/demo/demo_snr_estimate.py import pytest from numpy.random.mtrand import normal from aydin.analysis.snr_estimate import snr_estimate from aydin.io.datasets import camera, normalise from aydin.util.log.log import lprint, Log def demo_snr_estimate(display: bool = False): Log.enable_output =...
StarcoderdataPython
149491
# -*- coding: utf-8 -*- # © 2016 <NAME> # © 2016 Niboo SPRL (<https://www.niboo.be/>) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import api, exceptions, fields, models class ProjectProject(models.Model): _inherit = 'project.project' scrum_team_id = fields.Many2one('proje...
StarcoderdataPython
140555
import argparse import torch from stereo import MinSumStereo, BlockMatchStereo, RefinedMinSumStereo import data import imageio import numpy as np import matplotlib.pyplot as plt parser = argparse.ArgumentParser() parser.add_argument('--im0', action='store', required=True, type=str) parser.add_argument('--im1', acti...
StarcoderdataPython
172180
def wire(data): x, y = (0, 0) for dir, step in [(x[0], int(x[1:])) for x in data.split(",")]: for _ in range(step): x += -1 if dir == "L" else 1 if dir == "R" else 0 y += -1 if dir == "D" else 1 if dir == "U" else 0 yield x, y def aoc(data): wires = [set(wire(li...
StarcoderdataPython
30932
<reponame>materialsproject/maggflow """ Simple API Interface for Maggma """
StarcoderdataPython
3267710
from typing import Callable, Sequence from functools import partial from operator import itemgetter import torch from keyedtensor import KeyedTensor def _many_to_one(keyedtensors: Sequence[KeyedTensor], op: Callable, dim: int) -> KeyedTensor: keys = list(keyedtensors[0]) getter = itemgetter(*keys) op =...
StarcoderdataPython
1737690
<reponame>ErenKaracan47/TemelProgramlama<filename>ProgramlamayaGiris/2 - List and If/0 - List.py list1 = [0, 1, 2, 3, 4] list2 = [9, 8, 7, 6, 5] list3 = [0, 0, 0, 0, 0] list3[0] = list1[0] + list2[0] list3[1] = list1[1] - list2[1] list3[2] = list1[2] * list2[2] list3[3] = list1[3] / list2[3] list3[4] = list1[4] *...
StarcoderdataPython
421
import cv2, time import numpy as np import Tkinter """ Wraps up some interfaces to opencv user interface methods (displaying image frames, event handling, etc). If desired, an alternative UI could be built and imported into get_pulse.py instead. Opencv is used to perform much of the data analysis, but there is no re...
StarcoderdataPython
1685746
class FindObject: """An object represented a find(1) command""" def __init__(self, cmd): self.exec_cmd = '' self.path = '' self.opts = '' if cmd.startswith('find'): # find ./find -type f -exec rm -rf {} ; # 012345 012 0123456 # ...
StarcoderdataPython
26453
<gh_stars>0 from pygraphblas import * def test_add_identity(): A = Matrix.sparse(INT8, 10, 10) assert add_identity(A) == 10 A = Matrix.sparse(INT8, 10, 10) A[5,5] = 42 assert add_identity(A) == 9
StarcoderdataPython
1760949
import numpy as np from plotoptix import TkOptiX from PIL import Image im = Image.open("samples/color spectrum.png") px = im.load() colors = [] cont = 0 for row in range(0, im.height): for col in range(0, im.width): pix = px[col, row] newCol = (round(pix[0] / 255, 2), round(pix[1] / 255, 2), round...
StarcoderdataPython
20982
<reponame>Vertexwahn/depend_on_what_you_use def load_external_repo(): native.local_repository( name = "ext_repo", path = "test/external_repo/repo", )
StarcoderdataPython
1746608
<filename>menagerie/util/cloning_plans.py import json from pydent.models import Sample from util.plans import ExternalPlan, PlanStep, Transformation, get_obj_by_attr from util.plasmid_assembly_legs import GibsonLeg, SangerSeqLeg, PCRLeg from util.plasmid_assembly_legs import YeastTransformationLeg, YeastGenotypingLeg...
StarcoderdataPython
3301819
from socket import socket from typing import Optional from select import select from Dhcp.packet import Packet from Dhcp.opcodes import Opcodes from Dhcp.message_type import MessageType class Receivers: @staticmethod def discover_receiver(sock: socket, timeout: int = 5) -> Optional[Packet]: """ ...
StarcoderdataPython
1602442
import numpy as np from deepthought.experiments.encoding.experiment_templates.base import NestedCVExperimentTemplate class SVCBaseline(NestedCVExperimentTemplate): def pretrain_encoder(self, *args, **kwargs): def dummy_encoder_fn(indices): if type(indices) == np.ndarray: ind...
StarcoderdataPython
3377040
''' configurations and schedule for network training this implementation includes some kind fancy tools, like prefetch_generator, tqdm and tensorboardx. I also use logging to print information into log file rather than print function. ''' import argparse import os import time import logging import numpy as np import t...
StarcoderdataPython
55648
<gh_stars>1-10 import numpy as np import torch import torchvision import torch.nn as nn import torch.nn.functional as F class base(nn.Module): def __init__(self): super(base, self).__init__() self.conv1 = nn.Conv2d(3, 6, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(6, 16...
StarcoderdataPython
3356652
# %% import numpy as np from matplotlib import pyplot as plt import copy,os import pyhsmm from pyhsmm.util.text import progprint_xrange from mpl_toolkits.mplot3d import Axes3D from matplotlib.gridspec import GridSpec, GridSpecFromSubplotSpec from matplotlib import font_manager import matplotlib as mpl zhfont1 = font...
StarcoderdataPython
144914
<reponame>LeandroIssa/ha-nest-protect """Models used by PyNest.""" from dataclasses import dataclass, field import datetime from typing import Any @dataclass class NestLimits: """Nest Limits.""" thermostats_per_structure: int structures: int smoke_detectors_per_structure: int smoke_detectors: in...
StarcoderdataPython
130934
<reponame>ONSdigital/ras-frontstage<filename>tests/integration/test_jwt_authorization.py import unittest from unittest import mock from uuid import uuid4 from jose import JWTError from frontstage import app from frontstage.common.authorisation import jwt_authorization from frontstage.common.session import Session fro...
StarcoderdataPython
1707988
from typing import List, Tuple, Set, Dict def add_vec(v1: Tuple[int, int], v2: Tuple[int, int]) -> Tuple[int, int]: return v1[0] + v2[0], v1[1] + v2[1] def map_moves(steps: List[Tuple[str, int]]) -> Dict[Tuple[int, int], int]: movement_vec = { "U": (1, 0), "D": (-1, 0), "R": (0, 1), ...
StarcoderdataPython
3234941
from .headed_frame import HeadedFrame from .key_value_display import KeyValueDisplay from .ttk_text import TtkText
StarcoderdataPython
1654790
## Engineering spectral features import librosa as lr # Calculate the spectral centroid and bandwidth for the spectrogram bandwidths = lr.feature.spectral_bandwidth(S=spec)[0] centroids = lr.feature.spectral_centroid(S=spec)[0] ________________________________________________________________ from librosa.core import...
StarcoderdataPython
10576
<reponame>christopherferreira3/Python-ADB-Tools import subprocess import os def get_connected_devices() -> list: """ Returns a list of tuples containing the Device name and the android Version :return: """ devices = [] devices_output = subprocess.check_output(["adb", "devices"]).decode("utf-8"...
StarcoderdataPython
3287352
<reponame>gunpowder78/webdnn from typing import Tuple from webdnn.graph import traverse from webdnn.graph.axis import Axis from webdnn.graph.graph import Graph from webdnn.graph.operators.linear import Linear from webdnn.graph.operators.sgemm import Sgemm from webdnn.graph.optimize_rule import OptimizeRule from webdnn...
StarcoderdataPython
153146
# encoding:utf-8 from utils import get_url subreddit = 'hmmm' t_channel = '@r_hmmm' NSFW_EMOJI = u'\U0001F51E' def send_post(submission, r2t): what, url, ext = get_url(submission) title = submission.title link = submission.shortlink text = '{}\n{}'.format(title, link) if what not in ('img'):...
StarcoderdataPython
3310598
""" Script to compute features used for posture and activity recognition in multilocation paper. features: "MEAN" 'STD' 'MAX' 'DOM_FREQ' 'DOM_FREQ_POWER_RATIO' 'HIGHEND_FREQ_POWER_RATIO' 'RANGE' 'ACTIVE_SAMPLE_PERC' 'NUMBER_OF_ACTIVATIONS' 'ACTIVATION_INTERVAL_VAR' Usage: ...
StarcoderdataPython
3313141
import asyncio import logging import os from mqttrpc import MQTTRPC, dispatcher logging.basicConfig(level=logging.DEBUG) logging.getLogger('hbmqtt').setLevel(level=logging.INFO) class TestMQTTRPC(MQTTRPC): @dispatcher.public async def test(name=''): print('Hello') return 'Hello, {}'.format(na...
StarcoderdataPython
177553
# Environments # Put all custom environments here import numpy as np import gym import logging logger = logging.getLogger(__name__) import sys sys.path.append("../gym_tetris") from gym_tetris import TetrisEnvironment # can just download premade tetris environment online # to register, look at torchkit (good example ...
StarcoderdataPython
1743907
# Copyright 2018 Tensorforce Team. 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 applicable la...
StarcoderdataPython
3380237
import numpy as np import itertools import sys import os from qmla.exploration_strategies import connected_lattice import qmla.shared_functionality.probe_set_generation import qmla.shared_functionality.latex_model_names from qmla import construct_models # flatten list of lists def flatten(l): return [item for sublist...
StarcoderdataPython
3386991
import abc from enum import IntEnum, auto class Flags(IntEnum): ################################################### # Documentation of flags can be found in flags.md ################################################### #Null flags ROW_ID_NULL = auto() SERVICE_DATE_NULL = auto() VEHICLE_NUMBER_NULL = auto...
StarcoderdataPython
199811
<filename>DataLogger 01.py<gh_stars>0 # Programa de dataloogger com Cayenne # Autor: <NAME> # Data: junho/2018 # Comunicacao com o Cayenne # pip3 install cayenne-mqtt # Data Logger import cayenne.client import time, sys, csv from sense_hat import * import numpy as np import RPi.GPIO as GPIO # ----------------------...
StarcoderdataPython
192815
<reponame>eugenividal/GEOG5995M_Assessment_2 # -*- coding: utf-8 -*- """ Created on Wed Jul 11 11:48:17 2018 GEOG5995M Programming for Social Science: Core Skills @author: <NAME> """ # The algorithm for the model: # 1. Set up the environment # 2. Make the drunks and give them a name # 3. Move the drunks and draw the d...
StarcoderdataPython
3291647
# -*- encoding: utf-8 -*- # # Copyright © 2020–2021 Mergify SAS # # 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 appl...
StarcoderdataPython
27558
<filename>custom_components/weatheralerts/sensor.py """ A component which allows you to get information about next departure from spesified stop. For more details about this component, please refer to the documentation at https://github.com/custom-components/sensor.weatheralerts """ import voluptuous as vol from date...
StarcoderdataPython
1782220
<reponame>poffey21/demo from django.contrib import messages from django.contrib.admin.utils import unquote from django.contrib.auth import logout, login, authenticate, get_user_model from django.contrib.auth.decorators import login_required from django.contrib.auth.models import Group from django.http import Http404 fr...
StarcoderdataPython
3331835
"""Modify grb/config/path.py as needed. There are four paths to assign: - ROOT: the root directory for the repo, absolute path - FITS: data directory for FITS file, relative to ROOT - TABLE: data directory for tables ((e)csv, txt, etc.), relative to ROOT - IMAGE: image directory, relative to ROOT """ from pathlib imp...
StarcoderdataPython
197571
<filename>app/concat_unmask.py import os import subprocess import time import yaml import argparse """ Given a directory of PAN20 formatted datasets, runs `unmask.py run` on all of them. Inputs: - job.yml with <output_dir> and <transcription> placeholders - path to directory with PAN20 formatted datasets """ def now...
StarcoderdataPython
1745250
from multiprocessing.sharedctypes import Value from typing import List, Callable, Dict from torchmetrics.functional import accuracy from .data.imagedataset import ImageSet from .models.convnext import ConvNeXt from .models.convnext_isotropic import ConvNeXtIsotropic def Convnext( type=None, in_chans: int=3, ...
StarcoderdataPython
1242
<filename>gremlin-python/src/main/jython/tests/driver/test_client.py ''' 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 t...
StarcoderdataPython
1740085
import os import csv import shutil import urllib.request def get_score(model_name=None, dataset_name=None, dataset_res=None, dataset_split=None, task_name=None): # download the csv file from server url = "https://www.cs.cmu.edu/~clean-fid/files/leaderboard.csv" local_path = "/tmp/leaderboard.csv" ...
StarcoderdataPython
1638920
import discord import asyncio from discord.ext import commands from Components.MangoPi import MangoPi from Components.RaidFilter import RaidFilter def setup(bot: MangoPi): """ Function necessary for loading Cogs. This will update AntiRaid's data from mongoDB. Parameters ---------- bot : MangoPi ...
StarcoderdataPython
125577
import os from django.core.wsgi import get_wsgi_application try: import newrelic.agent newrelic.agent.initialize("/home/openstates/newrelic.ini") newrelic.agent.capture_request_params() except Exception as e: print("newrelic couldn't be initialized:", e) os.environ.setdefault("DJANGO_SETTINGS_MODULE...
StarcoderdataPython
1705303
<gh_stars>1-10 # (C) British Crown Copyright 2011 - 2020, Met Office # # This file is part of cartopy. # # cartopy is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (...
StarcoderdataPython
1741075
<filename>qutip/control/optimconfig.py<gh_stars>1000+ # -*- coding: utf-8 -*- # @author: <NAME> # @email1: <EMAIL> # @email2: <EMAIL> # @organization: Aberystwyth University # @supervisor: <NAME> """ Configuration parameters for control pulse optimisation """ import numpy as np # QuTiP logging import qutip.logging_ut...
StarcoderdataPython
1756206
<gh_stars>1-10 import os import shutil import subprocess import traceback from pathlib import Path from termcolor import colored os.system("color") print( colored( """ ooooo ooo ooooo ooooo ooooooo ooooo `888' `8' `888' `888' `8888 d8' 888 8 888 8...
StarcoderdataPython
3235297
<gh_stars>0 from typing import List, Tuple from utils.DatabaseConnection import DatabaseConnection data_file = 'data.db' Book = Tuple[int, str, str, int] def create_book_table() -> None: with DatabaseConnection(data_file) as connection: cursor = connection.cursor() # SQLite automati...
StarcoderdataPython
1786123
# -*- coding: utf-8 -*- """ Created on Sat Mar 11 11:20:14 2018 @author: <EMAIL> """ import numpy as np def Bresenham_line(ends): w, h = np.diff(ends, axis=0)[0] pt1, __ = ends x, y = pt1 longest = np.absolute(w) shortest = np.absolute(h) if w != 0: dx = int(np.absolute(w)/...
StarcoderdataPython
175749
from inspect import ismethod import numpy as np from htm.bindings.sdr import SDR # # from mdp_planner import DataEncoder, DataMultiEncoder, TemporalMemory, HtmAgent # # # class TestDataEncoder: # def __init__(self): # self.encoder = DataEncoder('-', n_vals=2, value_bits=3, activation_threshold=2) # # d...
StarcoderdataPython
3217831
<filename>login/migrations/0036_auto_20170414_1643.py # -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-04-14 11:13 from __future__ import unicode_literals from django.db import migrations, models import draceditor.models class Migration(migrations.Migration): dependencies = [ ('login', '0035...
StarcoderdataPython
4800690
from enum import Enum HOUSE = 'House' HOTEL = 'Hotel' class Card(): def __init__(self, index, value): self.index = index self.value = value class Cashable(Card): pass class CashCard(Cashable): def __repr__(self): return f'<CashCard (${self.value})>' class ActionCard(Cashable)...
StarcoderdataPython
143597
""" 2d and 3d wrappers for plotting 2d and 3d data in dataframes """ __author__ = "<NAME>" __copyright__ = "Copyright 2012, GWU Physics" __license__ = "Free BSD" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" __status__ = "Development" import datetime import matplotlib.pyplot as plt import matplotlib.ticker as mplti...
StarcoderdataPython
1739640
import os,copy,argparse from collections import OrderedDict from pypospack.pyposmat.data import PyposmatDataFile from pypospack.pyposmat.data import PyposmatConfigurationFile from pypospack.pyposmat.data import PyposmatDataAnalyzer def get_qoi_targets(o_config): print(type(o_config)) assert type(o_config) is P...
StarcoderdataPython
3260114
<filename>arekit/contrib/networks/core/input/embedding/offsets.py import logging from arekit.contrib.networks.embeddings.base import Embedding logger = logging.getLogger(__name__) class TermsEmbeddingOffsets(object): """ Describes indices distribution within a further TermsEmbedding. All parameters shif...
StarcoderdataPython
1651487
""" We try to determine if it is harder for a NN to learn from """ from __future__ import print_function import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms from torch.optim.lr_scheduler import StepLR from torch...
StarcoderdataPython
3337372
from taggit.forms import TagField, TagWidget from django.forms.widgets import SelectMultiple, Textarea, HiddenInput, TextInput from django import forms from django.utils.translation import ugettext as _ from taggit.utils import parse_tags, edit_string_for_tags import re from django import forms class ContactForm(form...
StarcoderdataPython
1745789
<gh_stars>10-100 #!/usr/bin/env python3 import os from typing import Optional EON = os.path.isfile('/EON') class Service: def __init__(self, port: int, should_log: bool, frequency: float, decimation: Optional[int] = None): self.port = port self.should_log = should_log self.frequency = frequency self...
StarcoderdataPython
1633972
import tensorflow as tf import argparse import logging from tqdm import tqdm import os import absl.logging from utils.datasets import PascalSentencesDataset from multi_hop_attention.hyperparameters import YParams from multi_hop_attention.loaders import InferenceLoader from multi_hop_attention.models import MultiHopAtt...
StarcoderdataPython
1775673
<filename>src/utils/transformation_configs.py<gh_stars>1-10 """ Configurations @author: <NAME> (y(dot)meng201011(at)gmail(dot)com) """ import cv2 from enum import Enum from PIL import Image from skimage import filters, morphology, transform from scipy import ndimage class TRANSFORMATION(Enum): CLEAN = 'clean' ...
StarcoderdataPython
3343984
<gh_stars>0 """ string-ID-based functions """ from .ipybel.smiles import canonical as canonical_smiles from .ipybel.smiles import number_of_atoms as number_of_atoms_from_smiles from .ipybel.smiles import formula as formula_from_smiles from .ipybel.smiles import geometry as geometry_from_smiles from .ipybel.smiles impor...
StarcoderdataPython
147273
<gh_stars>10-100 def main(): import RPi.GPIO as GPIO import time try: print(GPIO.VERSION) print(GPIO.RPI_INFO) GPIO.setmode(GPIO.BOARD) GPIO.setwarnings(False) GPIO.setup(12, GPIO.OUT) GPIO.setup(11, GPIO.OUT, initial=GPIO.HIGH) GPIO.setup(13, GPIO...
StarcoderdataPython
3312842
<gh_stars>1-10 import requests """ url = 'https://viacep.com.br/ws/' cep = '30140071' formato = '/json/' r = requests.get(url + cep + formato) if(r.status_code == 200): print('JSON: ', r.json()) else: print('Requisição mal sucedida') """ url = 'https://viacep.com.br/ws/' #invocação a um web wervice cep = '3...
StarcoderdataPython
4809155
from diary.views import NoteListView, NoteCreateView, note_and_next from django.urls import path urlpatterns = [ path('', NoteListView.as_view(), name='note-list'), path('note/create', NoteCreateView.as_view(), name='note-create'), path('note/<pk>/and_next', note_and_next, name='note_and_next'), ]
StarcoderdataPython
1644040
import ncvis vis = ncvis.NCVis(n_neighbors=15, M=16, ef_construction=200, n_init_epochs=20, n_epochs=50, min_dist=0.4, n_threads=-1, distance='euclidean')
StarcoderdataPython
3269464
from .kernel_model import KernelNet from .unet_model import UNet
StarcoderdataPython
43098
import tempfile import pandas as pd from pg2pd import Pg2Pd def test_make_df_1(pg_conn): """Test of main Postgres binary data to Pandas dataframe pipeline. This tests an integer and varchar. """ cursor = pg_conn.cursor() # Copy binary data to a tempfile path = tempfile.mkstemp()[1] que...
StarcoderdataPython
120469
from opendc.models.experiment import Experiment from opendc.util import exceptions from opendc.util.rest import Response def GET(request): """Get this Experiment.""" try: request.check_required_parameters( path={ 'experimentId': 'int' } ) except ex...
StarcoderdataPython
29457
<filename>tests/test_get_google_streetview.py import os import pandas as pd from open_geo_engine.src.get_google_streetview import GetGoogleStreetView def test_get_google_streetview(): size = "600x300" heading = "151.78" pitch = "-0.76" key = os.environ.get("GOOGLE_DEV_API_KEY") image_folder = "te...
StarcoderdataPython
66151
<reponame>ze-nian/yt_trending_data<filename>scraper.py import requests, sys, time, os, argparse,datetime # List of simple to collect features snippet_features = ["title", "publishedAt", "channelId", "channelTitle", "categoryId"] # Any char...
StarcoderdataPython
1609877
<gh_stars>1-10 # Import the Flask libraries # used for powering the Main Event loop try: from flask import Flask from flask import flash from flask import url_for from flask import redirect from flask import request from flask import session from flask import make_response from hashlib import md5 from flask ...
StarcoderdataPython
3261788
# Generated by Django 2.1.3 on 2018-12-01 14:21 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('chat', '0005_auto_20181117_1716'), ] operations = [ migrations.AlterField( model_name='chat', name='participants', ...
StarcoderdataPython
1677699
<filename>tests/11 - NSC Data Tests/All folders/Artificial Dataset/artificial_data_var.py<gh_stars>1-10 import sys import os import platform system = platform.system() current_dir = os.getcwd() if system == 'Windows': path_dir = current_dir.split("\\Neurons")[0] + "\\Neurons" else: path_dir = a.split("/Neuro...
StarcoderdataPython
69978
<filename>experiments/visualizations/visualize_smis.py import os import sys from datetime import datetime import logging from collections import OrderedDict import io import numpy as np import torch import h5py import pandas as pd from PIL import Image import rdkit.Chem as Chem from rdkit.Chem import Draw from rdkit.Ch...
StarcoderdataPython
23100
<gh_stars>0 import sys import os class Console(object): """ Class responsible for handling input from the user """ def __init__(self): self.log_file = "log.txt" # initialize log with open(self.log_file, 'a') as file: file.write("** NEW LOG CREATED **\n") @s...
StarcoderdataPython
726
<gh_stars>0 """ Client for simulator requests """ __copyright__ = "Copyright 2020, Microsoft Corp." # pyright: strict from random import uniform import time from typing import Union import jsons import requests from .exceptions import RetryTimeoutError, ServiceError from .logger import Logger from .simulator_protoc...
StarcoderdataPython
1612957
<gh_stars>0 from __future__ import division import numpy as np from collections import Counter import LinearAlgebraFunctions as alg import math num_friends = np.random.poisson(5, 1000) num_friends = [20 * nf_i for nf_i in num_friends] daily_minutes = np.random.poisson(10, 1000) daily_minutes = [15 * dm_i for dm_i in ...
StarcoderdataPython
1693819
<filename>test/02_ascii_art.py #!/usr/bin/python from PIL import Image ASCII_CHARS_RAW = "#@%*=+;:,. " ASCII_CHARS = list(ASCII_CHARS_RAW) def scale_image(image, new_width=100): """Resizes an image preserving the aspect ratio. """ (original_width, original_height) = image.size # because characters ar...
StarcoderdataPython
1693838
# http://www.columbia.edu/~cs2035/courses/csor4231.F15/matrix-chain.pdf # http://www.geeksforgeeks.org/dynamic-programming-set-8-matrix-chain-multiplication/ # Given a sequence of matrices, find the most efficient way to multiply these # matrices together. The problem is not actually to perform the multiplications, # b...
StarcoderdataPython
3202576
# -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2016-07-23 11:39 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('lead', '0001_initial'), ] operations = [ migrations.AlterField( ...
StarcoderdataPython
3240175
<gh_stars>1-10 from django.contrib import admin from .models import Usuario # admin.site.register(Usuario) @admin.register(Usuario) class UsuarioAdmin(admin.ModelAdmin): list_display = ('nome', 'email') search_fields = ('nome', 'email') readonly_fields = ('senha',)
StarcoderdataPython
3231320
<filename>petab_MS/C.py<gh_stars>0 # pylint: disable:invalid-name """ This file contains constant definitions. """ # MEASUREMENTS OBSERVABLE_ID = 'observableId' PREEQUILIBRATION_CONDITION_ID = 'preequilibrationConditionId' SIMULATION_CONDITION_ID = 'simulationConditionId' MEASUREMENT = 'measurement' TIME = 'time' OBS...
StarcoderdataPython
124710
""" Created by <NAME>, Sep. 2018. FLOW Lab Brigham Young University """ import unittest import numpy as np from _porteagel_fortran import porteagel_analyze, x0_func, theta_c_0_func, sigmay_func, sigma_spread_func from _porteagel_fortran import sigmaz_func, wake_offset_func, deltav_func, deltav_near_wake_lin_func from...
StarcoderdataPython
3211021
<filename>compiler/modules/single_level_column_mux.py import design import debug from tech import drc, info from vector import vector import contact from ptx import ptx from globals import OPTS class single_level_column_mux(design.design): """ This module implements the columnmux bitline cell used in the desig...
StarcoderdataPython
3396481
<reponame>GPelayo/kwantiko class PostDatabaseReader: @property def post_items(self): raise NotImplementedError
StarcoderdataPython
1719873
<gh_stars>0 #!/usr/bin/env python3.5 # -*- coding: utf-8 -*- # ./image_browser.py import hashlib import os import re import sys import unicodedata import collections import itertools import subprocess try: #~ from PyQt5.QtCore import ( #~ QByteArray, #~ QFile, #~ QPoint, #~ Qt, ...
StarcoderdataPython
3256422
<reponame>mdnls/tramp import unittest from tramp.channels import ( AbsChannel, SgnChannel, ReluChannel, LeakyReluChannel, HardTanhChannel, MultiConvChannel, LinearChannel, DiagonalChannel, UpsampleChannel ) from tramp.ensembles import Multi2dConvEnsemble import numpy as np import torch def empirical_second_mo...
StarcoderdataPython
170601
# flake8: noqa """ Auswärtiges Amt OpenData Schnittstelle Dies ist die Beschreibung für die Schnittstelle zum Zugriff auf die Daten des [Auswärtigen Amtes](https://www.auswaertiges-amt.de/de/) im Rahmen der [OpenData](https://www.auswaertiges-amt.de/de/open-data-schnittstelle/736118) Initiative. ## Deaktivier...
StarcoderdataPython
1689378
<gh_stars>100-1000 # Scorer function Gi(z) in the complex plane cplot(scorergi, [-8,8], [-8,8], points=50000)
StarcoderdataPython
4802132
from typing import Type from kernel.middleware import CrequestMiddleware _cls = Type('KernelModel', bound='kernel.models.base.KernelModel') class ActionKernelModel(object): @property def action_user(self): return CrequestMiddleware.get_user() @classmethod def generate_perm(cls: _cls, actio...
StarcoderdataPython
3331942
<gh_stars>0 import numpy as np from scipy import integrate import matplotlib.pyplot as plt def int_pendulum_sim(theta_init, t, L=1, m=1, b=0, g=9.81): theta_dot_1 = theta_init[1] theta_dot_2 = -b/m*theta_init[1] - g/L*np.sin(theta_init[0]) return theta_dot_1, theta_dot_2 # Input constants m = 1 # mass (kg...
StarcoderdataPython
1633389
#! /usr/bin/env python # Copyright 2020 <NAME>. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, ...
StarcoderdataPython
1708249
import copy from membase.helper.cluster_helper import ClusterOperationHelper from couchbase_helper.documentgenerator import BlobGenerator from .xdcrnewbasetests import XDCRNewBaseTest from .xdcrnewbasetests import NodeHelper from .xdcrnewbasetests import Utility, BUCKET_NAME, OPS from remote.remote_util import RemoteM...
StarcoderdataPython
1706031
<reponame>samuelduchesne/osmnx ################################################################################ # Module: footprints.py # Description: Download and plot footprints from OpenStreetMap # License: MIT, see full license in LICENSE.txt # Web: https://github.com/gboeing/osmnx #################################...
StarcoderdataPython