id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
3304750 | <filename>cstar/remote_paramiko.py<gh_stars>1-10
# Copyright 2017 Spotify AB
#
# 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 |
1742270 | from __future__ import absolute_import, division, print_function
import numpy as np
from .weno5m import WENO5M
class HenrickApproximator:
"""
Approximator for spatial derivatives by Henrick et al. [1]_ with WENO5JS.
Algorithm by Henrick et al. [1]_ is used to approximate spatial derivatives
for gov... | StarcoderdataPython |
176964 | import csv
import os
def menu_call():
user_selection = ""
while user_selection not in range(1, 4):
print("Please chose an option from the menu below:")
print("1: Generate a Password | 2: Create Entry | 3: Edit Entry | 4: Delete Entry.")
user_selection = int(input(">:"))
return user... | StarcoderdataPython |
3391982 | import time
def bruteForceBarrier(barrierSeconds):
time.sleep(barrierSeconds)
| StarcoderdataPython |
1797493 | """
>>> from ._microio import *
>>> import time, socket
>>> def foo():
... yield
... raise Return(1)
>>> loop(foo())
1
>>> def bar():
... foo_val = yield foo()
... raise Return(foo_val + 1)
>>> loop(bar())
2
>>> def delayed_print():
... yield time.time() + 0.1 # Delay for 0.1 second
... ... | StarcoderdataPython |
175164 | from onegov.ticket.handler import Handler, HandlerRegistry
handlers = HandlerRegistry() # noqa
from onegov.ticket.model import Ticket
from onegov.ticket.model import TicketPermission
from onegov.ticket.collection import TicketCollection
__all__ = [
'Handler',
'handlers',
'Ticket',
'TicketCollection'... | StarcoderdataPython |
1673390 | <reponame>xandox/jira_comment
from .image import Image, image_directory
from .table import Row, HeadRow, Table
from .float import FloatValue, is_float_value
from .text import *
from .settings import settings
__all__ = [
"Image",
"image_directory",
"Row",
"HeadRow",
"Table",
"Text",
"Paragra... | StarcoderdataPython |
1725911 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import os,sys
import urllib.request, urllib.parse, http.cookiejar
import requests
import re
from datetime import datetime
def getcontent(url):
text_string = requests.get(url).text
#正则匹配出轮胎列表
html_string = re.findall(r'<a class=\\... | StarcoderdataPython |
1624999 | """
Checks that the archive library can be successfully built for every
scheme/implementation.
"""
import pqclean
import helpers
def test_compile_lib():
for scheme in pqclean.Scheme.all_schemes():
for implementation in scheme.implementations:
yield check_compile_lib, implementation
@helpers... | StarcoderdataPython |
583 | <filename>influxdb_service_sdk/model/container/resource_requirements_pb2.py
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: resource_requirements.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descript... | StarcoderdataPython |
3204962 | import os
import re
import cv2
import numpy as np
import random
import matplotlib
import matplotlib.pyplot as plt
src_dir = "image/"
t_dir = "tremed_data/t/"
f_dir = "tremed_data/f/"
files = os.listdir(src_dir)
files.remove(".DS_Store")
dataset = np.empty((0, 100*100*3), np.float64)
id = 0
while True:
file = ra... | StarcoderdataPython |
3383647 | __all__ = ["algos", "job_script", "MDP_funcs", "samplers", "train_agent", "utils"]
| StarcoderdataPython |
133318 | <reponame>uniparthenope/api-uniparthenope<gh_stars>1-10
import json
import sys
import traceback
import base64
import math
import sqlalchemy
from sqlalchemy import exc
from app import api, db
from flask_restplus import Resource, fields
from datetime import datetime, timedelta
from flask import g, request
from app.apis... | StarcoderdataPython |
1738582 | #!/usr/bin/env python3
import db_ops
if __name__ == "__main__":
# Open database #
db_con = db_ops.openDB('job.db')
# Create required table #
db_cur = db_con.cursor()
# TODO: Use config file for schema instead of hardcoding
schema_opening = [('Company', 'VARCHAR', 'n'),
... | StarcoderdataPython |
1709956 | <reponame>Jwsonic/air
import serial
port = serial.Serial("/dev/ttyAMA0", baudrate=9600, timeout=2.0)
def read_pm_line(_port):
rv = b''
while True:
ch1 = _port.read()
if ch1 == b'\x42':
ch2 = _port.read()
if ch2 == b'\x4d':
rv += ch1 + ch2
... | StarcoderdataPython |
3296125 | # coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class BrandVettingTestCase(Inte... | StarcoderdataPython |
1710067 | <gh_stars>0
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
get_ipython().run_line_magic('matplotlib', 'inline')
from pyvista import set_plot_theme
set_plot_theme('document')
# In[19]:
import pyvista
from pyvista import examples
import numpy as np
import vtk
# pyvista.rcParams['use_panel'] = False
# # Overview... | StarcoderdataPython |
137692 | import datetime
from sqlalchemy import Boolean
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy.orm import relationship
from sqlalchemy import String
from chainerui import database
from chainerui import db
from chainerui.tas... | StarcoderdataPython |
1712693 | <filename>gravityApp/app/GravityMainStatus.py
#!/usr/bin/env python
"""
Written by: <NAME>
Copyright 2021 Creative Collisions Technology, LLC
MainStatus.py
This class keeps track of different variables that we need to keep track of the state of the system.
This allows us to store information in the main thread tha... | StarcoderdataPython |
3394713 | import pytest
import os
import numpy as np
import pandas as pd
import taxcrunch.multi_cruncher as mcr
CURRENT_PATH = os.path.abspath(os.path.dirname(__file__))
def test_a18_validation():
taxcrunch_in = os.path.join(CURRENT_PATH, "taxsim_validation/taxcrunch_in_a18.csv")
crunch = mcr.Batch(taxcrunch_in)
t... | StarcoderdataPython |
185897 | import os
from nltk.tokenize import RegexpTokenizer
tokenize = RegexpTokenizer("\w+").tokenize
PICKLE_PATH = "stuff.pkl"
TFIDF_PATH = "tfidf.npy"
VOCABULARY_PATH = "vocabulary.npy"
NPMI_FOLDER = "npmi_parts"
NPMI_PATH_TEMPLATE = os.path.join(NPMI_FOLDER, "npmi{}-{}.npy")
NPMI_PART_SIZE = 100
def get_terms(text):
... | StarcoderdataPython |
3221659 | #!/usr/bin/python3
from os.path import exists
import sqlite3 as sql
import pandas
db_path = './all13f.db'
if exists(db_path):
conn = sql.connect(db_path)
else:
print(db_path + ' does not exist. Exiting.')
exit(1)
# Get funds
funds_df = pandas.read_sql_query('''SELECT * FROM "FUNDS"''', conn, index_co... | StarcoderdataPython |
1623231 | <reponame>hirorin-demon/hirorin-streamlit
data = (
'Kai ', # 0x00
'Bian ', # 0x01
'Yi ', # 0x02
'Qi ', # 0x03
'Nong ', # 0x04
'Fen ', # 0x05
'Ju ', # 0x06
'Yan ', # 0x07
'Yi ', # 0x08
'Zang ', # 0x09
'Bi ', # 0x0a
'Yi ', # 0x0b
'Yi ', # 0x0c
'Er ', # 0x0d
'San ', # 0x0e
'Shi... | StarcoderdataPython |
1711055 | import numpy as np
num_of_days = 257
fish_numbers = np.zeros(9)
initial_fish = [5,1,1,5,4,2,1,2,1,2,2,1,1,1,4,2,2,4,1,1,1,1,1,4,1,1,1,1,1,5,3,1,4,1,1,1,1,1,4,1,5,1,1,1,4,1,2,2,3,1,5,1,1,5,1,1,5,4,1,1,1,4,3,1,1,1,3,1,5,5,1,1,1,1,5,3,2,1,2,3,1,5,1,1,4,1,1,2,1,5,1,1,1,1,5,4,5,1,3,1,3,3,5,5,1,3,1,5,3,1,1,4,2,3,3,1,2,4,1,... | StarcoderdataPython |
1622238 | <filename>algorithms/search_insert_position.py
from typing import List
# TODO 暴力法,待完善
class Solution:
def searchInsert(self, nums: List[int], target: int) -> int:
for i, num in enumerate(nums):
if num == target:
return i
if target < num:
nums.insert(i... | StarcoderdataPython |
34488 | <reponame>pabvald/chatbot<filename>brain/mastermind.py
from app import app, nlp
from brain import ACTIONS, LANGUAGES
from dateparser import parse
from datetime import datetime, date
from services import UserService, IntentService, AppointmentService
from utils import get_content
class MasterMind(object):
""" Mast... | StarcoderdataPython |
3348364 | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 22 15:44:45 2021
@author: odyss
"""
import json
import pandas as pd
from source.database_classes import connect_to_mongo, Tweet, ProcessedTweet
connect_to_mongo()
def tweets_to_dataframe(queryset):
df = pd.DataFrame(list(map(lambda x: json.loads(x.to_json()), que... | StarcoderdataPython |
3320022 | """LIANNtf_algorithmLIANN.py
# Author:
<NAME> - Copyright (c) 2020-2022 Baxter AI (baxterai.<EMAIL>)
# License:
MIT License
# Installation:
see LIANNtf_main.py
# Usage:
see LIANNtf_main.py
# Description:
LIANNtf algorithm LIANN - define local inhibition artificial neural network (force neural independence)
Emulat... | StarcoderdataPython |
8384 | #!/usr/bin/python3
"""
Good morning! Here's your coding interview problem for today.
This problem was recently asked by Google.
Given a list of numbers and a number k, return whether any two numbers from the list add up to k.
For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17.
Bonus: Can ... | StarcoderdataPython |
29696 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from ykdl.util.html import default_proxy_handler, get_content
from ykdl.util.match import match1, matchall
from ykdl.extractor import VideoExtractor
from ykdl.videoinfo import VideoInfo
from ykdl.compact import install_opener, build_opener, HTTPCookieProcessor
import json... | StarcoderdataPython |
3231138 | # Donut Damage Skin
success = sm.addDamageSkin(2435161)
if success:
sm.chat("The Donut Damage Skin has been added to your account's damage skin collection.")
| StarcoderdataPython |
3387405 | # Generated by Django 3.2.5 on 2021-08-07 11:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0002_auto_20210724_1307'),
('courses', '0006_auto_20210729_1232'),
]
operations = [
migrations.AddField(
mod... | StarcoderdataPython |
3286957 | # Desafio 045 -> crie um programa que faça o computador jogar jokenpo com vc (pedra papel ou tesoura)
from random import choice
from time import sleep
from sys import exit
lista = ['pedra', 'papel', 'tesoura']
jk = str(input('Pedra, papel ou tesoura?'))
jkp = jk.strip().lower()
jkppc = choice(lista)
if jkp == 'pedra' o... | StarcoderdataPython |
4802165 | <gh_stars>1-10
from django.test import TestCase
from django.urls import reverse
from http import HTTPStatus
class SignUpViewTests(TestCase):
"""
(view) Signup_view tests.
A class that perform the following tests:
1 - Url by name
"""
def test_signup_view_url_by_name(self):
url = rever... | StarcoderdataPython |
1627503 | <reponame>DavidLlorens/algoritmia<filename>src/demos/dynamicprogramming/coinchange6.py
#coding: latin1
#< full
from algoritmia.problems.generalizedcoinchange.dynamicprogramming6 import \
RecursiveDynamicCoinChanger
print(RecursiveDynamicCoinChanger([1, 2, 5], [1, 1, 4]).weight(7))
#> full | StarcoderdataPython |
3364346 | <gh_stars>0
from logging import info
from typing import Union
from borsh_construct import U64
from django.conf import settings
from eth_account.messages import encode_defunct
from eth_utils import remove_0x_prefix
from solana.publickey import PublicKey
from web3 import Web3
from web3.datastructures import AttributeDic... | StarcoderdataPython |
118483 | import numpy as np
from methods_project_old import MaximumIterationError
from robot_arm import RobotArm
def test_point_outside_outer_circle(lengths, n, plot_initial=True, plot_minimizer=True, animate=False):
print('---- Test with destination outside configuration space ----')
analytical_tests('ooc', lengths, n... | StarcoderdataPython |
1775230 | <filename>geoportal/tests/functional/test_xsd.py
# Copyright (c) 2018-2019, Camptocamp SA
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above ... | StarcoderdataPython |
85134 | <gh_stars>1-10
#!/usr/bin/env python3
import pathlib
from setuptools import setup, find_packages
HERE = pathlib.Path(__file__).parent
long_description = (HERE / 'README.md').read_text(encoding='utf-8')
setup(
name='blockfrost-python',
version='0.3.0',
description='The official Python SDK for Blockfrost A... | StarcoderdataPython |
97906 | <gh_stars>1-10
from django.shortcuts import render
from django.http import HttpResponse
from django.template import RequestContext, loader
from slimmermeten.models import ElektricityReading, GasReading, PowerConsumption
from django.db.models.aggregates import Count
from django.db.models import Avg
import colorsys
from ... | StarcoderdataPython |
4814882 | # coding = 'utf-8'
import pandas as pd
import numpy as np
import sklearn
class TargetMeanEncoderConfig:
def __init__(self, fold=5, smooth_parameter=0.9):
self.fold = fold
self.smooth_parameter = smooth_parameter
def encode_one_column(dfs, y, target_var, config):
"""
:param df:
:par... | StarcoderdataPython |
184421 | <reponame>JakobGM/robotarm-optimization
import numpy as np
from functools import partial
from problem import (
generate_objective_function,
generate_objective_gradient_function,
)
from constraints import (
generate_constraints_function,
generate_constraint_gradients_function,
)
from methods import BFGS... | StarcoderdataPython |
1756650 | <reponame>TheCarvalho/atividades-wikipython
'''
8. Faça um programa que leia 5 números e informe a soma e a média dos números.
'''
soma = 0
for i in range(5):
num = int(input('Insira o número: '))
soma += num
print('-'*10)
print(f'A soma é {soma}')
print(f'A média é {soma/5}')
| StarcoderdataPython |
113550 | <gh_stars>0
import numpy as np
from numba import njit
@njit
def sigmoid(x: np.ndarray):
return 1 / (1 + np.exp(-x))
class SufficientStats:
def __init__(self, funcs):
"""
:param funcs: list of callable functions
"""
self.funcs = funcs
def __call__(self, variable_values):
... | StarcoderdataPython |
141158 | <reponame>ektai/frappe3<filename>frappe/tests/test_formatter.py<gh_stars>0
# -*- coding: utf-8 -*-
import frappe
from frappe import format
import unittest
class TestFormatter(unittest.TestCase):
def test_currency_formatting(self):
df = frappe._dict({
'fieldname': 'amount',
'fieldtype': 'Currency',
'options... | StarcoderdataPython |
3280202 | # Copyright 2020 getcarrier.io
#
# 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 t... | StarcoderdataPython |
135546 | <gh_stars>0
#!flask/bin/python
from app import app, port
app.run(host='0.0.0.0', port=port, debug=True, use_reloader=True) | StarcoderdataPython |
103599 | <filename>linear_binning/test/test_linear_binning.py
from linear_binning import linear_binning
import numpy as np
import logging
from timeit import default_timer as timer
logging.basicConfig(level=logging.INFO)
def generate_data(n_samples=100000, D=2):
sample_coords = np.random.random(size=(n_samples, D))
sam... | StarcoderdataPython |
64948 | <gh_stars>0
"""Plot Milky Way spiral arms."""
import numpy as np
import matplotlib.pyplot as plt
from astropy.units import Quantity
from gammapy.astro.population import simulate
from gammapy.astro.population import FaucherSpiral
from gammapy.utils.coordinates import polar, cartesian
catalog = simulate.make_base_catalo... | StarcoderdataPython |
3202856 | <filename>examples/starkex-cairo/starkware/cairo/lang/compiler/ast/imports.py
import dataclasses
from typing import Optional, Sequence
from starkware.cairo.lang.compiler.ast.expr import ExprIdentifier
from starkware.cairo.lang.compiler.ast.formatting_utils import LocationField
from starkware.cairo.lang.compiler.ast.no... | StarcoderdataPython |
1705823 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 11 16:58:02 2018
@author: jack.lingheng.meng
"""
import matplotlib.pyplot as plt
import tensorflow as tf
import keras.backend as K
from Environment.LASEnv import LASEnv
from LASAgent.ExtrinsicallyMotivatedLASAgent import ExtrinsicallyMotivatedLASAg... | StarcoderdataPython |
82239 | import os
from django.conf.urls import url
from django.forms.forms import pretty_name
from django.http import HttpResponse, HttpResponseForbidden, JsonResponse
from django.template import Context
from django.template.loader import get_template
from glitter.assets.forms import ImageForm
from glitter.assets.models impo... | StarcoderdataPython |
1784506 | <filename>DailyChallenge/LC_986.py
class Solution:
def intervalIntersection(self, firstList: List[List[int]], secondList: List[List[int]]) -> List[List[int]]:
# intervals is pairwise disjoint and in sorted order.
p1 = p2 = 0
res = []
while p1 < len(firstList) and p2 < len(se... | StarcoderdataPython |
3336807 | # coding: utf-8
"""
Utility Functions for training, test and prediction of model.
Required: Python 3.6
TensorFlow 1.10.1
Copyright (c) 2018 <NAME>
"""
import tensorflow as tf
import tensorflow.contrib.eager as tfe
def loss(model, x, y, training=False):
prediction = model(x, training)
return tf.n... | StarcoderdataPython |
3393953 | <filename>batchnormlstm/layers.py
import numpy as np
""" basics """
def relu(x):
return np.maximum(x, 0)
def tanh(x):
return np.tanh(x)
def sigmoid(x):
return 1 / (1 + np.exp(-x))
""" layers """
def affine_forward(x, w, b):
"""
Computes the forward pass for an affine (fully-connected) layer.
... | StarcoderdataPython |
1682161 | <reponame>BlueCapacitor/Tree-Of-Life
'''
Created on Mar 1, 2019
@author: gosha
'''
from math import cos, pi
import turtle
import tkinter as tk
canvasPosition = [0, 0]
zoom = 1
class Tree(object):
def __init__(self, table):
self.branches = list(table.rows)
self.table = table
def link(self... | StarcoderdataPython |
1641720 | _base_ = "./FlowNet512_1.5AugCosyAAEGray_Aggressive_Flat_Pbr_01_ape.py"
OUTPUT_DIR = "output/deepim/lmPbrSO/FlowNet512_1.5AugCosyAAEGray_Aggressive_Flat_lmPbr_SO/camera"
DATASETS = dict(TRAIN=("lm_pbr_camera_train",), TEST=("lm_real_camera_test",))
# bbnc7
# objects camera Avg(1)
# ad_2 30.20 30.20
# ad_5 ... | StarcoderdataPython |
3219006 | """CrowdStrike S3 Bucket Protection with QuickScan.
Creation date: 09.01.21 - <EMAIL>
Modification: 12.21.21 - <EMAIL>
"""
import io
import os
import time
import logging
import urllib.parse
import json
import boto3
from botocore.exceptions import ClientError
# FalconPy SDK - Auth, Sample Uploads and Quick Scan
from fa... | StarcoderdataPython |
176485 | <reponame>Ryearwood/Python-Chatbot
#!/usr/bin/python
# Import Tools Libraries
import numpy as np
import random
import pickle
import json
# Import Deep Learning Libraries
from keras.models import Sequential
from keras.layers import Dense, Activation, Dropout
from keras.optimizers import SGD
# Import Language Librarie... | StarcoderdataPython |
147109 | <gh_stars>0
from rest_framework.serializers import ModelSerializer, PrimaryKeyRelatedField
from db_api.models import Item
from db_api.serializers.user import UserSerializer
from db_api.serializers.asset_bundle import AssetBundleSerializer
class ItemSerializer(ModelSerializer):
owner = PrimaryKeyRelatedField(read... | StarcoderdataPython |
101223 | from django.contrib import admin
from .models import *
admin.site.register(Visualization)
admin.site.register(Type)
admin.site.register(TypeToVisualization) | StarcoderdataPython |
1676652 | import logging
from helpers import assert_redirect
import pytest
def test_login_flow(auth, client):
assert_redirect(client.get('/'), '/auth/login')
assert b"Sign In" in client.get('/auth/login').data
assert_redirect(auth.login(), '/')
assert client.get('/').status_code == 200
assert_redirect(... | StarcoderdataPython |
3393183 | from django.shortcuts import render
def home(request):
return render(request, "principal/home.html", {})
| StarcoderdataPython |
81619 | <reponame>fuhrerguxez/telack
#!/usr/bin/env python
# pylint: disable=R0902,R0912,R0913
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2016
# <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Publi... | StarcoderdataPython |
55972 |
class ConnectedSIPMessage(object):
def __init__(self, a_sip_transport_connection, a_sip_message):
self.connection = a_sip_transport_connection
self.sip_message = a_sip_message
@property
def raw_string(self):
if self.sip_message:
return self.sip_message.raw_string
... | StarcoderdataPython |
97544 | <gh_stars>0
from django.shortcuts import render,redirect
from django.http import HttpResponse,Http404
from .models import Profile,Image,Comments
from .forms import NewImageForm,NewProfileForm,NewCommentForm
from django.contrib.auth.decorators import login_required
# Create your views here.
def home(request):
return ... | StarcoderdataPython |
123040 | <reponame>kuanpern/jupyterlab-snippets-multimenus
exptrigsimp(exp(z) + exp(-z)) | StarcoderdataPython |
1684135 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import torch as T
import torch.nn as nn
class DNINetwork(nn.Module):
def __init__(
self,
input_size,
hidden_size,
output_size
):
super(DNINetwork, self).__init__()
self.input_size = input_size
self.hidden_size = ... | StarcoderdataPython |
1744648 | from __future__ import print_function, with_statement
import logging
import os
from contextlib import contextmanager
from file_utils import temporary_file
from subprocess import Popen, PIPE
from urllib2 import urlopen
logger = logging.getLogger(__name__)
class CommandError(Exception):
"""Problem executing or ini... | StarcoderdataPython |
3205812 | <gh_stars>0
# exc. 7.3.1 (Rolling Mission)
def show_hidden_word(secret_word, old_letters_guessed):
"""
the function returns a string that contains underlines and letters
that show the letters from the list of letters the user guessed
in their excat location and the other letters the user didnt ... | StarcoderdataPython |
1753965 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import py... | StarcoderdataPython |
53410 | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018 Fetch.AI Limited
#
# 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 Lice... | StarcoderdataPython |
3209801 | <reponame>SDRAST/Math<filename>geometry.py
# -*- coding: utf-8 -*-
"""
Classes for properties of geometrical objects.
This isn't exactly difficult math but it illustrates object-oriented
programming pretty well.
For simple calculations it isn't necessary to create instances of the objects.
For example::
In [1]: fro... | StarcoderdataPython |
3316169 | <gh_stars>1-10
# Copyright (C) <NAME> 2020.
# Distributed under the MIT License (see the accompanying README.md and LICENSE files).
import argparse
import dataset
import numpy as np
def included_queries(data_split, squashed_clicks, rerank):
if rerank:
doc_per_q = (data_split.doclist_ranges[1:]
... | StarcoderdataPython |
156681 | <reponame>danielnbalasoiu/ws-nexus-integration<gh_stars>10-100
#!/usr/bin/env python3
import base64
import json
import logging
import os
import re
import sys
from configparser import ConfigParser
from distutils.util import strtobool
from multiprocessing import Pool, Manager
from typing import Union
from urllib.parse im... | StarcoderdataPython |
3268317 | <reponame>woodrow/pyoac
from pypy.module.marshal import interp_marshal
from pypy.interpreter.error import OperationError
import sys
class AppTestMarshalMore:
def test_long_0(self):
import marshal
z = 0L
z1 = marshal.loads(marshal.dumps(z))
assert z == z1
def test_unmarshal_in... | StarcoderdataPython |
101573 | <gh_stars>10-100
"""Contains a main function for training and/or evaluating a model."""
import os
import numpy as np
from pycrayon import CrayonClient
from slackclient import SlackClient
from slackclient.exceptions import SlackClientError
from parse_args import interpret_args
import atis_data
from interaction_mode... | StarcoderdataPython |
66869 | <gh_stars>0
from floodsystem.datafetcher import fetch_measure_levels
from floodsystem.stationdata import build_station_list, update_water_levels
from floodsystem.flood import stations_level_over_threshold
from floodsystem.analysis import polyfit
import datetime
import matplotlib
import numpy as np
def run():
statio... | StarcoderdataPython |
51621 | <gh_stars>10-100
import sublime
from ui.read import regions as read_regions
from structs.highlight_list import *
# Hmmm....
def highlight(view, regions, info):
if regions != None:
view.add_regions(info.name, regions, info.format, info.icon, info.mode)
else:
remove_highlight(view, info)
def r... | StarcoderdataPython |
3378713 | # python
# from datetime import datetime
# TODAY = datetime.today()
# TODAY = str(TODAY.year)+"-"+str(TODAY.month)+"-"+str(TODAY.day)
# steem
from steem import Steem
# 3.
import discord
class Keys:
accounts = [
{"username":"hakancelik","weight":100,"posting_key":"<KEY>"},
{"username":"coogger","weight":1... | StarcoderdataPython |
157866 | <filename>yoti_python_sdk/doc_scan/session/create/filter/__init__.py<gh_stars>1-10
from .document_restrictions_filter import (
DocumentRestrictionBuilder,
DocumentRestrictionsFilterBuilder,
)
from .orthogonal_restrictions_filter import OrthogonalRestrictionsFilterBuilder
from .required_id_document import Requir... | StarcoderdataPython |
3262681 | from ruledxml import destination, source, foreach
@foreach("/xml/element", "/doc/message")
@source("/xml/element/child")
@destination("/doc/message/text")
def rule34(child_text):
return child_text + "2"
| StarcoderdataPython |
3238749 | <filename>skpalm/permutations/utils/nextperm.py
import numpy as np
def nextperm(a):
n = a.shape[0]
j = n - 1
while j > 0 and a[j - 1, 0] >= a[j, 0]:
j = j - 1
if j > 0:
l = n
while a[j - 1, 0] >= a[l - 1, 0]:
l = l - 1
tmp = a[j - 1, :].copy()
a[j ... | StarcoderdataPython |
4830175 | <reponame>PingjunChen/pytorch-study<gh_stars>1-10
# -*- coding: utf-8 -*-
import os, sys, pdb
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
import torch.nn.functional as F
import shutil, time
from loader import train_imagenet_loader
from loader import val_imagene... | StarcoderdataPython |
3220441 | <reponame>Anilkumar95/python-75-hackathon
#creating a file if doesn't exist in the directory
exist = open("cmr.txt", "w")
| StarcoderdataPython |
1670606 | import pygame
from .chars import Enemy
from .shells import *
import os
# Working file paths
BASE_PATH = os.path.dirname(__file__)
IMAGES_PATH = os.path.join(BASE_PATH, 'resources/Images/')
# virus_1
class Virus1(Enemy):
ammo = Virus1shell
height = 78
width = 78
hp = 100
health_max = 100
# Virus... | StarcoderdataPython |
1745028 | <gh_stars>0
#encoding:utf-8
subreddit = 'bangladesh'
t_channel = '@r_bangladesh'
submissions_ranking = 'new'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| StarcoderdataPython |
3236863 | <gh_stars>0
'''
Uses PyMOL to convert cms structure into pdb
Supports renaming of lipid atoms (currently DPPC and DMPC only) to their amber/charmm counter parts
Also supports renaming:
> non-standard residues (i.e. GLH) to standard (i.e. GLU)
> solvent (i.e. SPC) to HOH
> ions (i.e. Na) to charmm names (i.e. SOD)
> ... | StarcoderdataPython |
3221067 | # -*- coding: utf-8 -*-
# Author: <NAME>
# Date: 9/13/17
class ComplexitySpec(object):
"""
Base class of complexity specification
:cvar environment: configs for environmental noise
:cvar propostion: configs for propositional noise
:cvar interaction: configs for interactional noise
:cvar s... | StarcoderdataPython |
1796422 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Integration with `theHarvester <https://code.google.com/p/theharvester/>`_.
"""
__license__ = """
GoLismero 2.0 - The web knife - Copyright (C) 2011-2014
Golismero project site: https://github.com/golismero
Golismero project mail: <EMAIL>
This program is free softwa... | StarcoderdataPython |
3338264 | import argparse
import numpy as np
import os
import torch
from torch import nn
from torch.autograd import Variable
from torch.backends import cudnn
from torch.utils import data
from utils.mpnet import MPNet
from utils.plan_class import plan_dataset
def main(args):
cudnn.benchmark = True
# Parameters
tra... | StarcoderdataPython |
3275488 | <reponame>bio-phys/capriqorn
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# Capriqorn --- CAlculation of P(R) and I(Q) Of macRomolcules in solutioN
#
# Copyright (c) <NAME>, <NAME>, and contributors.
# See the file A... | StarcoderdataPython |
1709777 | from . import pyhandy
name = "pyhandy"
__author__ = "callmexss"
__email__ = "<EMAIL>"
__copyright__ = "(c) 2019 callmexss"
__version__ = "0.0.5"
__license__ = "MIT"
__title__ = 'pyhandy'
__description__ = "A collection of python tools to make my life easier."
| StarcoderdataPython |
145770 | arr = list(map(int, input().split()))
print(arr[0] + arr[2] + arr[4] + arr[6] + arr[8])
print(arr[1] + arr[3] + arr[5] + arr[7]) | StarcoderdataPython |
126745 | <gh_stars>1-10
"""
Copyright (c) 2019 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.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | StarcoderdataPython |
4827286 | <reponame>uzakotim/programming_for_engineers_ctu
# Created on iPad (Timur).
print ('Hello World!') | StarcoderdataPython |
3226685 | <reponame>nerevu/riko
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko.modules.rssitembuilder
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides functions for creating a single-item RSS data source
Can be used to create a single new RSS item from scratch, or reformat and
restructure an existing item into an RSS structure... | StarcoderdataPython |
3323615 | """
Comparing models using Hierarchical modelling. Toy Model.
"""
from __future__ import division
import numpy as np
import pymc3 as pm
import matplotlib.pyplot as plt
plt.style.use('seaborn-darkgrid')
# THE DATA.
N = 30
z = 8
y = np.repeat([1, 0], [z, N-z])
# THE MODEL.
with pm.Model() as model:
... | StarcoderdataPython |
1759109 | <filename>backend/class_list.py
"""
class_list.py
==============
Endpoints for retrieving a list of all classes. All routes start with
/api/classList
All incoming request parameters are wrapped in a JSON body.
All outgoing response returns are wrapped in a JSON entry with key 'payload',
like this:
.. code-block::
... | StarcoderdataPython |
145076 | <gh_stars>1-10
from tkinter import Entry
from helperobjects.EntryCell import EntryCell
from typing import List
class EntryCellRow:
def __init__(self):
self.file_name:str = None
self.entry_cell_list:List[EntryCell] = []
self.comment_entry:Entry = None
def add_cell(self, entry_cell:Entr... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.