id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1792477 | # this could easily be accomplished with a simple cut/paste transpose
# why am I making this more work than it needs to be?!
import os
import sys
import csv
import datetime
import subprocess
from collections import OrderedDict
from openpyxl import Workbook, load_workbook
os.chdir(os.path.dirname(os.path.abspath(__... | StarcoderdataPython |
4811321 | <reponame>brandon-edwards/openfl
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Assigner package."""
from .assigner import Assigner
from .random_grouped_assigner import RandomGroupedAssigner
from .static_grouped_assigner import StaticGroupedAssigner
__all__ = [
'Assigner',
... | StarcoderdataPython |
4807361 | <filename>scripts/climdata_to_csv.py
"""
A directory of climate data -> a json describing it
keys:
rcp
period
model
variable
filepath
month
units
"""
import os
import pandas
from glob import glob
from rasterstats import zonal_stats
from itertools import chain
worldclim_dir = "/Users/mperry... | StarcoderdataPython |
1747412 | <reponame>mistermoutan/ModelsGenesis
import torch
class DiceLoss:
@staticmethod
def dice_loss(pred, target, smooth=0, eps=1e-7, return_loss=True, skip_zero_sum: bool = True, per_class=False):
"""
pred: tensor with first dimension as batch
target: tensor with first dimension as batch
... | StarcoderdataPython |
1640569 | """
These objects are pointers to code/data you wish to give access
to a launched job.
Each object defines a source and a mount point (where the directory will be visible
to the launched process)
"""
import os
import tarfile
import tempfile
from contextlib import contextmanager
class Mount(object):
"""
Args... | StarcoderdataPython |
3360602 | <gh_stars>100-1000
#
#//----------------------------------------------------------------------
#// Copyright 2007-2010 Mentor Graphics Corporation
#// Copyright 2007-2010 Cadence Design Systems, Inc.
#// Copyright 2010-2011 Synopsys, Inc.
#// Copyright 2019-2020 <NAME> (tpoikela)
#// All Rights Reserved World... | StarcoderdataPython |
4824574 | <filename>sympy/printing/rcode.py
"""
R code printer
The RCodePrinter converts single sympy expressions into single R expressions,
using the functions defined in math.h where possible.
"""
from __future__ import print_function, division
from sympy.codegen.ast import Assignment
from sympy.printing.codeprinter impo... | StarcoderdataPython |
1770088 | <gh_stars>0
from ...hek.defs.phys import *
| StarcoderdataPython |
3299795 | <reponame>Ruzil357/YoloCustomDatasetBoilerPlate_v4
from json import load
from utils.yolo_v4 import run as run_v4
from utils.yolo_v5 import run as run_v5
with open("config.json", "r") as file:
_YOLO_VERSION = load(file)["yolo_version"]
def main():
if _YOLO_VERSION == 4:
run_v4.main()
elif _YOLO_V... | StarcoderdataPython |
1691170 | <filename>kata/07/find_calc_type.py
"""
Based on those 3 values you have to return a string, that describes which operation was used to get the given result.
The possible return strings are: "addition", "subtraction", "multiplication", "division".
Notes
In case of division you should expect that the result of the ope... | StarcoderdataPython |
3397041 | <filename>tests/test_lexer/test_tokens.py
# coding: utf-8
from __future__ import division, print_function, unicode_literals
import pytest
from six.moves import range
from formatcode.lexer.tokens import (AmPmToken, AsteriskSymbol, AtSymbol, BlockDelimiter, ColorToken, CommaDelimiter,
... | StarcoderdataPython |
20607 | """ test gpath
isort:skip_file
"""
import os
import sys
import unittest
try:
from unittest import mock
except ImportError:
import mock
SRC = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "src")
if SRC not in sys.path:
sys.path.insert(0, SRC)
from ciopath.gpath import Pat... | StarcoderdataPython |
1797000 | <filename>Downey2011_exes/exe_02-01.py
#!/usr/bin/python
# vim: set fileencoding=utf8 :
"""
# UFRJ - PPGI
# MAB719
# <NAME> <<EMAIL>>
ThinkStats: Exercício 2.1
"""
import thinkstats
import math
_pumpkins_weight = [1, 1, 1, 3, 3, 591]
def Pumpkin(pumpkins_weight):
"""
Calculate the mean and
"""
... | StarcoderdataPython |
1798590 | <reponame>symroe/moto<filename>moto/sdb/urls.py<gh_stars>1000+
from .responses import SimpleDBResponse
url_bases = [
r"https?://sdb\.(.+)\.amazonaws\.com",
]
url_paths = {"{0}/$": SimpleDBResponse.dispatch}
| StarcoderdataPython |
1786890 | import csv;
import datetime
from sqlalchemy import Column, ForeignKey, Integer, String, Date, Boolean
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy.orm import sessionmaker
from pprint import pprint
SQLITE_CONNECTIO... | StarcoderdataPython |
1651452 | class image:
def __init__(self, mx, img, enh):
self.mins = 0
self.maxs = mx
self.img = img
self.enh = enh
self.default = '0'
def enhance(self):
self.mins -= 1
self.maxs += 1
influence = [(-1,-1),(0,-1),(1,-1),
... | StarcoderdataPython |
3395368 | <filename>MFWR/views/upload.py
# Webserver Dependencies
from flask import Flask, render_template, request, redirect, url_for, send_from_directory
from MFWR import app
# Image Upload Dependencies
import os
from werkzeug import secure_filename
def allowed_file(filename):
return '.' in filename and \
f... | StarcoderdataPython |
3269260 | # Copyright (c) 2015 GigaSpaces Technologies Ltd. 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... | StarcoderdataPython |
54860 | <reponame>Opty-MISCE/SS
from requests import session, get
from random import randint
from sys import argv
from Common.Driver import runScript
SERVER = argv[1]
attackerSERVER = "http://web.tecnico.ulisboa.pt/ist190774/SSof/R2Ai2t0bslrVyMxUOUyO.html"
victimSession = session()
victimUsername = str(randint(2 ** 27, 2 ** ... | StarcoderdataPython |
171749 | #
# radarbeam.py
#
# module for calculating geometry parameters and magnetic aspect
# angle of radar targets monitored by any radar
#
# use aspect_elaz or aspect_txty to calculate aspect angles of targets
# specified by (el,az) or (tx,ty) angles
#
# Created by <NAME> on 11/29/08 as jrobeam.py
# Copyright (c) 2008 EC... | StarcoderdataPython |
4833178 | import random
#while True:
num1 = random.randint(1,100)
num2 = random.randint(1,100)
result = int(input(f'{num1}-{num2}='))
if result == (num1-num2) :
print("정답입니다.")
else :
print("틀렸습니다.") | StarcoderdataPython |
3300288 | # 先把API com元件初始化
import os
# 第一種讓群益API元件可導入讓Python code使用的方法
#import win32com.client
#from ctypes import WinDLL,byref
#from ctypes.wintypes import MSG
#SKCenterLib = win32com.client.Dispatch("{AC30BAB5-194A-4515-A8D3-6260749F8577}")
#SKQuoteLib = win32com.client.Dispatch("{E7BCB8BB-E1F0-4F6F-A944-2679195E5807... | StarcoderdataPython |
3264336 | <gh_stars>0
import unittest
import Calculadora_Melu
class TestCalculadora (unittest.TestCase):
def testMultiplicacion(self):
resultado=Calculadora_Melu.multiplicacion (2, 4)
self.assertEqual(resultado, 8)
if __name__ == "__main__":
unittest.main()
| StarcoderdataPython |
1797724 | """This module contains the base class for a Chunker.
Classes:
Chunker: The duty of a chunker is to get the global inventory and split it
in smaller chunks
"""
from abc import abstractmethod
from suzieq.poller.controller.base_controller_plugin import ControllerPlugin
class Chunker(ControllerPlugin):... | StarcoderdataPython |
116756 | <reponame>wilkeraziz/chisel<gh_stars>1-10
__author__ = 'waziz'
from itertools import izip
import numpy as np
def scaled_fmap(fmap, scaling=1.0):
"""Returns a feature map scaled by a constant"""
if type(fmap) is dict:
return {k: v*scaling for k, v in fmap.iteritems()}
else:
return {k: v*sc... | StarcoderdataPython |
30909 | #!/usr/bin/env python
"""
@package mi.dataset.parser.test.test_nutnrb
@file marine-integrations/mi/dataset/parser/test/test_nutnrb.py
@author <NAME>
@brief Test code for a Nutnrb data parser
"""
import unittest
import gevent
from StringIO import StringIO
from nose.plugins.attrib import attr
from mi.core.log import g... | StarcoderdataPython |
106438 | #!/usr/bin/python
from flask import Blueprint,render_template,request,jsonify
from Models.TerminusModel import db, Projetos as ProjetosModel, Clientes as ClientesModel, Tarefas as TarefasModel
tarefas = Blueprint("tarefas",__name__)
@tarefas.route("/tarefas")
def tarefas_index():
tarefas = db.session.query(taref... | StarcoderdataPython |
8733 | """
Nonnegative CP decomposition by Hierarchical alternating least squares (HALS).
With support for missing data.
"""
import numpy as np
import scipy as sci
from scipy import linalg
from tensortools.operations import unfold, khatri_rao
from tensortools.tensors import KTensor
from tensortools.optimize import FitResult... | StarcoderdataPython |
7598 | from xmlrpc.server import MultiPathXMLRPCServer
import torch.nn as nn
import torch.nn.functional as F
import copy
from src.layers.layers import Encoder, EncoderLayer, Decoder, DecoderLayer, PositionwiseFeedForward
from src.layers.preprocessing import Embeddings, PositionalEncoding
from src.layers.attention import Mult... | StarcoderdataPython |
134214 | <reponame>Jumpscale/jumpscale6_core<filename>apps/jsftpserver/jsftpserver.py
#!/usr/bin/env python
# $Id: basic_ftpd.py 1174 2013-02-19 11:25:49Z g.rodola $
# pyftpdlib is released under the MIT license, reproduced below:
# ======================================================================
# Copyright (C) 2007-... | StarcoderdataPython |
45314 | from Task import Task
from Helper import Cli
class CliExecute(Task):
def __init__(self, logMethod, parent, params):
super().__init__("CLI Execute", parent, params, logMethod, None)
def Run(self):
parameters = self.params['Parameters']
cwd = self.params['CWD']
cli = Cli(parame... | StarcoderdataPython |
109875 | <reponame>andrewhead/Search-Task-Logger
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-31 20:59
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies =... | StarcoderdataPython |
4825302 | """
@brief test log(time=3s)
"""
import unittest
import datetime
import warnings
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder
from pyensae.finance.astock import StockPrices, StockPricesHTTPException
class TestStockUrlGoogle(unittest.TestCase):
def test_download_s... | StarcoderdataPython |
176873 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | StarcoderdataPython |
4816421 | <filename>06_food_reviews/01_preprocessing.py<gh_stars>0
"""
@author: <EMAIL>
@site: e-smartdata.org
"""
import pandas as pd
df = pd.read_csv('Reviews.csv')
print(df.info())
df.to_csv('prep_reviews.tsv', sep='\t', header=False, index=False)
| StarcoderdataPython |
3349703 | """
tdop.py - Library for expression parsing.
"""
from _devbuild.gen.id_kind_asdl import Id, Id_t
from _devbuild.gen.syntax_asdl import (
arith_expr, arith_expr_e, arith_expr_t,
arith_expr__VarRef, arith_expr__Binary, arith_expr__ArithWord,
sh_lhs_expr, sh_lhs_expr_t,
word_t,
)
from _devbuild.gen.types... | StarcoderdataPython |
4809730 | #!/usr/bin/env python
"""
Copyright (c) 2016 <EMAIL>
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, publi... | StarcoderdataPython |
1624857 | import json
from pyjetbrainsdevecosystem.data_import_utils import unpack_csv_data
questions_dict = {}
with open('survey_data/2019/DevEcosystem 2019 questions_outside.csv',
encoding='utf8') as questions_text:
questions_reader = unpack_csv_data(questions_text)
questions_fieldnames = questions_reader.f... | StarcoderdataPython |
1632539 | from .matrix import Matrix
import math
__all__=["ActivationFunction","NeuralNetwork","SIGMOID","TANH"]
class ActivationFunction:
def __init__(self,f,df):
self.f=f
self.df=df
SIGMOID=ActivationFunction(
lambda v,*a:1/(1+math.exp(-v)),
lambda v,*a:v*(1-v)
)
TANH=ActivationFunction(
lambda v,*a:math.tanh(... | StarcoderdataPython |
54003 | # Copyright 2017 Neosapience, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | StarcoderdataPython |
184951 | class FlowException(Exception):
"""Internal exceptions for flow control etc.
Validation, config errors and such should use standard Python exception types"""
pass
class StopProcessing(FlowException):
"""Stop processing of single item without too much error logging"""
pass
| StarcoderdataPython |
123196 | <reponame>chrox/RealTimeElectrophy
# Generate random orientation and spatial frequency gratings.
#
# Copyright (C) 2010-2011 <NAME>
#
# See LICENSE.TXT that came with this file.
from __future__ import division
from StimControl.LightStim.SweepSeque import ParamSeque
from StimControl.LightStim.FrameControl import FrameS... | StarcoderdataPython |
193857 | import subprocess
from .utils import logging, cwd
logger = logging.getLogger(__name__)
def export_tiles(r_row, vector_data, _):
r_id = r_row['id']
for v_row in vector_data:
v_id = v_row['id']
output_path = cwd / f'../outputs/data/{v_id}_{r_id}.mbtiles'
output_path.parent.mkdir(parents... | StarcoderdataPython |
1712120 | #!/usr/bin/python
''' The Snappy Frontend
REST commands for:
Backup (backup a volume)
Restore (restore a volume from a backup)
List (view details about submitted Snappy jobs)
are received and processed.
The frontend interacts with the Snappy Database.
If Cinder is being ... | StarcoderdataPython |
3212932 | <gh_stars>0
'''
Copyright (c)2020, by Qogir, JMJ, MA71
All rights reserved.
File Name: LocalProxy
System Name: SwiftProxy
Date: 2020-12-01
Version: 1.0
Description: 远程代理服务器。该模块主要依赖aiosqlite和asyncio库。
'''
import aiosqlite
import asyncio
import json
import logging
import signal
import argparse
import collectio... | StarcoderdataPython |
3353056 | from keras.models import Sequential
from keras.layers import Embedding, LSTM, Dense, Activation, LeakyReLU, Dropout, TimeDistributed
from keras.layers import SpatialDropout1D
from config import LSTM_units
from keras.utils.vis_utils import plot_model
def get_model_emotions(vocab_size, sequence_length, embedding_s... | StarcoderdataPython |
1614875 | # (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import re
from .utils import get_version_file, load_manifest
from ..utils import read_file, read_file_lines, write_file, write_file_lines
from ..errors import ManifestError
# Maps the Python platform strings to... | StarcoderdataPython |
111945 | #!/usr/bin/env python
from .model_util import *
from ..exrpc.rpclib import *
from ..exrpc.server import *
from ..matrix.ml_data import FrovedisLabeledPoint
from ..matrix.dtype import TypeUtil
from .metrics import *
import numpy as np
# Decision Tree Regressor Class
class DecisionTreeRegressor:
"A python wrapper of ... | StarcoderdataPython |
4830474 | <gh_stars>0
"""django_workflow_engine utils."""
import sys
import importlib
from django.conf import settings
from .exceptions import WorkflowImproperlyConfigured
def build_workflow_choices(workflows):
"""Build workflow choices.
Builds a choices list by iterating over the workflows dict
provided.
:p... | StarcoderdataPython |
3284463 | <reponame>pnarvor/nephelae_base<filename>nephelae_scenario/utils.py
# This defines a collection of function to help parsing of yaml configuration
def ensure_dictionary(config):
"""
ensure_dictionary
Ensure that config is a dictionary. If not, it is probably a list of one
element dictionaries (the writ... | StarcoderdataPython |
1659439 | <filename>src/permaviss/gauss_mod_p/__init__.py
""" __init__.py
This module implements the Gaussian elimination of a matrix by column
reductions. Coefficients are assumed to lie on a finite field Z (mod p) Where
p is a prime and Z are the integers. Ideally, this should be implemented in
Cython or similar later on.
"... | StarcoderdataPython |
3780 | #!/home/a.ghaderi/.conda/envs/envjm/bin/python
# Model 2
import pystan
import pandas as pd
import numpy as np
import sys
sys.path.append('../../')
import utils
parts = 1
data = utils.get_data() #loading dateset
data = data[data['participant']==parts]
mis = np.where((data['n200lat']<.101)|(data['n200lat']>.... | StarcoderdataPython |
1752203 | from lithopscloud.modules.gen2.image import ImageConfig
class RayImageConfig(ImageConfig):
def update_config(self, image_id, minimum_provisioned_size):
#minimum_provisioned_size will be used once non default image used
if self.base_config.get('available_node_types'):
for available_... | StarcoderdataPython |
5036 | <reponame>grigi/pybbm
# -*- coding: utf-8 -*-
from django.utils import translation
from django.db.models import ObjectDoesNotExist
from pybb import util
from pybb.signals import user_saved
class PybbMiddleware(object):
def process_request(self, request):
if request.user.is_authenticated():
t... | StarcoderdataPython |
117095 | <reponame>dicryptor/MSAS
import numpy as np
import time
import ResponsiveValue
import random
ALPHA = 0.5
deg_sym = u'\u00b0'
def low_pass_test(input_list, output_list=None):
if not output_list: return input_list
for i in range(3):
output[i] = output_list[i] + ALPHA * (input_list[i] - output_list[i])... | StarcoderdataPython |
3370947 | <reponame>MaXiaoran/FakeZillow
"""
Testing Flask installation
"""
from werkzeug.routing import BaseConverter
from flask import Flask,render_template,request
class RegexConvert(BaseConverter):
def __init__(self,url_map,*itms):
super(RegexConvert,self).__init__(url_map)
self.regex=itms[0]
app ... | StarcoderdataPython |
3378698 | <reponame>toolkmit/algotrading
from .cnn import cnn | StarcoderdataPython |
3214941 | #
#*******************************************************************************
# Copyright 2014-2020 Intel Corporation
#
# 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.a... | StarcoderdataPython |
4814735 | print()
# ----------------------------
print('# ')
def draw_box(height, width): # функция принимает два параметра
for i in range(height):
print('*' * width)
draw_box(10, 100)
print()
# ----------------------------
print('# прямоугольники разных размеров:')
draw_box(3, 3)
print()
draw_box(5, 5)
print(... | StarcoderdataPython |
12737 | import transitions
from functools import partial
# from transitions import transitions.Machine
# TODO: whenever there is a state chage store the following
# (DAY,function_called) -> Stored for every person for agent status, state and Testing state
class AgentStatusA(object):
"""The Statemachine of the agent"""
stat... | StarcoderdataPython |
165142 | <reponame>ryanchao2012/airfly
# Auto generated by 'inv collect-airflow'
from airfly._vendor.airflow.models.baseoperator import BaseOperator
class EmrAddStepsOperator(BaseOperator):
job_flow_id: "typing.Union[str, NoneType]"
job_flow_name: "typing.Union[str, NoneType]"
cluster_states: "typing.Union[typing.... | StarcoderdataPython |
1695446 | <reponame>tumb1er/celery-amqp-events
""" Default configuration for EventsCelery."""
from typing import Any, Dict, Tuple, Optional
from celery.app.task import Task
AMQP_EVENTS_CONFIG: Dict[str, Any] = {
# Connections
'broker_url': 'amqp://guest:guest@localhost:5672/',
'result_backend': None,
# Queues ... | StarcoderdataPython |
1611708 | <gh_stars>0
# Copyright 2008-2018 pydicom authors. See LICENSE file for details.
"""Use the `pillow <https://python-pillow.org/>`_ Python package
to decode *Pixel Data*.
"""
import io
import logging
from typing import TYPE_CHECKING, cast
import warnings
if TYPE_CHECKING: # pragma: no cover
from pydicom.dataset i... | StarcoderdataPython |
1732096 |
# coding: utf-8
# In[14]:
import numpy as np
from sklearn import datasets
from sklearn.neighbors import KNeighborsClassifier as KNC
iris = datasets.load_iris()
x= iris.data
y= iris.target
np.unique(y)
np.random.seed(123)
indices = np.random.permutation(len(x))
iris_x_train = x[indices[:-10]]
iris_y_train = y[indice... | StarcoderdataPython |
3341452 | #! /usr/bin/python
from __future__ import print_function
import argparse
import logging
import os
import pprint
import shlex
import string
import subprocess
import sys
from logging import StreamHandler
from logging.handlers import SysLogHandler
ALPHABET = frozenset(string.ascii_letters)
IDENTIFIER_START = ALPHABET | ... | StarcoderdataPython |
1657861 | <filename>Pycharm Repository/Preprocessor.py
import re
import nltk
from sklearn.datasets import load_files
#nltk.download('stopwords')
import pickle
from nltk.corpus import stopwords
test_data = load_files(r"...\txt_sentoken") # folder containing the 2 categories of documents in individual folders.
X, y = test_d... | StarcoderdataPython |
3293981 | from prometheus_client.core import GaugeMetricFamily
from SalesforcePy import client as sfdc_client
from os import environ
import logging
import requests
logging.basicConfig(level=logging.INFO)
class Collector(object):
def __init__(self):
self.salesforce_version = environ["SF_VERSION"]
self.envir... | StarcoderdataPython |
152641 | import asyncio
import discord
from discord.ext import commands
import get_link
client = commands.Bot(command_prefix='.') # Sets the prefix to listen.
async def post_tasks(): # background method to send the data extracted in get_link.py
await client.wait_until_ready()
channel = client.get_channel(6806... | StarcoderdataPython |
4816400 | <reponame>mami-project/lurk
"""Check unpacking non-sequences in assignments. """
# pylint: disable=too-few-public-methods, invalid-name, attribute-defined-outside-init, unused-variable, no-absolute-import
from os import rename as nonseq_func
from functional.unpacking import nonseq
__revision__ = 0
# Workin... | StarcoderdataPython |
1646706 | #
# Licensed to Big Data Genomics (BDG) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The BDG licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this fil... | StarcoderdataPython |
3329568 | <filename>Raspberry/old/server/old/sendSck.py
import socket, time
IPADDR = '192.168.0.192'
PORTNUM = 5000
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.getprotobyname('udp'))
addr = (IPADDR, PORTNUM)
#s.connect(addr)
while True:
print "Enviado 5 a ",addr
s.sendto(chr(5),addr)
time.sleep(1)
s.clo... | StarcoderdataPython |
149530 | <filename>o/odbc32.py
# md5 : b27c56d844ab064547d40bf4f0a96eae
# sha1 : c314e447018b0d8711347ee26a5795480837b2d3
# sha256 : c045615fe1b44a6409610e4e94e70f1559325eb55ab1f805b0452e852771c0ae
ord_names = {
1: b'SQLAllocConnect',
2: b'SQLAllocEnv',
3: b'SQLAllocStmt',
4: b'SQLBindCol',
5: b'SQLCancel',... | StarcoderdataPython |
3247419 | from abc import ABC, abstractmethod
import subprocess
import semver
import requests
import container_builder.src.exceptions as exceptions
# Resolution strategies come in after a build has completed with various ways to determine
# when a pushable change has occured
class Strategy(ABC):
def __init__(self, repo):
... | StarcoderdataPython |
1724750 | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 17 13:30:25 2017
@author: similarities
"""
import numpy as np
import Tkinter, tkFileDialog
import ntpath
import matplotlib.pyplot as plt
root = Tkinter.Tk()
root.withdraw()
ntpath.basename("a/b/c")
file_path = tkFileDialog.askopenfilename()
#open... | StarcoderdataPython |
3335829 | from hangups.hangouts_pb2 import Location as HangupsLocation, ItemType
from hangups.hangouts_pb2 import Place, EmbedItem
import hangups
from hanger.abc import HangupsObject
class Location(HangupsObject):
def __init__(self, name, address, latitude, longitude, url=None, image_url=None):
self.name = name
... | StarcoderdataPython |
1779970 | """Miscellaneous utility functions."""
from functools import reduce
import cv2, os
from PIL import Image
import numpy as np
from matplotlib.colors import rgb_to_hsv, hsv_to_rgb
def compose(*funcs):
"""Compose arbitrarily many functions, evaluated left to right.
Reference: https://mathieularose.com/function-... | StarcoderdataPython |
1771294 | #!/usr/bin/env python
import h5py
import numpy as np
ltype = "chain"
L = 6
filename="alpsraw/spectra.{}.{}.task1.out.h5".format(ltype, L)
spectrum = []
with h5py.File(filename, "r") as f:
for key in f["spectrum"]["sectors"].keys():
sector = f["spectrum"]["sectors"][key]
spectrum += list(sect... | StarcoderdataPython |
3209557 | <reponame>castvoid/type-safely<gh_stars>0
from google.protobuf.message import Message
from cryptography.hazmat.primitives.asymmetric import ec
import cryptography.hazmat.backends
from Crypto.Hash import CMAC
from Crypto.Cipher import AES
import os
import binascii
def wrapper_contains_type(wrapper: Message, message_ty... | StarcoderdataPython |
145285 | from typing import Tuple
import googlemaps
from model.exception import UnexpectedNumberOfLocationsForAddressError
from paths import GOOGLE_CLOUD_PLATFORMS_API_KEY_FILE
class AddressLocator(object):
def __init__(self):
with open(GOOGLE_CLOUD_PLATFORMS_API_KEY_FILE, encoding='utf8', mode='r') as api_key_... | StarcoderdataPython |
3344397 | <reponame>asifjoardar/tern
import unittest
from tern.utils import general
class TestUtilGeneral(unittest.TestCase):
def testImageString(self):
correct_strings = [
'image@digest_type:digest',
'image:tag',
'debian:buster',
'golang:1.12-alpine',
('... | StarcoderdataPython |
100740 | # lec5prob9-semordnilap.py
# edX MITx 6.00.1x
# Introduction to Computer Science and Programming Using Python
# Lecture 5, problem 9
# A semordnilap is a word or a phrase that spells a different word when backwards
# ("semordnilap" is a semordnilap of "palindromes"). Here are some examples:
#
# nametag / gateman
# dog ... | StarcoderdataPython |
3335437 | <reponame>cpostbitbuckets/BucketVision
import cv2
import time
im = cv2.imread('balls.jpg')
w = 640.0
r = w / im.shape[1]
dim = (int(w), int(im.shape[0] * r))
im = cv2.resize(im, dim, interpolation = cv2.INTER_AREA)
start = time.time()
hsv = cv2.cvtColor(im, cv2.COLOR_BGR2HSV)
hue = [0.0, 61.74061433447099]
sat = [... | StarcoderdataPython |
16569 | <filename>CORE/engines/Gudmundsson_Constraint.py
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
##################################################################################
# File: c:\Projects\KENYA ONE PROJECT\CORE\engines\Gudmundsson_Constraint.py #
# Project: c:\Projects\KENYA ONE PROJECT\CORE\engines ... | StarcoderdataPython |
3354839 | <gh_stars>1-10
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This so... | StarcoderdataPython |
179318 | from dash.dependencies import Input, Output, State
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
# main dash instance
from app import app
# call modules needed for callbacks
from apps.pages import map, photos, eda, map_overlay, model_results, progressba... | StarcoderdataPython |
1648632 | <filename>cloudmesh/transfer/provider/awss3/Provider.py
from cloudmesh.storage.StorageNewABC import StorageABC
from cloudmesh.common.debug import VERBOSE
from cloudmesh.common.StopWatch import StopWatch
from cloudmesh.common.util import banner
from cloudmesh.common.console import Console
from cloudmesh.configuration.Co... | StarcoderdataPython |
3268044 | #!/usr/bin/env python3
# K N N A L G O R I T H M
# Project KNN Algorithm Implementation
# Author <NAME>
# Email <EMAIL>
# Date 13.01.2017
# Python 3.5.1
# License MIT
import math
from random import random
from collections import defaultdict
def get_train_test_sets(data, results, train=0.75):
... | StarcoderdataPython |
3296293 | from Backtest import Backtest
from Portfolio import Portfolio | StarcoderdataPython |
10286 | <reponame>phumm/gpytorch
#!/usr/bin/env python3
from .gp import GP
from .pyro import _PyroMixin # This will only contain functions if Pyro is installed
class ApproximateGP(GP, _PyroMixin):
def __init__(self, variational_strategy):
super().__init__()
self.variational_strategy = variational_strate... | StarcoderdataPython |
142555 | <filename>cmdebug/protocol.py
import socket
import json
import pdb
import simple_http
import urlparse
from chrome_debugger import websocket
def connect(wsurl):
context = websocket.gen_handshake(wsurl)
host = "localhost"
port = 9222
netloc = context["components"].netloc
if ":" in netloc:
... | StarcoderdataPython |
1680486 | import torch
import torchvision.utils as utils
import io
from PIL import Image
from enum import Enum, auto
from train import loadModel
from generator import DCGenerator, getImage
class GType(Enum):
CELEBA_30_E = "celeba-30-e"
CELEBA_20_E = "celeba-20-e"
CELEBA_10_E = "celeba-10-e"
@classmethod
de... | StarcoderdataPython |
3215671 | import sys
import os
sys.path.append(os.path.dirname(__file__) + "/../../")
from hackathon.azureautodeploy.azureUtil import *
from hackathon.database import *
from azure.servicemanagement import *
import datetime
class AzureVirtualMachines:
"""
Azure virtual machines are a collection of deployment and virtua... | StarcoderdataPython |
38296 | <filename>dlutils/timer.py<gh_stars>1-10
# Copyright 2017-2019 <NAME>
#
# 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 ap... | StarcoderdataPython |
3338135 | <gh_stars>1-10
import heapq
class Solution:
def power(self,n):
if n in self.dic:
return self.dic[n]
if n % 2:
self.dic[n] = self.power(3 * n + 1) + 1
else:
self.dic[n] = self.power(n // 2) + 1
return self.dic[n]
def getKth(self, lo: int, hi... | StarcoderdataPython |
1722365 | <filename>scripts/data/mass_each_halo.py
import numpy as np
import sys; sys.path.append("/home/lls/mlhalos_code/")
import pynbody
import time
from multiprocessing import Pool
if __name__ == "__main__":
sims = ["11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21"]
for i in range(len(sims)):
... | StarcoderdataPython |
3290206 | """
Module that contains the Menu model class.
"""
# Core imports
from pprint import pformat
class Menu(object):
"""Class that models a Food Menu."""
# Allowed attributes for this class
attributes = ('meal', 'meal_combination', 'rice', 'maindish', 'garnish', 'salad', 'dessert',
'juice'... | StarcoderdataPython |
27837 | <reponame>nbilbo/services_manager<gh_stars>0
"""Frame to show all service\'s register\'s.
"""
import tkinter.ttk
from src.view import constants
from src.view.services_page import ServicesPage
class ServicesReadPage(ServicesPage):
def __init__(self, parent, controller, *args, **kwargs):
super(ServicesRea... | StarcoderdataPython |
1776592 | <reponame>BHFDSC/CCU013_01_ENG-COVID-19_event_phenotyping
# Databricks notebook source
# MAGIC %md
# MAGIC # Create skinny table of patients & CALIBER phenotypes
# MAGIC
# MAGIC **Description**
# MAGIC
# MAGIC 1. For each terminology in `ccu013_caliber_codelist_master`
# MAGIC 2. Join data source with codelist on ... | StarcoderdataPython |
3267127 | <reponame>lclarko/GDX-Analytics
# See https://github.com/snowplow/snowplow/wiki/Python-Tracker
# and https://github.com/snowplow-proservices/ca.bc.gov-schema-registry
import time
import random
from snowplow_tracker import Subject, Tracker, AsyncEmitter
from snowplow_tracker import SelfDescribingJson
# Set up co... | StarcoderdataPython |
3232679 | from flask import Flask, redirect, url_for, request ,render_template
from reviewanalysis import *
from datafeed import *
app = Flask(__name__)
@app.route('/')
def index():
return render_template("index.html")
@app.route('/login')
def login():
return render_template("login.html")
@app.route('/thanks')
def tha... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.