id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3342538 | <gh_stars>10-100
# -*- coding: iso-8859-1 -*-
from __future__ import print_function, division
import sys
if( sys.version_info[0] == 2 ):
range = xrange
import math
import re
import qm3.fio
try:
from qm3.engines._mmint import *
except:
pass
def p_sander( data ):
out = {}
if( type( data ) == list )... | StarcoderdataPython |
1682619 | <gh_stars>0
# 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 the Apache License, Version 2.0
# (the "License"); ... | StarcoderdataPython |
3302014 | <reponame>creativecommons/cc-legal-tools
# Third-party
from django import template
from django.utils.translation import get_language_bidi
register = template.Library()
@register.simple_tag
def bidi_start():
"""Returns 'left' if ltr language or 'right' if rtl language"""
return "right" if get_language_bidi() ... | StarcoderdataPython |
1677425 | #!/usr/env python
alpha = ['a', 'e', 'i', 'o', 'u']
num_alpha = 0
f = open('0810ex.txt')
for eachLine in f:
for w in eachLine:
if w in alpha:
num_alpha += 1
print 'the number of aeiou: %d' % num_alpha
f = open('0810ex.txt')
word_num = len([word for line in f for word in line.split()])
print 'the number of wo... | StarcoderdataPython |
1724349 | from __future__ import absolute_import
import sys
import weakref
# weak reference to installed hooks
_IMPORT_HOOKS = weakref.WeakValueDictionary()
# must have _IMPORT_HOOKS to bootstrap hook disabling
from .inhibit import DISABLED_TYPES
def path(file_path):
"""
Include module code from a file identified by i... | StarcoderdataPython |
3276001 | <filename>datasets/build_cars196.py
#!/usr/bin/env python
# coding=utf8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
"""CAR196 를 생성한다.
example:
CUDA_VISIBLE_DEVICES="" python build_cars196.py \
--data_dir=cars196 \
--output_dir=cars196/tfrecord_cls \
--us... | StarcoderdataPython |
149996 | # Copyright 2020, <NAME>, mailto:<EMAIL>
#
# Python test originally created or extracted from other peoples work. The
# parts from me are licensed as below. It is at least Free Software where
# it's copied from other people. In these cases, that will normally be
# indicated.
#
# Licensed under t... | StarcoderdataPython |
3382909 | import cadquery as cq
import cadquery.selectors as cqs
import logging, importlib
from types import SimpleNamespace as Measures
from math import cos, radians, sqrt
import utilities # Local directory import.
# Selective reloading to pick up changes made between script executions.
# See: https://github.com/CadQuery/CQ-ed... | StarcoderdataPython |
115708 | from .components import DTCommand, DTChance, DTChoice, DTCondition, DTExpr
from .nodes import DTNode, GameNode, ChanceNode, ChoiceNode, ConditionNode
from .base import BaseDecisionTree, DummyDecisionTree
| StarcoderdataPython |
49058 | <filename>Week-04/evorobotpy2/pybullet/showrobot/showrobot.py
import pybullet as p
import pybullet_data
import time
import sys
robotfile = ""
gravity = -9.8;
if len(sys.argv) == 1:
print("ROBOTSHOW.PY: shows a robot within the GUI")
print("You can indicate the following robot names as parameters:")
print(... | StarcoderdataPython |
3387112 | from . import handlers
import inspect
import multiprocessing as mp
import os
import subprocess
import sys
from .utils import python2_cmd, python3_cmd, node_cmd
try:
import psutil
ANALYTICS_ENABLED = True
except ImportError:
ANALYTICS_ENABLED = False
try:
import yaml
YAML_ENABLED = True
except ImportError:
YAML_... | StarcoderdataPython |
1654304 | <filename>django_tables/tests/test_models.py
"""Test ModelTable specific functionality.
Sets up a temporary Django project using a memory SQLite database.
"""
from unittest.mock import Mock
from nose.tools import assert_raises, assert_equal
from django.conf import settings
from django.core.paginator import Paginator,... | StarcoderdataPython |
3277087 | # MIT License
#
# Copyright (c) 2015-2018 <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 |
1651136 | <filename>Grafico pizza/Grafico pizza.py
import matplotlib.pyplot as plt
import numpy as np
# Valores do Gráfico #
valores = np.array([35, 25, 25, 15])
# Itens do Gráfico #
itens = ['Maçãs', 'Bananas', 'Laranjas', 'Melancias']
# Espaço entre as "fatias" do gráfico #
expaço = [0.2, 0, 0, 0]
# Monta o Gráfico e depoi... | StarcoderdataPython |
3329446 | <reponame>manliu1225/Facebook_crawler
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should a... | StarcoderdataPython |
27620 | <filename>Neural Network/NNToyFx/python/activations.py<gh_stars>0
from simulation import *
def relu(ctx: SimulationContext, x: Connection):
relu1 = ctx.max(x, ctx.variable(0))
return relu1 | StarcoderdataPython |
4832006 | <filename>exercicios/ex080.py
numeros = []
for i in range(0, 5): # Laço irá rodar 5 vezes
n = int(input(f'Digite o {i+1}º número: ')) # Usuário insere número
if i == 0 or n >= numeros[-1]: # Se for a primeira vez do laço ou se n for maior que o último valor da lista
numeros.append(n) # Se n for maio... | StarcoderdataPython |
3308135 | #!/usr/bin/env python3
# ---------------------------------------------------------------------------- #
# FHNW Technik, glaL4, Experiment O12: Laser Anemometry #
# Flow Profile in turbulent case #
# Conversion of measured frequencies into flow speeds... | StarcoderdataPython |
1650929 | ###############################################################################
#
# Connection - A class for writing connections to Tableau files
#
###############################################################################
class Filter(object):
"""
A class for writing filters to Tableau files.
"""
... | StarcoderdataPython |
3338867 | <gh_stars>10-100
# File: ciscoumbrella_consts.py
# Copyright (c) 2021 Splunk Inc.
#
# Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
#
CISCOUMB_JSON_DOMAIN = "domain"
CISCOUMB_JSON_CUSTKEY = "customer_key"
CISCOUMB_JSON_PAGE_INDEX = "page_index"
CISCOUMB_JSON_DOMAIN_LIMIT = "limit"
CISCOU... | StarcoderdataPython |
69204 | <gh_stars>1-10
from nltk.sentiment.vader import SentimentIntensityAnalyzer as SIA
import nltk
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from nltk.tokenize import word_tokenize, RegexpTokenizer
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
from nltk.stem.snowba... | StarcoderdataPython |
1662833 | <gh_stars>1-10
#!/usr/bin/python3.7+
# -*- coding:utf-8 -*-
"""
@auth: cml
@date: 2021-04-16 21:16
@desc: ...
""" | StarcoderdataPython |
3285389 | import urllib
from tornado.escape import json_decode
from tornado.testing import AsyncHTTPTestCase
from nbgraderapi import Application
class TestHandlerBase(AsyncHTTPTestCase):
def get_app(self):
return Application(db_url='sqlite:///:memory:', auth_token='<PASSWORD>')
def get_token_auth_headers(sel... | StarcoderdataPython |
1684004 | from example_interfaces.srv import AddTwoInts
import rclpy
from rclpy.qos import qos_profile_sensor_data, qos_profile_system_default
from rclpy.node import Node
from cv_bridge import CvBridge
from sensor_msgs.msg import Image
import cv2
import message_filters
from image_segmentation.predict import Predict
import numpy ... | StarcoderdataPython |
1742834 | <reponame>yatonon/dlib-face
#!/usr/bin/python
# The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt
#
# This example shows how to use dlib to learn to do sequence segmentation. In
# a sequence segmentation task we are given a sequence of objects (e.g. words in
# a sentence) and we ... | StarcoderdataPython |
3316481 | <filename>PIVX-Discord-master/utils/mysql_module.py
import pymysql.cursors, json
from utils import parsing, output
class Mysql:
def __init__(self):
config = parsing.parse_json('config.json')["mysql"]
self.host = config["db_host"]
try:
self.port = int(config["db_port"])
... | StarcoderdataPython |
169149 | <filename>pypy/module/js/__init__.py
from pypy.interpreter.mixedmodule import MixedModule
class Module(MixedModule):
"""\
This module provides access to the host javascript environment. It can be
used to introspect objects and call functions in the host environment, and
to create callbacks allowing the host env... | StarcoderdataPython |
3370317 | from db.models import AuthModel
from collections import namedtuple
user = {
"national_id": 222222,
"firstname": "John",
"lastname": "Joe",
"othername": "smith",
"email": "<EMAIL>",
"isadmin": "False",
"phone": "+254724862149",
"password":"<PASSWORD>",
... | StarcoderdataPython |
3224769 | x = "abc" # x is binded to string
print(x)
x = 1 # x can be rebinded to integer
print(x)
| StarcoderdataPython |
1735133 | <reponame>sycdan/django-virtual-field<gh_stars>0
# -*- coding: utf-8
from __future__ import unicode_literals, absolute_import
from django.conf.urls import url, include
urlpatterns = [
]
| StarcoderdataPython |
3371979 | from datetime import datetime
from loguru import logger
from config import settings
from order.dao import ordermodel
from order.schemas.schemas_order import (
orderMessage,
orderPayload,
orderModelBrokerMessage,
orderModelCreate,
messageBaseResponse,
)
from order.api.adapters.user import get_user
... | StarcoderdataPython |
1781007 | <gh_stars>0
def standardseats(capacityif,firstclassseats):
result = capacityif - firstclassseats * 2
return result
| StarcoderdataPython |
1680626 | <reponame>eriklarsolson/cloudmesh-common<gh_stars>0
import subprocess
import time
import sys
class run(object):
"""
A class to simply execute a comman.
Example:
command = run("sleep 100")
command.execute()
...
command.kill()
"""
def __init__(self, command):
... | StarcoderdataPython |
1729172 | from .common import InfoExtractor
from ..utils import (
determine_ext,
float_or_none,
join_nonempty,
traverse_obj,
url_or_none,
)
class DailyWireBaseIE(InfoExtractor):
_JSON_PATH = {
'episode': ('props', 'pageProps', 'episodeData', 'episode'),
'videos': ('props', 'pageProps', '... | StarcoderdataPython |
3296855 | <gh_stars>0
#!/usr/bin/env python
from __future__ import print_function
import binascii
import os
import struct
import sys
usage = """\
Usage: ./bump.py "<image_file>" "<output_image>"
image_file - <required> path to the image file to bump
output_image - <optional> path to output the bumped file to (... | StarcoderdataPython |
1662951 | <filename>cfripper/rules/IAMRoleWildcardActionOnPermissionsPolicyRule.py
"""
Copyright 2018-2019 Skyscanner 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/LICENS... | StarcoderdataPython |
3228682 | <reponame>peteowlett/owls-template
def say_hello(username):
return("Hello, {username}!".format(username=username))
| StarcoderdataPython |
191905 | <gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
from numba import jit
class DataAnalyzer():
def __init__(self, ResultsPath = ''):
try:
self.PosHistory = np.load(ResultsPath + '/PosHistory.npy')
self.Mass = np.load(ResultsPath + '/Masses.npy')
#load yaml... | StarcoderdataPython |
4814566 | import socket
from unittest.mock import patch, PropertyMock
import feedparser
from django.core.management import call_command
from django.utils import timezone
from feedhq import es
from feedhq.feeds.models import Favicon, Feed, UniqueFeed
from feedhq.feeds.tasks import update_feed
from feedhq.feeds.utils import epoch... | StarcoderdataPython |
3234591 | <filename>app/untitled-3.py<gh_stars>0
#global count
count = 0
def has_top_words():
global count
count = count + 1
# return True if common_words is a subset of unique_words
# return False otherwise
has_top_words()
print(count)
| StarcoderdataPython |
1772015 | #Salario base del empleado
salario_base, horas_extra, bonificacion = input("").split()
#Convertir cada entrada en el dato correspondiente
salario_base = float(salario_base)
horas_extra = int(horas_extra)
bonificacion = int(bonificacion)
#Calcular el valor de una hora extra
#Y el valor a pagar de horas extras
hora_lab... | StarcoderdataPython |
1708391 | <reponame>harikrishna95/StackConnect
#import all librarires
import streamlit as st
from PIL import Image
import json
from firebase_authenticate import upload_user
import requests
import pandas as pd
from insights import insights_layout
from tag_generator import generator_layout
from career import career_layout
#Open I... | StarcoderdataPython |
176784 | import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
data = np.load("scores.npy", allow_pickle=True).item()
fig, axs = plt.subplots(3, 1, figsize=(20, 20))
for i, score in enumerate(["insert", "delete", "irof"]):
ax = axs[i]
df = data[score]
for key in df:
if key=="rbm_flip_det... | StarcoderdataPython |
1775543 | #!-*- coding:utf-8 -*-
#!/usr/bin/env python
#---------------------------------------------------
#jinja2でレンダリング
#copyright 2013 ABARS all rights reserved.
#---------------------------------------------------
import os
import logging
import jinja2
import custom_filter
from myapp.SetUtf8 import SetUtf8
from google.... | StarcoderdataPython |
194461 | <gh_stars>0
import datetime
import unittest
from il2fb.ds.events.definitions.shootdowns import AIAircraftShotdownEvent
from il2fb.ds.events.definitions.shootdowns import AIAircraftShotdownSelfEvent
from il2fb.ds.events.definitions.shootdowns import HumanAircraftShotdownEvent
from il2fb.ds.events.definitions.shootdowns... | StarcoderdataPython |
147254 | <reponame>piyush82/elastest-device-emulator-service<filename>eds/openmtc-gevent/server/openmtc-ngsi/openmtc-ngsi-pylibs/urllib3/packages/six.py
from __future__ import absolute_import
from six import *
| StarcoderdataPython |
4134 | <filename>TWLight/emails/views.py
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse, reverse_lazy
from django.core.mail import BadHeaderError, send_mail
from django.http import Ht... | StarcoderdataPython |
151953 | <gh_stars>10-100
# Copyright 2020 The Private Cardinality Estimation Framework Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | StarcoderdataPython |
1727607 | """
Boosting Module
Gradient Boosted Decision Tree 系統のアルゴリズムを使った Out Of Fold を定義するモジュール
"""
from .lgbm import LGBMClassifierOutOfFold, LGBMRegressorOutOfFold
from .xgboost import XGBoostRegressorOutOfFold, XGBoostClassifierOutOfFold, OptunaXGBClassifierOutOfFold, \
OptunaXGBRegressionOutOfFold
| StarcoderdataPython |
70852 | <gh_stars>10-100
class Deque(object):
"""A deque (double-ended queue) is a linear structure of
ordered items where the addition and removal of items can
take place on any end.
Thus deques can work as FIFO (First In, First Out) or
LIFO (Last In, First Out)
Examples:
>>> d = Deque()
... | StarcoderdataPython |
1717559 | # -*- coding: utf-8 -*-
from தமிழ் import எழுத்து
from தமிழ்.சொல் import *
def பிரம்மி(வாக்கியம்):
pass
def பண்டைய_எழுத்து(வாக்கியம் , வருடம் ):
pass
def பண்டைய_சொல் (வாக்கியம், வருடம் ):
pass
def பண்டைய_வாக்கியம்_ஆக்கு(வாக்கியம், வருடம் ):
pass
def தனிமொழி_ஆக்கு(வாக்கியம் ):
pass
def தொடர... | StarcoderdataPython |
176328 | import re
from lib import get_lines
def day_8():
screen = [['.' for _ in range(50)] for _ in range(6)]
rect_cmd_regex = r'rect (?P<rows>[0-9]+)x(?P<cols>[0-9]+)'
rotate_cmd_regex = r'rotate (?P<dimension>[\w]+) (x|y)=(?P<index>[0-9]+) by (?P<amount>[0-9]+)'
for command in get_lines('input8.txt'):
... | StarcoderdataPython |
1697917 | <reponame>EricssonResearch/arms
from time import sleep
import math
import numpy as np
import cv2
from collections import Counter
import datetime
import arms.utils.log as log
import RPi.GPIO as GPIO
class Camera:
"""
Initializes the Camera object with a specified resolution,
rotation and zoom. Also creates... | StarcoderdataPython |
3259056 | from django.db import models
import uuid
# Create your models here.
from datetime import date
from datetime import datetime
from datetime import timezone
from dateutil.relativedelta import relativedelta
from django.utils.translation import ugettext_lazy as _
import string, random
from django.core.validators i... | StarcoderdataPython |
4805512 | from flask import Flask, render_template, request, make_response, redirect, url_for
import socket
from GameRoom.GameRoomPacket.GRPacket import GRPacket
app = Flask(__name__)
class GameRoomClient:
def __init__(self, conn = '/home/gaotian/Programs/GameHost/GameRoomConn'):
self.connected = False
self.... | StarcoderdataPython |
1655938 | <reponame>jd-jones/seqtools<gh_stars>1-10
import torch
from mathtools import utils
def log_prob(data_scores, y, max_segs, pw=None):
# Scores has shape (num_segs, num_samples, num_classes),
# so marginalizing over number of segments and number of classes at the last
# frame should give us the data likelih... | StarcoderdataPython |
1644745 | # Copyright 2016 IBM Corp.
#
# 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 writing, s... | StarcoderdataPython |
3307509 | # encoding: utf-8
import glob
import re
import os.path as osp
from scipy.io import loadmat
from .bases import BaseVideoDataset
import pandas as pd
class MARS(BaseVideoDataset):
# dataset_dir = 'MARS'
dataset_dir = 'MARS-DL'
info_dir = 'info'
def __init__(self, root='/home/mediax/Dataset', verbose=Tr... | StarcoderdataPython |
49463 | def colorprint(text, color, bgcolor, *options):
import os
bef = "\x1B["
bg = bef + bgcolorcode(bgcolor)
cc = bef + colorcode(color)
styles = optioncode(*options)
end = bef + "0m"
os.system("echo \"" + styles + bg + cc + text + end + "\"")
def optioncode(*options):
option = ""
allop... | StarcoderdataPython |
17930 | <gh_stars>0
from collections import deque
class Solution:
def longestValidParentheses(self, s: str) -> int:
if len(s) == 1 or s == '': return 0
opened = deque()
for i,p in enumerate(s):
if p == '(': opened.append(i)
else:
if opened:
... | StarcoderdataPython |
1693964 | <gh_stars>1-10
print("First number?")
a = int(input())
print("Second number?")
b = int(input())
total = a + b
print("The result is " + str(total))
res = a + b * 2
print(res)
| StarcoderdataPython |
141857 | # Copyright (c) The PyAMF Project.
# See LICENSE.txt for details.
"""
Remoting tests.
@since: 0.1.0
"""
| StarcoderdataPython |
1722414 | <gh_stars>1-10
from traceback import print_exc
import sys
_enable_callback_tracebacks = False
def enable_callback_tracebacks(flag):
global _enable_callback_tracebacks
_enable_callback_tracebacks = flag
from ctypes import (
PYFUNCTYPE, POINTER, sizeof, cast, string_at,
c_int, c_void_p, py_object, c_ch... | StarcoderdataPython |
4823490 | import __builtin__
import itertools
import re
from rdc.dic.util import cached_property
CALL = object()
SETATTR = object()
module_regex = re.compile(r"\w+(\.\w+)*$").match
def dereference(x):
# While x is a reference, resolve it.
while callable(x) and hasattr(x, '__reference__') and x.__reference__:
... | StarcoderdataPython |
3349795 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited. 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... | StarcoderdataPython |
3253649 | from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedETreasureAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedETreasureAI')
| StarcoderdataPython |
4803008 | # AUTO GENERATED FILE - DO NOT EDIT
from dash.development.base_component import Component, _explicitize_args
class Interval(Component):
"""An Interval component.
A component that repeatedly increments a counter `n_intervals`
with a fixed time delay between each increment.
Interval is good for trigger... | StarcoderdataPython |
3397393 | <reponame>CMU-313/fall-2021-hw2-451-unavailable-for-legal-reasons<gh_stars>1-10
from django.utils.translation import ugettext_lazy as _
from mayan.apps.documents.search import (
document_version_search, document_version_page_search, document_search
)
# Document
document_search.add_model_field(
field... | StarcoderdataPython |
3376207 | <filename>classroom/25.12.19-5.py
def join(s,b):
a = len(s)
for i in range(0,a):
print(s[i],end = b)
s = input("Enter the string:")
b = input("Enter the character to be added:")
print("The string after joined is:",end = " ")
join(s,b)
| StarcoderdataPython |
3333424 | from importlib.util import module_from_spec, spec_from_file_location
from pathlib import Path
from types import ModuleType
from typing import Dict, Optional
from controller import PROJECT_DIR
BACKUP_MODULES: Dict[str, ModuleType] = {}
RESTORE_MODULES: Dict[str, ModuleType] = {}
PASSWORD_MODULES: Dict[str, ModuleType]... | StarcoderdataPython |
83703 | # Copyright (c) 2021-present, Facebook, Inc.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import gym
import pytest
import bisk
from bisk.features.joints import JointsFeaturizer
from bisk.single_robot import BiskSingleRobotEnv
def test... | StarcoderdataPython |
128764 | # -*- coding: utf-8 -*-
import numpy as np
import time
from geopy.distance import vincenty
from auxiliar_functions import *
#get_neighbours_index: np.matrix int -> np.array
#obtiene los vecinos del usuario "user",
#considerando como vecino a quien comparte dos ubicaciones
def get_neighbours_index(rois_a,shared_rois,us... | StarcoderdataPython |
3335482 | <filename>projetos/tic_tac_toe.py
# jogo da velha/tic tac toe
p1 = p2 = 0
tabuleiro = [1, 2, 3,\
4, 5, 6,\
7, 8, 9]
tabuleiro2 =['•', '•', '•',\
'•', '•', '•',\
'•', '•', '•']
l = ['X', 'O']
def banner(txt, np=60):
print('-'*np)
print(txt.center(np))
pri... | StarcoderdataPython |
151693 | <reponame>ph4r05/monero-agent
# Automatically generated by pb2py
# fmt: off
from .. import protobuf as p
if __debug__:
try:
from typing import Dict, List # noqa: F401
from typing_extensions import Literal # noqa: F401
EnumTypeCapability = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,... | StarcoderdataPython |
1716221 | <filename>sfs/fd/nfchoa.py<gh_stars>10-100
"""Compute NFC-HOA driving functions.
.. include:: math-definitions.rst
.. plot::
:context: reset
import matplotlib.pyplot as plt
import numpy as np
import sfs
plt.rcParams['figure.figsize'] = 6, 6
xs = -1.5, 1.5, 0
# normal vector for plane wa... | StarcoderdataPython |
3384712 | <gh_stars>0
import sqlite3, csv, re, pickle
import pandas as pd
import numpy as np
from sklearn.decomposition import NMF
from fuzzywuzzy import process
############################
# set up SQLite DB
############################
db =sqlite3.connect('MoviesData.db')
cur = db.cursor()
db
############################
# ... | StarcoderdataPython |
16669 | import cx_Oracle
from oracledb import OracleJSONDatabaseConnection
import json
jsondb = OracleJSONDatabaseConnection()
connection = jsondb.get_connection()
connection.autocommit = True
soda = connection.getSodaDatabase()
x_collection = soda.createCollection('f1_2021_weather')
all_data = list()
for doc in x_collect... | StarcoderdataPython |
3398827 | #!/usr/bin/env python
# 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, publish,
# distribute, subli... | StarcoderdataPython |
770 | # V0
import collections
class Solution(object):
def frequencySort(self, s):
count = collections.Counter(s)
count_dict = dict(count)
count_tuple_sorted = sorted(count_dict.items(), key=lambda kv : -kv[1])
res = ''
for item in count_tuple_sorted:
res += item[0] * it... | StarcoderdataPython |
1707 | <gh_stars>0
from unsync import unsync
import asyncio
import datetime
import math
import aiohttp
import requests
def main():
t0 = datetime.datetime.now()
tasks = [
compute_some(),
compute_some(),
compute_some(),
download_some(),
download_some(),
download_some(),
... | StarcoderdataPython |
3302843 | <gh_stars>0
# def get_multiples(number = 1, count = 10):
# for num in range(1, count + 1):
# yield number * num
# evens = get_multiples(2, 3)
# print(next(evens)) # 2
# print(next(evens)) # 4
# print(next(evens)) # 6
# # next(evens) # StopIteration
# default_multiples = get_multiples()
# print(list(def... | StarcoderdataPython |
157393 | #!/usr/bin/env python
#
# Copyright 2009 Google 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 o... | StarcoderdataPython |
140154 | <gh_stars>1-10
import time
import subprocess
import requests
"""
Libnspv has no analog to komodod's -connect= parameter
You are supposed to run this script after modifying coins file
and add a 0 && to the if statement on line 389 in netspv.c.
Obviously, recompile nspv executable with this changes.
"""
# i... | StarcoderdataPython |
3240443 | # -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
source_directory = 'point to source directory here'
projects_directory = 'point to SEEG data directory here'
import numpy as np
import csv
import cPickle as pick
import sys
import copy
sys.path.append(source_directory + 'Python27\\Utilities')
impor... | StarcoderdataPython |
57830 | <reponame>frgfm/torch-zoo<gh_stars>0
import torch
from holocron.nn.modules import dropblock
def test_dropblock2d():
x = torch.rand(2, 4, 16, 16)
# Drop probability of 1
mod = dropblock.DropBlock2d(1.0, 1, inplace=False)
with torch.no_grad():
out = mod(x)
assert torch.equal(out, torch.z... | StarcoderdataPython |
1784230 | <filename>Sketches/CE/Display6nokia.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
#... | StarcoderdataPython |
3344163 | import nox
REQUIRES = {
"bake": ["cookiecutter>=1.6.0,<2.0.0"],
"test": ["cookiecutter>=1.6.0,<2.0.0", "nox"],
"fmt": ["black>=19.10b0,<20.00"],
"lint": ["flake8>=3.7.9,<4.0.0"],
}
def install(session, *names):
for e in names:
session.install(*REQUIRES[e])
@nox.session
def devel(session... | StarcoderdataPython |
1782221 | import numpy as np
import wfdb
from scipy.signal import resample
from decision import *
import os,sys
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
try:
from keras.models import model_from_json
except:
from tensorflow.keras.models import model_from_json
'''
Written by: <NAME>
School of Medical Instrume... | StarcoderdataPython |
3278905 | <reponame>gtfierro/taglib-experiments
import brickschema
from brickschema.namespaces import BRICK
import readline
from collections import defaultdict
# use any haystack tag library that is necessary (and translate between them!)
# use existing haystack software on top of semantic web stuff!
# haystack doesn't have to ... | StarcoderdataPython |
111201 | <gh_stars>100-1000
"""
##################################################################################################
# Copyright Info : Copyright (c) <NAME> @ Hikvision Research Institute. All rights reserved.
# Filename : structures.py
# Abstract : BitmapMasks designed for LGPMA
# Current Ve... | StarcoderdataPython |
1600308 | <filename>cursoEmVideo/Python/Mundo 1/Exercicios/ex016.py
# crie um programa que leia um numero real qualquer pelo tecaldo
# e mostre na tela a sua porção inteira
# ex: 6.127
# o Número 6.127 tem a parte inteira 6
#
#from math import trunc
#num = float(input('digite um numero quebrado: '))
#print('O número {} tem a par... | StarcoderdataPython |
3351240 | """
A general-purposed bytes-based memory-access read-only FASTA class with GZip support.
"""
import functools
import gzip
import itertools
import logging
import os.path
from typing import Optional, List, Iterable
_FASTA_COMP_TRANS = bytes.maketrans(b'ATCGatcgNn', b'TAGCtagcNn')
"""The fasta complementary translator d... | StarcoderdataPython |
4842320 | import time
import os
import json
import sys
from pprint import pformat
import joblib
from joblib import Parallel, delayed
import rasterio
from rasterio.plot import reshape_as_image
from rasterio.mask import mask
from rasterio.merge import merge
import geopandas as gpd
import pandas as pd
import numpy as np
from skle... | StarcoderdataPython |
1602536 | #!/usr/bin/env python3
import argparse
from distutils.version import LooseVersion
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Prints if the release version is newer than the current version')
parser.add_argument('current_version')
parser.add_argument('release_version')
args... | StarcoderdataPython |
1636665 | <gh_stars>0
# -*- coding: utf-8 -*-
# CCP in Tomographic Imaging (CCPi) Core Imaging Library (CIL).
# Copyright 2017-2020 UKRI-STFC
# Copyright 2017-2020 University of Manchester
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licens... | StarcoderdataPython |
3300310 | #!/bin/python
# -*- coding: utf-8 -*-
import tweepy
import os
import urllib2
from config import *
from clean_tweet import clean_tweet
from print_quote import *
# GLOBALS
posts_to_scan = 75
# FUNCTION: GET USER IDs OF PEOPLE WHO FAVED A TWEET
# workaround using urllib2
def get_user_ids_of_post_likes(post_id):
... | StarcoderdataPython |
199747 | <reponame>dcu-sharepoint/Browser-id<filename>old/server/result/bk/result.py
import BaseHTTPServer
import os.path
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import SocketServer
import urllib
import json
import linecache
from PIL import Image, ImageChops, ImageFilter
import numpy as np
from scipy.ndim... | StarcoderdataPython |
37052 | from faker import Faker
import os, random, requests, json
fake = Faker()
BASE_URL = "http://localhost:8083/api"
cities = [
"Braga",
"Viseu",
"Porto",
"Lisboa",
"Guimarães",
"Leiria",
"Coimbra",
"Santarém",
"Guarda",
"Aveiro",
"Faro",
"Portimão",
"Beja",
"Évora... | StarcoderdataPython |
3335266 | <filename>Software/AX3/cwa-recover/cwa-recover.py
#!/usr/bin/env python
# coding=UTF-8
# CWA Dump File Recovery
import sys
import os
from struct import *
def checksum512(data):
sum = 0
for o in range(256):
value = data[2 * o] | (data[2 * o + 1] << 8)
sum = (sum + value) & 0xffff
return sum
def singleBi... | StarcoderdataPython |
35815 | # python
#
# Copyright 2020 The usbmon-tools Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.